/* =============================================================================
   elizamarin.com design system · tokens.css
   LAYER 1 (primitives) and LAYER 2 (roles, the theme layer).

   Layer 1 holds every raw value once: hex colours, the spacing rhythm, the
   type scale, radii, shadows, motion. Names follow --category-family-step.
   Nothing outside this file writes a hex code.

   Layer 2 is the theme. It gives each primitive a job (--paper, --ink,
   --rule ...) and is the only layer that changes between day and night.
   The role names are the ones the 21 pages already use in their own :root,
   so moving a page onto the system deletes its :root block and renames
   nothing.

   Layer 3 (component-tokens.css) points components at roles, never at
   primitives, so a theme change reaches every component at once.

   Source of the values: site/index.html :root and its dark block,
   site/shell.css, site/voice-guide.html (state colours), as live on
   20 Nov 2026. Values that the site does not yet use are marked PLANNED.
   ============================================================================= */

:root {

  /* ── COLOUR · PEARL (the day neutrals) ───────────────────────────────────
     Pearl-ivory, the family of the pearl spinning top on the home page.
     Warm on purpose: the grey that carried the lila hue (286°) made the
     page read as one cold colour. 50 is the paper, 900 the ink. */
  --color-pearl-50:  #faf7f2;   /* paper: cards, open folder, sheets */
  --color-pearl-100: #f5f1eb;   /* panel2: quiet fills, chips, hover */
  --color-pearl-150: #f1ece5;   /* panel: folder tabs at rest */
  --color-pearl-200: #ebe5dc;   /* bg: the page itself */
  --color-pearl-250: #e4ddd3;   /* rule2: the faint divider */
  --color-pearl-300: #d9d1c6;   /* rule: borders and hairlines */
  --color-pearl-400: #cfc7bc;   /* mist: folders furthest back, empty dots */
  --color-pearl-500: #8b8279;   /* steel: radio rings, decorative strokes only */
  --color-pearl-600: #5c554d;   /* slate: secondary text, 6.9:1 on bg */
  --color-pearl-700: #38322c;   /* graphite: nav labels, body in menus */
  --color-pearl-900: #1c1814;   /* ink: headings and body */

  /* ── COLOUR · NIGHT (the dark neutrals, live) ────────────────────────────
     What the site serves in dark mode today: a cool night blue-grey.
     PLANNED: replaced by the charcoal family below (decided 28 Oct 2026,
     not yet ported). See stories/theme-night-charcoal.md. */
  --color-night-50:  #131418;   /* bg */
  --color-night-100: #181a1f;   /* paper */
  --color-night-150: #1e2126;   /* panel */
  --color-night-200: #23262c;   /* panel2 */
  --color-night-250: #282c33;   /* rule2 */
  --color-night-300: #31363f;   /* rule */
  --color-night-400: #3a4049;   /* mist */
  --color-night-500: #7b818b;   /* steel */
  --color-night-600: #a7adb6;   /* slate */
  --color-night-700: #c7ccd3;   /* graphite */
  --color-night-900: #eef0f3;   /* ink */

  /* ── COLOUR · CHARCOAL (PLANNED night) ───────────────────────────────────
     The warm night chosen on 28 Oct 2026, so the theme keeps one
     temperature from day to night. Not referenced by any role yet. */
  --color-charcoal-50:  #16120f;  /* the story room at night */
  --color-charcoal-100: #221d19;  /* bg */
  --color-charcoal-600: #a89c92;  /* slate */
  --color-charcoal-900: #f5efe6;  /* ink */

  /* ── COLOUR · MIST (the day neutrals from 1.2) ──────────────────────────
     Chosen on 21 Nov 2026 with the sea glass mood: white with a breath of sea glass,
     replacing the grey-beige pearl Eliza did not want. Text stays on the pearl inks. */
  --color-mist-50:  #fbfdfc;   /* paper */
  --color-mist-100: #ecf3ef;   /* panel2 */
  --color-mist-150: #e6efeb;   /* panel: folder tabs at rest */
  --color-mist-200: #f1f5f2;   /* bg: the page itself */
  --color-mist-250: #e5eeea;   /* rule2 */
  --color-mist-300: #d9e5e0;   /* rule */
  --color-mist-400: #cadcd6;   /* mist: folders furthest back */

  /* ── COLOUR · SEA GLASS (identity from 1.2) ────────────────────────────────
     Chosen on 21 Nov 2026 from Eliza's references (Restful cards, Prism, Floral therapy,
     Kintsugi): sea glass with blush, cream and a periwinkle haze. Takes over every job the
     lila family had; the role names stay --lila-* until the migration renames them.
     Turquoise and blue carry contentment and relief (Jonauskaite et al. 2020). */
  --color-sea-soft:  #e4f1ee;   /* hover fills, the selected rail row */
  --color-sea-pale:  #c3e0dc;   /* text selection, the top rule of a card */
  --color-sea-mid:   #6ea7a8;   /* outlines of a button */
  --color-sea-vivid: #26757c;   /* focus ring, active marks, the live dot. Was #2a7d84; darkened on
                                   21 Nov 2026 so it clears 4.5:1 on cards too (older pages use it as text) */
  --color-sea-deep:  #1f6169;   /* identity text at reading size */
  --color-sea-periwinkle: #5b6fb8;   /* the haze, as a gradient stop only */
  --color-sea-night-soft:  #1d3533;
  --color-sea-night-pale:  #8cc6c0;
  --color-sea-night-mid:   #5f9f9a;
  --color-sea-night-vivid: #7ccac2;
  --color-sea-night-deep:  #a3d6cf;
  --color-sea-night-periwinkle: #aab3ec;

  /* ── COLOUR · OPAL (the page as one conversation, 25 Nov 2026) ─────────────
     Seven turns, one hue each, in spectrum order. Day is pastel on a warm paper; night is
     the same spectrum lit from behind. The roles --hw1..--hw7 below pick the set. */
  --color-opal-day-1: #eeb0c6;  --color-opal-day-2: #f3c2a2;  --color-opal-day-3: #ead394;
  --color-opal-day-4: #a9e0c2;  --color-opal-day-5: #9fd6e0;  --color-opal-day-6: #aebdf0;
  --color-opal-day-7: #c8aeee;
  --color-opal-night-1: #ff8fb8;  --color-opal-night-2: #ffa877;  --color-opal-night-3: #f4cf5c;
  --color-opal-night-4: #6fe0a8;  --color-opal-night-5: #5fd0e6;  --color-opal-night-6: #8a9dff;
  --color-opal-night-7: #b585ff;
  --color-opal-bg: #f7f5f4;   --color-opal-paper: #fdfcfb;
  --color-opal-night-bg: #141318;   --color-opal-night-paper: #1c1b21;
  /* warm neutrals for panels and lines, from the Opal bg (chosen 26 Nov 2026, replaces the sea-glass mist) */
  --color-opal-panel: #efebe8;  --color-opal-panel2: #f3f0ee;  --color-opal-mist: #d6cfca;
  --color-opal-rule: #e2dcd8;   --color-opal-rule2: #ebe6e3;
  /* the seven Opal hues taken down in lightness until text clears 5:1 on the day paper (26 Nov 2026):
     for words, numbers and spine labels drawn in the spectrum; the pale hues stay for the patches */
  --color-opal-ink-1: #a24a6f;  --color-opal-ink-2: #9c561f;  --color-opal-ink-3: #866200;
  --color-opal-ink-4: #02774e;  --color-opal-ink-5: #007383;  --color-opal-ink-6: #5263ad;
  --color-opal-ink-7: #7e52b2;

  /* ── COLOUR · VIOLET (the interface accent from 25 Nov 2026) ────────────────
     Interface only: focus, the active tab, active marks, controls. Text links are ink; the
     colour of a link is its underline, taken from its turn. Hue 257. Contrast on paper
     #fdfcfb: deep 7.8, vivid 6.6, mid 4.9 (night values on #141318 / #1c1b21 in the roles). */
  --color-violet-soft:  #ece7f8;   /* hover fills, the selected rail row */
  --color-violet-pale:  #d0c4ee;   /* text selection, the top rule of a card */
  --color-violet-mid:   #7a5cc4;   /* outlines of a button */
  --color-violet-vivid: #6844b8;   /* focus ring, active marks, the live dot */
  --color-violet-deep:  #5a3f9c;   /* accent text at reading size */
  --color-violet-night-soft:  #2a2340;
  --color-violet-night-pale:  #8a73c8;   /* 4.7 on night bg */
  --color-violet-night-mid:   #9a7fe0;   /* 5.7 */
  --color-violet-night-vivid: #a584f5;   /* 6.4 */
  --color-violet-night-deep:  #c0aaf8;   /* 9.1 */

  /* ── COLOUR · GLASS (the field band from 1.2) ──────────────────────────────
     Soft light: cream and blush blooms and a periwinkle haze over sea glass aqua.
     aqua-2 is the darkest stop, the contrast reference for the ink on the band. */
  --color-glass-cream:  #f4e6d8;
  --color-glass-blush:  #ecc9d3;
  --color-glass-haze:   #cbc8e8;
  --color-glass-aqua-1: #bfdeda;
  --color-glass-aqua-2: #a9d0cf;
  --color-glass-aqua-3: #d2e5dd;
  --color-glass-night-1: #1f3b3b;   /* the lightest night stop, the contrast reference */
  --color-glass-night-2: #2b3148;
  --color-glass-night-3: #3a2d33;
  --color-glass-rail-1: #dcefeb;
  --color-glass-rail-2: #e3e4f6;
  --color-glass-rail-3: #f5e9df;

  /* ── COLOUR · LILA (identity until 1.1; retired 21 Nov 2026, kept until migration) ────────────────────────────────────────────
     The one accent, chosen 23 Jul 2026. Named by job, not by a numbered
     step, because vivid is more saturated than deep but lighter than it:
     a numbered ramp would put them in a false order. */
  --color-lila-soft:  #e7e2f5;   /* hover fills, the selected rail row */
  --color-lila-pale:  #cbc2ec;   /* text selection, the top rule of a card */
  --color-lila-mid:   #7a6bb4;   /* outlines of a lila button */
  --color-lila-vivid: #6a2ff0;   /* focus ring, active marks, the live dot, the numbers on a field.
                                   Was #6338cf; raised in saturation on 21 Nov 2026 (bold colour,
                                   direction F): the one saturated colour on the site. */
  --color-lila-deep:  #544586;   /* lila text at reading size, 7.1:1 on paper */

  --color-lila-night-soft:  #2e2a3f;
  --color-lila-night-pale:  #b8a9e6;
  --color-lila-night-mid:   #a99bd8;
  --color-lila-night-vivid: #bda9ff;
  --color-lila-night-deep:  #c6bbee;

  /* ── COLOUR · STATE (meaning, never decoration) ──────────────────────────
     The SaaS convention, decided 1 Oct 2026: green is done or a result,
     red is a problem, amber is attention, grey is neutral, violet is
     identity. Text colour and its soft fill always travel as a pair.
     Live on one page only (voice-guide.html).
     21 Nov 2026: warmed at Eliza's request (the fills leaned cool: blue-green, blue-pink).
     Green moves toward sage, amber toward apricot, the problem red toward a warm brick;
     each keeps its meaning. */
  --color-ok-text:   #2f6a55;  --color-ok-fill:   #d9ece3;
  --color-warn-text: #8a5418;  --color-warn-fill: #f6e8d2;
  --color-bad-text:  #9e3f3c;  --color-bad-fill:  #f6e0dc;
  --color-handoff:   #6b7079;  /* the grey step of the autonomy scale */

  --color-ok-night-text:   #b0d48c;  --color-ok-night-fill:   #27301d;
  --color-warn-night-text: #ebbd78;  --color-warn-night-fill: #382818;
  --color-bad-night-text:  #f2a690;  --color-bad-night-fill:  #3b231d;
  --color-handoff-night:   #9aa0a8;

  /* ── COLOUR · TRUST (the gradient word) ──────────────────────────────────
     Five stops from the sea glass mood (21 Nov 2026, 1.2): sea glass, periwinkle, mauve,
     sea, sea glass, painted across one word. Was violet, blue, orchid, green, violet. The display stops are for headline-size type (large text, 3:1);
     the small stops are the same hues darkened until the weakest clears
     4.6:1 at reading size. */
  --color-trust-1: #2a7d84;  --color-trust-small-1: #1f6169;
  --color-trust-2: #5b6fb8;  --color-trust-small-2: #4a5ca3;
  --color-trust-3: #9a5a86;  --color-trust-small-3: #85496f;
  --color-trust-4: #3f8f93;  --color-trust-small-4: #2f7276;
  --color-trust-5: #2a7d84;  --color-trust-small-5: #1f6169;

  /* night: on a dark ground the pale stops already clear 6:1 */
  --color-trust-night-1: #a3d6cf;
  --color-trust-night-2: #aab3ec;
  --color-trust-night-3: #e0b4cc;
  --color-trust-night-4: #8cc6c0;
  --color-trust-night-5: #a3d6cf;

  /* ── COLOUR · INK GRADIENT (the accent word in a pull quote) ─────────────
     One violet family, no colour blocks. Today each page writes these
     stops inline; here they are declared once. */
  --color-accent-1: #1f6169;
  --color-accent-2: #2a7d84;
  --color-accent-3: #3f8f93;
  --color-accent-4: #5b6fb8;
  --color-accent-5: #2a7d84;

  /* ── COLOUR · IRIDESCENT (the mesh) ──────────────────────────────────────
     The title band, the portrait background, the selected rail row. Pastel
     surfaces only: never under small text that is not ink. */
  --color-iris-lilac: #e7ccf3;
  --color-iris-blue:  #ccd6f5;
  --color-iris-peach: #f6e0cf;
  --color-iris-violet:#dbc9f2;
  --color-iris-rail-1:#e9dff6;  /* the rail's selected row, three stops */
  --color-iris-rail-2:#dde6f8;
  --color-iris-rail-3:#f6e9de;

  --color-iris-night-rail-1: #3a2d4c;
  --color-iris-night-rail-2: #2a3350;
  --color-iris-night-rail-3: #43362f;
  /* the field band, warmer and paler than the mesh (21 Nov 2026, Eliza: "mai pastel, mai
     calde"): rose-lilac, warm lavender in place of the blue, blush, cream peach. Night: plum,
     violet-grey and warm brown, one step off the rail so the band reads as its own surface. */
  --color-iris-warm-1: #f2dfef;   /* rose-lilac */
  --color-iris-warm-2: #e6e0f2;   /* warm lavender, the darkest stop */
  --color-iris-warm-3: #f6e3e2;   /* blush */
  --color-iris-warm-4: #f9eadb;   /* cream peach */
  --color-iris-warm-night-1: #3e2f40;
  --color-iris-warm-night-2: #36303f;
  --color-iris-warm-night-3: #463830;   /* the lightest night stop */

  /* ── COLOUR · SHADOW TINT ────────────────────────────────────────────────
     Shadows are the ink at low alpha, never black. One lila tint for the
     card that is being chosen. */
  --color-shadow-ink:  28 24 20;     /* the ink as r g b, for rgb(... / a) */
  --color-shadow-lila: 31 97 105;   /* sea glass from 1.2; the name stays until migration */
  --color-shadow-night: 0 0 0;

  /* ── SPACING ─────────────────────────────────────────────────────────────
     The rhythm the site already keeps, read from about 3,000 padding,
     margin and gap values: steps of 2px up to 26, then a widening run.
     The odd values in the pages (3, 5, 9, 11, 15) and 28, 32 round to a
     neighbour on migration; MIGRATION.md lists each one. */
  --space-1:  4px;
  --space-2:  6px;
  --space-3:  8px;
  --space-4:  10px;
  --space-5:  12px;
  --space-6:  14px;
  --space-7:  16px;
  --space-8:  18px;
  --space-9:  20px;
  --space-10: 22px;   /* phone gutter */
  --space-11: 24px;
  --space-12: 26px;
  --space-13: 30px;
  --space-14: 34px;
  --space-15: 40px;   /* desktop gutter */
  --space-16: 44px;
  --space-17: 56px;
  --space-18: 76px;
  --space-19: 104px;  /* the top of an act */

  /* ── TYPOGRAPHY ──────────────────────────────────────────────────────────
     Three families, each with one job. Merriweather Sans for everything you
     read. Fira Code for labels, numbers, dates and codes, never for a
     sentence (its fixed advance reads as letter spacing). Merriweather
     italic for a quoted voice, never for one word inside a heading. */
  --font-family-sans:  'Merriweather Sans', 'Merriweather Fallback', system-ui, sans-serif;
  --font-family-mono:  'Fira Code', ui-monospace, monospace;
  --font-family-serif: 'Merriweather', 'Iowan Old Style', Georgia, serif;

  /* Seven text sizes on the 18px root, and four fluid display sizes.
     Nothing on screen is smaller than --font-size-1 (12px), decided 6 Oct
     2026. These are the --fs-* tokens of shell.css under their system
     name; roles below keep the --fs-* aliases. */
  --font-size-1: 0.667rem;   /* 12px  · mono labels, counts */
  --font-size-2: 0.75rem;    /* 13.5px · tabs, chips, eyebrows */
  --font-size-3: 0.85rem;    /* 15.3px · menus, captions, small body */
  --font-size-4: 0.95rem;    /* 17.1px · meta values */
  --font-size-5: 1.05rem;    /* 18.9px · body */
  --font-size-6: 1.3rem;     /* 23.4px · card titles */
  --font-size-7: 1.9rem;     /* 34.2px · section numbers */
  --font-size-lede: clamp(1.12rem, 1.9vw, 1.4rem);
  --font-size-d3:   clamp(1.4rem, 2.6vw, 2rem);
  --font-size-d2:   clamp(2rem, 4vw, 3rem);
  --font-size-d1:   clamp(2.6rem, 6.4vw, 5.1rem);

  --font-weight-normal:   400;
  --font-weight-medium:   500;
  --font-weight-semibold: 600;   /* emphasis in running text, chosen items */
  --font-weight-bold:     700;
  --font-weight-black:    800;   /* display headings and the wordmark */

  --line-height-number:  0.85;   /* a big act number beside its label */
  --line-height-display: 0.98;   /* the hero headline */
  --line-height-tight:   1.05;   /* act titles */
  --line-height-heading: 1.2;
  --line-height-compact: 1.3;    /* rail links, two-line labels */
  --line-height-snug:    1.45;
  --line-height-relaxed: 1.55;   /* card descriptions, the lede */
  --line-height-base:    1.6;

  --letter-spacing-display: -0.035em;
  --letter-spacing-heading: -0.02em;
  --letter-spacing-snug:    -0.01em;  /* menu titles */
  --letter-spacing-label:   0.1em;    /* mono uppercase labels */
  --letter-spacing-eyebrow: 0.14em;   /* the eyebrow over a hero */

  --measure:        66ch;   /* body text line length */
  --measure-narrow: 52ch;   /* the lede */
  --measure-heading: 20ch;  /* act titles */
  --measure-pull:    22ch;  /* a pull quote */

  /* ── SHAPE ───────────────────────────────────────────────────────────────
     Fourteen radii are in use today. Five plus the pill cover every case;
     the migration table maps each old value. */
  --radius-xs:   4px;    /* a highlighted word, a progress tick */
  --radius-sm:   8px;    /* menu rows, small controls */
  --radius-md:   12px;   /* menus, panels, the folder corner */
  --radius-lg:   16px;   /* cards */
  --radius-xl:   20px;   /* choice cards, large figures */
  --radius-full: 999px;  /* pills: buttons, chips, segmented controls */

  /* ── DEPTH ───────────────────────────────────────────────────────────────
     Six shadows in use today, all ink-tinted with a negative spread so the
     shadow sits under the object, not around it. Four remain. */
  --shadow-sm:   0 8px 20px -12px rgb(var(--color-shadow-ink) / .20);
  --shadow-md:   0 20px 44px -30px rgb(var(--color-shadow-ink) / .40);
  --shadow-lg:   0 30px 60px -30px rgb(var(--color-shadow-ink) / .35);
  --shadow-pop:  0 14px 30px -18px rgb(var(--color-shadow-ink) / .35);  /* menus */
  --shadow-lila: 0 22px 44px -28px rgb(var(--color-shadow-lila) / .45); /* a card being chosen */

  /* ── BORDERS ─────────────────────────────────────────────────────────────
     The hairline carries structure (the grid, dividers, card edges). The
     2px line carries meaning: a focus ring, a card's top rule, a radio. */
  --border-width-hairline: 1px;
  --border-width-mark:     1.5px;  /* the underline of a term or a tab label */
  --border-width-strong:   2px;

  /* ── MOTION ──────────────────────────────────────────────────────────────
     One easing for everything that moves, a long ease-out that settles.
     Eight durations are in use; four remain. Nothing moves only to move
     (19 Oct 2026): motion answers a hover, a scroll or a choice. */
  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);   /* the spinning top only */
  --duration-fast:   160ms;   /* colour and background changes */
  --duration-base:   220ms;   /* lifts, underlines, the folder rising */
  --duration-slow:   350ms;   /* disclosures opening */
  --duration-reveal: 700ms;   /* content arriving on scroll */

  /* ── FOLDER GEOMETRY ─────────────────────────────────────────────────────
     How far a folder's shoulder leans out, how hard, and how far the next
     folder tucks under it. A phone gets the short set. */
  --folder-shoulder: 34px;  --folder-shoulder-sm: 24px;
  --folder-lean:     22deg; --folder-lean-sm:     16deg;
  --folder-tuck:     16px;  --folder-tuck-sm:     11px;
  --folder-lift:     -6px;  /* how far a folder rises on hover */

  /* ── SIZE AND LAYOUT ─────────────────────────────────────────────────────*/
  --size-page-max:   78rem;
  --size-gutter:     clamp(22px, 4vw, 4rem);
  --size-nav-h:      63px;   /* the rail's height, until shell.js measures it */
  --size-target:     44px;   /* every control a finger presses */
  --size-target-min: 24px;   /* WCAG 2.5.8 floor for inline links and dots */
  --size-dot:        8px;    /* the live dot, carousel dots */
  --size-radio:      18px;
  --size-switch-w:   42px;
  --size-switch-h:   24px;
  --size-menu-min:   268px;
  --size-menu-max:   320px;
  --size-tip-max:    280px;
  --focus-ring-width:  2px;
  --focus-ring-offset: 2px;

  --opacity-step-back: .6;   /* the card you are not choosing */
  --opacity-disabled:  .5;
}


/* =============================================================================
   LAYER 2 · ROLES (the theme)
   Day first, then night twice: once for the reader's system setting, once
   for the night switch in the accessibility panel (html[data-theme]).
   A page that sets data-theme="light" keeps the day whatever the system says.
   ============================================================================= */

:root {
  color-scheme: light;

  /* surfaces, from the page up */
  --bg:     var(--color-opal-bg);
  --panel:  var(--color-opal-panel);
  --panel2: var(--color-opal-panel2);
  --paper:  var(--color-opal-paper);
  --mist:   var(--color-opal-mist);

  /* lines */
  --rule:  var(--color-opal-rule);
  --rule2: var(--color-opal-rule2);
  --steel: var(--color-pearl-500);

  /* text */
  --ink:      var(--color-pearl-900);
  --graphite: var(--color-pearl-700);
  --slate:    var(--color-pearl-600);

  /* identity: one accent, one line to change it. The --lila-* names stay as aliases until the
     migration renames them. */
  --accent:      var(--color-violet-vivid);
  --accent-soft: var(--color-violet-soft);
  --accent-deep: var(--color-violet-deep);
  --accent-mid:  var(--color-violet-mid);
  --accent-pale: var(--color-violet-pale);
  --lila:       var(--accent-pale);
  --lila-soft:  var(--accent-soft);
  --lila-mid:   var(--accent-mid);
  --lila-vivid: var(--accent);
  --lila-deep:  var(--accent-deep);

  /* links: the text is ink, the colour is the underline, taken from the turn (--c) */
  --link:      var(--ink);
  --link-line: var(--hw6);   /* fallback; a { } below re-reads --c on each link */

  /* Opal: the seven turns, the wash and the page */
  --hw1: var(--color-opal-day-1); --hw2: var(--color-opal-day-2); --hw3: var(--color-opal-day-3);
  --hw4: var(--color-opal-day-4); --hw5: var(--color-opal-day-5); --hw6: var(--color-opal-day-6);
  --hw7: var(--color-opal-day-7);
  --hw-op: .8; --hw-blend: normal;

  /* the autonomy scale: the bot acts, asks to confirm, or hands off */
  --act:     var(--accent);
  --confirm: var(--accent-mid);
  --handoff: var(--color-handoff);

  /* state */
  --ok:   var(--color-ok-text);   --ok-soft:   var(--color-ok-fill);
  --warn: var(--color-warn-text); --warn-soft: var(--color-warn-fill);
  --bad:  var(--color-bad-text);  --bad-soft:  var(--color-bad-fill);

  /* gradients */
  --trust-grad: linear-gradient(100deg, var(--color-trust-1) 0%, var(--color-trust-2) 26%, var(--color-trust-3) 50%, var(--color-trust-4) 74%, var(--color-trust-5) 100%);
  --trust-grad-small: linear-gradient(100deg, var(--color-trust-small-1) 0%, var(--color-trust-small-2) 26%, var(--color-trust-small-3) 50%, var(--color-trust-small-4) 74%, var(--color-trust-small-5) 100%);
  --accent-grad: linear-gradient(100deg, var(--color-opal-ink-1) 0%, var(--color-opal-ink-2) 16.6%, var(--color-opal-ink-3) 33.3%, var(--color-opal-ink-4) 50%, var(--color-opal-ink-5) 66.6%, var(--color-opal-ink-6) 83.3%, var(--color-opal-ink-7) 100%);
  --rail-grad: linear-gradient(90deg, var(--color-glass-rail-1), var(--color-glass-rail-2) 70%, var(--color-glass-rail-3));
  --rail-grad-text: var(--color-pearl-900);

  /* type aliases: the names pages already write */
  --sans:  var(--font-family-sans);
  --mono:  var(--font-family-mono);
  --serif: var(--font-family-serif);
  --fs-1: var(--font-size-1); --fs-2: var(--font-size-2); --fs-3: var(--font-size-3);
  --fs-4: var(--font-size-4); --fs-5: var(--font-size-5); --fs-6: var(--font-size-6);
  --fs-7: var(--font-size-7);
  --fs-lede: var(--font-size-lede);
  --fs-d3: var(--font-size-d3); --fs-d2: var(--font-size-d2); --fs-d1: var(--font-size-d1);
  --ease: var(--ease-out);

  /* the single focus colour, so a theme moves focus everywhere at once */
  --focus-ring-color: var(--accent);
  /* the field: a bright band for the few places that carry the story (decided 21 Nov 2026,
     direction F). Brightness keeps it pleasant; the saturation lives only in its accent.
     --field-base is the darkest stop, the worst case for the ink on it, used for contrast. */
  --field:        radial-gradient(55% 90% at 10% 15%, var(--color-glass-cream) 0%, transparent 62%),
                  radial-gradient(45% 80% at 80% 25%, var(--color-glass-blush) 0%, transparent 62%),
                  radial-gradient(70% 110% at 55% 105%, var(--color-glass-haze) 0%, transparent 60%),
                  linear-gradient(120deg, var(--color-glass-aqua-1), var(--color-glass-aqua-2) 50%, var(--color-glass-aqua-3));
  --field-base:   var(--color-glass-aqua-2);
  --field-text:   var(--color-pearl-900);
  --field-muted:  var(--color-pearl-700);
  --field-accent: var(--accent-deep);
  --field-rule:   var(--color-opal-mist);
}

/* A custom property is resolved where it is declared, so the turn colour has to be read on the link itself. */
:where(a) { --link-line: var(--c, var(--hw6)); }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: var(--color-opal-night-bg); --paper: var(--color-opal-night-paper);
    --panel: var(--color-night-150); --panel2: var(--color-night-200);
    --mist: var(--color-night-400);
    --rule: var(--color-night-300); --rule2: var(--color-night-250); --steel: var(--color-night-500);
    --ink: var(--color-night-900); --graphite: var(--color-night-700); --slate: var(--color-night-600);
    --accent:      var(--color-violet-night-vivid);
    --accent-soft: var(--color-violet-night-soft);
    --accent-deep: var(--color-violet-night-deep);
    --accent-mid:  var(--color-violet-night-mid);
    --accent-pale: var(--color-violet-night-pale);
    --lila: var(--accent-pale); --lila-soft: var(--accent-soft);
    --lila-mid: var(--accent-mid); --lila-vivid: var(--accent);
    --lila-deep: var(--accent-deep);
    --hw1: var(--color-opal-night-1); --hw2: var(--color-opal-night-2); --hw3: var(--color-opal-night-3);
    --hw4: var(--color-opal-night-4); --hw5: var(--color-opal-night-5); --hw6: var(--color-opal-night-6);
    --hw7: var(--color-opal-night-7);
    --hw-op: .28; --hw-blend: screen;
    --act: var(--accent); --confirm: var(--accent-mid); --handoff: var(--color-handoff-night);
    --ok: var(--color-ok-night-text); --ok-soft: var(--color-ok-night-fill);
    --warn: var(--color-warn-night-text); --warn-soft: var(--color-warn-night-fill);
    --bad: var(--color-bad-night-text); --bad-soft: var(--color-bad-night-fill);
    --trust-grad: linear-gradient(100deg, var(--color-trust-night-1) 0%, var(--color-trust-night-2) 26%, var(--color-trust-night-3) 50%, var(--color-trust-night-4) 74%, var(--color-trust-night-5) 100%);
    --trust-grad-small: var(--trust-grad);
    --accent-grad: linear-gradient(100deg, var(--hw1) 0%, var(--hw2) 16.6%, var(--hw3) 33.3%, var(--hw4) 50%, var(--hw5) 66.6%, var(--hw6) 83.3%, var(--hw7) 100%);
    --rail-grad: linear-gradient(90deg, var(--color-glass-night-1), var(--color-glass-night-2) 70%, var(--color-glass-night-3));
    --rail-grad-text: var(--color-night-900);
    --focus-ring-color: var(--accent);
    --color-shadow-ink: var(--color-shadow-night);
    --field: linear-gradient(100deg, var(--color-glass-night-1), var(--color-glass-night-2) 50%, var(--color-glass-night-3));
    --field-base: var(--color-glass-night-1);
    --field-text: var(--color-night-900); --field-muted: var(--color-night-700);
    --field-accent: var(--accent); --field-rule: var(--color-night-300);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: var(--color-opal-night-bg); --paper: var(--color-opal-night-paper);
  --panel: var(--color-night-150); --panel2: var(--color-night-200);
  --mist: var(--color-night-400);
  --rule: var(--color-night-300); --rule2: var(--color-night-250); --steel: var(--color-night-500);
  --ink: var(--color-night-900); --graphite: var(--color-night-700); --slate: var(--color-night-600);
  --accent:      var(--color-violet-night-vivid);
  --accent-soft: var(--color-violet-night-soft);
  --accent-deep: var(--color-violet-night-deep);
  --accent-mid:  var(--color-violet-night-mid);
  --accent-pale: var(--color-violet-night-pale);
  --lila: var(--accent-pale); --lila-soft: var(--accent-soft);
  --lila-mid: var(--accent-mid); --lila-vivid: var(--accent);
  --lila-deep: var(--accent-deep);
  --hw1: var(--color-opal-night-1); --hw2: var(--color-opal-night-2); --hw3: var(--color-opal-night-3);
  --hw4: var(--color-opal-night-4); --hw5: var(--color-opal-night-5); --hw6: var(--color-opal-night-6);
  --hw7: var(--color-opal-night-7);
  --hw-op: .28; --hw-blend: screen;
  --act: var(--accent); --confirm: var(--accent-mid); --handoff: var(--color-handoff-night);
  --ok: var(--color-ok-night-text); --ok-soft: var(--color-ok-night-fill);
  --warn: var(--color-warn-night-text); --warn-soft: var(--color-warn-night-fill);
  --bad: var(--color-bad-night-text); --bad-soft: var(--color-bad-night-fill);
  --trust-grad: linear-gradient(100deg, var(--color-trust-night-1) 0%, var(--color-trust-night-2) 26%, var(--color-trust-night-3) 50%, var(--color-trust-night-4) 74%, var(--color-trust-night-5) 100%);
  --trust-grad-small: var(--trust-grad);
  --accent-grad: linear-gradient(100deg, var(--hw1) 0%, var(--hw2) 16.6%, var(--hw3) 33.3%, var(--hw4) 50%, var(--hw5) 66.6%, var(--hw6) 83.3%, var(--hw7) 100%);
  --rail-grad: linear-gradient(90deg, var(--color-glass-night-1), var(--color-glass-night-2) 70%, var(--color-glass-night-3));
  --rail-grad-text: var(--color-night-900);
  --focus-ring-color: var(--accent);
  --color-shadow-ink: var(--color-shadow-night);
  --field: linear-gradient(100deg, var(--color-glass-night-1), var(--color-glass-night-2) 50%, var(--color-glass-night-3));
  --field-base: var(--color-glass-night-1);
  --field-text: var(--color-night-900); --field-muted: var(--color-night-700);
  --field-accent: var(--accent); --field-rule: var(--color-night-300);
}
