How the Inverted Screen (Mirror) Effect Works Technically in the Browser
When a person opens a familiar websiteβsuch as Wikipedia, a news portal, or a company dashboardβtheir brain relies on spatial memory to scan top-left logos, left-aligned paragraphs, and right-aligned utility bars before reading a single word. The Inverted Screen (The Mirror) effect (`mirror.js`) disrupts this subconscious pattern recognition by applying a horizontal reflection matrix across the entire document viewport.
In CSS3, every element's coordinate space can be manipulated using a 2D affine transformation matrix: matrix(a, b, c, d, tx, ty). While a 180-degree rotation flips both the X and Y axes (`scale(-1, -1)`), a true mirror reflection negates only the horizontal scaling factor (`a = -1`, `d = 1`), written concisely as transform: scaleX(-1) with transform-origin: center center.
Cross-Origin Frame Reflection vs. Same-Origin DOM Injection
Our script (`mirror.js`) implements a two-tiered strategy to ensure the mirror reflection works reliably regardless of how the destination website is served:
- Immediate Viewport Frame Reflection: The moment the script initializes, it targets
#destination-frameand appliesframe.style.transform = 'scaleX(-1)'. Because the browser composites the `iframe` as a single GPU texture layer, every child node, image, video, and font glyph inside the frame is reflected instantaneously at zero layout reflow cost. - Same-Origin / Proxied Document Enhancement: If the frame finishes loading via our reverse proxy (`proxy.php`), the `load` listener injects a `