/* ════════════════════════════════════════════════════════════════════
   channelstricks.com — Editorial Ink design tokens        v1 · 2026-07-24
   System of record: chanstri-sys/brand (tokens/editorial-ink.css)

   Format decision (measured, not assumed): every consumer is hand-authored
   CSS custom properties with no build step — home. inlines this block in
   its Worker template string, lab. pastes into styles.css, learn. inlines
   in its page template. Copy the whole block; never fork values.

   Theme: light-first, dark twin via light-dark(). Requires
   `color-scheme: light dark` on :root (included). Fallback for very old
   browsers: replace light-dark(a, b) with `a` and add a
   @media (prefers-color-scheme: dark) override block — see tokens README.

   Contrast (WCAG 2.1, checked 2026-07-24): every text token here is
   ≥ 4.5:1 on paper/card in its own theme; big-mode pairs are ≥ 8.5:1
   (home. AAA bar). Don't introduce new color pairs without re-checking.
   ════════════════════════════════════════════════════════════════════ */

:root {
  color-scheme: light dark;

  /* ── raw palette ─────────────────────────────────────── */
  /* light */
  --ei-paper-l:  #F7F4EC;   /* page ground                              */
  --ei-wash-l:   #EDE8DB;   /* recessed fills, meters, wells            */
  --ei-card-l:   #FFFEF9;   /* raised surfaces: tiles, cards, dialogs   */
  --ei-ink-l:    #171512;   /* primary text            16.6:1 on paper  */
  --ei-muted-l:  #5F5B50;   /* secondary text           6.2:1 on paper  */
  --ei-line-l:   #D9D3C4;   /* hairlines, borders                       */
  /* dark twin */
  --ei-paper-d:  #141311;
  --ei-wash-d:   #1B1A17;
  --ei-card-d:   #211F1B;
  --ei-ink-d:    #F1EEE5;   /*                         16.0:1 on paper  */
  --ei-muted-d:  #A6A093;   /*                          7.1:1 on paper  */
  --ei-line-d:   #37342E;

  /* THE brand accent — one vermilion, everywhere, always.
     Unified 2026-07-24 on the AA-passing value; #D8451F (early boards)
     is retired. Light 4.6:1 on paper · dark 5.8:1 on paper.            */
  --ei-vermilion-l: #C93D1B;
  --ei-vermilion-d: #E86A44;
  --ei-on-vermilion-l: #FFF6EE;  /* text on vermilion fills, 4.7:1      */
  --ei-on-vermilion-d: #1E0C05;

  /* ── semantic tokens (use these, not the raws) ───────────────── */
  --paper:  light-dark(var(--ei-paper-l),  var(--ei-paper-d));
  --wash:   light-dark(var(--ei-wash-l),   var(--ei-wash-d));
  --card:   light-dark(var(--ei-card-l),   var(--ei-card-d));
  --ink:    light-dark(var(--ei-ink-l),    var(--ei-ink-d));
  --muted:  light-dark(var(--ei-muted-l),  var(--ei-muted-d));
  --line:   light-dark(var(--ei-line-l),   var(--ei-line-d));
  --accent: light-dark(var(--ei-vermilion-l), var(--ei-vermilion-d));
  --on-accent: light-dark(var(--ei-on-vermilion-l), var(--ei-on-vermilion-d));

  /* Sub-flavor slot (decision 2026-07-24): each surface may set ONE muted
     secondary for its working parts (links, status, highlights). Brand
     moments (wordmark stop, key signals) stay --accent. Default = accent,
     i.e. a surface without a declared secondary is vermilion-only.      */
  --second: var(--accent);

  /* tFrame render-mode semantics, recut for Editorial Ink (plain-word
     badges: "here / opens / app ↗"; badges hidden in big mode).
     NON-TEXT (the badge dot) — 3:1 floor, not 4.5:1. --mode-page light
     measures 4.46:1 on paper, so it is dot-safe but must never set text. */
  --mode-inline: light-dark(#2E7D4F, #57D089);
  --mode-page:   light-dark(#8A6D1B, #E2B45A);
  --mode-link:   light-dark(#4E56B8, #9A9AFF);

  /* Reserved data-encoding set — vitals (home. /whoop), added 2026-07-24.
     Graphical objects ONLY: ring strokes, chart bars, stage bars. 3:1 floor
     (SC 1.4.11), measured both themes; never text, never chrome, and never
     the only signal — the zone is always named in words too. See
     styleguide/topics/foundations/data-encoding-palettes.md.             */
  --v-recovery-good: light-dark(#0CA335, #19E04F);
  --v-recovery-mid:  light-dark(#B18700, #FFD23F);
  --v-recovery-low:  light-dark(#FF495B, #FF4B5C);
  --v-strain:        light-dark(#0999C2, #12B8E6);
  --v-sleep:         light-dark(#6385FF, #6C8CFF);

  /* ── type ──────────────────────────────────────────── */
  --font-display: "DM Serif Display", Georgia, serif;
  --font-body:    "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono:    "Geist Mono", ui-monospace, Consolas, monospace;

  --text-masthead: clamp(2.2rem, 6vw, 3.6rem);   /* DM Serif, 400       */
  --text-title:    1.5rem;                        /* tile/section titles */
  --text-body:     1rem;
  --text-label:    0.78rem;                       /* mono, tracked caps  */
  --tracking-label: 0.06em;

  /* ── space & shape ───────────────────────────────────── */
  --radius: 18px;
  --gap:    16px;
  --tap-min: 44px;    /* minimum target — Grandma bar, all surfaces     */

  /* ── motion (restraint rules, decision 2026-07-24) ─────────────── */
  /* One entrance stagger per page load; nothing loops except Inkstream's
     tidal drift; prefers-reduced-motion stills everything.             */
  --motion-rise: 0.5s;
  --motion-rise-step: 45ms;
  --motion-dialog: 0.22s;
  --ease-settle: cubic-bezier(.2, .7, .3, 1);

  accent-color: var(--accent);
}

/* ── big mode (home. Grandma contract — per-person flag, NOT a media
      query). A scaled-up skin of the same design: same palette family,
      pushed to AAA; badges hidden; grid forced 2-up by the consumer.  */
.big, body.big {
  --ink:   light-dark(#0E0D0B, #FFFFFF);   /* 17.7:1 / 18.6:1           */
  --muted: light-dark(#4A463C, #C9C3B4);   /*  8.6:1 / 10.6:1           */
  --radius: 24px;
  --gap:    22px;
  --text-title: 2.1rem;
  --text-body:  1.3rem;
}

/* ── per-surface secondaries (the only per-surface color variation) ── */
/* home. and search. declare nothing: vermilion-only.                  */
.surface-lab {
  --second: light-dark(#2F5C8F, #8FB0DC);  /* prussian  6.3:1 / 8.3:1   */
}
.surface-learn {
  --second: light-dark(#8A6717, #D9B45A);  /* ochre     4.7:1 / 9.4:1   */
  /* Note: the study's #A87E1C failed AA as text (3.4:1) and was deepened
     for the light theme; the hue intent is unchanged.                  */
}
