/* Design tokens as CSS custom properties.
   Light is the default; dark follows the OS
   unless the user picked a theme: <html data-theme="light|dark">. */

@font-face { font-family: "Onest"; src: url("/fonts/Onest-Variable.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/fonts/JetBrainsMono-Variable.woff2") format("woff2"); font-weight: 100 800; font-style: normal; font-display: swap; }

:root, [data-theme="light"] {
  color-scheme: light;
  --paper-0: #ffffff;
  --paper-25: #fdfcfa;
  --paper-50: #f6f5f1;
  --paper-100: #eeece5;
  --paper-200: #e7e4db;
  --paper-300: #dcd8ce;
  --graphite-300: #a9adb4;
  --graphite-400: #7f848d;
  --graphite-500: #5d636e;
  --graphite-600: #454b55;
  --graphite-800: #232831;
  --graphite-900: #14181f;
  --night-50: #e8ebf0;
  --night-200: #b3bbc7;
  --night-300: #949eac;
  --night-500: #677286;
  --night-600: #4b5567;
  --night-700: #2c3647;
  --night-750: #1d2634;
  --night-800: #19212d;
  --night-850: #131a24;
  --night-900: #0e131b;
  --night-950: #0a0e14;
  --cobalt-50: #e5eafb;
  --cobalt-100: #c9d4f8;
  --cobalt-200: #afc1ff;
  --cobalt-300: #93abff;
  --cobalt-400: #6680cf;
  --cobalt-500: #7c97f5;
  --cobalt-600: #2346c0;
  --cobalt-700: #1b399f;
  --cobalt-800: #152d7d;
  --cobalt-900: #1b2649;
  --cobalt-925: #2b3a6e;
  --cobalt-950: #0b1020;
  --green-100: #dcefe6;
  --green-300: #5ccf9f;
  --green-700: #12684b;
  --green-950: #0f2a22;
  --amber-100: #f7ead0;
  --amber-300: #eeb64b;
  --amber-700: #875500;
  --amber-950: #2c2410;
  --red-100: #f9e1dd;
  --red-300: #ff8b7c;
  --red-700: #b0281c;
  --red-950: #35181a;
  --teal-100: #ddedf2;
  --teal-300: #6dc5df;
  --teal-700: #0d627b;
  --teal-950: #0f2731;
  --vermilion-300: #ff8c5e;
  --vermilion-600: #b93d14;
  --bg: var(--paper-50);
  --bg-grid: var(--paper-200);
  --surface: var(--paper-25);
  --surface-raised: var(--paper-0);
  --surface-sunken: var(--paper-100);
  --surface-inverse: var(--graphite-900);
  --border-subtle: var(--paper-300);
  --border: var(--graphite-400);
  --border-strong: var(--graphite-800);
  --text: var(--graphite-900);
  --text-muted: var(--graphite-600);
  --text-subtle: var(--graphite-500);
  --text-disabled: var(--graphite-300);
  --text-inverse: var(--paper-50);
  --text-on-accent: var(--paper-0);
  --accent: var(--cobalt-600);
  --accent-hover: var(--cobalt-700);
  --accent-active: var(--cobalt-800);
  --accent-subtle: var(--cobalt-50);
  --link: var(--accent);
  --connector: var(--cobalt-400);
  --marker: var(--vermilion-600);
  --success: var(--green-700);
  --success-subtle: var(--green-100);
  --warning: var(--amber-700);
  --warning-subtle: var(--amber-100);
  --danger: var(--red-700);
  --danger-subtle: var(--red-100);
  --info: var(--teal-700);
  --info-subtle: var(--teal-100);
  --focus: var(--cobalt-600);
  --selection: var(--cobalt-100);
  --overlay: rgba(20, 24, 31, 0.48);
  --shadow-none: none;
  --shadow-sm: 0 1px 2px rgba(20, 24, 31, 0.06), 0 2px 6px rgba(20, 24, 31, 0.05);
  --shadow-md: 0 8px 24px rgba(20, 24, 31, 0.10), 0 2px 6px rgba(20, 24, 31, 0.06);
  --shadow-lg: 0 24px 64px rgba(20, 24, 31, 0.18), 0 4px 12px rgba(20, 24, 31, 0.08);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: var(--night-900);
  --bg-grid: var(--night-750);
  --surface: var(--night-850);
  --surface-raised: var(--night-800);
  --surface-sunken: var(--night-950);
  --surface-inverse: var(--night-50);
  --border-subtle: var(--night-700);
  --border: var(--night-500);
  --border-strong: var(--night-200);
  --text: var(--night-50);
  --text-muted: var(--night-200);
  --text-subtle: var(--night-300);
  --text-disabled: var(--night-600);
  --text-inverse: var(--night-900);
  --text-on-accent: var(--cobalt-950);
  --accent: var(--cobalt-300);
  --accent-hover: var(--cobalt-200);
  --accent-active: var(--cobalt-500);
  --accent-subtle: var(--cobalt-900);
  --link: var(--accent);
  --connector: var(--cobalt-400);
  --marker: var(--vermilion-300);
  --success: var(--green-300);
  --success-subtle: var(--green-950);
  --warning: var(--amber-300);
  --warning-subtle: var(--amber-950);
  --danger: var(--red-300);
  --danger-subtle: var(--red-950);
  --info: var(--teal-300);
  --info-subtle: var(--teal-950);
  --focus: var(--cobalt-200);
  --selection: var(--cobalt-925);
  --overlay: rgba(3, 6, 10, 0.68);
  --shadow-none: none;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.7), 0 4px 12px rgba(0, 0, 0, 0.5);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: var(--night-900);
    --bg-grid: var(--night-750);
    --surface: var(--night-850);
    --surface-raised: var(--night-800);
    --surface-sunken: var(--night-950);
    --surface-inverse: var(--night-50);
    --border-subtle: var(--night-700);
    --border: var(--night-500);
    --border-strong: var(--night-200);
    --text: var(--night-50);
    --text-muted: var(--night-200);
    --text-subtle: var(--night-300);
    --text-disabled: var(--night-600);
    --text-inverse: var(--night-900);
    --text-on-accent: var(--cobalt-950);
    --accent: var(--cobalt-300);
    --accent-hover: var(--cobalt-200);
    --accent-active: var(--cobalt-500);
    --accent-subtle: var(--cobalt-900);
    --link: var(--accent);
    --connector: var(--cobalt-400);
    --marker: var(--vermilion-300);
    --success: var(--green-300);
    --success-subtle: var(--green-950);
    --warning: var(--amber-300);
    --warning-subtle: var(--amber-950);
    --danger: var(--red-300);
    --danger-subtle: var(--red-950);
    --info: var(--teal-300);
    --info-subtle: var(--teal-950);
    --focus: var(--cobalt-200);
    --selection: var(--cobalt-925);
    --overlay: rgba(3, 6, 10, 0.68);
    --shadow-none: none;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.7), 0 4px 12px rgba(0, 0, 0, 0.5);
  }
}

:root {
  --space-0: 0px;
  --space-0-5: 2px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;
  --space-32: 128px;
  --radius-0: 0px;
  --radius-xs: 2px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-full: 9999px;
  --fs-display: clamp(2.75rem, 1.833rem + 4.074vw, 5.5rem);
  --fs-h1: clamp(2.25rem, 1.75rem + 2.222vw, 3.75rem);
  --fs-h2: clamp(1.75rem, 1.417rem + 1.481vw, 2.75rem);
  --fs-h3: clamp(1.375rem, 1.25rem + 0.5556vw, 1.75rem);
  --fs-h4: clamp(1.125rem, 1.083rem + 0.1852vw, 1.25rem);
  --fs-lead: clamp(1.125rem, 1.042rem + 0.3704vw, 1.375rem);
  --fs-body: clamp(1rem, 0.9792rem + 0.09259vw, 1.062rem);
  --fs-body-sm: clamp(0.875rem, 0.8542rem + 0.09259vw, 0.9375rem);
  --fs-label: 0.875rem;
  --fs-caption: 0.8125rem;
  --fs-metric: clamp(2.5rem, 2rem + 2.222vw, 4rem);
  --fs-mono-label: 0.75rem;
  --fs-mono-sm: 0.8125rem;
  --fs-mono-md: 0.9375rem;
  --space-section: clamp(4rem, 2.667rem + 5.926vw, 8rem);
  --space-block: clamp(2rem, 1.5rem + 2.222vw, 3.5rem);
  --page-margin: clamp(1rem, 0.3333rem + 2.963vw, 3rem);
  --container-prose: 680px;
  --container-content: 1200px;
  --container-wide: 1440px;
  --bp-sm: 600px;
  --bp-md: 768px;
  --bp-lg: 1024px;
  --bp-xl: 1280px;
  --bp-2xl: 1440px;
  --grid-cols-base: 4;
  --grid-cols-md: 8;
  --grid-cols-lg: 12;
  --gutter-base: 16px;
  --gutter-md: 24px;
  --gutter-xl: 32px;
  --header-h: 64px;
  --sidebar-w: 248px;
  --sidebar-w-collapsed: 56px;
  --control-h-sm: 32px;
  --control-h-md: 40px;
  --control-h-lg: 48px;
  --touch-target: 44px;
  --border-width: 1px;
  --border-width-strong: 2px;
  --focus-width: 2px;
  --focus-offset: 2px;
  --z-base: 0;
  --z-raised: 10;
  --z-sticky: 100;
  --z-dropdown: 1000;
  --z-overlay: 1100;
  --z-modal: 1200;
  --z-toast: 1300;
  --z-tooltip: 1400;
  --duration-instant: 0ms;
  --duration-fast: 120ms;
  --duration-base: 180ms;
  --duration-slow: 280ms;
  --duration-slower: 480ms;
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --ease-enter: cubic-bezier(0, 0, 0, 1);
  --ease-exit: cubic-bezier(0.3, 0, 1, 1);
  --icon-sm: 16px;
  --icon-md: 20px;
  --icon-lg: 24px;
  --icon-stroke: 1.5;
  --font-sans: "Onest", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --duration-fast: 0ms; --duration-base: 0ms; --duration-slow: 0ms; --duration-slower: 0ms;
  }
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}

/* Type styles */
.display { font-family: var(--font-sans); font-size: var(--fs-display); line-height: 0.98; font-weight: 620; letter-spacing: -0.04em; }
.h1 { font-family: var(--font-sans); font-size: var(--fs-h1); line-height: 1.04; font-weight: 600; letter-spacing: -0.032em; }
.h2 { font-family: var(--font-sans); font-size: var(--fs-h2); line-height: 1.08; font-weight: 600; letter-spacing: -0.026em; }
.h3 { font-family: var(--font-sans); font-size: var(--fs-h3); line-height: 1.2; font-weight: 600; letter-spacing: -0.016em; }
.h4 { font-family: var(--font-sans); font-size: var(--fs-h4); line-height: 1.3; font-weight: 600; letter-spacing: -0.008em; }
.lead { font-family: var(--font-sans); font-size: var(--fs-lead); line-height: 1.5; font-weight: 400; letter-spacing: -0.006em; }
.body { font-family: var(--font-sans); font-size: var(--fs-body); line-height: 1.6; font-weight: 400; letter-spacing: 0em; }
.body-sm { font-family: var(--font-sans); font-size: var(--fs-body-sm); line-height: 1.55; font-weight: 400; letter-spacing: 0em; }
.label { font-family: var(--font-sans); font-size: var(--fs-label); line-height: 1.43; font-weight: 520; letter-spacing: 0em; }
.caption { font-family: var(--font-sans); font-size: var(--fs-caption); line-height: 1.45; font-weight: 400; letter-spacing: 0em; }
.metric { font-family: var(--font-mono); font-size: var(--fs-metric); line-height: 1.0; font-weight: 500; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.mono-label { font-family: var(--font-mono); font-size: var(--fs-mono-label); line-height: 1.33; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; font-variant-numeric: tabular-nums; }
.mono-sm { font-family: var(--font-mono); font-size: var(--fs-mono-sm); line-height: 1.54; font-weight: 400; letter-spacing: 0em; font-variant-numeric: tabular-nums; }
.mono-md { font-family: var(--font-mono); font-size: var(--fs-mono-md); line-height: 1.6; font-weight: 400; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
