# Business Rules — theme-foundation (U1) | Id | Rule | |---|---| | BR-U1-1 | The variant is `'b'` on every page load. It is never read from or written to storage or the URL. | | BR-U1-2 | Initial mode: a valid stored mode wins; otherwise `dark` if `prefers-color-scheme: dark`, else `light`. | | BR-U1-3 | While `modeSource = 'system'`, the mode follows live changes of the system preference. After the user clicks the mode button, `modeSource = 'user'` and system changes are ignored. | | BR-U1-4 | The mode button toggles light and dark (two states), sets `modeSource = 'user'` and persists the new mode. Storage errors never break the toggle (state still changes for the session). | | BR-U1-5 | The initial `data-variant` and `data-mode` are set before first paint by a small same-origin script (`/theme-init.js`, no inline script, CSP-friendly) so there is no flash of the wrong theme; React then takes over the same values. | | BR-U1-6 | The variant button switches between B and E using the time-travel transition (cover → swap → reveal). After the swap the page scrolls to the top and focus moves to the start of the new page (skip target / `main`). | | BR-U1-7 | A live region announces the change in Dutch ("Tijdreis-weergave geladen." / "Terug naar de moderne weergave."). | | BR-U1-8 | E is loaded lazily. While it loads, the transition stays in `cover`. If loading fails, the variant stays `'b'`, the cover is removed and an alert says "De tijdreis kon niet worden geladen." with a retry; B stays usable. | | BR-U1-9 | Under `prefers-reduced-motion: reduce` there is no transition, no dither, no fade: the swap is immediate (all other rules still apply). | | BR-U1-10 | The mode is shared by both variants; switching variant keeps the mode. | | BR-U1-11 | The old red/purple themes and their classes (`theme-red`, `theme-purple`) are removed; the old storage key is ignored and removed. | | BR-U1-12 | Both buttons are real `