/* =========================================================
   Portal 2.0 · the frame (design system v2; the pages brief, settled
   item 5)

   A page on the frame sits inside the shell with its COLOURS mapped onto
   v2's tokens, so it follows the theme, dark included. Nothing else
   moves: faces, sizes, radii and spacing stay today's. A page that moves
   onto v2 fully links this first and its own v2 stylesheet after it.

   Every rule needs :root[data-v2], which only a portal.v2 holder's page
   carries, so without the key this file defines nothing. It defines
   today's names and reads only v2's (scripts/check-v2-static.py holds it
   to that).

   WHY ON body, AND WHY THE BRIDGE NAMES TOO. Today's tokens are declared
   on :root, and a custom property that reads another is resolved where it
   is declared: legacy-bridge.css's `--p-ink: var(--ink)` is worked out on
   :root, from :root's --ink, and every element inherits the result. So a
   remap of --ink on body would never reach --p-ink. Each name a page
   reads is declared here, on body, where the tier classes (also on body)
   resolve theirs against these values.

   NOT MAPPED, deliberately: the brand literals (--zeal-orange,
   --zeal-black, --zeal-purple and their steps) and the category and role
   hues. They are fixed colours by the brand doc, and a black panel must
   not turn light in the dark theme. A page whose contrast depends on one
   says so in its own v2 stylesheet, and the rendered contrast guard is
   what finds it.
   ========================================================= */

:root[data-v2] body {
  /* ink */
  --ink: var(--z-text);
  --ink-2: var(--z-text-2);
  --ink-3: var(--z-text-3);
  --ink-4: var(--z-text-3);
  --ink-5: var(--z-line-2);
  --fg-1: var(--z-text);
  --fg-2: var(--z-text-2);
  --fg-3: var(--z-text-3);
  --fg-on-white: var(--z-text);
  --fg-on-warm: var(--z-text);
  --link: var(--z-text);
  /* grounds */
  --paper: var(--z-bg-raised);
  --paper-2: var(--z-bg-sunk);
  --surface: var(--z-bg);
  --warm: var(--z-bg-hover);
  --bg-primary: var(--z-bg);
  --bg-secondary: var(--z-bg-sunk);
  --bg-muted: var(--z-bg-sunk);
  --bg-warm: var(--z-bg-rail);
  --bg-territory: var(--z-bg-rail);
  /* lines */
  --rule: var(--z-line);
  --rule-2: var(--z-line-2);
  --rule-3: var(--z-line-2);
  --border-soft: var(--z-line);
  --border-strong: var(--z-line-2);
  /* the accent: orange stays orange, and text on it is ink */
  --accent: var(--z-accent);
  --accent-hover: var(--z-orange-press);
  --accent-press: var(--z-orange-press);
  --accent-soft: var(--z-bg-select);
  --fg-on-orange: var(--z-on-accent);
  /* status */
  --green: var(--z-ok);
  --green-soft: var(--z-ok-soft);
  --amber: var(--z-warn);
  --amber-soft: var(--z-warn-soft);
  --red-status: var(--z-bad);
  --red-soft: var(--z-bad-soft);
  --red-press: var(--z-bad);
  /* the coverage language, on v2's colours */
  --st-booked: var(--z-ok);
  --st-booked-soft: var(--z-ok-soft);
  --st-pencil: var(--z-ok);
  --st-clash: var(--z-accent);
  --st-open: var(--z-bad);
  --st-open-soft: var(--z-bad-soft);
  /* legacy-bridge.css's names, resolved on :root, so declared again */
  --p-ink: var(--z-text);
  --p-ink-2: var(--z-text-2);
  --p-ink-3: var(--z-text-3);
  --p-ink-4: var(--z-text-3);
  --p-paper-2: var(--z-bg-sunk);
  --p-rule: var(--z-line);
  --p-rule-2: var(--z-line-2);
  --p-accent: var(--z-accent);
  --p-success: var(--z-ok);
  --p-warning: var(--z-warn);
  --p-danger: var(--z-bad);
  /* portal-system.css's own set, hard-coded on :root */
  --p-paper: var(--z-bg);
  --p-paper-3: var(--z-bg-rail);
  --p-card: var(--z-bg-raised);
  --p-rule-strong: var(--z-text);
  --p-accent-solid: var(--z-accent);
  --p-accent-press: var(--z-orange-press);
  --p-accent-wash: var(--z-bg-select);
  --p-success-wash: var(--z-ok-soft);
  --p-warning-wash: var(--z-warn-soft);
  --p-danger-wash: var(--z-bad-soft);
  --p-info: var(--z-info);
  --p-info-wash: var(--z-info-soft);
  --p-focus: var(--z-focus);
  --paper-warm: var(--z-bg-rail);
  --text-primary: var(--z-text);
  --text-secondary: var(--z-text-2);
  --text-tertiary: var(--z-text-3);
  --accent-green: var(--z-ok);
  --accent-red: var(--z-bad);
  /* the ground and the ink the page itself paints */
  background: var(--z-bg);
  color: var(--z-text);
}
/* the canvas past the page takes the same ground, so in dark an overscroll
   or the space under a short page isn't light (base.css says why) */
:root[data-v2] { background: var(--z-bg); }

/* ── colour on and in the accent. Today's components put white text on
   orange (the primary button, the accent pill: 3.15:1) and orange text
   on white (the footer's name: 3.15:1). v2 draws ink on the accent and
   the accent's own text shade for orange words, so a page on the frame
   alone meets AA there too. working.css says the same for a page on v2
   fully, so on those pages nothing moves. ── */
:root[data-v2] :is(.btn--primary, .btn--primary:hover, .btn--primary:active, .pill--accent) { color: var(--z-on-accent); }
:root[data-v2] .footer span { color: var(--z-accent-text); }
