1. Your OS is in light mode and the site has stored nothing, so the page follows along. Flip the OS control to run this the other way round.
  2. You toggle. The target is dark, which is not what the OS says, so the site stores an override. The page goes dark.
  3. Your OS switches to dark. The override now matches it but is still kept. Nothing visibly happens, which is correct.
  4. Your OS switches back to light. The page stays dark, because the override is still active.
  5. You toggle. The target is light, which is what the OS says, so the override is removed. The page follows the OS again.
  6. Your turn. Both controls are live and nothing from here on is scripted. Drive them in any order and watch what does — and does not — end up in localStorage.