/* ============================================================================
   Pulse Music — Design Tokens
   Inherits from theloopgoeson.com (parent) and extends for music-specific
   surfaces, waveform palette, and rhythm motion.
   ============================================================================ */

:root {
  color-scheme: dark;

  /* -------------------------------------------------------------------------
     INHERITED from parent — do not diverge without coordination
     (matches the palette in site/the-pulse.html et al.)
     ------------------------------------------------------------------------- */

  /* Void spectrum */
  --void:         #0a0a0f;
  --void-raised:  #0d0d14;
  --void-overlay: #12121a;

  /* Gold spectrum */
  --gold:         #c9a84c;
  --gold-dim:     #a08838;
  --gold-bright:  #d4af37;
  --gold-glow:    rgba(201,168,76,0.15);
  --gold-ghost:   rgba(201,168,76,0.06);
  --gold-line:    rgba(201,168,76,0.12);
  --gold-soft:    rgba(201, 168, 76, 0.18);

  /* Text spectrum */
  --text-primary: #f5f5f0;
  --text-body:    #d4c5a0;
  --text-muted:   #8b7d69;
  --text-faint:   #5a5245;

  /* Named aliases used by parent and preserved for compatibility */
  --parchment:    #eae4da;
  --bone:         #f5f0e8;

  /* Accents */
  --accent-green: #6bbf8a;
  --accent-amber: #bf9a5b;
  --accent-red:   #bf6b6b;

  /* Lines and dividers */
  --line:         rgba(234, 228, 218, 0.08);

  /* Typography families */
  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-body:    "Spectral", Georgia, serif;
  --font-label:   "Instrument Sans", -apple-system, BlinkMacSystemFont, sans-serif;

  /* Size scale — clamp ranges match parent */
  --size-label:   clamp(0.75rem, 0.7rem + 0.2vw, 0.85rem);
  --size-small:   clamp(0.85rem, 0.8rem + 0.2vw, 0.95rem);
  --size-body:    clamp(1rem, 0.95rem + 0.2vw, 1.1rem);
  --size-lead:    clamp(1.1rem, 1rem + 0.3vw, 1.3rem);
  --size-h3:      clamp(1.3rem, 1.2rem + 0.5vw, 1.7rem);
  --size-h2:      clamp(1.7rem, 1.5rem + 1vw, 2.4rem);
  --size-h1:      clamp(2.2rem, 1.8rem + 2vw, 3.4rem);
  --size-hero:    clamp(2.6rem, 2rem + 3vw, 4.8rem);

  /* Spacing */
  --content-max:    720px;
  --content-wide:   960px;
  --section-gap:    clamp(48px, 7vh, 96px);
  --page-padding-x: clamp(20px, 4vw, 40px);

  /* Motion — inherited base */
  --ease-reveal:  cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-breathe: cubic-bezier(0.37, 0, 0.63, 1);
  --dur-reveal:   800ms;

  /* -------------------------------------------------------------------------
     EXTENDED for Pulse Music
     ------------------------------------------------------------------------- */

  /* Audio surfaces — slight warmth shift, only for audio/interactive surfaces
     not for page backgrounds (keeps parent continuity) */
  --surface-audio:        #0e0d12;
  --surface-audio-active: #131118;
  --surface-audio-edge:   rgba(201, 168, 76, 0.18);

  /* Waveform palette */
  --wave-warm:    #c9a84c;               /* master pulse / kick — gold */
  --wave-cool:    #8ba4bf;               /* opposing oscillator — cool blue-grey */
  --wave-coupled: #d4af37;               /* phase-locked state — bright gold */
  --wave-track:   rgba(139, 164, 191, 0.18); /* unused / background track */

  /* Phase-transition flash (the drop / recognition moment) — use sparingly */
  --flash-recognition: rgba(212, 175, 55, 0.35);

  /* Self-test states (use inherited accents, named for clarity) */
  --test-affirm:  var(--accent-green);
  --test-revisit: var(--accent-amber);

  /* Framework-term inline treatment */
  --term-color:    var(--gold-dim);
  --term-size:     0.92em;
  --term-tracking: 0.04em;

  /* Rhythm tokens — 120 BPM heartbeat */
  --bpm:           120;
  --beat-ms:       500ms;    /* 60000 / 120 */
  --half-beat-ms:  250ms;
  --quarter-beat-ms: 125ms;
  --bar-ms:        2000ms;   /* 4 beats */
  --phrase-ms:     8000ms;   /* 16 beats / 4 bars */

  /* Musical easing — snappier than the parent's contemplative ease */
  --ease-kick:    cubic-bezier(0.16, 1, 0.3, 1);
  --ease-hat:     cubic-bezier(0.33, 0, 0.67, 1);
  --ease-swell:   cubic-bezier(0.37, 0, 0.63, 1);

  /* Audio-specific spacing */
  --audio-block-padding: 20px;
  --audio-block-radius:  6px;
}

/* ============================================================================
   Reduced-motion overrides — all rhythm animations fall to static
   ============================================================================ */

@media (prefers-reduced-motion: reduce) {
  :root {
    --beat-ms:       0ms;
    --half-beat-ms:  0ms;
    --quarter-beat-ms: 0ms;
    --bar-ms:        0ms;
    --phrase-ms:     0ms;
    --dur-reveal:    0ms;
  }

  /* Individual keyframe animations are disabled at the component level
     via their own @media queries (more reliable than overriding vars alone). */
}

/* ============================================================================
   Base reset and root defaults — matches parent site
   ============================================================================ */

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--void);
  color-scheme: dark;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  background: var(--void);
  color: var(--text-body);
  font: 400 var(--size-body)/1.75 var(--font-body);
}

/* Grain overlay — inherited from parent */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--gold);
  color: var(--void);
  padding: 8px 16px;
  z-index: 1000;
  text-decoration: none;
  font-family: var(--font-label);
  font-size: var(--size-label);
}
.skip-link:focus { top: 0; }

/* Focus state — consistent with parent */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Selection */
::selection {
  background: var(--gold-soft);
  color: var(--text-primary);
}
