/* ==========================================================================
   HUD Studio: chrome design tokens (checkpoint 1, revision 3)
   The studio's own interface. Dialects style the canvas only; the chrome
   has its own fixed accent and never changes with the dialect.

   Set data-mode="light" (default) or "dark" on <html>.
   ========================================================================== */

:root {
  /* ---- Type ------------------------------------------------------------ */
  --font-sans: "Archivo", "Helvetica Neue", Arial, sans-serif;            /* variable: wdth 62–125 */
  --font-mono: "Martian Mono", ui-monospace, "Cascadia Mono", monospace;   /* variable: wdth 75–112.5 */

  --type-legend: 600 10px/12px var(--font-sans);   /* uppercase, wdth 118, +0.14em */
  --type-legend-track: 0.14em;
  --type-label: 450 12px/16px var(--font-sans);    /* control labels, sentence case */
  --type-body: 400 13px/18px var(--font-sans);
  --type-field: 450 15px/20px var(--font-sans);    /* simple-view inputs: larger */
  --type-title: 600 15px/20px var(--font-sans);    /* deck section titles */
  --type-num: 400 11px/14px var(--font-mono);      /* every value, wdth 87.5 */
  --type-num-lg: 300 22px/26px var(--font-mono);   /* timecode, wdth 75 */

  /* ---- Spacing: 4px grid ---------------------------------------------- */
  --s-1: 2px;
  --s-2: 4px;
  --s-3: 8px;
  --s-4: 12px;
  --s-5: 16px;
  --s-6: 24px;
  --s-7: 32px;
  --s-8: 48px;
  --s-9: 64px;

  /* Fixed chrome dimensions */
  --bar-h: 52px;        /* top bar */
  --play-h: 60px;       /* play bar */
  --deck-h: 360px;      /* simple-view control deck */
  --row-h: 36px;        /* one control row (advanced) */
  --ctl-h: 30px;        /* compact control (advanced) */
  --ctl-h-lg: 40px;     /* large control (simple view) */
  --lib-w: 304px;       /* advanced: module library */
  --insp-w: 368px;      /* advanced: settings */

  /* ---- Radius ---------------------------------------------------------- */
  --r-0: 0;
  --r-1: 2px;   /* compact inputs, segments, chips */
  --r-2: 4px;   /* large inputs, buttons, cards, thumbnails */
  --r-3: 8px;   /* the monitor frame and the drop zone */
  --r-round: 999px;

  /* ---- Line ------------------------------------------------------------ */
  --hair: 1px;
  --focus-w: 2px;

  /* ---- Motion: quick, precise, never bouncy ---------------------------- */
  --dur-flip: 60ms;
  --dur-quick: 120ms;
  --dur-swap: 180ms;    /* dialect swap on the canvas, view toggle */
  --dur-panel: 220ms;   /* ceiling for any chrome motion */
  --ease-precise: cubic-bezier(0.2, 0, 0, 1);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);   /* entrances, press release */
  --ease-exit: cubic-bezier(0.4, 0, 1, 1);
  --ease-detent: steps(1, end);
}

/* ---- Modes: one system, two modes --------------------------------------
   dark  = graphite + vermilion
   light = cool instrument gray + signal orange   (default)
   The accent never comes from the dialect.                                   */

:root, [data-mode="dark"] {
  color-scheme: dark;
  --bg-app: #141518;      /* seams between panels */
  --bg-panel: #1a1b1f;    /* deck and panel faces */
  --bg-raised: #222429;   /* inputs, segments */
  --bg-active: #2c2e34;   /* active segment, pressed */
  --bg-well: #0e0f11;     /* the monitor recess */
  --line: #2a2c31;
  --line-strong: #3c3f46;
  --text-hi: #ecebe7;
  --text-mid: #a4a5a2;
  --text-lo: #939593;   /* 4.5:1 or better on every dark surface */
  --text-faint: #47494b;
  --warn: #ffb020;        /* errors use amber so they never read as the accent */
  --accent: #ff5b1a;      /* signal orange, the same in both modes */
  --lamp: #6fe3a1;        /* phosphor green: live lamps only */
  --accent-ink: #120a08;  /* text on accent fills */
  --acc-l-min: 0.68;      /* accent text is kept at least this light */
  --acc-l-max: 1;
}

[data-mode="light"] {
  color-scheme: light;
  --bg-app: #c8ccd1;
  --bg-panel: #e1e4e7;
  --bg-raised: #eef0f2;
  --bg-active: #d3d7db;
  --bg-well: #2b2e33;     /* monitor recess stays dark so the canvas reads true */
  --line: #c9cdd2;
  --line-strong: #a3a9b0;
  --text-hi: #1b1e22;
  --text-mid: #3a4047;
  --text-lo: #50565f;   /* 4.5:1 or better on every light surface */
  --text-faint: #a2a8b0;
  --warn: #9a5b00;
  --accent: #ff5b1a;      /* signal orange */
  --lamp: #1f9a5b;
  --accent-ink: #16171a;
  --acc-l-min: 0;
  --acc-l-max: 0.47;    /* accent text reads at 4.5:1 on light fills */
}

/* Derived. Full-strength --accent is kept for the one primary action
   (Export). Everything active or selected uses --accent-soft: the same hue,
   less saturated, so a selection or a pressed segment never shouts. */
:root, [data-mode="dark"] {
  --accent-soft: oklch(from var(--accent) 0.72 calc(c * 0.52) h);
}
[data-mode="light"] {
  --accent-soft: oklch(from var(--accent) 0.58 calc(c * 0.62) h);
}
:root, [data-mode] {
  --accent-text: oklch(from var(--accent-soft) clamp(var(--acc-l-min), l, var(--acc-l-max)) c h);
  --accent-wash: oklch(from var(--accent-soft) l c h / 0.13);
  --accent-line: oklch(from var(--accent-soft) l c h / 0.55);
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-quick: 0ms;
    --dur-swap: 0ms;
    --dur-panel: 0ms;
  }
}
