/* ==========================================================================
   PAPÁ NOEL EN TRINEO ROJO CON RENOS & REGALOS CON DESEOS DORADOS (PAN Y CANELA)
   Animación interactiva sin emojis ni bloqueo de interacción
   ========================================================================== */

#santa-sky-container {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 99997;
  overflow: hidden;
}

/* Contenedor posicionado por JS con translate3d(posX, posY, 0) */
.santa-flyer {
  position: absolute;
  top: 0;
  left: 0;
  width: 245px;
  height: 106px;
  pointer-events: auto;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  will-change: transform;
  transform-origin: center center;
}

/* Envoltorio para efectos al soltar regalos (evita sobrescribir el translate3d padre) */
.santa-poof-wrap {
  width: 100%;
  height: 100%;
  transform-origin: center center;
  filter: drop-shadow(0 8px 16px rgba(26, 17, 8, 0.28));
  transition: filter 0.25s ease;
}

.santa-flyer:hover .santa-poof-wrap,
.santa-flyer:focus-visible .santa-poof-wrap {
  filter: drop-shadow(0 0 14px rgba(229, 169, 60, 0.85)) drop-shadow(0 8px 18px rgba(26, 17, 8, 0.38));
}

.santa-flyer:focus-visible {
  outline: 2px dashed #e5a93c;
  outline-offset: 4px;
  border-radius: 12px;
}

/* Impulso festivo cuando suelta regalos */
.santa-flyer.is-dropping .santa-poof-wrap {
  animation: santaDropPulse 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes santaDropPulse {
  0% {
    transform: scale(1);
    filter: drop-shadow(0 8px 16px rgba(26, 17, 8, 0.28));
  }
  40% {
    transform: scale(1.12) translateY(-4px);
    filter: brightness(1.18) drop-shadow(0 0 24px rgba(244, 196, 48, 0.95));
  }
  100% {
    transform: scale(1);
    filter: drop-shadow(0 8px 16px rgba(26, 17, 8, 0.28));
  }
}

/* Envoltorio visual que recibe scaleX(direction) y rotate(pitchAngle) */
.santa-visual {
  width: 100%;
  height: 100%;
  transform-origin: center center;
  will-change: transform;
}

/* Gráfico SVG de Papá Noel y su trineo con renos */
.santa-svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  animation: santaSleighFloat 2.4s ease-in-out infinite;
}

@keyframes santaSleighFloat {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-5px) rotate(-1.5deg);
  }
}

/* Galope alterno de las patas de los renos */
.reindeer-leg-front {
  transform-box: fill-box;
  transform-origin: top center;
  animation: reindeerGallopA 0.38s ease-in-out infinite alternate;
}

.reindeer-leg-back {
  transform-box: fill-box;
  transform-origin: top center;
  animation: reindeerGallopB 0.38s ease-in-out infinite alternate;
}

@keyframes reindeerGallopA {
  0% {
    transform: rotate(-18deg);
  }
  100% {
    transform: rotate(22deg);
  }
}

@keyframes reindeerGallopB {
  0% {
    transform: rotate(20deg);
  }
  100% {
    transform: rotate(-18deg);
  }
}

/* Nariz roja luminosa del reno guía */
.rudolph-nose {
  animation: rudolphGlow 1.1s ease-in-out infinite alternate;
}

@keyframes rudolphGlow {
  0% {
    opacity: 0.85;
    filter: drop-shadow(0 0 2px #ff3b30);
  }
  100% {
    opacity: 1;
    filter: drop-shadow(0 0 7px #ff3b30);
  }
}

/* Pompón del gorro y chispas mágicas */
.santa-pom {
  transform-box: fill-box;
  transform-origin: center;
  animation: santaPomBounce 0.9s ease-in-out infinite alternate;
}

@keyframes santaPomBounce {
  0% {
    transform: translate(0, 0);
  }
  100% {
    transform: translate(-2px, -2px);
  }
}

.santa-sparkle-1 {
  animation: santaSparklePulse 0.9s ease-in-out infinite alternate;
}

.santa-sparkle-2 {
  animation: santaSparklePulse 1.3s ease-in-out 0.35s infinite alternate;
}

@keyframes santaSparklePulse {
  0% {
    opacity: 0.35;
    transform: scale(0.7);
  }
  100% {
    opacity: 1;
    transform: scale(1.25);
  }
}

/* Estela de chispas doradas tras los patines del trineo */
.santa-flight-spark {
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
  will-change: transform, opacity;
  animation: santaTrailSparkFade 0.9s ease-out forwards;
}

@keyframes santaTrailSparkFade {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 0.92;
  }
  100% {
    transform: translate3d(var(--st-x, -16px), var(--st-y, 12px), 0) scale(0.1);
    opacity: 0;
  }
}

/* Etiqueta sutil para invitar a tocarlo */
.santa-hint-pill {
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(17, 11, 5, 0.88);
  color: #fdfaf4;
  font-family: 'Outfit', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0.9;
  transition: opacity 0.3s ease, transform 0.3s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(229, 169, 60, 0.7);
}

.santa-flyer:hover .santa-hint-pill,
.santa-flyer:focus-visible .santa-hint-pill {
  opacity: 1;
  transform: translateX(-50%) translateY(2px) scale(1.05);
}

/* ==========================================================================
   REGALOS CAYENDO Y DESVANECIÉNDOSE
   ========================================================================== */
.santa-gift {
  position: absolute;
  width: 38px;
  height: 38px;
  pointer-events: none;
  z-index: 99998;
  will-change: transform, opacity;
  filter: drop-shadow(0 5px 10px rgba(17, 11, 5, 0.32));
  animation: santaGiftFall var(--gift-dur, 1.35s) cubic-bezier(0.22, 0.75, 0.36, 1) var(--gift-delay, 0s) forwards;
}

.santa-gift-svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

@keyframes santaGiftFall {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg) scale(0.35);
    opacity: 0;
  }
  12% {
    opacity: 1;
    transform: translate3d(calc(var(--gift-dx, 0px) * 0.18), calc(var(--gift-dy, 150px) * 0.14), 0)
      rotate(calc(var(--gift-rot, 18deg) * -0.4)) scale(1.05);
  }
  55% {
    opacity: 1;
    transform: translate3d(calc(var(--gift-dx, 0px) * 0.72), calc(var(--gift-dy, 150px) * 0.68), 0)
      rotate(calc(var(--gift-rot, 18deg) * 0.65)) scale(1);
  }
  84% {
    opacity: 0.92;
    transform: translate3d(var(--gift-dx, 0px), var(--gift-dy, 150px), 0)
      rotate(var(--gift-rot, 18deg)) scale(1.08);
    filter: drop-shadow(0 0 12px rgba(244, 196, 48, 0.85));
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--gift-dx, 0px), calc(var(--gift-dy, 150px) + 12px), 0)
      rotate(calc(var(--gift-rot, 18deg) * 1.15)) scale(1.28);
    filter: drop-shadow(0 0 20px rgba(255, 215, 0, 1));
  }
}

/* Chispas doradas al desvanecerse el regalo */
.santa-gift-spark {
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
  z-index: 99998;
  will-change: transform, opacity;
  animation: santaGiftBurst 0.65s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes santaGiftBurst {
  0% {
    transform: translate3d(0, 0, 0) scale(0.4);
    opacity: 1;
  }
  100% {
    transform: translate3d(var(--sp-tx, 20px), var(--sp-ty, -20px), 0) scale(1.2);
    opacity: 0;
  }
}

/* ==========================================================================
   PALABRAS DORADAS DE BUENOS DESEOS
   ========================================================================== */
.santa-wish-word {
  position: absolute;
  pointer-events: none;
  z-index: 99999;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  font-family: 'Cormorant', Georgia, serif;
  font-size: clamp(1.38rem, 2.7vw, 1.95rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #F4C430;
  text-shadow:
    0 2px 5px rgba(17, 11, 5, 0.82),
    0 0 14px rgba(212, 175, 55, 0.75),
    0 0 2px rgba(92, 58, 8, 0.95);
  will-change: transform, opacity;
  animation: santaWishFloat 2.6s cubic-bezier(0.16, 0.84, 0.32, 1) forwards;
}

@keyframes santaWishFloat {
  0% {
    opacity: 0;
    transform: translate(-50%, -40%) scale(0.65);
  }
  18% {
    opacity: 1;
    transform: translate(-50%, -58%) scale(1.08);
  }
  32% {
    opacity: 1;
    transform: translate(-50%, -64%) scale(1);
  }
  75% {
    opacity: 0.96;
    transform: translate(-50%, calc(-50% - 26px)) scale(1.02);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, calc(-50% - 44px)) scale(0.96);
  }
}

@media (max-width: 768px) {
  .santa-flyer {
    width: 178px;
    height: 78px;
  }
  .santa-hint-pill {
    font-size: 10px;
    padding: 2px 8px;
    bottom: -14px;
  }
  .santa-gift {
    width: 32px;
    height: 32px;
  }
}

/* Accesibilidad y Preferencias de Reducción de Movimiento */
@media (prefers-reduced-motion: reduce) {
  .santa-svg,
  .reindeer-leg-front,
  .reindeer-leg-back,
  .rudolph-nose,
  .santa-pom,
  .santa-sparkle-1,
  .santa-sparkle-2 {
    animation: none !important;
  }
  .santa-gift {
    animation-duration: 0.75s !important;
  }
  .santa-wish-word {
    animation-duration: 1.6s !important;
  }
}
