/* musical.quest - Retro-futuristic vaporwave horizontal musical journey */
:root {
  --void-black: #0A0A0F;
  --midnight-indigo: #12101F;
  --neon-fuchsia: #FF2D7B;
  --electric-violet: #8B2FC9;
  --cyan-pulse: #00E5FF;
  --vapor-white: #E8E0F0;
  --haze-lilac: #9B8AAF;
  --sunset-gold: #FFB830;
  --reveal-speed: 400ms;
  --draw-speed: 3s;
  --drift-speed: 60s;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scrollbar-width: none; }
html::-webkit-scrollbar { display: none; }

body {
  background: var(--void-black);
  color: var(--vapor-white);
  font-family: 'DM Sans', sans-serif;
  font-weight: 300;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

/* Horizontal scroll container */
.horizontal-container {
  display: flex;
  width: 700vw;
  height: 100vh;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
.horizontal-container::-webkit-scrollbar { display: none; }

.track {
  width: 100vw;
  height: 100vh;
  flex-shrink: 0;
  position: relative;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.track-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.bg-fuchsia {
  background: radial-gradient(ellipse at 30% 50%, rgba(255,45,123,0.2), var(--midnight-indigo));
}
.bg-violet {
  background: radial-gradient(ellipse at 70% 40%, rgba(139,47,201,0.2), var(--void-black));
}
.bg-triadic {
  background: 
    radial-gradient(ellipse at 20% 30%, rgba(255,45,123,0.15), transparent),
    radial-gradient(ellipse at 80% 70%, rgba(0,229,255,0.12), transparent),
    radial-gradient(ellipse at 50% 50%, rgba(139,47,201,0.18), var(--void-black));
}
.bg-indigo {
  background: var(--midnight-indigo);
}
.bg-cycle {
  background: var(--void-black);
  animation: hue-cycle 30s ease infinite;
}
@keyframes hue-cycle {
  0%   { background: radial-gradient(ellipse at center, rgba(255,45,123,0.12), var(--void-black)); }
  33%  { background: radial-gradient(ellipse at center, rgba(139,47,201,0.12), var(--void-black)); }
  66%  { background: radial-gradient(ellipse at center, rgba(0,229,255,0.12), var(--void-black)); }
  100% { background: radial-gradient(ellipse at center, rgba(255,45,123,0.12), var(--void-black)); }
}

.track-content {
  position: relative;
  z-index: 2;
  max-width: 60vw;
  max-height: 70vh;
  padding: 2rem;
}

/* Hero */
.hero-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  opacity: 0;
  animation: fadeElastic 2s cubic-bezier(0.68,-0.55,0.265,1.55) 0.5s forwards;
}
.hero-line {
  font-family: 'Dela Gothic One', cursive;
  font-size: clamp(4rem, 12vw, 10rem);
  color: var(--vapor-white);
  line-height: 1;
}
.hero-waveform {
  width: 80%;
  height: 40px;
}
.sine-wave {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: drawPath 4s ease-in-out 2s forwards, wavePulse 4s ease-in-out 6s infinite;
}

@keyframes fadeElastic {
  0% { opacity: 0; transform: scale(1.05); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes drawPath {
  to { stroke-dashoffset: 0; }
}

@keyframes wavePulse {
  0%, 100% { d: path("M0,20 Q100,20 200,20 T400,20 T600,20 T800,20"); }
  50% { d: path("M0,20 Q100,10 200,30 T400,10 T600,30 T800,20"); }
}

.scroll-arrow {
  font-size: 2rem;
  color: var(--sunset-gold);
  opacity: 0;
  animation: pulseArrow 3s ease-in-out 4s infinite;
  text-align: center;
  margin-top: 2rem;
}
@keyframes pulseArrow {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 0.7; }
}

/* Track titles */
.track-title {
  font-family: 'Dela Gothic One', cursive;
  font-size: clamp(2.5rem, 6vw, 5rem);
  color: var(--vapor-white);
  margin-bottom: 1.5rem;
  line-height: 1.1;
}

.body-text {
  font-family: 'DM Sans', sans-serif;
  font-weight: 300;
  font-size: clamp(0.9rem, 1.2vw, 1.1rem);
  line-height: 1.7;
  color: var(--vapor-white);
  max-width: 50ch;
  margin-bottom: 1rem;
}

.metadata {
  font-family: 'Victor Mono', monospace;
  font-style: italic;
  font-size: 0.8rem;
  color: var(--haze-lilac);
  display: block;
  margin-top: 0.5rem;
}

/* Split content for Track 2 */
.split-content {
  display: flex;
  gap: 4rem;
  align-items: center;
  max-width: 80vw;
}
.split-left { flex: 1; }
.split-right { flex: 1; display: flex; justify-content: center; }
.lissajous, .lissajous-center {
  width: 300px;
  height: 300px;
}
.lissajous-path, .lissajous-path-2 {
  filter: drop-shadow(0 0 4px currentColor);
}

/* Frequency bars */
.freq-bars-bg {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  padding: 0 10%;
  pointer-events: none;
}
.freq-bar {
  width: 8px;
  background: var(--neon-fuchsia);
  opacity: 0.15;
  border-radius: 2px 2px 0 0;
  animation: barPulse 1.5s ease-in-out infinite;
}
@keyframes barPulse {
  0%, 100% { transform: scaleY(0.3); }
  50% { transform: scaleY(1); }
}

/* Crescendo bars */
.crescendo-bars {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  pointer-events: none;
}
.crescendo-bar {
  width: 6px;
  border-radius: 2px 2px 0 0;
  transition: transform 0.3s cubic-bezier(0.68,-0.55,0.265,1.55);
}
.crescendo-title {
  font-size: clamp(4rem, 10vw, 8rem) !important;
  text-align: center;
  mix-blend-mode: difference;
}

/* Waveform overlays */
.waveform-overlay {
  position: absolute;
  bottom: 20%;
  left: 0;
  width: 100%;
  height: 200px;
  z-index: 1;
  pointer-events: none;
}
.draw-on-snap {
  stroke-dasharray: 2000;
  stroke-dashoffset: 2000;
  filter: drop-shadow(0 0 4px var(--neon-fuchsia));
}
.draw-on-snap.animate {
  animation: drawPath 4s ease-in-out forwards;
}

/* Vinyl grooves */
.vinyl-grooves {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 0;
}
.vinyl-svg {
  width: 80vh;
  height: 80vh;
  animation: slowSpin 120s linear infinite;
}
@keyframes slowSpin {
  to { transform: rotate(360deg); }
}

.lissajous-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
}
.center-meta {
  position: absolute;
  bottom: 20%;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
}

/* Resonance */
.resonance-content {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  max-width: 55vw;
}
.resonance-block { margin-bottom: 1rem; }
.wave-divider {
  width: 100%;
  height: 30px;
  margin-top: 0.5rem;
}

/* Quest title animation */
.quest-title {
  letter-spacing: 0;
  transition: letter-spacing 1.5s cubic-bezier(0.68,-0.55,0.265,1.55);
}
.quest-title.expanded {
  letter-spacing: 0.5em;
}
.quest-body {
  text-align: center;
  margin-top: 1rem;
}
.typewriter-text {
  font-family: 'Victor Mono', monospace;
  font-size: 0.9rem;
  color: var(--cyan-pulse);
  text-align: center;
  margin-top: 2rem;
  min-height: 1.5em;
}

/* Timeline */
.timeline {
  position: fixed;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  z-index: 100;
}
.timeline-line {
  position: absolute;
  width: 1px;
  height: 100%;
  background: var(--haze-lilac);
  opacity: 0.3;
}
.timeline-node {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--haze-lilac);
  opacity: 0.4;
  position: relative;
  z-index: 1;
  cursor: pointer;
  transition: all 0.3s ease;
}
.timeline-node.active {
  background: var(--sunset-gold);
  opacity: 1;
  box-shadow: 0 0 8px var(--sunset-gold);
}

/* Fixed domain */
.fixed-domain {
  position: fixed;
  top: 24px;
  left: 24px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--vapor-white);
  opacity: 0.4;
  z-index: 100;
  transition: opacity 0.3s;
}
.fixed-domain:hover { opacity: 1; }

/* Skeleton loading */
.skeleton-overlay {
  position: fixed;
  inset: 0;
  background: var(--void-black);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.8s ease;
}
.skeleton-overlay.hidden { opacity: 0; pointer-events: none; }
.skeleton-line {
  width: 60%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan-pulse), transparent);
  animation: skeletonSweep 1.5s ease-in-out infinite;
}
@keyframes skeletonSweep {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

@media (max-width: 768px) {
  .split-content { flex-direction: column; gap: 2rem; }
  .track-content { max-width: 85vw; padding: 1.5rem; }
  .timeline { right: 12px; }
}
