/* ==========================================================================
   Nexus Mastering — Animations
   Keyframes, scroll-reveal, hover micro-interactions
   ========================================================================== */

/* --------------------------------------------------------------------------
   Keyframes
   -------------------------------------------------------------------------- */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(28px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.94);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes floatY {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-14px);
  }
}

@keyframes pulseGlow {
  0%,
  100% {
    opacity: 0.25;
  }
  50% {
    opacity: 0.45;
  }
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

@keyframes waveform {
  0%,
  100% {
    transform: scaleY(0.4);
  }
  50% {
    transform: scaleY(1);
  }
}

/* --------------------------------------------------------------------------
   Entrance animation utility (applied via JS + IntersectionObserver)
   -------------------------------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.9s var(--ease-apple), transform 0.9s var(--ease-apple);
  will-change: opacity, transform;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-fade {
  opacity: 0;
  transition: opacity 1s var(--ease-apple);
}

.reveal-fade.is-visible {
  opacity: 1;
}

.reveal-scale {
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.9s var(--ease-apple), transform 0.9s var(--ease-apple);
}

.reveal-scale.is-visible {
  opacity: 1;
  transform: scale(1);
}

/* Stagger children delays (used within grids) */
.reveal-stagger > * {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s var(--ease-apple), transform 0.8s var(--ease-apple);
}

.reveal-stagger.is-visible > *:nth-child(1) {
  transition-delay: 0.05s;
}
.reveal-stagger.is-visible > *:nth-child(2) {
  transition-delay: 0.15s;
}
.reveal-stagger.is-visible > *:nth-child(3) {
  transition-delay: 0.25s;
}
.reveal-stagger.is-visible > *:nth-child(4) {
  transition-delay: 0.35s;
}
.reveal-stagger.is-visible > *:nth-child(5) {
  transition-delay: 0.45s;
}
.reveal-stagger.is-visible > *:nth-child(6) {
  transition-delay: 0.55s;
}

.reveal-stagger.is-visible > * {
  opacity: 1;
  transform: translateY(0);
}

/* --------------------------------------------------------------------------
   Entrance on load (hero content — no scroll trigger needed)
   -------------------------------------------------------------------------- */
.animate-in {
  animation: slideUp 1s var(--ease-apple) both;
}

.animate-in-fade {
  animation: fadeIn 1.2s var(--ease-apple) both;
}

.delay-1 {
  animation-delay: 0.1s;
}
.delay-2 {
  animation-delay: 0.25s;
}
.delay-3 {
  animation-delay: 0.4s;
}
.delay-4 {
  animation-delay: 0.55s;
}
.delay-5 {
  animation-delay: 0.7s;
}

/* --------------------------------------------------------------------------
   Ambient glow pulses
   -------------------------------------------------------------------------- */
.bg-glow::before {
  animation: pulseGlow 8s ease-in-out infinite;
}

.bg-glow::after {
  animation: pulseGlow 8s ease-in-out infinite 2s;
}

/* --------------------------------------------------------------------------
   Floating decorative element
   -------------------------------------------------------------------------- */
.float-el {
  animation: floatY 6s ease-in-out infinite;
}

/* --------------------------------------------------------------------------
   Waveform bars (decorative, used in hero / mastering imagery)
   -------------------------------------------------------------------------- */
.waveform-bars {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 40px;
}

.waveform-bars span {
  display: block;
  width: 3px;
  height: 100%;
  border-radius: 3px;
  background: var(--accent-gradient);
  animation: waveform 1.2s ease-in-out infinite;
  transform-origin: center;
}

.waveform-bars span:nth-child(2n) {
  animation-duration: 0.9s;
  animation-delay: 0.1s;
}
.waveform-bars span:nth-child(3n) {
  animation-duration: 1.4s;
  animation-delay: 0.2s;
}
.waveform-bars span:nth-child(4n) {
  animation-duration: 1s;
  animation-delay: 0.3s;
}
.waveform-bars span:nth-child(5n) {
  animation-duration: 1.1s;
  animation-delay: 0.15s;
}

/* --------------------------------------------------------------------------
   Card & image hover interactions
   -------------------------------------------------------------------------- */
.img-zoom {
  overflow: hidden;
}

.img-zoom img {
  transition: transform 1.2s var(--ease-apple);
}

.img-zoom:hover img {
  transform: scale(1.06);
}

/* Button shimmer sweep */
.btn-primary {
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    120deg,
    transparent 20%,
    rgba(255, 255, 255, 0.35) 50%,
    transparent 80%
  );
  transform: translateX(-100%);
  transition: transform 0.8s var(--ease-smooth);
}

.btn-primary:hover::before {
  transform: translateX(100%);
}

/* --------------------------------------------------------------------------
   Page transition overlay
   -------------------------------------------------------------------------- */
.page-transition {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: var(--bg-primary);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s var(--ease-smooth);
}

.page-transition.is-active {
  opacity: 1;
  pointer-events: auto;
}

body.is-loaded .page-transition {
  opacity: 0;
}

/* Loading fade-in for whole page on first paint */
body {
  animation: fadeIn 0.6s var(--ease-smooth) both;
}

/* --------------------------------------------------------------------------
   Marquee (client logos)
   -------------------------------------------------------------------------- */
.marquee-track {
  display: flex;
  width: max-content;
  animation: marqueeScroll 28s linear infinite;
}

@keyframes marqueeScroll {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

.marquee-wrap:hover .marquee-track {
  animation-play-state: paused;
}
