/* ============================================
   CELEBRATIONS v4 — Vintage Aviation Celebration Styles
   Companion to celebrations.js
   TWA-era: spinning propellers, jet airliners, turbines.
   ============================================ */

/* ─── Layer: fixed full-viewport overlay ─── */
.celeb {
  position: fixed;
  inset: 0;
  z-index: 100000;
  pointer-events: none;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.celeb--active {
  opacity: 1;
}

.celeb--out {
  opacity: 0;
  transition: opacity 0.5s ease;
}

/* ─── Expanding Ring Pulses ─── */
.celeb__rings {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.celeb__rings--apex {
  top: 40%;
}

.celeb__ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  border-radius: 50%;
  border: 2.5px solid;
  opacity: 0;
}

.celeb--active .celeb__ring {
  animation: celebRingPulse 1.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.celeb--phase2 .celeb__rings--apex .celeb__ring {
  animation: celebRingPulse 1.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes celebRingPulse {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 0.8;
  }
  55% {
    opacity: 0.3;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.8);
    opacity: 0;
  }
}

/* ─── Confetti Container ─── */
.celeb__confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* ─── Confetti Pieces (thick ribbons, rectangles, circles) ─── */
.celeb__piece {
  position: absolute;
  top: 30%;
  opacity: 0;
}

.celeb--active .celeb__piece {
  animation: celebConfetti var(--anim-dur, 1.8s) cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-duration: inherit;
}

.celeb--phase2 .celeb__piece {
  animation: celebConfetti var(--anim-dur, 1.8s) cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-duration: inherit;
}

@keyframes celebConfetti {
  0% {
    left: var(--sx);
    top: 30%;
    opacity: 0;
    transform: rotate(0deg) scale(0);
  }
  10% {
    opacity: 1;
    transform: scale(1);
  }
  60% {
    opacity: 1;
  }
  100% {
    left: var(--ex);
    top: var(--ey);
    opacity: 0;
    transform: rotate(var(--r)) scale(0.3);
  }
}


/* ═══════════════════════════════════════════════════════════════════
   SPINNING PROPELLERS — The brand signature element.
   4-blade propeller that continuously spins while drifting.
   ═══════════════════════════════════════════════════════════════════ */

.celeb__propeller {
  position: absolute;
  opacity: 0;
  z-index: 3;
}

.celeb__propeller svg {
  width: 100%;
  height: 100%;
  display: block;
  animation: celebPropellerSpin var(--spin-speed, 0.5s) linear infinite;
}

.celeb--active .celeb__propeller {
  animation: celebPropellerDrift var(--anim-dur, 3s) cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-duration: inherit;
}

.celeb--phase2 .celeb__propeller {
  animation: celebPropellerDrift var(--anim-dur, 3s) cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-duration: inherit;
}

/* Continuous blade rotation */
@keyframes celebPropellerSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Drift outward from origin while fading */
@keyframes celebPropellerDrift {
  0% {
    left: var(--sx);
    top: var(--sy);
    opacity: 0;
    transform: scale(0.2);
  }
  12% {
    opacity: 0.95;
    transform: scale(1);
  }
  55% {
    opacity: 0.85;
  }
  100% {
    left: var(--ex);
    top: var(--ey);
    opacity: 0;
    transform: scale(1.15);
  }
}


/* ═══════════════════════════════════════════════════════════════════
   JET AIRLINERS — Big commercial jets sweeping across viewport.
   Bold silhouette with swept wings and twin engines.
   ═══════════════════════════════════════════════════════════════════ */

.celeb__jet {
  position: absolute;
  opacity: 0;
  z-index: 2;
}

.celeb__jet svg {
  width: 100%;
  height: auto;
  display: block;
}

.celeb--active .celeb__jet {
  animation: celebJetSweep var(--anim-dur, 2.5s) cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-duration: inherit;
}

.celeb--phase2 .celeb__jet {
  animation: celebJetSweep var(--anim-dur, 2.5s) cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-duration: inherit;
}

@keyframes celebJetSweep {
  0% {
    left: var(--sx);
    top: var(--sy);
    opacity: 0;
    transform: scale(0.5) rotate(var(--tilt, 0deg));
  }
  8% {
    opacity: 1;
    transform: scale(1) rotate(var(--tilt, 0deg));
  }
  55% {
    opacity: 0.9;
  }
  100% {
    left: var(--ex);
    top: var(--ey);
    opacity: 0;
    transform: scale(0.85) rotate(var(--tilt, 0deg));
  }
}


/* ═══════════════════════════════════════════════════════════════════
   TURBINE ENGINES — Front-view jet engine intakes that spin.
   Fan blades rotate continuously, drifts through viewport.
   ═══════════════════════════════════════════════════════════════════ */

.celeb__turbine {
  position: absolute;
  opacity: 0;
  z-index: 2;
}

.celeb__turbine svg {
  width: 100%;
  height: 100%;
  display: block;
  animation: celebPropellerSpin var(--spin-speed, 0.8s) linear infinite;
}

.celeb--active .celeb__turbine {
  animation: celebTurbineDrift var(--anim-dur, 3.5s) cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-duration: inherit;
}

.celeb--phase2 .celeb__turbine {
  animation: celebTurbineDrift var(--anim-dur, 3.5s) cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-duration: inherit;
}

@keyframes celebTurbineDrift {
  0% {
    left: var(--sx);
    top: var(--sy);
    opacity: 0;
    transform: scale(0.3);
  }
  15% {
    opacity: 0.8;
    transform: scale(1);
  }
  60% {
    opacity: 0.65;
  }
  100% {
    left: var(--ex);
    top: var(--ey);
    opacity: 0;
    transform: scale(1.1);
  }
}


/* ─── Contrails behind jets ─── */
.celeb__contrail {
  position: absolute;
  height: 3px;
  width: 0;
  opacity: 0;
  border-radius: 2px;
  z-index: 1;
  filter: blur(2px);
}

.celeb--active .celeb__contrail {
  animation: celebContrail var(--anim-dur, 2.2s) cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-duration: inherit;
}

.celeb--phase2 .celeb__contrail {
  animation: celebContrail var(--anim-dur, 2.2s) cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-duration: inherit;
}

@keyframes celebContrail {
  0% {
    left: var(--sx);
    top: var(--sy);
    width: 0;
    opacity: 0;
  }
  12% {
    opacity: 0.7;
    width: 20vw;
  }
  50% {
    opacity: 0.45;
    width: 55vw;
  }
  100% {
    left: var(--ex);
    top: var(--ey);
    width: 70vw;
    opacity: 0;
  }
}

/* ─── Exhaust glow behind jet engines ─── */
.celeb__exhaust {
  position: absolute;
  width: 80px;
  height: 30px;
  opacity: 0;
  z-index: 1;
  border-radius: 50%;
  filter: blur(12px);
}

.celeb--active .celeb__exhaust {
  animation: celebExhaust var(--anim-dur, 2.5s) cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-duration: inherit;
}

.celeb--phase2 .celeb__exhaust {
  animation: celebExhaust var(--anim-dur, 2.5s) cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-duration: inherit;
}

@keyframes celebExhaust {
  0% {
    left: var(--sx);
    top: var(--sy);
    opacity: 0;
    transform: scale(0.5);
  }
  10% {
    opacity: 0.6;
    transform: scale(1.5);
  }
  50% {
    opacity: 0.35;
    transform: scale(2);
  }
  100% {
    left: var(--ex);
    top: var(--ey);
    opacity: 0;
    transform: scale(3);
  }
}


/* ─── Starburst Particles ─── */
.celeb__stars {
  position: absolute;
  top: 50%;
  left: 50%;
  pointer-events: none;
}

.celeb__stars--apex {
  top: 40%;
}

.celeb__star {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0);
}

.celeb--active .celeb__star {
  animation: celebStarburst 1.1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.celeb--phase2 .celeb__stars--apex .celeb__star {
  animation: celebStarburst 1.1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes celebStarburst {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(2);
  }
  40% {
    opacity: 0.7;
  }
  100% {
    opacity: 0;
    transform: translate(var(--tx), var(--ty)) scale(0);
  }
}

/* ─── Thrust Lines (grand takeoff phase 1) ─── */
.celeb__thrust {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.celeb__thrust-line {
  position: absolute;
  bottom: 0;
  height: 0;
  transform-origin: bottom center;
}

.celeb--active .celeb__thrust-line {
  animation: celebThrustGrow 1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes celebThrustGrow {
  0% {
    height: 0;
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  65% {
    height: 70vh;
    opacity: 0.8;
  }
  100% {
    height: 90vh;
    opacity: 0;
  }
}

/* ─── Apex Flash (grand takeoff phase 2) ─── */
.celeb__flash {
  position: absolute;
  top: 40%;
  left: 50%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
}

.celeb--phase2 .celeb__flash,
.celeb .celeb__flash {
  animation: celebFlash 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes celebFlash {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0);
  }
  25% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(8);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(16);
  }
}

/* ─── Background Glow (ticker tape) ─── */
.celeb__glow {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.celeb--active .celeb__glow {
  opacity: 1;
  animation: celebGlowPulse 3s ease-in-out forwards;
}

@keyframes celebGlowPulse {
  0% { opacity: 0; }
  15% { opacity: 1; }
  65% { opacity: 0.5; }
  100% { opacity: 0; }
}

/* ─── Ticker Tape Shower Container ─── */
.celeb__ticket-shower {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* ─── Ticker Tape Ribbons (fall from top with tumble + sway) ─── */
.celeb__ribbon {
  position: absolute;
  top: -120px;
  opacity: 0;
  transform-style: preserve-3d;
}

.celeb--active .celeb__ribbon {
  animation: celebRibbonFall forwards;
  animation-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes celebRibbonFall {
  0% {
    left: var(--x);
    top: -120px;
    opacity: 0;
    transform: rotateX(0deg) rotateZ(0deg) translateX(0);
  }
  6% {
    opacity: 1;
  }
  45% {
    transform: rotateX(calc(var(--tumble) * 0.5)) rotateZ(calc(var(--twist) * 0.5)) translateX(calc(var(--sway) * 0.6));
    opacity: 0.95;
  }
  80% {
    opacity: 0.4;
  }
  100% {
    left: var(--x);
    top: 115vh;
    opacity: 0;
    transform: rotateX(var(--tumble)) rotateZ(var(--twist)) translateX(var(--sway));
  }
}

/* ─── Sparkle Accents ─── */
.celeb__sparkle {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  opacity: 0;
}

.celeb--active .celeb__sparkle {
  animation: celebSparkle 1.4s ease-in-out forwards;
}

@keyframes celebSparkle {
  0% {
    opacity: 0;
    transform: scale(0);
  }
  25% {
    opacity: 1;
    transform: scale(3);
  }
  55% {
    opacity: 0.6;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(0);
  }
}

/* ─── Mobile Tweaks ─── */
@media (max-width: 480px) {
  .celeb__jet {
    width: 150px !important;
  }
  .celeb__propeller {
    width: 80px !important;
    height: 80px !important;
  }
  .celeb__turbine {
    width: 60px !important;
    height: 60px !important;
  }
  .celeb__ring:nth-child(3) {
    width: 400px !important;
    height: 400px !important;
  }
}

/* ─── Reduced Motion ─── */
@media (prefers-reduced-motion: reduce) {
  .celeb * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
