/*
 * Studio Stereo Frequency Shifter — design tokens (overrides the neutral defaults in kit.css).
 *
 * Concept: a Bode-type single-sideband frequency shifter as a piece of electronic-music laboratory
 * equipment. The module itself is dark anodised aluminium with engraved white legends (as the
 * specification asks); it stands on a pale lab bench next to a cream test-signal generator.
 * A calibrated shift dial and a phosphor CRT carry the signal colours:
 *
 *   turquoise   partials moving UP in frequency (upper sideband for a positive shift)
 *   purple      partials moving DOWN in frequency
 *   amber       the input / reference trace
 *   phosphor    CRT graticule and the measured output spectrum
 *
 * Two theme zones share one token vocabulary: :root is the light bench (page, signal source, footer),
 * .device re-binds every semantic and component token to the dark faceplate. Component tokens are
 * declared on both selectors so their var() references resolve inside each zone.
 *
 * Type: system fonts only — a condensed grotesque for engraved legends, monospace for read-outs.
 *
 * Contrast (WCAG, computed from the OKLCH values below):
 *   bench   ink 0.23 on floor 0.86 = 11.0:1 · on plate 0.935 = 14.0:1 · muted 0.40 on floor = 6.0:1,
 *           on plate = 7.6:1 · danger 0.47 on floor = 4.9:1 · on-accent on accent 0.46 = 6.4:1 ·
 *           input border 0.52 on plate = 4.6:1
 *   device  legend 0.95 on panel 0.235 = 14.4:1 · on section 0.275 = 12.8:1 · muted 0.80 on section
 *           = 7.9:1 · on CRT glass = 10.3:1 · CRT labels 0.80 on glass = 10.6:1 · turquoise on glass
 *           = 11.6:1 · purple on glass = 7.8:1 · amber on glass = 11.2:1 · purple on section = 6.1:1 ·
 *           control borders 0.58 on section = 3.5:1 · clip red 0.70 on section = 5.0:1 ·
 *           faint 0.60 on section = 3.8:1 (tick marks and decoration only, never body text)
 */

@layer tokens {
  :root {
    color-scheme: light;

    /* — primitives: lab bench (light zone) — */
    --bench-floor: oklch(0.86 0.010 95);
    --bench-plate: oklch(0.935 0.008 95);
    --bench-well: oklch(0.985 0.004 95);
    --bench-line: oklch(0.75 0.012 95);
    --bench-line-strong: oklch(0.52 0.014 95);
    --bench-ink: oklch(0.23 0.012 255);
    --bench-ink-muted: oklch(0.40 0.014 255);
    --bench-ink-faint: oklch(0.62 0.012 95);
    --bench-accent: oklch(0.46 0.095 210);
    --bench-on-accent: oklch(0.985 0.004 95);
    --bench-danger: oklch(0.47 0.18 27);
    --bench-shadow: oklch(0.35 0.02 95 / 0.28);
    --bench-sheen: oklch(1 0 0 / 0.6);

    /* — primitives: anodised aluminium faceplate (dark zone) — */
    --alu-950: oklch(0.19 0.012 255);
    --alu-900: oklch(0.235 0.013 255);
    --alu-850: oklch(0.275 0.013 255);
    --alu-800: oklch(0.32 0.012 255);
    --alu-600: oklch(0.58 0.012 255);
    --alu-brush: oklch(0.255 0.013 255);
    --alu-sheen: oklch(0.34 0.012 255);
    --alu-shade: oklch(0.2 0.012 255);
    --alu-knob: oklch(0.36 0.010 255);
    --alu-knob-hi: oklch(0.62 0.008 255);
    --alu-knob-lo: oklch(0.24 0.010 255);
    --engrave: oklch(0.95 0.006 250);
    --engrave-dim: oklch(0.80 0.012 250);
    --engrave-faint: oklch(0.60 0.012 250);
    --ink-dark: oklch(0.18 0.02 250);
    --shadow-deep: oklch(0.08 0.01 255 / 0.55);
    --shadow-soft: oklch(0.08 0.01 255 / 0.35);
    --highlight: oklch(1 0 0 / 0.07);

    /* — primitives: signal colours (CRT phosphor, sideband lamps) — */
    --crt-glass: oklch(0.165 0.022 165);
    --crt-glass-edge: oklch(0.12 0.018 165);
    --crt-grid: oklch(0.42 0.055 160);
    --crt-grid-faint: oklch(0.29 0.04 160);
    --crt-label: oklch(0.80 0.07 160);
    --crt-trace: oklch(0.90 0.06 160);
    --sideband-up: oklch(0.82 0.125 192);
    --sideband-down: oklch(0.74 0.16 305);
    --trace-input: oklch(0.83 0.14 78);
    --lamp-off: oklch(0.34 0.012 255);
    --level-ok: oklch(0.80 0.17 150);
    --level-warn: oklch(0.87 0.16 95);
    --level-clip: oklch(0.70 0.20 27);

    /* — semantic: light bench zone — */
    --color-chassis: var(--bench-floor);
    --color-panel: var(--bench-plate);
    --color-panel-raised: var(--bench-plate);
    --color-inset: var(--bench-well);
    --color-bench: var(--bench-plate);
    --color-border: var(--bench-line);
    --color-border-strong: var(--bench-line-strong);
    --color-text: var(--bench-ink);
    --color-text-muted: var(--bench-ink-muted);
    --color-text-faint: var(--bench-ink-faint);
    --color-accent: var(--bench-accent);
    --color-accent-2: var(--sideband-down);
    --color-on-accent: var(--bench-on-accent);
    --color-focus: var(--bench-accent);
    --color-danger: var(--bench-danger);
    --color-meter-ok: var(--level-ok);
    --color-meter-warn: var(--level-warn);
    --color-meter-clip: var(--level-clip);

    --shadow-panel: 0 1px 0 var(--bench-sheen) inset, 0 10px 24px var(--bench-shadow);
    --shadow-inset: 0 1px 3px var(--bench-shadow) inset;

    --font-ui: "Avenir Next", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-display: "DIN Alternate", "DIN Condensed", "Bahnschrift", "Avenir Next Condensed", "Roboto Condensed", "Arial Narrow", sans-serif;

    --radius-sm: 0.1875rem;
    --radius-md: 0.3125rem;
    --radius-lg: 0.5rem;

    /* — component: faceplate details (dark zone colours, used only inside .device) — */
    --crt-size-min: 15rem;
    --dial-size: min(100%, 16.5rem);
  }

  /* The faceplate: re-bind every semantic token to anodised aluminium. */
  .device {
    color-scheme: dark;
    --color-chassis: var(--alu-950);
    --color-panel: var(--alu-900);
    --color-panel-raised: var(--alu-850);
    --color-inset: var(--crt-glass);
    --color-bench: var(--alu-900);
    --color-border: var(--alu-800);
    --color-border-strong: var(--alu-600);
    --color-text: var(--engrave);
    --color-text-muted: var(--engrave-dim);
    --color-text-faint: var(--engrave-faint);
    --color-accent: var(--sideband-up);
    --color-accent-2: var(--sideband-down);
    --color-on-accent: var(--ink-dark);
    --color-focus: var(--engrave);
    --color-danger: var(--level-clip);
    --color-meter-ok: var(--level-ok);
    --color-meter-warn: var(--level-warn);
    --color-meter-clip: var(--level-clip);

    --shadow-panel: 0 1px 0 var(--highlight) inset, 0 22px 44px var(--shadow-deep);
    --shadow-inset: 0 2px 6px var(--shadow-deep) inset;
  }

  /* Component tokens reference semantic tokens, so they are declared in both zones. */
  :root,
  .device {
    --knob-track: var(--color-inset);
    --knob-arc: var(--color-text-muted);
    --knob-cap: var(--alu-knob);
    --knob-cap-edge: var(--alu-knob-hi);
    --knob-pointer: var(--color-text);
    --button-bg: var(--color-panel-raised);
    --button-bg-hover: var(--color-border);
    --button-fg: var(--color-text);
    --button-border: var(--color-border-strong);
    --button-bg-on: var(--color-text);
    --button-fg-on: var(--color-panel);

    --lamp-up: var(--sideband-up);
    --lamp-down: var(--sideband-down);
    --panel-sheen: var(--alu-sheen);
    --panel-shade: var(--alu-shade);
    --panel-brush: var(--alu-brush);
  }

  /* The bench keeps its accent for the "on" state of its buttons (transport, segments). */
  :root {
    --button-bg-on: var(--color-accent);
    --button-fg-on: var(--color-on-accent);
  }
}
