ADR-036: Theming and Accessibility Baseline
Context
The site was dark-only, with about 700 Tailwind class names using raw palette colours, and a dark-only page is hard to read in bright light. A review against WCAG 2.2 AA also found low-contrast muted text, overlays that didn't return focus, skipped heading levels, animations that ignored reduced-motion settings, and layout shift while loading.
Decision
Theming through tokens:
1. Brand colours are named tokens in Tailwind v4's @theme; components never use hex values.
2. The light theme is one rule on html[data-theme="light"] that re-points the variables the classes read (the slate ramp is mirrored, surfaces turn white, status shades deepen). No per-component dark/light variants.
3. The site follows the system light/dark setting until the visitor uses the toggle; that choice is remembered in localStorage and wins from then on. A tiny same-origin script applies the theme before first paint, so there is no flash.
Accessibility target WCAG 2.2 AA, checked with axe:
4. Text keeps at least 4.5:1 contrast in both themes.
5. A skip link, a focusable main, ordered headings, Escape and focus return on every overlay, and focusable diagram nodes with a visible ring.
6. Reduced motion stops decorative animation and view transitions; spinners stay.
7. Self-hosted fonts and sized images prevent layout shift.
8. Interface changes are checked with axe in both themes and at phone width before merging.
Amended 2026-11-02: light mode contrast was calibrated to prevent stark glare. The page canvas was softened to #EEF2F6 (slate-100 tone), creating clear elevation for cards (#FFFFFF) and flyouts (#F8FAFC) against defined borders (slate-800 to #CBD5E1). Static cyan neon borders were replaced with dynamic theme-aware glow variables (--theme-glow-card, --theme-glow-status, --theme-glow-focus), rendering clean, subtle box shadows in light mode while preserving cyberpunk ambient glows in dark mode. Typography contrast was calibrated for WCAG AAA (slate-400 to #334155 for 7.5:1 ratio; white headings to #0F172A).
Consequences
Benefits:
* A second theme costs one block of overrides, and new components get both themes for free.
* Both themes meet AA contrast.
* The baseline is written down, so regressions can be caught in review.
Trade-offs:
* In light mode a class name no longer describes the colour seen (text-slate-400 is dark text there).
* Any new text shade must be checked in both themes.
* The axe check is a review step, not yet a CI gate.
Alternatives considered
1. Stay dark-only: Rejected — poor readability in bright light, with no choice for readers who need it.
2. dark: variants on every component: Rejected — doubles about 700 class lists and drifts.
3. Follow the system colour scheme by default: Rejected initially (brand was dark-first), but adopted in the 2026-10-30 amendment; the remembered toggle allows manual override.
4. A component library's theming: Rejected — no component library is used, and adding one for theming alone isn't worth it.