/* ekte web UI v2 — colour tokens: the ONE place colours are defined.
 *
 * Every v2 page links this file first:
 *   <link rel="stylesheet" href="/static/tokens.css" />
 * Every other stylesheet, page and script uses var(--…) only, never a literal
 * colour. Each token is written once as light-dark(<light>, <dark>), so the two
 * themes sit side by side and cannot drift apart.
 *
 * Themes: color-scheme picks the side of light-dark(). No attribute follows
 * prefers-color-scheme; data-theme="light" / "dark" on <html> (theme.js, the
 * header's theme switch) forces one.
 *
 * Palette "Emerald" (OKLCH hue 162). Contrast rules, checked in both themes:
 *   - --ink, --ink-muted and --primary as text: >= 7:1 on --bg, --surface, --sunken;
 *   - --on-primary on --primary / --primary-strong: >= 7:1;
 *   - --border (form-control boundaries, WCAG 1.4.11): >= 4.5:1;
 *   - status colours as text: >= 4.5:1 on the surfaces and on their own tint;
 *     icons on a status fill (--on-primary, --on-warning): >= 4.5:1;
 *   - chart series: >= 3:1 against --surface, pairwise apart under
 *     deuteranopia and protanopia (OKLab distance x100 >= 8.5).
 * Status colours never carry meaning alone: an icon or a word goes with them.
 */

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

:root {
  /* ---- neutrals ---- */
  --bg: light-dark(#f1f8f4, #090e0b);          /* page */
  --surface: light-dark(#ffffff, #0f1612);     /* cards, fields, popovers */
  --sunken: light-dark(#ebf2ee, #161e1a);      /* wells, tracks, tab rails, neutral tints */
  --line: light-dark(#d6e1db, #27302b);        /* dividers, card edges (decorative) */
  --border: light-dark(#63716a, #78877f);      /* control boundaries */
  --ink: light-dark(#0c1b14, #ecf4f0);         /* body text */
  --ink-muted: light-dark(#46534c, #9caaa2);   /* secondary text, neutral status */

  /* ---- brand: one green for links, actions, selection, focus ---- */
  --primary: light-dark(#005b35, #47d89d);
  --primary-strong: light-dark(#004224, #82eab9);  /* hover / pressed */
  --on-primary: light-dark(#ffffff, #090e0b);      /* text and icons on any solid fill */
  --primary-tint: light-dark(#d8f3e4, #183528);    /* focus halo, selected wash */
  --highlight: light-dark(#a1ebc5, #21543e);       /* hero highlighter stroke */

  /* ---- status (text colour, fill, pale tint) ---- */
  /* the verdict scale (ekte/risk_scale.py), one hue per step:
     consistent = the brand green, mostly consistent = olive, deviations =
     amber, likely substituted = red; info blue is never a verdict. The
     steps stay apart from each other (tests/test_risk_scale.py). */
  --success: var(--primary);
  --success-tint: var(--primary-tint);
  --fair: light-dark(#5a6b00, #c2c93c);            /* olive: "mostly consistent", grade C */
  --fair-tint: light-dark(#eef3d2, #292c12);
  --warning: light-dark(#945f00, #e59600);         /* text */
  --warning-fill: light-dark(#bf7c00, #e59600);    /* dots, bars, ribbons */
  --on-warning: light-dark(#0c1b14, #090e0b);
  --warning-tint: light-dark(#ffeccc, #312a0f);
  --danger: light-dark(#d40016, #ff8175);
  --danger-tint: light-dark(#ffe8e4, #352722);
  --info: light-dark(#006dbc, #54abff);
  --info-tint: light-dark(#dff3ff, #1a2e38);

  /* ---- who decides a test step (accessibility report): blue = the test
     suite, violet = a person. Each pair is one hue, solid for the whole
     (Automatic, Manual) and light for the part (Partly automatic, Manual
     review pending). Fills >= 3:1 on --surface and --sunken; the solid and
     the light step of a pair stay apart. ---- */
  --machine: light-dark(#035892, #54abff);
  --machine-soft: light-dark(#338ac9, #386fa0);
  --machine-tint: var(--info-tint);
  --human: var(--chart-3);
  --human-soft: light-dark(#9572b9, #6e6890);
  --human-tint: light-dark(#e8e0f0, #252a30);
  /* result fills next to them: not tested >= 3:1; not applicable stays faint
     (it is never a result, its count is always written next to it) */
  --untested-fill: light-dark(#8c9490, #9caaa2);
  --na-fill: light-dark(#bec3c0, #404a44);

  /* ---- charts: series 0 is the brand, the rest are picked around it ---- */
  --chart-0: var(--primary);
  --chart-1: light-dark(#2a9a98, #2b9c97);  /* teal */
  --chart-2: light-dark(#4c4ff1, #5483f4);  /* indigo */
  --chart-3: light-dark(#4f148a, #bbacf8);  /* violet */
  /* sequential (heatmap): the brand faded into the card, low step closest to it;
     the low step stays clearly greener than an empty cell (--sunken) */
  --heat-1: color-mix(in srgb, var(--primary) 22%, var(--surface));
  --heat-2: color-mix(in srgb, var(--primary) 32%, var(--surface));
  --heat-3: color-mix(in srgb, var(--primary) 52%, var(--surface));
  --heat-4: color-mix(in srgb, var(--primary) 76%, var(--surface));
  --heat-5: var(--primary);

  /* ---- depth ---- */
  --shadow: light-dark(rgba(0, 50, 30, 0.45), rgba(0, 0, 0, 0.8));
  --shadow-hi: light-dark(rgba(255, 255, 255, 0.9), transparent);
  --backdrop: light-dark(rgba(5, 15, 10, 0.55), rgba(0, 0, 0, 0.7));
  --shadow-card: 0 26px 60px -42px var(--shadow), 0 2px 0 var(--shadow-hi) inset;
  --shadow-pop: 0 18px 40px -24px var(--shadow);
}
