/*
  Design tokens — JD-08 Editor (house preset "Sardonic Repulsion", dark only).

  Three layers. Components use semantic and component tokens only; raw colours
  appear in the primitives block and nowhere else.

  Semantic tokens
    --color-bg              page background
    --color-surface         sections, dialogs
    --color-raised          controls resting on a surface (buttons, inputs, fader slots)
    --color-border          1px separators; elevation is done with borders, not shadows
    --color-border-strong   control outlines (≥ 3:1 against surface)
    --color-text            body text
    --color-text-muted      labels, help (7:1 on bg)
    --color-accent          teal: active state and the primary action, nothing else
    --color-accent-dim      background of selected items
    --color-on-accent       text on teal
    --color-danger          destructive action, errors
    --tone-a … --tone-d     identity tint of tones A–D (always paired with the letter)
    --tone                  tint of the tone being edited; set by the panel

  State matrix of interactive components (button, segmented option, input, fader,
  choice, toggle, list row): default · :hover (pointer devices only) · :focus-visible
  (2px accent ring, offset 2px) · :active · disabled / aria-disabled (muted, no pointer)
  · selected / pressed (accent) · unknown value (hollow, dashed) · error (danger).
*/

@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('../fonts/dm-sans.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: 'DM Sans';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('../fonts/dm-sans-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, 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: 'DM Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/dm-mono-400.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: 'DM Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/dm-mono-400-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, 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: 'DM Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/dm-mono-500.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: 'DM Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/dm-mono-500-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, 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.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: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/instrument-serif-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: dark;

  /* — layer 1: primitives — */
  --gray-950: #0a0a0c;
  --gray-900: oklch(0.165 0.006 275);
  --gray-850: oklch(0.205 0.007 275);
  --gray-800: oklch(0.25 0.008 275);
  --gray-700: oklch(0.33 0.009 275);
  --gray-550: oklch(0.5 0.01 275);
  --gray-400: #9a9aa3;
  --gray-100: #e7e7ea;
  --teal-400: #2dd4bf;
  --red-400: oklch(0.72 0.17 25);
  --amber-300: oklch(0.84 0.13 85);
  --coral-300: oklch(0.79 0.12 30);
  --violet-300: oklch(0.78 0.11 305);
  --sky-300: oklch(0.82 0.09 235);

  /* — layer 2: semantic — */
  --color-bg: var(--gray-950);
  --color-surface: var(--gray-900);
  --color-raised: var(--gray-850);
  --color-raised-hover: var(--gray-800);
  --color-border: var(--gray-800);
  --color-border-strong: var(--gray-550);
  --color-text: var(--gray-100);
  --color-text-muted: var(--gray-400);
  --color-accent: var(--teal-400);
  --color-accent-dim: color-mix(in oklch, var(--teal-400) 18%, var(--gray-900));
  --color-on-accent: var(--gray-950);
  --color-danger: var(--red-400);
  --color-danger-dim: color-mix(in oklch, var(--red-400) 16%, var(--gray-900));
  --tone-a: var(--amber-300);
  --tone-b: var(--coral-300);
  --tone-c: var(--violet-300);
  --tone-d: var(--sky-300);
  --tone: var(--color-text);

  --font-display: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
  --font-ui: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'DM Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --text-micro: 0.6875rem;
  --text-sm: 0.8125rem;
  --text-base: 1rem;
  --text-lg: clamp(1.15rem, 1.05rem + 0.4vw, 1.35rem);
  --text-display: clamp(1.5rem, 1.3rem + 0.8vw, 1.9rem);
  --leading: 1.5;
  --tracking-micro: 0.08em;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;

  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-full: 999px;

  --dur-fast: 120ms;
  --ease: cubic-bezier(0.2, 0, 0, 1);

  /* — layer 3: component — */
  --focus-ring: 2px solid var(--color-accent);
  --control-h: 2rem; /* buttons and inputs: 32px, above the 24px target minimum */
  --control-h-small: 1.625rem;
  --ctl-w: 3.25rem; /* one control column of the panel */
  --ctl-gap: var(--space-1);
  --fader-h: 8.25rem;
  --fader-thumb-h: 0.875rem;
  --fader-slot: var(--color-raised);
  --fader-cap: var(--gray-100);
  --key-white: var(--gray-100);
  --key-black: var(--gray-900);
  --button-bg: var(--color-raised);
  --button-fg: var(--color-text);
  --button-primary-bg: var(--color-accent);
  --button-primary-fg: var(--color-on-accent);
  --chrome-h: 9rem; /* height of the sticky bars; measured at runtime */
}
