/* ─────────────────────────────────────────────────────────────────────
   MusicMind Design System — v1
   ─────────────────────────────────────────────────────────────────────
   Single source of truth for type, colour, spacing, motion. Every other
   stylesheet in the app should reference these tokens via var(--…).
   Avoid raw hex/px/ms values outside this file unless you're defining
   a new token here first.

   Brand philosophy (Vitreous Orbit, extended):
     - Rothko-quiet dark base, warm-gold single brand accent
     - One luminous thread through the void — not a rainbow
     - Editorial serif for voice, geometric sans for system
     - Motion is restraint: nothing pulses, nothing bounces
     - Nine tribes are siblings of one another, never of the brand gold

   Maintained by: Neil + Claude
   Locked: 2026-05-31 (type + colour philosophy + tribe palette)
   ───────────────────────────────────────────────────────────────────── */

/* ── Fonts ─────────────────────────────────────────────────────────── */
/* Display: Fraunces (variable, with soft + opsz axes for warmth)
   Body / UI: Space Grotesk (geometric, retained from existing landing) */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght,SOFT@9..144,400..900,0..100&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
  /* ── Type families ──────────────────────────────────────────────── */
  --font-display: 'Fraunces', 'Georgia', serif;
  --font-body: 'Space Grotesk', 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Monaco', monospace;

  /* ── Type scale (3-step + utility) ─────────────────────────────────
     48 / 24 / 16 / 13 is the canonical scale. Anything off-scale needs
     a justification. Headlines use --font-display, everything else uses
     --font-body. */
  --text-display: 48px;        /* hero headlines, big section titles */
  --text-display-sm: 32px;     /* mobile hero, secondary display */
  --text-section: 24px;        /* section headings */
  --text-body: 16px;           /* paragraph, button, input */
  --text-caption: 13px;        /* meta, footer, secondary labels */
  --text-micro: 11px;          /* timestamps, badge counts */

  /* ── Type weights ──────────────────────────────────────────────────
     Killed the 800-letter-spacing-2px shout. Max display weight is 600
     (Fraunces) or 700 (Space Grotesk). Restraint. */
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  /* ── Line heights ──────────────────────────────────────────────────
     Tight for display, generous for body. Caption is single-line. */
  --leading-display: 1.05;
  --leading-tight: 1.2;
  --leading-body: 1.55;
  --leading-caption: 1.4;

  /* ── Letter spacing ──────────────────────────────────────────────── */
  --tracking-tight: -0.02em;   /* large display */
  --tracking-normal: 0;
  --tracking-wide: 0.04em;     /* small caps, micro labels */

  /* ── Surface colours (the spine — keep religiously) ────────────────
     Three vertical levels: bg (void), surface (panels), elevated (modals).
     Borders are deliberately near-invisible — surface contrast does the
     work, lines are accents only. */
  --bg: #0a0a0f;                  /* void — pure base */
  --surface: #12121a;             /* cards, panels, nav */
  --surface-elevated: #1a1a26;    /* modals, popovers, drawers */
  --border: #2a2a3a;              /* subtle dividers, input rests */
  --border-strong: #3a3a4e;       /* focused inputs, emphasized cards */

  /* ── Text colours (lifted from the squad a11y review — all 4.5:1+) ─ */
  --text: #f0f0f5;                /* body, primary headings */
  --text-muted: #b8b8c8;          /* secondary body, captions */
  --text-dim: #9a9ab0;            /* placeholders, footer, edge labels */

  /* ── Brand accent (the single warm-gold thread — RESERVED) ─────────
     Gold is the brand mark. Never use it as a tribe colour. Use it for:
     - Logo + wordmark
     - Primary CTAs (when there's one and only one)
     - The luminous "thread" through path renders
     - Selected/active state on system controls
     Never use it for: tribe identity, success states, body emphasis. */
  --accent: #d4a574;              /* warm gold — the brand */
  --accent-strong: #e8b988;       /* hover / pressed gold */
  --accent-dim: rgba(212, 165, 116, 0.15);  /* gold wash for tints */

  /* ── Semantic / system colours ─────────────────────────────────────
     Not tribe colours. These are functional roles. */
  --success: #6cc24a;             /* confirmations, "added" */
  --warning: #fbbf24;             /* caution, quota approaching */
  --error: #ec5e74;               /* failures, validation errors */
  --info: #7a94c9;                /* informational, hints */

  /* ── Tribe palette (the 9-hue ring — derived, not picked) ──────────
     All at HSL ~65% luminance, ~45% chroma. Sit harmoniously together.
     Every hue >25° from gold (31°), every neighbour >30° apart.
     Tribe colour is for: chip border + low-alpha background + path-rail
     tint when a hop belongs to that tribe. Nothing else. */
  --tribe-emo-accent:    hsl(350, 45%, 65%);  /* dusty rose */
  --tribe-metal-accent:  hsl(  5, 45%, 65%);  /* blood-rust red */
  --tribe-hiphop-accent: hsl( 80, 45%, 65%);  /* warm chartreuse */
  --tribe-jazz-accent:   hsl(130, 45%, 65%);  /* green */
  --tribe-world-accent:  hsl(175, 45%, 65%);  /* pale teal */
  --tribe-techno-accent: hsl(220, 45%, 65%);  /* industrial blue */
  --tribe-soul-accent:   hsl(260, 45%, 65%);  /* plum-purple */
  --tribe-indie-accent:  hsl(295, 45%, 65%);  /* magenta-violet */
  --tribe-pop-accent:    hsl(330, 45%, 65%);  /* hyperpop pink */

  /* Low-alpha background tints for chips. color-mix is modern but well-
     supported (Chrome 111+, Safari 16.4+, Firefox 113+). The fallback
     for older browsers is a faint gold wash. */
  --tribe-emo-tint:    color-mix(in srgb, var(--tribe-emo-accent)    10%, transparent);
  --tribe-metal-tint:  color-mix(in srgb, var(--tribe-metal-accent)  10%, transparent);
  --tribe-hiphop-tint: color-mix(in srgb, var(--tribe-hiphop-accent) 10%, transparent);
  --tribe-jazz-tint:   color-mix(in srgb, var(--tribe-jazz-accent)   10%, transparent);
  --tribe-world-tint:  color-mix(in srgb, var(--tribe-world-accent)  10%, transparent);
  --tribe-techno-tint: color-mix(in srgb, var(--tribe-techno-accent) 10%, transparent);
  --tribe-soul-tint:   color-mix(in srgb, var(--tribe-soul-accent)   10%, transparent);
  --tribe-indie-tint:  color-mix(in srgb, var(--tribe-indie-accent)  10%, transparent);
  --tribe-pop-tint:    color-mix(in srgb, var(--tribe-pop-accent)    10%, transparent);

  /* ── Spacing scale (8px 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;
  --space-9: 96px;

  /* ── Radii ────────────────────────────────────────────────────────── */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-pill: 999px;

  /* ── Shadows (single direction, single density — restraint) ──────── */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.5);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.6);
  --shadow-glow: 0 0 24px rgba(212, 165, 116, 0.18);  /* gold halo — sparingly */

  /* ── Motion ───────────────────────────────────────────────────────── */
  --duration-instant: 80ms;
  --duration-fast: 150ms;
  --duration-normal: 240ms;
  --duration-slow: 480ms;
  --duration-deliberate: 800ms;   /* path animation, narration fade */
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  /* ── Layout ───────────────────────────────────────────────────────── */
  --container-narrow: 480px;      /* signup forms, focused interactions */
  --container-content: 720px;     /* landing column, focused reading */
  --container-wide: 1200px;       /* explorer at desktop */
}

/* ── Base typographic resets ──────────────────────────────────────────
   Apply globally so the design system actually shapes the page. Pages
   that import this file get sensible defaults without per-element work. */
body {
  font-family: var(--font-body);
  font-size: var(--text-body);
  font-weight: var(--weight-regular);
  line-height: var(--leading-body);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Display type uses Fraunces by default. Manually override font-family
   when you specifically want sans display (rare — usually a system label). */
h1, h2, h3, .display, .hero-text {
  font-family: var(--font-display);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-display);
  letter-spacing: var(--tracking-tight);
  /* Fraunces axes for a slightly softer, warmer feel at display sizes */
  font-variation-settings: "opsz" 144, "SOFT" 50;
}
h1, .display { font-size: var(--text-display); }
h2 { font-size: var(--text-section); line-height: var(--leading-tight); }
h3 { font-size: 20px; line-height: var(--leading-tight); }
small, .caption { font-size: var(--text-caption); color: var(--text-muted); }

/* ── Focus indicator (from a11y patch — kept here as the systematic home) */
*:focus { outline: none; }
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ── Reduced-motion guard — non-negotiable accessibility floor ─────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Visually-hidden utility for offscreen labels ────────────────────── */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

/* ── Mobile hero scale-down ──────────────────────────────────────────── */
@media (max-width: 520px) {
  h1, .display { font-size: var(--text-display-sm); }
}

/* ─────────────────────────────────────────────────────────────────────
   Value strip — the "what does this path become" component
   ─────────────────────────────────────────────────────────────────────
   Used on the explorer first-visit demo AND on the landing page below
   the journey example. Same visual treatment in both places — same
   promise architecture. Class names use .demo-value-* prefix for
   historical reasons (originated in the explorer demo); they're
   generic to any "here's the product value" context.
   ───────────────────────────────────────────────────────────────────── */

.demo-value-strip {
  display: none;
  margin: var(--space-6) auto var(--space-5);
  max-width: 580px;
  text-align: left;
}
.demo-value-strip.visible { display: block; }

.demo-value-intro {
  font-family: var(--font-body);
  font-size: var(--text-caption);
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  margin-bottom: var(--space-3);
  text-align: center;
}

.demo-value-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-2);
  transition: border-color var(--duration-fast) var(--ease-out);
}
.demo-value-row:hover { border-color: var(--border-strong); }

.demo-value-icon {
  flex-shrink: 0;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-dim);
  border-radius: var(--radius-pill);
  font-size: 18px;
  color: var(--accent);
}

.demo-value-content { flex: 1; min-width: 0; }
.demo-value-title {
  font-family: var(--font-body);
  font-size: var(--text-body);
  font-weight: var(--weight-semibold);
  color: var(--text);
  margin-bottom: 2px;
}
.demo-value-detail {
  font-family: var(--font-body);
  font-size: var(--text-caption);
  color: var(--text-muted);
  line-height: var(--leading-caption);
}
.demo-value-detail .track-list {
  display: block;
  margin-top: var(--space-1);
  color: var(--text-dim);
  font-style: italic;
}
.demo-value-action {
  flex-shrink: 0;
  padding: var(--space-2) var(--space-3);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--text-caption);
  color: var(--text-dim);
  cursor: not-allowed;
  opacity: 0.55;
}
.demo-value-action.live {
  cursor: pointer;
  opacity: 1;
  color: var(--accent);
  border-color: var(--accent);
  transition: background var(--duration-fast) var(--ease-out);
}
.demo-value-action.live:hover {
  background: var(--accent-dim);
}

.demo-value-row.statement {
  background: transparent;
  border: 1px dashed var(--border);
  text-align: center;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-5) var(--space-4);
}
.demo-value-row.statement .demo-value-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-style: italic;
  color: var(--accent);
  font-variation-settings: "opsz" 144, "SOFT" 80;
}
.demo-value-row.statement .demo-value-detail {
  text-align: center;
  color: var(--text-muted);
}

@media (max-width: 520px) {
  .demo-value-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .demo-value-action { align-self: stretch; text-align: center; }
}
