/* Pemspring design tokens.
   Source: `06-design-tokens.css` in the specification pack, v2.3.1.

   The pack file is reproduced unchanged, with one addition: `--grid`, which
   the chart grammar needs and the pack file did not name.

   It was added because the pack assumed this file was already in the theme
   when it was not — §11.3 says the ramp is "already re-stepped for dark", and
   until now nothing in the theme defined a single one of these variables.
   Every chart drew with undefined colours and rendered invisible.

   ## The dark ground is navy-900, on the client's instruction

   `#0B1F33` — the brand navy the hero and footer already sit on, so those
   panels stop being panels and become the page. Chosen by the client on
   5 September 2026, and then validated rather than assumed. Against it:

     - every label and axis token reaches ≥ 4.5:1 (lowest: `--ink-3` at 5.49
       on the ground, 4.84 on the raised surface — it was lifted from the
       pack's `#7C8794`, which fell to 4.01 there);
     - every series mark reaches ≥ 3:1 (lowest: `--seq-3` at 4.05);
     - the categorical ramp separates on the new ground — and `--cat-3`, which
       carries a measured 2.74:1 warning against the LIGHT surface, reaches
       4.90 here, so the known accessibility problem is better on navy, not
       worse;
     - the 13% and 29% bands stay distinct from the ground and from each
       other (1.27, 1.79, and 1.42 between them).

   §11.2's fourth gate is worth one note: it asks for ≥ 3:1 on "every series
   mark and gridline". The pack's own LIGHT palette does not meet that for
   gridlines — `--grid` is 1.21:1 on white and `--rule` 1.38:1 — because a
   gridline at 3:1 would be a louder line than the data. Read as a gate on
   series marks, which is what it can mean in practice, both palettes pass.

   ## How the page follows

   `style.css` addressed colour by preset, and a preset names a colour, not a
   job. Its 77 references are now role tokens, and `theme.json` points at the
   same ones. The light values are byte-identical to the presets they replaced
   — verified by hashing every computed colour on five pages before and after,
   1,721 elements, unchanged.

   ## Structure (from the pack file)

   Define the complete light palette on bare :root, redefine ONLY the tokens
   under the dark media query and the [data-theme="dark"] scope, and style every
   component through the tokens. A colour whose only definition sits inside a
   media or [data-theme] block will not apply in the un-stamped default state. */

:root{
  color-scheme: light;

  /* surfaces */
  --ground:#F4F6F8;  --paper:#FFFFFF;  --paper-2:#EDF1F4;

  /* ink */
  --ink:#0B1F33;     --ink-2:#4A5058;  --ink-3:#767E88;

  /* rules */
  --rule:#D6DCE3;    --rule-soft:#E5EAEF;

  /* brand accent — teal */
  --accent:#0F6F7A;  --accent-deep:#0B5C66;  --accent-wash:#E4F1F2;

  /* brand navy */
  --navy-900:#0B1F33; --navy-700:#10314F; --navy-500:#1B4A76; --navy-300:#7FD4DD;

  /* evidence tags — semantic, never reused as chart series colours */
  --good:#2E7D4F;    --good-wash:#E4F0E9;   /* Measured  */
  --warn:#A8641B;    --warn-wash:#F6EDE2;   /* Assumed   */
  --stop:#9B3226;    --stop-wash:#F7E8E5;   /* Blocked   */
  /* Estimated uses --accent / --accent-wash */

  /* sequential ramp — single-series charts, ordered magnitudes */
  --seq-1:#CFE3E6; --seq-2:#8FC2C9; --seq-3:#4E9AA4; --seq-4:#1D7480; --seq-5:#0A4A52;

  /* categorical — MULTI-SERIES CHARTS ONLY.
     The brand navy/teal/green family fails colour-vision-deficiency separation when
     used together as categories. Use these three, in this order, capped at three
     series, always with direct labels. Beyond three, facet into small multiples —
     do not add a fourth hue. */
  --cat-1:#2a78d6; --cat-2:#eb6834; --cat-3:#1baf7a;

  --shadow:0 1px 2px rgba(11,31,51,.06), 0 8px 24px -12px rgba(11,31,51,.14);

  /* type */
  --font-sans:"IBM Plex Sans",-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  --font-serif:"Source Serif 4",Georgia,serif;      /* running prose */
  --font-mono:"IBM Plex Mono",ui-monospace,Consolas,monospace;  /* data, labels, tags */

  --step--1:.875rem; --step-0:1.0625rem; --step-1:1.12rem;
  --step-2:1.62rem;  --step-3:clamp(2rem,5.2vw,3.15rem);

  --measure:34rem;   /* prose column */
  --wide:70rem;      /* page frame  */
  --radius:4px;

  /* Gridlines are one step off the surface. Named here rather than inlined so
     the dark value can be the dark ramp's OWN step — §11.3 is explicit that a
     lightened light-mode grey turns muddy on a dark ground. */
  --grid:#E5EAEF;

  /* ---- theme.json preset roles ----------------------------------------
     `style.css` addressed colour by PRESET — `grey-100`, `navy-900` — and a
     preset names a colour, not a job. Four of them were doing two jobs each:
     `white`, `grey-100`, `navy-700` and `navy-900` were every one of them a
     surface in some rules and ink in others, which is why no redefinition of
     a preset could turn the page dark. One value cannot be both a ground and
     the text on it.

     These name the JOB instead, and every light value below is byte-identical
     to the preset it replaces, so the light rendering does not move. Only the
     dark column is new, and it is the pack's own validated dark palette. */
  --body-ink:#1A1D21;     /* was grey-900 — body text, a touch softer than --ink */
  --surface-2:#EEF1F4;    /* was grey-100 as a ground */
  --rule-strong:#7C838C;  /* was grey-400 — visible borders, not hairlines */
  --ink-soft:#5C636C;     /* was grey-600 */
  --ink-strong:#10314F;   /* was navy-700 as ink and as an accent stripe */
  --good-deep:#1F6B43;    /* was green-700 */

  /* Ink that sits ON a dark panel. These do NOT flip: the navy and gradient
     grounds they sit on are dark in both themes, so their text stays light in
     both. Naming them is what stops a later pass "fixing" them by inverting
     them along with everything else. */
  --on-dark:#FFFFFF;      /* was white as ink */
  --on-dark-2:#EEF1F4;    /* was grey-100 as ink */
  --on-dark-3:#C8CDD3;    /* was grey-300 */
}

@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    color-scheme: dark;
    --ground:#081826; --paper:#0B1F33; --paper-2:#0E2A44;
    --ink:#E9EEF3;    --ink-2:#A3AEB9; --ink-3:#929DAA;
    --rule:#1E3A56;   --rule-soft:#16304A;
    --accent:#54B9C4; --accent-deep:#7FD4DD; --accent-wash:#0E2A44;
    --good:#57A97D;   --good-wash:#13291E;
    --warn:#D19A55;   --warn-wash:#2C2216;
    --stop:#D9776A;   --stop-wash:#2E1A17;
    --seq-1:#16333A; --seq-2:#215A66; --seq-3:#338894; --seq-4:#54B9C4; --seq-5:#8FDDE5;
    --cat-1:#3987e5; --cat-2:#d95926; --cat-3:#199e70;
    --shadow:0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
    --grid:#16304A;
    --body-ink:#E9EEF3; --surface-2:#0E2A44; --rule-strong:#4A6A88;
    --ink-soft:#98A3AE; --ink-strong:#7FD4DD; --good-deep:#57A97D;
    --on-dark:#FFFFFF; --on-dark-2:#EEF1F4; --on-dark-3:#C8CDD3;
  }
}
:root[data-theme="dark"]{
  color-scheme: dark;
  --ground:#081826; --paper:#0B1F33; --paper-2:#0E2A44;
  --ink:#E9EEF3;    --ink-2:#A3AEB9; --ink-3:#929DAA;
  --rule:#1E3A56;   --rule-soft:#16304A;
  --accent:#54B9C4; --accent-deep:#7FD4DD; --accent-wash:#0E2A44;
  --good:#57A97D;   --good-wash:#13291E;
  --warn:#D19A55;   --warn-wash:#2C2216;
  --stop:#D9776A;   --stop-wash:#2E1A17;
  --seq-1:#16333A; --seq-2:#215A66; --seq-3:#338894; --seq-4:#54B9C4; --seq-5:#8FDDE5;
  --cat-1:#3987e5; --cat-2:#d95926; --cat-3:#199e70;
  --shadow:0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
  --grid:#16304A;
  --body-ink:#E9EEF3; --surface-2:#0E2A44; --rule-strong:#4A6A88;
  --ink-soft:#98A3AE; --ink-strong:#7FD4DD; --good-deep:#57A97D;
  --on-dark:#FFFFFF; --on-dark-2:#EEF1F4; --on-dark-3:#C8CDD3;
}

/* ---- block preset utilities in dark ------------------------------------
   `style.css` and `theme.json` now address colour by role, but the block
   templates still carry WordPress's own preset utility classes, which are
   generated from the palette and cannot be renamed.

   They can be remapped per role, though, because WordPress emits a SEPARATE
   class for each — `has-grey-100-background-color` and `has-grey-100-color`
   are two selectors, so the surface and the ink can go different ways. That
   is exactly what redefining the preset variable could not do.

   Only the light surfaces and the light inks need a counterpart. The navy,
   teal-700 and grey-700 panels are dark grounds carrying light text already
   and read correctly on either page ground, so they are left alone.

   The `:not([data-theme="light"])` form appears ONLY inside the media query.
   At the top level it would also match the un-stamped state, which is the
   light one, and paint the light site dark. */
:root[data-theme="dark"] .has-white-background-color{background-color:var(--paper) !important}
:root[data-theme="dark"] .has-grey-100-background-color{background-color:var(--surface-2) !important}
:root[data-theme="dark"] .has-teal-300-background-color{background-color:var(--accent-wash) !important}
:root[data-theme="dark"] .has-navy-900-color{color:var(--ink) !important}
:root[data-theme="dark"] .has-grey-700-color{color:var(--ink-2) !important}

@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]) .has-white-background-color{background-color:var(--paper) !important}
  :root:not([data-theme="light"]) .has-grey-100-background-color{background-color:var(--surface-2) !important}
  :root:not([data-theme="light"]) .has-teal-300-background-color{background-color:var(--accent-wash) !important}
  :root:not([data-theme="light"]) .has-navy-900-color{color:var(--ink) !important}
  :root:not([data-theme="light"]) .has-grey-700-color{color:var(--ink-2) !important}
}

/* ---- evidence tag: the signature component ---------------------------- */
.pem-tag{
  display:inline-flex; align-items:center; gap:.4em;
  font-family:var(--font-mono); font-size:.625rem; font-weight:500;
  letter-spacing:.09em; text-transform:uppercase;
  padding:.24em .55em; border-radius:2px; border:1px solid; line-height:1.35;
  white-space:nowrap;
}
.pem-tag::before{content:""; width:5px; height:5px; border-radius:50%; background:currentColor; flex:none}
.pem-tag--measured {color:var(--good);   border-color:color-mix(in oklab,var(--good) 34%,transparent);   background:var(--good-wash)}
.pem-tag--estimated{color:var(--accent); border-color:color-mix(in oklab,var(--accent) 34%,transparent); background:var(--accent-wash)}
.pem-tag--assumed  {color:var(--warn);   border-color:color-mix(in oklab,var(--warn) 34%,transparent);   background:var(--warn-wash)}
.pem-tag--blocked  {color:var(--stop);   border-color:color-mix(in oklab,var(--stop) 34%,transparent);   background:var(--stop-wash)}

/* ---- numerals --------------------------------------------------------- */
.pem-num{font-variant-numeric:tabular-nums}

/* ---- charts ----------------------------------------------------------- */
/* Pre-render as SVG at build time. Do not load a charting library at runtime.
   Wide content scrolls inside its own container; the body never scrolls sideways. */
.pem-figure{overflow-x:auto}
.pem-figure svg{display:block; width:100%; height:auto}

/* ---- reduced motion --------------------------------------------------- */
@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}
