/* CRATE design tokens (second design pass, 2026-12-03).
 * Single source of truth for colour, type, spacing, radii and motion. Loaded first by index.html.
 * site/design/tokens.css is a byte-identical copy for design tools; site/research/test_design_tokens.mjs
 * checks the copy, the OKLCH-to-hex match and WCAG 2.x contrast in both themes.
 * Selectors are html:root… so these tokens out-rank the legacy :root blocks in style.css and clean.css.
 * Colour: hex first (fallback), then the same colours in OKLCH inside @supports. Custom properties never
 * fall back on their own, so the OKLCH values must stay inside @supports.
 * Dark is the default theme; [data-theme=light] switches. */

/* Shared (theme-independent) */
html:root,html:root[data-theme]{
 /* Fonts: brand faces only (all SIL OFL). Heebo is in every stack so Hebrew never falls to a random face. */
 --font-body:Heebo,Inter,Arial,sans-serif;
 --font-display:Inter,Heebo,Arial,sans-serif;
 --font-mono:'JetBrains Mono',Heebo,ui-monospace,Menlo,Consolas,monospace;

 /* Type scale (size / line height / Latin tracking). Hebrew is never tracked or uppercased. */
 --fs-display:clamp(2.5rem,1.6rem + 4vw,4.75rem);--lh-display:1;--track-display:-.025em;
 --fs-h1:clamp(2rem,1.5rem + 2.2vw,3.25rem);--lh-h1:1.05;--track-h1:-.02em;
 --fs-h2:clamp(1.5rem,1.3rem + 1vw,2rem);--lh-h2:1.15;--track-h2:-.01em;
 --fs-h3:1.25rem;--lh-h3:1.3;
 --fs-body-lg:1.0625rem;--fs-body:1rem;--lh-body:1.6;
 --fs-sm:.875rem;--lh-sm:1.5;
 --fs-xs:.75rem;--lh-xs:1.4;          /* 12px: the floor for Hebrew text */
 --fs-mono:.6875rem;--track-mono:.12em; /* 11px: Latin and numeric mono labels only */

 /* Spacing (4px base) and layout */
 --sp-1:4px;--sp-2:8px;--sp-3:12px;--sp-4:16px;--sp-5:24px;--sp-6:32px;--sp-7:40px;--sp-8:48px;--sp-9:64px;--sp-10:96px;
 --gutter:clamp(16px,4vw,32px);--section-gap:clamp(18px,3vw,32px);--content-max:1320px;--measure:65ch;
 --player-h:0px;

 /* Radii, derived from one base (legacy --radius is left to style.css/clean.css) */
 --radius-base:12px;
 --r-sm:calc(var(--radius-base) * .67);--r-md:var(--radius-base);--r-lg:calc(var(--radius-base) * 1.5);
 --r-xl:calc(var(--radius-base) * 1.84);--r-2xl:calc(var(--radius-base) * 2.67);--r-pill:999px;--r-cover:var(--r-md);

 /* Motion: entrances decelerate, exits accelerate */
 --dur-instant:80ms;--dur-fast:150ms;--dur-base:240ms;--dur-slow:400ms;--dur-slower:700ms;
 --ease-standard:cubic-bezier(.2,0,0,1);--ease-out:cubic-bezier(.2,.7,.2,1);--ease-in:cubic-bezier(.3,0,.8,.15);--ease-linear:linear;
 --stagger:40ms;

 /* Focus: one designed ring (outline keeps working in forced-colors mode) */
 --focus-width:2px;--focus-offset:2px;

 /* Accent band: CRATE's own ember → #FF4D2E → #FF8A3D (no pink stop). Text on it is always --on-accent. */
 --accent-0:#F2461C;--accent-1:#FF4D2E;--accent-2:#FF8A3D;--on-accent:#140805;--accent-strong:#B63613;
 --accent-angle:135deg;
 --accent-grad:linear-gradient(var(--accent-angle),var(--accent-0),var(--accent-1) 38%,var(--accent-2));
 --accent-bar:linear-gradient(90deg,var(--accent-1),var(--accent-2));
 --glass:rgba(255,255,255,.88);
}

/* Dark (default) */
html:root,html:root[data-theme=dark]{
 color-scheme:dark;
 --surface-0:#09090C;--surface-1:#111115;--surface-2:#19191E;--surface-3:#212127;
 --line:#2A2B31;--line-strong:#6E6E76;--muted:#A3A3AE;--text:#F5F1EC;--accent-text:#FC7145;
 --genre-amber:#F5B83D;--genre-teal:#2EC4B6;--genre-violet:#9B87FF;--genre-pink:#FF5C8A;--genre-blue:#4DA3FF;--genre-neutral:#9A9AA6;
 --hover:rgba(255,77,46,.06);
 --shadow-1:0 1px 0 rgba(255,255,255,.03) inset,0 1px 2px rgba(0,0,0,.4);
 --shadow-2:0 1px 0 rgba(255,255,255,.04) inset,0 8px 24px rgba(0,0,0,.45);
 --shadow-3:0 1px 0 rgba(255,255,255,.06) inset,0 18px 48px rgba(0,0,0,.6);
 --glow:0 10px 30px -12px rgba(255,77,46,.55);
}

/* Light */
html:root[data-theme=light]{
 color-scheme:light;
 --surface-0:#F8F5F1;--surface-1:#FFFFFF;--surface-2:#F1EEE9;--surface-3:#E9E6E0;
 --line:#E1DDD7;--line-strong:#848078;--muted:#5D5D64;--text:#16161A;--accent-text:#B63613;
 --genre-amber:#AD7300;--genre-teal:#009586;--genre-violet:#7B67CC;--genre-pink:#BE4D77;--genre-blue:#1F7DCF;--genre-neutral:#73747B;
 --hover:rgba(255,77,46,.07);
 --shadow-1:0 1px 2px rgba(40,30,20,.06);
 --shadow-2:0 1px 2px rgba(40,30,20,.05),0 8px 24px rgba(40,30,20,.08);
 --shadow-3:0 2px 4px rgba(40,30,20,.06),0 18px 48px rgba(40,30,20,.16);
 --glow:0 10px 30px -12px rgba(255,77,46,.45);
}

/* The same colours in OKLCH, where supported */
@supports (color:oklch(0 0 0)){
 html:root,html:root[data-theme]{
  --accent-0:oklch(0.64 0.215 34);--accent-1:oklch(0.67 0.219 32.3);--accent-2:oklch(0.75 0.167 50.5);--on-accent:oklch(0.152 0.023 38.6);--accent-strong:oklch(0.52 0.17 35);
  --accent-grad:linear-gradient(var(--accent-angle) in oklch,var(--accent-0),var(--accent-1) 38%,var(--accent-2));
  --accent-bar:linear-gradient(90deg in oklch,var(--accent-1),var(--accent-2));
 }
 html:root,html:root[data-theme=dark]{
  --surface-0:oklch(0.14 0.008 285);--surface-1:oklch(0.18 0.009 285);--surface-2:oklch(0.215 0.01 285);--surface-3:oklch(0.25 0.011 285);
  --line:oklch(0.29 0.012 285);--line-strong:oklch(0.54 0.012 285);--muted:oklch(0.72 0.015 285);--text:oklch(0.96 0.008 80);--accent-text:oklch(0.71 0.18 38);
  --genre-amber:oklch(0.819 0.15 80.8);--genre-teal:oklch(0.742 0.121 185.4);--genre-violet:oklch(0.695 0.171 288.8);--genre-pink:oklch(0.701 0.2 6.6);--genre-blue:oklch(0.705 0.159 252.4);--genre-neutral:oklch(0.69 0.017 285.9);
 }
 html:root[data-theme=light]{
  --surface-0:oklch(0.972 0.007 80);--surface-1:oklch(1 0 0);--surface-2:oklch(0.95 0.008 80);--surface-3:oklch(0.925 0.009 80);
  --line:oklch(0.9 0.01 80);--line-strong:oklch(0.6 0.012 80);--muted:oklch(0.48 0.012 290);--text:oklch(0.2 0.008 285);--accent-text:oklch(0.52 0.17 35);
  --genre-amber:oklch(0.6 0.13 75);--genre-teal:oklch(0.58 0.15 185);--genre-violet:oklch(0.58 0.15 290);--genre-pink:oklch(0.58 0.15 0);--genre-blue:oklch(0.58 0.15 250);--genre-neutral:oklch(0.56 0.012 285);
 }
}

/* Semantic aliases: the names the existing stylesheets and app.js already use */
html:root,html:root[data-theme]{
 --bg:var(--surface-0);--panel:var(--surface-1);--soft:var(--surface-2);--ink:var(--text);--lime:var(--accent-text);
 --focus-color:var(--accent-text);
 --glass-bar:rgba(17,17,21,.94);
}
html:root[data-theme=light]{--glass-bar:rgba(255,255,255,.95)}
@supports (backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px)){
 html:root,html:root[data-theme]{--glass-bar:color-mix(in oklch,var(--surface-2) 78%,transparent)}
 html:root[data-theme=light]{--glass-bar:color-mix(in oklch,var(--surface-1) 80%,transparent)}
}
