/* ============================================================
   digidelic — tokens.css · THE single source of design tokens
   Every colour, type, spacing, focus, target, motion and texture
   value in the system lives here and nowhere else. Everything
   else — colors_and_type.css, textures.css, the tool shell, the
   hubs, the kits — reads these custom properties.

     <link rel="stylesheet" href="tokens.css">     tokens only
     <link rel="stylesheet" href="styles.css">     tokens + base + motifs

   tokens.json (DTCG), tailwind.config.js and components/core.js
   mirror these values for non-CSS consumers; `npm run check`
   fails if any of them drift from this file.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&display=swap');

/* Local brand mono — Geist Mono (variable weight) — PRIMARY UI/terminal font */
@font-face {
  font-family: 'Geist Mono';
  src: url('fonts/GeistMono-VariableFont_wght.ttf') format('truetype-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* Local brand mono — Red Hat Mono (variable weight) — alt/fallback mono */
@font-face {
  font-family: 'Red Hat Mono';
  src: url('fonts/RedHatMono-VariableFont_wght.ttf') format('truetype-variations');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* ─── BASE ──────────────────────────────────────────────── */
  --black:        #000000;      /* universal canvas */
  --black-soft:   #0a0a0a;      /* page bg */
  --black-panel:  #111110;      /* surface */
  --black-raised: #1a1a18;      /* elevated */
  --white:        #ffffff;
  --white-soft:   rgba(255,255,255,0.86);
  /* 0.55 is the READABLE FLOOR on black (6.25:1 — AA).
     Raised from 0.42 (3.90:1, AA-fail) after the 07-2026 contrast audit.
     See the Accessibility card for every computed pairing. */
  --white-dim:    rgba(255,255,255,0.55);
  --white-faint:  rgba(255,255,255,0.35);  /* 3.00:1 — DECORATIVE ONLY, never informational text */
  --white-ghost:  rgba(255,255,255,0.12);

  /* ─── THE 7 HEROES (sampled from refs) ──────────────────── */

  /* ELECTRIC COBALT — primary action, focus ring, hero fill.
     4.70:1 on pure black (4.43 on #0a0a0a — so as TEXT, #000 only).
     Ink on a cobalt fill is black (4.70:1). White ink is 4.47:1 —
     under AA for body copy, large labels only (≥19px bold / ≥24px). */
  --cobalt:       #2d6cff;
  --cobalt-deep:  #1f52d6;   /* pressed / active */

  /* ORANGE — warning signal. 6.71:1 on black. */
  --orange:       #ff5a00;

  /* HOT PINK — WILLB, Clov, glitch hero, notification */
  --pink:         #ff2d87;
  --pink-hot:     #ff0066;

  /* NEON GREEN — Marathon bioluminescent, Clov live states */
  --green:        #39ff6a;
  --green-deep:   #00d93d;

  /* ELECTRIC BLUE — alias of cobalt. The old #2d4cff was visually
     indistinguishable from cobalt and failed AA body text (3.59:1),
     so the two merged. Kept as a name for the checkerboard motif. */
  --blue:         var(--cobalt);
  --blue-deep:    var(--cobalt-deep);

  /* MAGENTA — Marathon glitch, chromatic aberration */
  --magenta:      #c800ff;
  --magenta-deep: #8a00bf;

  /* CYAN — WILLB accent, data readout */
  --cyan:         #00d9ff;

  /* ─── ZINE LAYER (from update n.02 collage) ─────────────── */
  /* SKY BLUE — soft electric blue, zine ground / surface */
  --sky:    #0a84e0;
  /* DUOTONE TEAL — the duotone third (tokens.json color.duotone.teal,
     Tailwind `teal`). Not the second-set --teal (#03888c, knit plate). */
  --duo-teal: #12b39b;
  --periwinkle-lo: #4150d6;

  /* CORAL — checkerboard, tribal dividers, marble swirl */
  --red:           #ff6050;
  --coral:         var(--red);   /* same hue, both names in use */
  --red-deep:      #d42218;

  /* ACID LIME — spirograph / lissajous line overlays */
  --lime:          #c6ff3a;

  /* ─── NIGHT GARDEN LAYER (infrared photo refs, 07-2026) ── */
  --night:        #150a1c;   /* deep violet night sky — alt hero ground */
  --violet:       #8a3fb0;   /* violet dusk — gradients over --night */
  --indigo:       #4653e8;   /* indigo leaf — calm data surfaces */
  --blood:        #e02020;   /* blood red — infrared foliage, urgent fills */

  /* ─── SEMANTIC TEXT ─────────────────────────────────────── */
  --fg:           var(--white);
  --fg-soft:      var(--white-soft);
  --fg-dim:       var(--white-dim);
  --fg-faint:     var(--white-faint);
  --fg-ghost:     var(--white-ghost);

  /* Text-on-color — always inverted to black for legibility */
  --fg-on-color:  var(--black);

  /* ─── SEMANTIC SURFACES ─────────────────────────────────── */
  --bg-page:      var(--black-soft);
  --bg-void:      var(--black);
  --bg-surface:   var(--black-panel);
  --bg-raised:    var(--black-raised);

  /* ─── BORDERS ───────────────────────────────────────────── */
  --border:       var(--white-ghost);
  --border-hi:    rgba(255,255,255,0.25);
  --border-solid: var(--white);

  /* ─── STATUS ROLES ──────────────────────────────────────── */
  --st-ok:        var(--green);
  --st-live:      var(--green);
  --st-alert:     var(--pink);
  --st-err:       var(--pink-hot);
  --st-warn:      var(--orange);   /* cobalt is not a hazard signal — warning is orange */
  --st-info:      var(--cyan);
  --st-dead:      var(--white-ghost);

  /* ─── SPECTRAL ACCENTS (Blue to Pink-Red Gradients) ─────── */
  --grad-blue-pink:      linear-gradient(90deg, var(--cobalt) 0%, var(--pink) 100%);
  --grad-blue-pink-diag: linear-gradient(135deg, var(--cobalt) 0%, #a82fff 50%, var(--pink) 100%);
  --grad-blue-pink-v:    linear-gradient(180deg, var(--cobalt) 0%, var(--pink) 100%);

  /* ─── TYPOGRAPHY ────────────────────────────────────────── */
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-mono:    'Geist Mono', 'Red Hat Mono', 'Courier New', monospace;
  --font-body:    'Space Grotesk', system-ui, sans-serif;

  --text-2xs: 10px;
  --text-xs:  11px;
  --text-sm:  12px;
  --text-md:  14px;
  --text-lg:  16px;
  --text-xl:  20px;
  --text-2xl: 28px;
  --text-3xl: 40px;
  --text-4xl: 56px;
  --text-5xl: 80px;
  --text-6xl: 120px;

  --fw-regular: 400;   /* @kind font */
  --fw-semibold:600;   /* @kind font */
  --fw-bold:    700;   /* @kind font */
  --fw-black:   900;   /* @kind font */

  --lh-tight:   0.95;  /* @kind font */
  --lh-snug:    1.15;  /* @kind font */
  --lh-base:    1.45;  /* @kind font */
  --lh-relaxed: 1.65;  /* @kind font */

  --ls-tight:  -0.02em; /* @kind font */
  --ls-normal:  0;      /* @kind font */
  --ls-wide:    0.06em; /* @kind font */
  --ls-wider:   0.12em; /* @kind font */
  --ls-widest:  0.22em; /* @kind font */

  /* ─── SPACING — 4px base ────────────────────────────────── */
  --sp-1:4px;  --sp-2:8px;  --sp-3:12px; --sp-4:16px;
  --sp-5:20px; --sp-6:24px; --sp-8:32px; --sp-10:40px;
  --sp-12:48px;--sp-16:64px;--sp-20:80px;--sp-24:96px;

  --radius: 0;  /* never anything else */

  /* ─── FOCUS ─────────────────────────────────────────────── */
  --focus-ring:        var(--cobalt);   /* 4.70:1 on black; clears 3:1 on every system surface */
  --focus-ring-invert: var(--white);    /* flip when the ring would sit on a cobalt fill */
  --focus-width:  2px;
  --focus-offset: 1px;

  /* ─── TARGET SIZE ───────────────────────────────────────── */
  --target-min:   24px;  /* WCAG 2.5.8 floor */
  --target-touch: 44px;  /* mobile default */

  /* ─── MOTION ────────────────────────────────────────────── */
  /* Durations — short + decisive. This is a machine, not a toy. */
  --dur-instant: 60ms;   /* @kind other */
  --dur-fast:    100ms;  /* @kind other */
  --dur-base:    160ms;  /* @kind other */
  --dur-slow:    260ms;  /* @kind other */

  /* Easings — two fluid curves + one digital step.
     snap  = quick out, for hovers/taps. flow = expo-out, for entrances.
     step  = quantised, for glitch/digital reveals (on-brand). */
  --ease:       linear;                        /* @kind other */
  --ease-snap:  cubic-bezier(0.2, 0, 0, 1);    /* @kind other */
  --ease-flow:  cubic-bezier(0.16, 1, 0.3, 1); /* @kind other */
  --ease-step:  steps(6, end);                 /* @kind other */

  /* Composite transition presets — drop straight onto `transition:` */
  --t-hover: color var(--dur-fast) var(--ease-snap),
             background var(--dur-fast) var(--ease-snap),
             border-color var(--dur-fast) var(--ease-snap),
             box-shadow var(--dur-fast) var(--ease-snap); /* @kind other */
  --t-move:  transform var(--dur-base) var(--ease-flow),
             opacity var(--dur-base) var(--ease-flow); /* @kind other */
}

:root {
  /* ═══ second set, cream surface, primitives (used by textures.css) ═══ */
  /* ─── THE SECOND SET ────────────────────────────────────────
     Editorial, plates and full-bleed grounds. A node is never
     "oxblood" — these do not participate in seeded hue. */
  --blush:        #d798a7;   /* dusty mid pink — floral plate ground */
  --oxblood:      #962c38;   /* deep crimson — cloth plate */
  --botanical:    #3f6b45;   /* leaf green — floral plate foliage */
  --teal:         #03888c;   /* dark cyan — knit plate */
  --red-true:     #ff0026;   /* signal red — dither plate sky */
  --electric:     #0008ff;   /* pure blue — Turing plate */

  /* Ink that clears AA 4.5:1 on each. Measured, not assumed. */
  --blush-ink:     #000000;  /* 8.94 */
  --oxblood-ink:   #ffffff;  /* 7.74 */
  --botanical-ink: #ffffff;  /* 6.18 */
  --teal-ink:      #000000;  /* 4.90 */
  --red-true-ink:  #000000;  /* 5.28 */
  --electric-ink:  #ffffff;  /* 8.47 */

  /* ─── CREAM: THE THIRD SURFACE ──────────────────────────────
     Warm chalk, from the cloth plate. Reads as paper, not screen. */
  --cream:            #e8e3d0;
  --cream-panel:      #f2efe4;
  --cream-raised:     #ffffff;
  --cream-fg:         #0a0a0a;             /* 16.33 on cream */
  --cream-fg-dim:     rgba(10,10,10,.62);
  --cream-fg-faint:   rgba(10,10,10,.34);
  --cream-rule:       rgba(10,10,10,.26);
  --cream-rule-hi:    rgba(10,10,10,.48);

  /* The ramp, darkened until white ink clears 4.6:1 on every stop.
     Night rotates the ramp sideways; cream pushes it down. All ten
     stops stay available. Ink on a cream-surface fill is ALWAYS white. */
  --c-magenta: #c000f5;
  --c-pink:    #db2774;
  --c-coral:   #c84b3f;
  --c-orange:  #cd4800;
  --c-lime:    #627e1d;
  --c-green:   #1e8638;
  --c-cyan:    #008096;
  --c-cobalt:  #2c6afb;
  --c-indigo:  #4653e8;   /* already dark enough — authored hex kept */
  --c-violet:  #8a3fb0;   /* already dark enough — authored hex kept */

  /* ─── PRIMITIVE GEOMETRY ────────────────────────────────────── */
  /* primitive tile size */
  --t-cell:   14px;   /* @kind other */
  /* grid line weight */
  --t-rule:   1px;    /* @kind other */
}
