/* =========================================================================
   TOKENS — the single source of truth. Nothing below this file invents a
   value. Dark-first; the light theme redefines tokens only, never rules.
   ========================================================================= */

/* Colour is split from the rest of :root so a .plate-night can re-declare
   it. Semantic tokens are resolved where they are declared, so a section
   cannot become dark by redefining the ramp alone — it has to restate the
   semantics against the new ramp too, which is exactly what listing it
   here does. Used by the pillars section: its backdrop is a night sky and
   stays one in the light theme. */
:root,
.plate-night {
  /* ---- Neutral ramp (dark-first) ------------------------------------- */
  --n-000: #0e1013;   /* page — lifted off pure black; white text blooms on #08090A */
  --n-050: #15181b;   /* raised surface */
  --n-100: #1e2226;   /* card — 1.24:1 off the page, so edges read */
  --n-200: #272c30;   /* hairline strong */
  --n-300: #3d4449;   /* border — 1.68:1 on card, was 1.33:1 */
  --n-400: #4a5157;   /* disabled ink */
  --n-500: #8b939a;   /* meta ink — 6.11:1, was 4.26:1 (failed AA) */
  --n-600: #a3aab1;   /* secondary ink */
  --n-700: #c3c9ce;
  --n-800: #e6e8ea;
  --n-900: #f4f3ef;   /* primary ink (warm paper white) */

  /* ---- Semantic ------------------------------------------------------ */
  --bg:            var(--n-000);
  --bg-raised:     var(--n-050);
  --bg-card:       var(--n-100);
  --ink:           var(--n-900);
  --ink-secondary: var(--n-600);
  --ink-meta:      var(--n-500);
  --border:        var(--n-300);
  --border-subtle: var(--n-200);

  /* ---- Accent: vermilion. One accent, used only where it means something.
         Dark value hits 5.0:1 on --n-000. Light theme swaps to 4.8:1. ---- */
  --accent:        #ff4a25;
  --accent-ink:    #ff4a25;   /* accent used as text */
  --accent-soft:   rgba(255, 74, 37, 0.14);
  --accent-line:   rgba(255, 74, 37, 0.32);
  --on-accent:     #08090a;
}

:root {
  /* ---- Type ---------------------------------------------------------- */
  --font-display: "Inter Tight", "Helvetica Neue", Arial, sans-serif;
  --font-ui:      "Inter Tight", "Helvetica Neue", Arial, sans-serif;
  --font-edit:    "Instrument Serif", Georgia, "Times New Roman", serif;
  --font-mono:    "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --t-mono:    0.6875rem;                              /* 11px labels */
  --t-small:   0.8125rem;                              /* 13px */
  --t-body:    clamp(1rem, 0.96rem + 0.2vw, 1.125rem); /* 16 → 18 */
  --t-lead:    clamp(1.125rem, 1rem + 0.6vw, 1.5rem);  /* 18 → 24 */
  --t-h3:      clamp(1.25rem, 1.1rem + 0.7vw, 1.75rem);
  --t-h2:      clamp(2rem, 1.4rem + 2.8vw, 4.25rem);
  --t-hero:    clamp(2.75rem, 1.2rem + 7.4vw, 8.5rem);
  --t-numeral: clamp(1.75rem, 1.2rem + 2.4vw, 3.25rem);

  --lh-tight: 0.94;
  --lh-snug:  1.15;
  --lh-body:  1.6;
  --tr-mono:  0.14em;
  --tr-tight: -0.03em;

  /* ---- Space (4/8 rhythm) -------------------------------------------- */
  --s-1: 0.25rem;  --s-2: 0.5rem;   --s-3: 0.75rem;  --s-4: 1rem;
  --s-5: 1.5rem;   --s-6: 2rem;     --s-7: 3rem;     --s-8: 4rem;
  --s-9: 6rem;     --s-10: 8rem;
  /* Three section rhythms, not one. Uniform padding on every section is the
     absence of rhythm: nothing groups, nothing separates, nothing lands. */
  --section-y:       clamp(5rem, 3rem + 9vw, 11rem);   /* a new movement  */
  --section-y-tight: clamp(2.5rem, 1.5rem + 4vw, 5rem); /* continues the last */
  --section-y-close: clamp(1rem, 0.5rem + 1.5vw, 2rem); /* joined to the last */
  --gutter:    clamp(1.25rem, 0.6rem + 3vw, 4.5rem);
  --measure:   68ch;
  --maxw:      82rem;

  /* ---- Shape --------------------------------------------------------- */
  --r-1: 4px; --r-2: 8px; --r-3: 14px; --r-full: 999px;

  /* ---- Motion — one rhythm for the whole site ------------------------ */
  --e-out:   cubic-bezier(0.2, 0.8, 0.2, 1);   /* entering  */
  --e-in:    cubic-bezier(0.6, 0, 0.9, 0.4);   /* leaving   */
  --e-soft:  cubic-bezier(0.4, 0, 0.2, 1);     /* state     */
  --e-expo:  cubic-bezier(0.16, 1, 0.3, 1);    /* signature — decisive */
  --d-micro: 160ms;   /* hover, focus, press — Emil territory */
  --d-state: 260ms;
  --d-enter: 620ms;   /* section reveals — Jakub territory   */
  --d-exit:  465ms;   /* leaving is 75% of entering              */
  --stagger: 70ms;

  --z-base: 0; --z-raised: 10; --z-nav: 40; --z-overlay: 60; --z-cursor: 90;
}

/* Light theme: tokens only. Accent darkens to hold 4.5:1 on paper. */
[data-theme="light"] {
  --n-000: #f4f3ef;
  --n-050: #efeee9;
  --n-100: #ffffff;
  --n-200: #e2e0d9;
  --n-300: #b6b1a3;   /* border — 2.14:1 on card, was 1.54:1 */
  --n-400: #a5a196;
  --n-500: #67635a;   /* meta ink — 5.39:1, was 4.26:1 (failed AA) */
  --n-600: #565349;
  --n-700: #33312b;
  --n-800: #1a1917;
  --n-900: #0d0d0c;

  --accent:      #c43214;
  --accent-ink:  #c43214;
  --accent-soft: rgba(196, 50, 20, 0.10);
  --accent-line: rgba(196, 50, 20, 0.28);
  --on-accent:   #f4f3ef;
}
