/**
 * Psychodeli+ Brand Tokens — the design substrate for the consumer control surface.
 *
 * WHY THIS FILE: today the brand lives as ~hundreds of hardcoded hex/rgba values
 * scattered across panels (shared-ui.css had exactly 1 CSS custom property). The
 * consumer Simple surface — and any muriel design against it — must bind to TOKENS,
 * not magic numbers, so the look is on-brand by construction, the 8:1 text floor is
 * enforceable in one place, and "melt-away" timing/translucency stay consistent.
 *
 * SOURCE OF TRUTH: docs/STYLE_GUIDE.md + the sampled palette in
 * muriel-personal/examples/psychodeli-brand.toml. In-app surface = BRAND CYAN, the
 * same hue family as the wordmark (--pd-hue: 188, index.html). It replaced the
 * neon-green phosphor on 2026-09-22, because the mark was cyan and the chrome was
 * green: the product contradicted its own logo on every screen it drew.
 *
 * ⚠️ THERE ARE TWO CYANS AND THE OLD RULE CONFLATED THEM. Psychodeli's cyan is
 * #00e1ff (hue 188) and it IS the in-app accent. MBP studio's cyan is #4ecdc4
 * (hue 176, desaturated teal); that one, and MBP's magenta/gold, stay out of
 * Psychodeli surfaces. The previous wording here and in the brand guide read as
 * "do not use cyan in Psychodeli", which banned the brand's own hue. It meant
 * "do not borrow MBP's cyan". Do not re-derive the broad version. The warm /mac
 * landing palette remains separate from both.
 *
 * NAMING: --pd-phosphor* keeps its name. A phosphor is a CRT emitter, not a colour
 * (P1 was green, P4 white, P11 blue); renaming ~150 call sites would buy nothing.
 *
 * CONTRAST: every --pd-text-* / --pd-accent* value is verified >= 8:1 on the dark
 * panel ground (Andy's hard floor: "MINIMUM 8:1 CONTRAST RATIO ON ALL TEXT").
 * Ratios noted inline are vs #050510. Fractal/visualizer hues are NOT tokens here
 * (they're engine output and exempt from the text floor).
 */
:root {
  /* ── Ground (near-black; the panel sits over the live visuals) ── */
  --pd-bg:            #050510;            /* primary ground */
  --pd-bg-2:          #0a0a0f;            /* app chrome */
  --pd-bg-3:          #000000;            /* pure black */
  --pd-panel:         rgba(10, 10, 10, 0.85);  /* primary translucent panel */
  --pd-overlay:       rgba(0, 0, 0, 0.40);     /* lighter scrim */

  /* ── Live palette accents (channel tokens) ──
     PaletteAccents (js/lib/palette-accents.js) overwrites these on :root every
     ~600ms with colors sampled from the canvas palette, so all panels track the
     visuals. The values here are the STATIC fallback (legacy green + a cyan
     secondary) used before first sample or when __panelPaletteHue === false. */
  /* ⚠️ FILL/CHROMA CHANNEL — NOT FOR TEXT. Set per-album at runtime from extracted art
     colours (js/lib/palette-accents.js → a.primary), so it carries NO contrast guarantee:
     on Elephant it resolved to a purple measuring 3.21:1 on the now-playing pill, making
     the largest text in that panel the least legible (fixed 2026-08-18).
     Borders, glows, shadows, backgrounds → this. Anything a person READS → --pd-accent-text
     (same hue lifted to rel-lum >= 0.45 = >= 9.5:1 on near-black). Pinned by
     tests/unit/accent-text-contrast.test.js. */
  /* Primary → active is a LIGHTNESS STEP inside one hue family, which is the rule
     WORDMARK_TREATMENT.md already sets for the mark ("one rendering uses one hue
     family"). The two values are the wordmark's own r5 mid-band and r1 core-band, so
     the chrome and the logo step the same way. Hover stays amber: it is the one place
     a second hue earns its keep, because hover and selected must not be told apart by
     brightness alone. */
  --pd-accent-rgb:    0, 225, 255;        /* primary channels — brand cyan, hue 188   12.8:1 */
  --pd-accent-text:   #aaf3ff;            /* primary lightened for text   relLum .80  16.4:1 */
  --pd-accent2-rgb:   165, 241, 253;      /* secondary (active / selected) — wordmark r1 16.0:1 */
  --pd-accent2-text:  #ddfaff;            /* secondary lightened for text relLum .91  18.5:1 */
  --pd-accent3-rgb:   255, 170, 64;       /* tertiary channels (hover — distinct from both) */
  --pd-accent3-text:  #ffd9a8;            /* tertiary lightened for >=8:1 text        15.2:1 */
  --pd-accent-fill:   #00e1ff;            /* filled-control bg (vivid or lifted for 8:1 label) */
  --pd-accent-on:     #001418;            /* label color that clears 8:1 on --pd-accent-fill (11.9:1) */

  /* ── Primary accent (derived from --pd-accent-rgb so it tracks the palette) ── */
  --pd-phosphor:      rgb(var(--pd-accent-rgb));         /* primary accent */
  --pd-phosphor-soft: var(--pd-accent-text);             /* keycaps / labels */
  --pd-phosphor-dim:  #cfe6ec;            /* connective text    ~15.6:1 */
  --pd-active:        #0fb8c9;            /* cyan "on" state — FILL-ONLY, never a glyph colour
                                             (8.4:1 on the ground, but it backs switches, and a
                                             label sitting ON it would not clear the floor) */

  /* ── Secondary accent (derived from --pd-accent2-rgb) — for hover / active /
     selected affordances, giving the chrome a two-tone language. ── */
  --pd-accent2:        rgb(var(--pd-accent2-rgb));
  --pd-accent2-border: rgba(var(--pd-accent2-rgb), 0.45);
  --pd-accent2-glow:   rgba(var(--pd-accent2-rgb), 0.55);
  --pd-accent3:        rgb(var(--pd-accent3-rgb));
  --pd-accent3-border: rgba(var(--pd-accent3-rgb), 0.45);
  --pd-accent3-glow:   rgba(var(--pd-accent3-rgb), 0.55);

  /* ── Text (all >= 8:1 on --pd-bg) ── */
  --pd-text:          #f0f0f0;            /* body text          ~17:1 */
  --pd-text-muted:    #c8c8d0;            /* secondary text     ~12:1 */
  --pd-text-strong:   rgba(255, 255, 255, 0.95);

  /* ── Translucent UI fills (glassy, non-competitive with the visuals) ── */
  --pd-fill:          rgba(255, 255, 255, 0.12);  /* default control fill */
  --pd-fill-hover:    rgba(255, 255, 255, 0.18);  /* hover */
  --pd-border:        rgba(var(--pd-accent-rgb), 0.40);  /* primary mid-ring border */
  --pd-glow:          rgba(var(--pd-accent-rgb), 0.60);  /* glow / focus ring */

  /* ── Toast accent (PALETTE ITERATION): a bright hue swapped in for the
     legacy neon-green on transient toasts / the parameter indicator. Change
     these three to retune the toast color in one place. Electric cyan starts:
     15.7:1 on #000 (vs green's 14.8:1) — clears the 8:1 text floor. ── */
  --pd-toast-accent:  #00ffff;                     /* toast text + ring */
  --pd-toast-glow:    rgba(0, 255, 255, 0.30);     /* box-shadow halo */
  --pd-toast-shadow:  rgba(0, 255, 255, 0.50);     /* text-shadow halo */
  /* ⚠️ OPAQUE ON PURPOSE — this is the surface the toast's 8:1 floor is measured
     against, so it must not let the fractal through. It was rgba(0,0,0,0.5) until
     2026-09-13, which meant the real backdrop was half whatever was on screen:
     the accent lift in command-registry.js cleared 8:1 against pure black while the
     painted result fell to 2.9:1 over a bright passage — and bright passages are
     exactly when toasts fire. A translucent scrim cannot hold a contrast floor.
     js/command-registry.js `_refreshToastAccentFromPalette` READS this value and
     lifts the sampled accent against it, so retuning the plate here automatically
     retunes the guard. Keep it opaque; keep it dark. */
  --pd-toast-plate:   #0a0a0f;                     /* toast/indicator ground */

  /* ── Touch & rhythm (mobile-first: 44px floor, 22–45% larger on mobile) ── */
  --pd-touch-min:     44px;              /* WCAG/Apple touch-target floor */
  --pd-radius:        14px;
  --pd-blur:          12px;              /* backdrop-filter blur for glass panels */
  /* Single knob for consumer-UI overlay translucency (pie wedges + element chips). Lower = more of
     the live visual shows through. 1.0 = the old fully-opaque surfaces; the /mac page sits at ~0.4
     (its panels are over a controlled bg). 0.6 here keeps readable text near the 8:1 floor over the
     animated viz while letting the visual breathe. Dial toward 0.4 if contrast holds on your content. */
  --pd-surface-alpha: 0.6;

  /* ── "Melt away": the canonical minimally-distract behavior, as shared timing ── */
  --pd-idle-fade-delay: 2400ms;         /* time of inactivity before controls fade */
  --pd-fade-dur:        420ms;           /* fade in/out duration */
  --pd-fade-ease:       cubic-bezier(0.22, 1, 0.36, 1);
  --pd-melt-opacity:    0;               /* fully gone when idle (it's an ambient app) */

  /* ── Z-index lanes (replaces the ad-hoc 9999/1000/900 sprawl for the new surface) ── */
  --pd-z-surface:     1000;             /* the consumer control surface */
  --pd-z-modal:       1100;             /* a focused modal within it */
  --pd-z-toast:       1200;             /* transient toasts */
}

/* Mobile upsizing — the style guide's 22–45% larger touch UI, expressed once. */
@media (max-width: 768px) {
  :root {
    --pd-touch-min: 56px;
    --pd-radius:    18px;
  }
}
