/* ============================================================
   TOKENS — fonts, colour themes, type scale, spacing, motion
   Single source of truth. Every other stylesheet reads these.
   ============================================================ */

/* ---------- self-hosted fonts (latin + latin-ext only) ---------- */

@font-face {
  font-family: "Instrument Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/instrument-serif-normal-latin-ext.woff2") format("woff2");
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
    U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB,
    U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Instrument Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/instrument-serif-normal-latin.woff2") format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212,
    U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Instrument Serif";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/instrument-serif-italic-latin-ext.woff2") format("woff2");
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
    U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB,
    U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Instrument Serif";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/instrument-serif-italic-latin.woff2") format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212,
    U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("../fonts/space-grotesk-latin-ext.woff2") format("woff2");
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
    U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB,
    U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("../fonts/space-grotesk-latin.woff2") format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212,
    U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("../fonts/jetbrains-mono-latin-ext.woff2") format("woff2");
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
    U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB,
    U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("../fonts/jetbrains-mono-latin.woff2") format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212,
    U+2215, U+FEFF, U+FFFD;
}

/* ---------- design tokens ---------- */

:root {
  color-scheme: dark;

  /* surfaces */
  --bg: #0c0c0d;
  --bg-sunk: #080809;
  --surface: #121214;
  --surface-2: #17171a;

  /* hairlines */
  --line: #232328;
  --line-soft: #1a1a1e;

  /* ink */
  --ink: #ededef;
  --ink-2: #a0a0a8;
  --ink-3: #83838d;

  /* one accent, used sparingly */
  --accent: #ffb224;
  --accent-ink: #1a1206;
  --accent-dim: rgba(255, 178, 36, 0.13);
  --accent-line: rgba(255, 178, 36, 0.34);

  /* diagram strokes */
  --wire: #26262c;
  --wire-live: var(--accent);

  /* type families */
  --font-display:
    "Instrument Serif", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-sans:
    "Space Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI",
    Roboto, sans-serif;
  --font-mono:
    "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* fluid type scale */
  --fs-mono: 0.6875rem;
  --fs-xs: 0.75rem;
  --fs-sm: 0.8125rem;
  --fs-base: clamp(0.9375rem, 0.9rem + 0.2vw, 1rem);
  --fs-md: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --fs-lg: clamp(1.125rem, 1.04rem + 0.4vw, 1.375rem);
  --fs-xl: clamp(1.5rem, 1.3rem + 0.9vw, 2rem);
  --fs-2xl: clamp(1.875rem, 1.5rem + 1.8vw, 2.75rem);
  --fs-3xl: clamp(2.25rem, 1.7rem + 2.6vw, 3.5rem);
  --fs-hero: clamp(3rem, 1.6rem + 7.5vw, 7.5rem);

  /* spacing */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;
  --s8: 64px;
  --s9: 96px;
  --s10: 128px;

  /* layout */
  --maxw: 1180px;
  --gutter: clamp(1.25rem, 0.7rem + 2.2vw, 2.75rem);
  --section-y: clamp(4rem, 2.6rem + 5.5vw, 8rem);
  --measure: 64ch;

  /* shape — runbook means hairlines, not pillows */
  --bw: 1px;
  --r1: 2px;
  --r2: 3px;
  --r3: 4px;
  --r-pill: 999px;

  /* motion */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur-1: 120ms;
  --dur-2: 240ms;
  --dur-3: 560ms;

  /* the only shadow in the system */
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

[data-theme="light"] {
  color-scheme: light;

  --bg: #f4f1ea;
  --bg-sunk: #ece8df;
  --surface: #fbfaf6;
  --surface-2: #f7f4ec;

  --line: #d5cfc0;
  --line-soft: #e3ded2;

  --ink: #14140f;
  --ink-2: #55534a;
  --ink-3: #6b695f;

  --accent: #8a5000;
  --accent-ink: #fdf9f0;
  --accent-dim: rgba(138, 80, 0, 0.1);
  --accent-line: rgba(138, 80, 0, 0.32);

  --wire: #d9d3c6;

  --shadow: 0 1px 2px rgba(20, 20, 15, 0.08);
}

/* Reduced motion collapses every duration in the system at once. */
@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-1: 1ms;
    --dur-2: 1ms;
    --dur-3: 1ms;
  }
}
