The theme was resolved once at mount, so the site did not follow a later
change of the system preference while no explicit choice was stored. The
design contract asks for the site to keep following the system until the
reader makes a choice.
The theme module now subscribes to the prefers-color-scheme change event
and applies the new system preference while nothing is stored. A stored
choice still wins and stops the site from following the system.
The toggle subscribes to theme changes, so its icon and its accessible
label stay in step with the active theme.
Add a self-contained theme toggle component under
public/src/components/theme/ that toggles the dark class on the root
element and stores the choice under the beat-theme key in
localStorage. Apply the stored theme, or the prefers-color-scheme
default when nothing is stored, before the app mounts so a cold load
never paints the wrong theme.
The pre-paint script in index.html and both 404 copies reads the same
beat-theme key, so the theme is already on the root element when the
first frame is painted.