/* The canonical theme (S08a, DESIGN.md "Production tokens"). Every colour of every surface lives here and nowhere else.
 *
 * - :root holds the default value of every token; the defaults are the reference "neon" look.
 * - [data-theme="<id>"] blocks are the approved storefront palettes (init_content.go knows their ids and titles, never their colours).
 * - [data-surface="staff"] is the panel's scheme: restrained surfaces with the brand accents kept. It is not a palette.
 * - A token whose value uses var() is declared only in the composite rule at the end, whose selector covers every scope, so it is
 *   computed where each scope overrides the colours it is built from. Root tests (theme_test.go, theme_audit_test.go) pin all of it. */

:root {
  color-scheme: dark;

  --color-canvas: #101014;
  --color-surface: #1a171f;
  --color-surface-raised: #27212c;
  --color-surface-deep: #151018;
  --color-overlay: rgba(16, 16, 20, 0.78);
  --color-text: #f7f5f8;
  --color-text-muted: #c4bacb;
  --color-text-on-primary: #131607;
  --color-caption: #f7f5f8;
  --color-primary: #d6ff3f;
  --color-primary-hover: #e4ff84;
  --color-primary-soft: rgba(214, 255, 63, 0.14);
  --color-accent: #ff3cac;
  --color-accent-soft: #ff99d3;
  --color-accent-deep: #b82976;
  --color-border: #514357;
  --color-border-subtle: #362c3c;
  --color-border-selected: #d6ff3f;
  --color-border-locked: #514357;
  --color-focus: #e4ff84;
  --color-success: #9ee6bd;
  --color-success-soft: rgba(158, 230, 189, 0.14);
  --color-waiting: #ffe09a;
  --color-waiting-soft: rgba(255, 224, 154, 0.14);
  --color-error: #ff9cae;
  --color-error-soft: rgba(255, 156, 174, 0.14);
  --color-info: #b8c9ff;
  --color-disabled-bg: #352d3b;
  --color-disabled-text: #b9adbf;
  --color-locked: #b9adbf;
  --color-nav: #151018;
  --color-nav-text: #c4bacb;
  --color-nav-active: #f7f5f8;
  --color-nav-active-bg: rgba(214, 255, 63, 0.12);
  --color-icon: #f7f5f8;
  --color-icon-muted: #c4bacb;
  --color-transparent: transparent;
  --meta-theme-color: #101014;

  --gradient-wash: linear-gradient(135deg, #3d183e, #201722 60%, #1a171f);
  --gradient-hero: linear-gradient(160deg, #2a1230 0%, #18121c 45%, #101014 100%);
  --gradient-accent: linear-gradient(90deg, #d6ff3f, #ff3cac);
  --shadow-panel: 0 12px 40px rgba(0, 0, 0, 0.22);
  --shadow-focus: 0 0 0 3px rgba(214, 255, 63, 0.3);
  --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.28);
  --shadow-raised: 0 16px 48px rgba(0, 0, 0, 0.36);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --radius-card: 20px;
  --radius-control: 12px;
  --radius-pill: 999px;
  --touch-min: 44px;
  --cta-height: 54px;
  --font-display: "Arial Narrow", "Roboto Condensed", "Helvetica Neue", system-ui, sans-serif;
  /* The landing's poster face (after the concept): heavy, condensed, italic — Sofia Sans Extra Condensed (OFL, static/fonts), with
   * system faces as the fallback. */
  --font-poster: "Sofia Sans Extra Condensed", Impact, "Haettenschweiler", "Arial Narrow Bold", "Arial Narrow", "Roboto Condensed", "Helvetica Neue", sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --text-body: 16px;
  --text-small: 14px;
  --motion-duration: 200ms;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --layout-side-width: 220px;
  --layout-top-height: 52px;
  --z-toast: 10000;
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --motion-duration: 0ms;
  }
}

[data-theme="neon"] {
  --color-canvas: #101014;
  --color-surface: #1a171f;
  --color-surface-raised: #27212c;
  --color-surface-deep: #151018;
  --color-text: #f7f5f8;
  --color-text-muted: #c4bacb;
  --color-text-on-primary: #131607;
  --color-primary: #d6ff3f;
  --color-primary-hover: #e4ff84;
  --color-accent: #ff3cac;
  --color-accent-soft: #ff99d3;
  --color-accent-deep: #b82976;
  --color-border: #514357;
  --color-border-subtle: #362c3c;
  --color-focus: #e4ff84;
  --color-success: #9ee6bd;
  --color-waiting: #ffe09a;
  --color-error: #ff9cae;
  --color-info: #b8c9ff;
  --color-disabled-bg: #352d3b;
  --color-disabled-text: #b9adbf;
  --color-overlay: rgba(16, 16, 20, 0.78);
  --color-transparent: transparent;
  --meta-theme-color: #101014;
  --gradient-wash: linear-gradient(135deg, #3d183e, #201722 60%, #1a171f);
  --shadow-panel: 0 12px 40px rgba(0, 0, 0, 0.22);
  --shadow-focus: 0 0 0 3px rgba(214, 255, 63, 0.3);
}

[data-surface="staff"] {
  --color-canvas: #121216;
  --color-surface: #1b1b21;
  --color-surface-raised: #24242c;
  --color-surface-deep: #16161b;
  --color-text: #f2f2f5;
  --color-text-muted: #b4b4c0;
  --color-border: #3a3a46;
  --color-border-subtle: #2b2b34;
  --color-nav: #0d0d11;
  --color-nav-text: #b4b4c0;
  --color-nav-active: #f2f2f5;
  --color-nav-active-bg: rgba(214, 255, 63, 0.1);
  --gradient-wash: linear-gradient(135deg, #24242c, #1b1b21);
  --shadow-panel: 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* Composite tokens: built from other tokens, so they are declared for every scope that overrides those tokens. */
:root, [data-theme], [data-surface="staff"] {
  --focus-ring: 0 0 0 3px var(--color-focus);
  --gradient-thumbnail: linear-gradient(145deg, #5d245e, var(--color-accent-deep) 48%, #27212c);
  /* The cabinet's neon (S08c): glows and a background composed from the colour tokens, so a palette recolours them. */
  --glow-accent: 0 10px 40px -12px color-mix(in srgb, var(--color-accent) 35%, transparent);
  --glow-primary: 0 6px 22px -4px color-mix(in srgb, var(--color-primary) 55%, transparent);
  --gradient-neon:
    radial-gradient(520px 340px at 88% -6%, color-mix(in srgb, var(--color-accent) 38%, transparent), transparent 70%),
    radial-gradient(460px 300px at 30% 108%, color-mix(in srgb, var(--color-primary) 20%, transparent), transparent 70%),
    radial-gradient(380px 260px at 4% 30%, color-mix(in srgb, var(--color-accent-deep) 45%, transparent), transparent 70%),
    var(--gradient-hero);
  /* The landing hero (after the concept): the picture fades into the canvas under the copy, with a pink glow behind it. */
  --gradient-hero-fade:
    linear-gradient(90deg, var(--color-canvas) 0%, color-mix(in srgb, var(--color-canvas) 82%, transparent) 30%, transparent 62%),
    linear-gradient(0deg, var(--color-canvas) 0%, transparent 30%);
  --gradient-hero-fade-narrow: linear-gradient(0deg, var(--color-canvas) 2%, color-mix(in srgb, var(--color-canvas) 55%, transparent) 40%, transparent 75%);
  --glow-hero:
    radial-gradient(60% 70% at 75% 40%, color-mix(in srgb, var(--color-accent) 45%, transparent), transparent 70%),
    var(--gradient-hero);
  --gradient-style-caption: linear-gradient(0deg, color-mix(in srgb, var(--color-canvas) 88%, transparent) 0%, transparent 55%);
  --shadow-poster: 0 3px 0 color-mix(in srgb, var(--color-accent-deep) 80%, transparent);
}
