/* ============================================
   Audio Lab — Animations
   ============================================ */

/* --- Reduced Motion Support --- */
@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;
  }
}

/* --- Shockwave Bass Rings --- */
/* Each ring is spawned by JS with its own inline animation-duration.
   This lets the slider smoothly change the pulse rate without
   restarting existing animations. */

/* Parent container composites rings in screen blend mode so overlapping
   waves add light (constructive interference) like sound waves meeting. */
.hero__rings {
  mix-blend-mode: screen;
}

.shockwave-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 4px solid rgba(var(--accent-rgb), 0.75);
  /* Soft blurred edge + outer bass bloom glow */
  filter: blur(3px);
  box-shadow:
    0 0 30px rgba(var(--accent-rgb), 0.35),
    0 0 60px rgba(var(--accent-rgb), 0.2),
    inset 0 0 20px rgba(var(--accent-rgb-hover), 0.35);
  animation: shockwave 3s ease-out forwards;
  will-change: width, height, opacity;
}

@keyframes shockwave {
  0% {
    width: 60px;
    height: 60px;
    opacity: 1;
    border-width: 5px;
    border-color: rgba(var(--accent-rgb-hover), 1);
    filter: blur(2px);
    box-shadow:
      0 0 40px rgba(var(--accent-rgb-hover), 0.7),
      0 0 80px rgba(var(--accent-rgb), 0.45),
      inset 0 0 30px rgba(var(--accent-rgb-hover), 0.5);
  }
  30% {
    opacity: 0.85;
    border-width: 4px;
    border-color: rgba(var(--accent-rgb), 0.85);
    filter: blur(3px);
    box-shadow:
      0 0 35px rgba(var(--accent-rgb-hover), 0.5),
      0 0 70px rgba(var(--accent-rgb), 0.3),
      inset 0 0 25px rgba(var(--accent-rgb-hover), 0.35);
  }
  70% {
    opacity: 0.4;
    filter: blur(5px);
    box-shadow:
      0 0 25px rgba(var(--accent-rgb), 0.25),
      0 0 50px rgba(var(--accent-rgb), 0.15);
  }
  100% {
    width: 900px;
    height: 900px;
    opacity: 0;
    border-width: 1px;
    border-color: rgba(var(--accent-rgb), 0);
    filter: blur(8px);
    box-shadow:
      0 0 10px rgba(var(--accent-rgb), 0),
      0 0 20px rgba(var(--accent-rgb), 0);
  }
}

/* --- Mouse-Follow Shockwave Rings --- */
.hero__mouse-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

.mouse-ring {
  position: absolute;
  top: 0;
  left: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 2px solid rgba(var(--accent-rgb-hover), 0.4);
  transform: translate(-50%, -50%);
  pointer-events: none;
  filter: blur(2px);
  box-shadow: 0 0 20px rgba(var(--accent-rgb-hover), 0.25);
  animation: mouseRing 1.8s ease-out forwards;
  will-change: width, height, opacity;
}

@keyframes mouseRing {
  0% {
    width: 8px;
    height: 8px;
    opacity: 0.4;
    border-width: 2px;
    border-color: rgba(var(--accent-rgb-hover), 0.4);
  }
  20% {
    opacity: 0.4;
    border-color: rgba(var(--accent-rgb-hover), 0.38);
  }
  100% {
    width: 650px;
    height: 650px;
    opacity: 0;
    border-width: 1px;
    border-color: rgba(var(--accent-rgb), 0);
  }
}

/* Central rings stay prominent — no dimming on mouse hover */
.hero.is-mouse-active .hero__rings {
  opacity: 1;
}

/* --- Click-to-Pulse Ring ---
   Spawned on click/tap in the hero. Always white (or red when the
   white theme is active). Bigger, brighter, slower than mouse
   trail rings so a deliberate click reads as a bass hit. */
.click-ring {
  position: absolute;
  top: 0;
  left: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 4px solid rgba(var(--click-rgb), 0.95);
  transform: translate(-50%, -50%);
  pointer-events: none;
  filter: blur(2px);
  box-shadow:
    0 0 30px rgba(var(--click-rgb), 0.75),
    0 0 60px rgba(var(--click-rgb), 0.45),
    inset 0 0 20px rgba(var(--click-rgb), 0.4);
  animation: clickRing 1.5s ease-out forwards;
  will-change: width, height, opacity;
}

@keyframes clickRing {
  0% {
    width: 12px;
    height: 12px;
    opacity: 1;
    border-width: 5px;
    filter: blur(1px);
  }
  25% {
    opacity: 0.9;
    border-width: 4px;
    filter: blur(2px);
  }
  60% {
    opacity: 0.5;
    border-width: 3px;
    filter: blur(4px);
  }
  100% {
    width: 720px;
    height: 720px;
    opacity: 0;
    border-width: 1px;
    filter: blur(8px);
    box-shadow:
      0 0 10px rgba(var(--click-rgb), 0),
      0 0 20px rgba(var(--click-rgb), 0);
  }
}

/* --- Neon Flicker --- */
.neon-flicker {
  animation: neonFlicker 4s ease-in-out infinite;
}

@keyframes neonFlicker {
  0%, 100% {
    text-shadow:
      0 0 10px rgba(var(--accent-rgb), 0.6),
      0 0 20px rgba(var(--accent-rgb), 0.4),
      0 0 40px rgba(var(--accent-rgb), 0.2),
      0 0 80px rgba(var(--accent-rgb), 0.1);
  }
  8% {
    text-shadow:
      0 0 10px rgba(var(--accent-rgb), 0.3),
      0 0 20px rgba(var(--accent-rgb), 0.15);
  }
  10% {
    text-shadow:
      0 0 10px rgba(var(--accent-rgb), 0.6),
      0 0 20px rgba(var(--accent-rgb), 0.4),
      0 0 40px rgba(var(--accent-rgb), 0.2),
      0 0 80px rgba(var(--accent-rgb), 0.1);
  }
  50% {
    text-shadow:
      0 0 12px rgba(var(--accent-rgb), 0.7),
      0 0 24px rgba(var(--accent-rgb), 0.45),
      0 0 48px rgba(var(--accent-rgb), 0.25),
      0 0 96px rgba(var(--accent-rgb), 0.12);
  }
  55% {
    text-shadow:
      0 0 8px rgba(var(--accent-rgb), 0.4),
      0 0 16px rgba(var(--accent-rgb), 0.2);
  }
  57% {
    text-shadow:
      0 0 12px rgba(var(--accent-rgb), 0.7),
      0 0 24px rgba(var(--accent-rgb), 0.45),
      0 0 48px rgba(var(--accent-rgb), 0.25),
      0 0 96px rgba(var(--accent-rgb), 0.12);
  }
}

/* --- Neon Border Glow --- */
.neon-border {
  animation: neonBorderPulse 3s ease-in-out infinite;
}

@keyframes neonBorderPulse {
  0%, 100% {
    box-shadow: 0 0 5px rgba(var(--accent-rgb), 0.2), inset 0 0 5px rgba(var(--accent-rgb), 0.1);
  }
  50% {
    box-shadow: 0 0 15px rgba(var(--accent-rgb), 0.4), inset 0 0 10px rgba(var(--accent-rgb), 0.15);
  }
}

/* --- Crack Lines (SVG background for hero) --- */
.crack-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background:
    linear-gradient(23deg, transparent 48.5%, rgba(var(--accent-rgb), 0.15) 49%, transparent 51%),
    linear-gradient(157deg, transparent 48.5%, rgba(var(--accent-rgb), 0.1) 49%, transparent 51%),
    linear-gradient(95deg, transparent 48.5%, rgba(var(--accent-rgb), 0.08) 49%, transparent 51%),
    linear-gradient(-45deg, transparent 47%, rgba(var(--accent-rgb), 0.12) 49.5%, transparent 52%),
    linear-gradient(130deg, transparent 48%, rgba(var(--accent-rgb), 0.06) 49%, transparent 51%);
}

/* --- Glow Pulse (for CTA banner bg) --- */
.glow-pulse {
  animation: glowPulse 4s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% {
    box-shadow: 0 0 30px rgba(var(--accent-rgb), 0.1);
  }
  50% {
    box-shadow: 0 0 60px rgba(var(--accent-rgb), 0.2);
  }
}

/* --- Float Up (scroll reveal variant) --- */
@keyframes floatUp {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Counter Roll (for proof bar numbers) --- */
.counter-animate {
  animation: counterPop 0.6s ease-out forwards;
}

@keyframes counterPop {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }
  70% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}
