/* ============================================================
   PetalMesh — Design Tokens (single source of truth)
   Dark-mode-first. Every panel/screen in every phase references
   these variables; never hand-roll one-off colors or spacing.
   A light theme, if ever added, overrides these under
   [data-theme="light"] — component CSS never changes.

   "Signal" palette (UI/UX overhaul, phase: dev-prompt roadmap):
   warm graphite chrome, one amber accent reserved strictly for
   STATE (selection, active tool, live value) — never decoration.
   Token NAMES are stable across this repalette; only values
   changed, plus additive tokens, so nothing consuming var()
   elsewhere needed to change. See PROGRESS.md for the full slice
   list and the three cross-file sync points (renderer.rs clear
   color, gen-icon.mjs accent, app.css literals) that must track
   --color-bg-base / --color-accent if they ever move again.
   ============================================================ */

/* Bundled fonts (SIL OFL, licences in assets/fonts/). Relative URLs so the
   web server and the Tauri webview resolve them the same way. */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../assets/fonts/inter-latin-wght-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../assets/fonts/jetbrains-mono-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../assets/fonts/jetbrains-mono-latin-500-normal.woff2') format('woff2');
}

:root {
  /* Tells the browser to render native form controls, scrollbars, and
     other UA chrome dark by default instead of light-then-overridden —
     without this, e.g. a <select>'s dropdown list renders light even
     though every other pixel of the app is dark. */
  color-scheme: dark;

  /* ---- Color: surfaces (darkest → most raised) ----
     Warm graphite: a few degrees of hue lift as the ramp lightens
     (not dead-neutral grey) so raised surfaces read as machined
     rather than merely "lighter". */
  --color-bg-sunken: #0a0908;     /* recessed wells (scrub tracks, inset fields) */
  --color-bg-base: #100f0d;       /* viewport / app background (= wgpu clear color; see renderer.rs:401,482) */
  --color-bg-surface: #171613;    /* panels, sidebars */
  --color-bg-raised: #1f1d19;     /* cards, popovers, inputs */
  --color-bg-overlay: #27241f;    /* menus, tooltips */

  /* ---- Color: lines ---- */
  --color-border-subtle: #201e1a;
  --color-border: #2b2925;
  --color-border-strong: #3d3a33;

  /* ---- Color: text ---- */
  --color-text-primary: #ebe8e2;
  --color-text-secondary: #b3ada2;
  --color-text-muted: #948e83;   /* >= 4.5:1 on surface, raised and overlay (was #6b665c, 3.2:1) */

  /* ---- Color: accent & semantic ----
     SIGNAL. Reserved for state: selection, the active tool, a live
     scrubbed value, the marking-menu highlight. Never used to
     decorate a static element — if it's amber, something is live. */
  --color-accent: #f2a03d;
  --color-accent-hover: #ffb75c;
  --color-accent-muted: #4a3520;
  --color-accent-fg: #1a1006;     /* text/icon color ON a solid accent fill */
  --color-hover: rgb(255 255 255 / 0.05);
  --color-active: rgb(255 255 255 / 0.08);
  --color-selected-bg: rgb(242 160 61 / 0.14);
  --color-accent-wash: color-mix(in srgb, var(--color-accent) 6%, transparent);
  --color-scrim: rgba(6, 5, 4, 0.55);
  --color-success: #3ecf8e;
  --color-warning: #f5a623;
  --color-danger: #f0526a;

  /* ---- Color: curve editor (categorical channel palette + handles) ----
     Canvas 2D can't consume var() directly, so the curve editor reads
     these once via getComputedStyle into a JS constant — this file stays
     the single source of truth, not a hardcoded array in index.html.
     NOTE (flagged): that read happens once at module scope, so it cannot
     follow a runtime theme switch if one is ever added — pre-existing
     limitation, not introduced by this repalette. Names must not be
     renamed (see index.html:3748-3757 fallback arrays). */
  --curve-ch-0: #e05555;
  --curve-ch-1: #55b855;
  --curve-ch-2: #5588e0;
  --curve-ch-3: #e08a4d;
  --curve-ch-4: #b8b84d;
  --curve-ch-5: #9a55d0;
  --curve-ch-6: #d05590;
  --curve-ch-7: #55c0b0;
  --curve-ch-8: #8899aa;
  --curve-handle-line: #999999;
  --curve-handle-out: #e0c060;
  --curve-handle-in: #60c0e0;
  --curve-key-selected: #ffffff;

  /* ---- Color: node-graph category accents (read-only node graph) ---- */
  --color-node-adjust: #b070e0;
  --color-node-group: #e0a030;
  --color-node-output: #40c060;

  /* ---- Color: axis (navigation gizmo) — sRGB-encoded equivalents of the
     exact linear `AXIS_COLORS` in `gizmo.rs`, so the corner orientation
     widget matches the in-viewport move/rotate/scale gizmo's axis colors. ---- */
  --axis-x: #f68995;
  --axis-y: #a6ea99;
  --axis-z: #90c1fa;

  /* ---- Spacing scale (4px base) ---- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  /* ---- Radii ---- */
  --radius-xs: 2px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;

  /* ---- Typography ---- */
  --font-ui: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-display: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Cascadia Code', Consolas, monospace;
  --text-xs: 12px;     /* captions, hints, status bar only */
  --text-sm: 13px;     /* controls, labels (xs = captions only) */
  --text-base: 13px;   /* dense-UI default, DCC-appropriate */
  --text-md: 14px;
  --text-lg: 16px;
  --text-xl: 20px;
  --text-2xl: 24px;
  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --tracking-tight: -0.01em;
  --tracking-wide: 0.06em;
  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;

  /* ---- Elevation ----
     --edge-highlight: a 1px inner top highlight on raised surfaces —
     the single detail that reads as "instrument" rather than "flat dark
     theme". Pair with --shadow-raised on the same element. */
  --shadow-raised: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-overlay: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-popover: 0 8px 40px rgba(0, 0, 0, 0.6);
  --shadow-drag: 0 2px 8px rgba(0, 0, 0, 0.5);
  --shadow-ring: 0 0 0 2px var(--color-accent);
  /* Foundation (UI pass): control sizes and the keyboard focus ring. */
  --control-h: 28px;      /* standard control height (buttons, selects, scrub fields, tabs) */
  --control-h-sm: 24px;   /* minimum hit height for dense rows (chips, list rows, small buttons) */
  --focus-ring: 0 0 0 2px var(--color-bg-base), 0 0 0 4px var(--color-accent);
  --edge-highlight: inset 0 1px 0 rgb(255 255 255 / 0.04);

  /* ---- Motion ---- */
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-radial: cubic-bezier(0.34, 1.56, 0.64, 1);
  --motion-fast: 120ms;
  --motion-med: 200ms;
  --duration-fast: 120ms;
  --duration-normal: 200ms;
  --duration-slow: 320ms;

  /* ---- Stacking ---- */
  --z-dock-resizer: 5;
  --z-viewport-overlay: 10;
  --z-nav-gizmo: 15;
  --z-palette: 20;
  --z-radial: 30;
  --z-toast: 40;
  --z-drag-hint: 50;
}
