/* Colour themes (SPEC §5.8, SF-SET-1, SF-SET-2).

   Every interface colour is named here, for its role, and used nowhere else
   as a literal — not in another stylesheet, not in JavaScript
   (test/theme.test.js checks). Values are the prototype's
   (`tools/design/prototype/css/tokens.css`), which holds the agreed ones.

   What a theme changes is SF-SET-2: the neutral colours (surfaces, text,
   lines, the new-since-last-visit accent) and the *tuned brightness* of the
   status and grade colours, whose hues and meanings stay. Everything else —
   the colours drawn over a picture, the placeholder's saturation and
   lightness — is declared once on `:root` and no theme block touches it.

   The dossier placeholder tint (SF-IMG-2) is the one colour derived in code:
   a hue only, set as `--h` on the element and combined here with the
   saturation and lightness below, as `hsl(var(--h) var(--ph-…))`.

   Light is the default. Dark reaches the page by two routes: the device's
   media query, so first paint is right before any script runs, and the
   `data-theme` attribute theme.js sets for an explicit choice. For `auto`
   the attribute is absent, and the media query is guarded on that absence
   so an explicit choice always wins. The dark values are written once as a
   `--dark-*` palette and assigned from it in both routes: plain CSS has no
   mixins, and a theme written twice is one that eventually gets updated in
   only one place (CasaFluxFE's theme.css, through WeatherStripesFE's). */

:root {
  /* --- neutrals, light --- */
  --bg: #f7f4ee;
  --surface: #ffffff;
  --surface-2: #f0ece4;
  --text: #1f1c18;
  --text-2: #4a453e;
  --muted: #7a7469;
  --line: #e4ded3;
  --accent: #b4532a;          /* "new since last visit" */
  --accent-soft: #f6e3d8;
  --focus: #2f6fdb;
  --shadow: 0 1px 2px rgb(40 30 20 / 0.06), 0 4px 16px rgb(40 30 20 / 0.06);

  /* --- status and grade, light brightness. Never shown without the text
         label (SF-FMT-1). --- */
  --st-confirmed: #1d7f46;
  --st-corroborated: #2a5fc4;
  --st-rumoured: #a8650d;
  --st-debunked: #b8322a;
  --st-stale: #857f75;
  --grade-on: #3c3830;
  --grade-off: #d9d3c8;

  /* --- the same in both themes --- */
  --on-accent: #fff;                          /* text on the accent: the new-count pill, a primary button */
  --on-image: #fff;                           /* text and glyphs over a picture */
  --image-scrim: rgb(0 0 0 / 0.72);           /* the hero's darkening under its text */
  --image-text-shadow: rgb(0 0 0 / 0.35);
  --chip-on-image: rgb(255 255 255 / 0.18);   /* the hero's kind chip */
  --control-on-image: rgb(0 0 0 / 0.45);      /* the hero picker's control */
  --backdrop: rgb(0 0 0 / 0.4);               /* behind a dialog */
  /* Placeholder (SF-IMG-2): saturation, lightness and alpha for the
     dossier's hue. */
  --ph-glow: 55% 62% / 0.9;
  --ph-from: 38% 34%;
  --ph-to: 32% 22%;
  --ph-ink: 60% 92% / 0.92;

  /* --- the dark palette, assigned by both dark routes below --- */
  --dark-bg: #141310;
  --dark-surface: #1c1a17;
  --dark-surface-2: #24221e;
  --dark-text: #ece7de;
  --dark-text-2: #c9c2b6;
  --dark-muted: #9a9387;
  --dark-line: #2e2b26;
  --dark-accent: #f08a5d;
  --dark-accent-soft: #3a261c;
  --dark-focus: #79a6ff;
  --dark-shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 4px 16px rgb(0 0 0 / 0.25);
  --dark-st-confirmed: #5cc98a;
  --dark-st-corroborated: #78a5ff;
  --dark-st-rumoured: #f0b450;
  --dark-st-debunked: #ff7d70;
  --dark-st-stale: #8f897f;
  --dark-grade-on: #e6e0d5;
  --dark-grade-off: #3a3731;
}

:root[data-theme='dark'] {
  --bg: var(--dark-bg);
  --surface: var(--dark-surface);
  --surface-2: var(--dark-surface-2);
  --text: var(--dark-text);
  --text-2: var(--dark-text-2);
  --muted: var(--dark-muted);
  --line: var(--dark-line);
  --accent: var(--dark-accent);
  --accent-soft: var(--dark-accent-soft);
  --focus: var(--dark-focus);
  --shadow: var(--dark-shadow);
  --st-confirmed: var(--dark-st-confirmed);
  --st-corroborated: var(--dark-st-corroborated);
  --st-rumoured: var(--dark-st-rumoured);
  --st-debunked: var(--dark-st-debunked);
  --st-stale: var(--dark-st-stale);
  --grade-on: var(--dark-grade-on);
  --grade-off: var(--dark-grade-off);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: var(--dark-bg);
    --surface: var(--dark-surface);
    --surface-2: var(--dark-surface-2);
    --text: var(--dark-text);
    --text-2: var(--dark-text-2);
    --muted: var(--dark-muted);
    --line: var(--dark-line);
    --accent: var(--dark-accent);
    --accent-soft: var(--dark-accent-soft);
    --focus: var(--dark-focus);
    --shadow: var(--dark-shadow);
    --st-confirmed: var(--dark-st-confirmed);
    --st-corroborated: var(--dark-st-corroborated);
    --st-rumoured: var(--dark-st-rumoured);
    --st-debunked: var(--dark-st-debunked);
    --st-stale: var(--dark-st-stale);
    --grade-on: var(--dark-grade-on);
    --grade-off: var(--dark-grade-off);
  }
}
