/* ==========================================================================
   Beer Stop – Luxury Christmas Experience 2026
   Animaciones cinematográficas y soporte prefers-reduced-motion
   ========================================================================== */

/* Elementos de entrada escalonada por pantalla */
.anim-in {
  opacity: 0;
  transform: translateY(18px);
}

.screen.is-active .anim-in {
  animation: luxuryFadeUp 0.9s var(--ease-luxury) var(--delay, 0s) forwards;
}

@keyframes luxuryFadeUp {
  0% {
    opacity: 0;
    transform: translateY(18px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Destellos dorados alrededor del logotipo Beer Stop */
.screen.is-active .sparkle--1 {
  animation: sparkleTwinkle 3.2s ease-in-out 0.2s infinite;
}
.screen.is-active .sparkle--2 {
  animation: sparkleTwinkle 2.8s ease-in-out 0.9s infinite;
}
.screen.is-active .sparkle--3 {
  animation: sparkleTwinkle 3.6s ease-in-out 1.4s infinite;
}
.screen.is-active .sparkle--4 {
  animation: sparkleTwinkle 3.0s ease-in-out 2.0s infinite;
}

@keyframes sparkleTwinkle {
  0%, 100% {
    opacity: 0.22;
    transform: scale(0.75) rotate(0deg);
  }
  50% {
    opacity: 1;
    transform: scale(1.2) rotate(18deg);
  }
}

/* Barras animadas del botón de sonido */
.audio-toggle[aria-pressed="true"] .audio-bars span:nth-child(1) {
  animation: eqBar 0.95s ease-in-out 0s infinite alternate;
}
.audio-toggle[aria-pressed="true"] .audio-bars span:nth-child(2) {
  animation: eqBar 0.75s ease-in-out 0.2s infinite alternate;
}
.audio-toggle[aria-pressed="true"] .audio-bars span:nth-child(3) {
  animation: eqBar 1.05s ease-in-out 0.1s infinite alternate;
}
.audio-toggle[aria-pressed="true"] .audio-bars span:nth-child(4) {
  animation: eqBar 0.85s ease-in-out 0.35s infinite alternate;
}

@keyframes eqBar {
  0% { height: 4px; }
  100% { height: 13px; }
}

/* ==========================================================================
   PANTALLA 2: Flotación sutil y explosión dorada del regalo
   ========================================================================== */

.screen--gift.is-active .gift-box:not(.is-opened) .gift-box-3d {
  animation: giftFloat 4.2s ease-in-out infinite;
}

.screen--gift.is-active .gift-box:not(.is-opened):hover .gift-box-3d,
.screen--gift.is-active .gift-box:not(.is-opened).is-hovered .gift-box-3d {
  animation: none;
}

@keyframes giftFloat {
  0%, 100% {
    transform: rotateX(-16deg) rotateY(-26deg) translateY(0);
  }
  50% {
    transform: rotateX(-14deg) rotateY(-22deg) translateY(-9px);
  }
}

.gift-explosion-glow.is-exploding {
  animation: giftBloom 1.5s var(--ease-luxury) forwards;
}

.gift-rays.is-exploding {
  animation: giftRaysSpin 2.2s var(--ease-luxury) forwards;
}

@keyframes giftBloom {
  0% {
    opacity: 0;
    transform: scale(0.2);
  }
  28% {
    opacity: 1;
    transform: scale(1.25);
  }
  100% {
    opacity: 0.22;
    transform: scale(1.55);
  }
}

@keyframes giftRaysSpin {
  0% {
    opacity: 0;
    transform: scale(0.35) rotate(0deg);
  }
  30% {
    opacity: 0.95;
    transform: scale(1.12) rotate(16deg);
  }
  100% {
    opacity: 0.25;
    transform: scale(1.3) rotate(38deg);
  }
}

.gift-reveal.is-revealed {
  animation: revealPop 0.95s var(--ease-luxury) forwards;
}

@keyframes revealPop {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ==========================================================================
   PANTALLA 3: Texto progresivo elegante
   ========================================================================== */

.screen--gratitude.is-active .reveal-line {
  animation: storyLineIn 1.05s var(--ease-luxury) calc(0.45s + (var(--line-i) * 0.42s)) forwards;
}

@keyframes storyLineIn {
  0% {
    opacity: 0;
    filter: blur(6px);
    transform: translateY(14px);
  }
  100% {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
  }
}

/* ==========================================================================
   PANTALLA 4: Encendido gradual de luces del árbol navideño
   ========================================================================== */

.screen--christmas.is-active .tree-light {
  animation:
    lightIgnite 0.8s var(--ease-luxury) var(--light-delay, 0.2s) forwards,
    lightPulse 3.2s ease-in-out calc(var(--light-delay, 0.2s) + 0.8s) infinite alternate;
}

.screen--christmas.is-active .tree-star-halo {
  animation: starPulse 3.6s ease-in-out infinite alternate;
}

@keyframes lightIgnite {
  0% {
    opacity: 0;
    transform: scale(0.25);
  }
  70% {
    opacity: 1;
    transform: scale(1.35);
  }
  100% {
    opacity: 0.92;
    transform: scale(1);
  }
}

@keyframes lightPulse {
  0% {
    opacity: 0.55;
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1.18);
  }
}

@keyframes starPulse {
  0% {
    opacity: 0.55;
    transform: scale(0.94);
    transform-origin: 180px 48px;
  }
  100% {
    opacity: 1;
    transform: scale(1.1);
    transform-origin: 180px 48px;
  }
}

/* ==========================================================================
   PANTALLA 5: Aparición dorada de "2027"
   ========================================================================== */

.screen--newyear.is-active .year-2027 span {
  animation:
    digitReveal 1.05s var(--ease-luxury) calc(0.22s + (var(--digit-i) * 0.12s)) forwards,
    digitGoldGlow 4.5s ease-in-out calc(1.3s + (var(--digit-i) * 0.15s)) infinite alternate;
}

@keyframes digitReveal {
  0% {
    opacity: 0;
    transform: translateY(28px) scale(0.86);
    filter: blur(8px) drop-shadow(0 0 0 rgba(212, 175, 55, 0));
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0) drop-shadow(0 12px 30px rgba(212, 175, 55, 0.3));
  }
}

@keyframes digitGoldGlow {
  0% {
    filter: drop-shadow(0 10px 26px rgba(212, 175, 55, 0.24));
  }
  100% {
    filter: drop-shadow(0 14px 40px rgba(246, 231, 184, 0.52));
  }
}

/* ==========================================================================
   Soporte completo para prefers-reduced-motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .screen,
  .scene-veil,
  .gift-box,
  .gift-box-3d,
  .gift-lid,
  .btn-luxury,
  .btn-shine,
  .toast {
    transition-duration: 0.15s !important;
  }

  .anim-in,
  .reveal-line,
  .year-2027 span,
  .tree-light {
    animation: none !important;
    opacity: 1 !important;
    filter: none !important;
    transform: none !important;
  }

  .sparkle,
  .audio-bars span,
  .gift-box-3d,
  .tree-star-halo,
  .gift-explosion-glow,
  .gift-rays {
    animation: none !important;
  }

  .gift-explosion-glow.is-exploding {
    opacity: 0.28;
    transform: scale(1.25);
  }
}
