This change replaces the single-page render buffer with an array of page buffers and updates drawing logic to stitch multiple rendered pages into the viewport. loadpage() now loads up to two consecutive pages, handles end-of-document bounds, and applies inversion across all loaded pages, while margin detection continues to use the primary page. The result is groundwork for smoother multi-page viewing with fewer redraw constraints when navigating near page boundaries.