/* viz.css — the platform's data-visualisation palette: the one home of every colour a chart, a
 * heatmap or a treemap paints (platform-theme-system increment-viz-data-palette, VZ-U1).
 * Dark is the default (:root); [data-theme="light"] overrides. Loaded by the shell manifest after
 * the theme sheets (VZ-U2); a host that keeps its own token sheet carries this file as a pinned,
 * byte-identical copy (VZ-X1).
 *
 * DELIBERATELY NOT the UI palette. The Catppuccin hues of tokens.css sit quietly behind text; as
 * chart series they fail colourblind separation (eight of them measure ΔE 4.1 for NORMAL vision on
 * our surface). A chart palette has a different job and gets its own set. */

:root {
  /* ── Categorical ramp (--viz-cat-N) ─────────────────────────────────────
   * B16's hue roles and order (iiriki 2026-08-01), re-stepped for every card of the platform
   * (increment-viz-cat-restep VC-U1…U4): a pastel family (OKLCH L 0.73–0.84) that reaches ≥ 3:1 on
   * the card and page of every dark-scheme theme (dark, slate, charcoal, midnight, obsidian) and on
   * the hosts' tier cards. Dataviz validator: worst adjacent CVD ΔE 10.4, normal-vision 20.0; the
   * first three clear CVD ΔE 10.4 on all pairs. Order is FIXED — assign slots in sequence, never
   * cycle, never generate a 9th hue: fold to "Other" or facet. Where every pair can touch (a graph,
   * a scatter) use the first three; past three, fold or facet. */
  --viz-cat-1: #89aedd; /* blue    */
  --viz-cat-2: #fd8357; /* orange  */
  --viz-cat-3: #6fd9ab; /* aqua    */
  --viz-cat-4: #feae2e; /* yellow  */
  --viz-cat-5: #fa7ba5; /* magenta */
  --viz-cat-6: #93e28c; /* green   */
  --viz-cat-7: #a299fb; /* violet  */
  --viz-cat-8: #fe8b88; /* red     */
  --viz-other: var(--fg-subtle); /* the 9th+ series, and anything past the cap */
  /* Ink for a label sitting ON a categorical fill: dark on the pastel ramp (≥ 7.5:1). */
  --viz-on-cat: #11111b;

  /* ── Status fills: a band heatmap's good / fair / poor (VZ-U3…U5) ───────
   * Good and fair are soft, poor is the one strong fill, so only the cell that needs attention
   * stands out. Fair is set apart from good by LIGHTNESS as well as hue: a pastel amber at a
   * pastel green's lightness collapses under protan (OKLab ΔE 4.3). Measured with the dataviz
   * validator: worst pair CIEDE2000 17.2 normal vision, OKLab ΔE 15.7 deutan, 18.1 tritan.
   * One dark ink on all three: 15.5 / 10.1 / 4.8 : 1. The same fills in both themes; on a light
   * card the value printed in each cell is the relief. */
  --viz-ok:   #d9f0d6; /* pale mint   — good */
  --viz-warn: #eeb455; /* soft amber  — fair */
  --viz-err:  #e5484d; /* strong red  — poor */
  --viz-ink:  #11111b; /* the value ink on any data fill */

  /* ── Sequential ramp: a dynamic heatmap mixes lo → hi by intensity ─────── */
  --viz-seq-lo: #dfe3ea;
  --viz-seq-hi: #a6e3a1;
  --viz-seq-hi-red: #f5b5c0;
  --viz-seq-hi-blue: #a9c8f7;
  --viz-seq-hi-orange: #f7c39a;
}

/* A light-scheme theme without a viz block of its own paints the light data palette (theme-groups U14):
 * the mediterranean and seasonal light themes. light and stone keep their own blocks (VC-U5). */
[data-theme-scheme="light"] {
  --viz-cat-1: #1767c2;
  --viz-cat-2: #80361a;
  --viz-cat-3: #267d5a;
  --viz-cat-4: #664610;
  --viz-cat-5: #9b5a72;
  --viz-cat-6: #0e750c;
  --viz-cat-7: #584bbb;
  --viz-cat-8: #9a504b;
  --viz-on-cat: #ffffff;

  --viz-ok:   #d9f0d6;
  --viz-warn: #eeb455;
  --viz-err:  #e5484d;
  --viz-ink:  #11111b;

  --viz-seq-lo: #e6e9ef;
  --viz-seq-hi: #a6e3a1;
  --viz-seq-hi-red: #f5b5c0;
  --viz-seq-hi-blue: #a9c8f7;
  --viz-seq-hi-orange: #f7c39a;
}

[data-theme="light"] {
  /* The light-scheme ramp: as light as 3:1 allows on the darkest light card (stone #cbc7c4), so
   * orange and yellow are deep. Validator: worst adjacent CVD ΔE 10.5, normal-vision 16.5. White
   * label ink ≥ 5.0:1. stone carries the same block (VC-U5). */
  --viz-cat-1: #1767c2;
  --viz-cat-2: #80361a;
  --viz-cat-3: #267d5a;
  --viz-cat-4: #664610;
  --viz-cat-5: #9b5a72;
  --viz-cat-6: #0e750c;
  --viz-cat-7: #584bbb;
  --viz-cat-8: #9a504b;
  --viz-on-cat: #ffffff;

  --viz-ok:   #d9f0d6;
  --viz-warn: #eeb455;
  --viz-err:  #e5484d;
  --viz-ink:  #11111b;

  --viz-seq-lo: #e6e9ef;
  --viz-seq-hi: #a6e3a1;
  --viz-seq-hi-red: #f5b5c0;
  --viz-seq-hi-blue: #a9c8f7;
  --viz-seq-hi-orange: #f7c39a;
}

/* stone is a light-scheme theme (heritage-contrast-scheme): the same light data palette. */
[data-theme="stone"] {
  /* The light-scheme ramp: as light as 3:1 allows on the darkest light card (stone #cbc7c4), so
   * orange and yellow are deep. Validator: worst adjacent CVD ΔE 10.5, normal-vision 16.5. White
   * label ink ≥ 5.0:1. stone carries the same block (VC-U5). */
  --viz-cat-1: #1767c2;
  --viz-cat-2: #80361a;
  --viz-cat-3: #267d5a;
  --viz-cat-4: #664610;
  --viz-cat-5: #9b5a72;
  --viz-cat-6: #0e750c;
  --viz-cat-7: #584bbb;
  --viz-cat-8: #9a504b;
  --viz-on-cat: #ffffff;

  --viz-ok:   #d9f0d6;
  --viz-warn: #eeb455;
  --viz-err:  #e5484d;
  --viz-ink:  #11111b;

  --viz-seq-lo: #e6e9ef;
  --viz-seq-hi: #a6e3a1;
  --viz-seq-hi-red: #f5b5c0;
  --viz-seq-hi-blue: #a9c8f7;
  --viz-seq-hi-orange: #f7c39a;
}

/* Paper is white whatever theme the screen shows: every printed page paints the light data palette
 * (increment-viz-print VP-U1). Last in the file, so it wins the dark :root and every theme block. */
@media print {
  :root, [data-theme] {
    --viz-cat-1: #1767c2;
    --viz-cat-2: #80361a;
    --viz-cat-3: #267d5a;
    --viz-cat-4: #664610;
    --viz-cat-5: #9b5a72;
    --viz-cat-6: #0e750c;
    --viz-cat-7: #584bbb;
    --viz-cat-8: #9a504b;
    --viz-on-cat: #ffffff;
    --viz-ok:   #d9f0d6;
    --viz-warn: #eeb455;
    --viz-err:  #e5484d;
    --viz-ink:  #11111b;
    --viz-seq-lo: #e6e9ef;
    --viz-seq-hi: #a6e3a1;
    --viz-seq-hi-red: #f5b5c0;
    --viz-seq-hi-blue: #a9c8f7;
    --viz-seq-hi-orange: #f7c39a;
  }
}
