/* Design tokens: the only place a colour is written down. Everything else uses var(--name).
 * Light is the base; dark applies when the device prefers it (unless the user pinned light), or when the user pinned dark
 * (<html data-theme="dark">, set by the server from the stored preference). ContrastTest checks every pair below.
 *
 *   --bg / --surface        page and card backgrounds
 *   --text / --text-muted   body text, secondary text (both >= 4.5:1 on --bg and --surface)
 *   --accent                links, accent text and the fill of primary buttons (>= 4.5:1 on --bg and --surface); --accent-text
 *                           is the text on such a fill. One brand hue (teal); --warn (amber) is only for "new" badges and warnings
 *   --border                dividers and card edges (decorative; not enough contrast to mark a control)
 *   --border-strong         the edge of inputs, buttons and chips (>= 3:1, WCAG 1.4.11)
 *   --warn / --danger       warning and error text (>= 4.5:1)
 *   --shadow / --scrim     drop shadow colour, and the dim layer behind the article panel
 */
:root {
  color-scheme: light dark;
  accent-color: var(--accent);   /* native checkboxes, radios, ranges and the picker of date / time inputs */
  --bg: #FAFAF7;
  --surface: #FFFFFF;
  --text: #1F2328;
  --text-muted: #57606A;
  --accent: #0F6B63;
  --accent-text: #FFFFFF;
  --border: #D0D7DE;
  --border-strong: #6E7781;
  --warn: #8A5A00;
  --danger: #B3261E;
  --font-sans: 'IBM Plex Sans', 'Plex Sans Fallback', system-ui, sans-serif;
  --font-serif: 'IBM Plex Serif', 'Plex Serif Fallback', Georgia, serif;   /* article titles and summaries; UI chrome stays sans */
  --shadow: rgba(0, 0, 0, .18);
  --scrim: rgba(0, 0, 0, .35);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121417;
    --surface: #1C1F24;
    --text: #E8EAED;
    --text-muted: #A8B0B8;
    --accent: #5CC8BC;
    --accent-text: #0B1A33;
    --border: #3A3F45;
    --border-strong: #8B949E;
    --warn: #E0A84A;
    --danger: #F2B8B5;
    --shadow: rgba(0, 0, 0, .6);
    --scrim: rgba(0, 0, 0, .6);
  }
}

:root[data-theme="light"] { color-scheme: light; }

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121417;
  --surface: #1C1F24;
  --text: #E8EAED;
  --text-muted: #A8B0B8;
  --accent: #5CC8BC;
  --accent-text: #0B1A33;
  --border: #3A3F45;
  --border-strong: #8B949E;
  --warn: #E0A84A;
  --danger: #F2B8B5;
  --shadow: rgba(0, 0, 0, .6);
  --scrim: rgba(0, 0, 0, .6);
}
