/**
 * GRADPORT AVIATION ANIMATIONS & MOTIONS
 * Lightweight, GPU-accelerated CSS animations
 * Directionally accurate forward flight (Left to Right)
 * Cinematic Commercial Widebody Aircraft Flight Experience
 */

/* Cinematic Widebody Aircraft Cruising & Banking Motion (Forward Flight) */
@keyframes cinematicFlight {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg) scale(0.98);
  }
  25% {
    transform: translate3d(14px, -10px, 0) rotate(0.8deg) scale(1.0);
  }
  50% {
    transform: translate3d(28px, -20px, 0) rotate(1.4deg) scale(1.02);
  }
  75% {
    transform: translate3d(16px, -12px, 0) rotate(0.6deg) scale(1.01);
  }
  100% {
    transform: translate3d(0, 0, 0) rotate(0deg) scale(0.98);
  }
}

/* Mobile Cinematic Aircraft Motion */
@keyframes cinematicFlightMobile {
  0%, 100% {
    transform: translate3d(0, 0, 0) rotate(0deg) scale(0.96);
  }
  50% {
    transform: translate3d(10px, -8px, 0) rotate(1deg) scale(1.0);
  }
}

/* Sunlight Lens Flare Pulse on Fuselage */
@keyframes sunFlareShift {
  0%, 100% {
    opacity: 0.55;
    transform: scale(1.0);
  }
  50% {
    opacity: 0.9;
    transform: scale(1.2);
  }
}

/* Floating Destination Tags Bobbing Movement */
@keyframes floatingTagBob {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

/* Engine Contrail Flow Turbulence */
@keyframes contrailFlow {
  0%, 100% {
    opacity: 0.45;
    transform: scaleY(1.0);
  }
  50% {
    opacity: 0.75;
    transform: scaleY(1.25);
  }
}

/* Floating Atmospheric Cloud Layers */
@keyframes cloudDriftSlow {
  0% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(-60px, -8px, 0);
  }
  100% {
    transform: translate3d(0, 0, 0);
  }
}

@keyframes cloudDriftFast {
  0% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(80px, 10px, 0);
  }
  100% {
    transform: translate3d(0, 0, 0);
  }
}

/* Dotted Flight Route Flow */
@keyframes flightPathDash {
  to {
    stroke-dashoffset: -120;
  }
}

/* Strobe & Beacon Light Pulses */
@keyframes strobePulse {
  0%, 100% {
    opacity: 0.25;
    transform: scale(0.9);
  }
  50% {
    opacity: 1;
    transform: scale(1.3);
    filter: drop-shadow(0 0 6px currentColor);
  }
}

@keyframes beaconPing {
  0% {
    transform: scale(0.8);
    opacity: 1;
  }
  70% {
    transform: scale(2.4);
    opacity: 0;
  }
  100% {
    transform: scale(2.4);
    opacity: 0;
  }
}

/* Page Visibility Pause (Saves CPU/GPU when tab is hidden) */
.animations-paused *,
.animations-paused *::before,
.animations-paused *::after {
  animation-play-state: paused !important;
}

/* Reduced Motion Override */
@media (prefers-reduced-motion: reduce) {
  .aircraft-chassis,
  .sky-sunburst-glow,
  .aircraft-sun-flare,
  .floating-tag,
  .contrail,
  .cloud-layer-distant,
  .cloud-layer-midground,
  .animate-cinematic-flight {
    animation: none !important;
    transform: none !important;
  }
}

/* Status Pill Glow Pulse */
@keyframes statusGlow {
  0%, 100% {
    box-shadow: 0 0 15px rgba(51, 130, 246, 0.3), inset 0 0 10px rgba(51, 130, 246, 0.15);
    border-color: rgba(51, 130, 246, 0.45);
  }
  50% {
    box-shadow: 0 0 25px rgba(51, 130, 246, 0.6), inset 0 0 15px rgba(51, 130, 246, 0.25);
    border-color: rgba(96, 165, 250, 0.85);
  }
}

/* Fade in & Slide Up */
@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Route plane icon on curved path */
@keyframes moveAlongPath {
  0% {
    offset-distance: 0%;
  }
  100% {
    offset-distance: 100%;
  }
}

/* Floating Elevation for Telemetry Cards */
@keyframes floatGentle {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

/* ==========================================================================
   GLOBAL PASSPORT 3D & STAMP ANIMATIONS
   ========================================================================== */

/* Passport Gold Foil Sheen Sweep */
@keyframes goldFoilSweep {
  0% {
    background-position: -200% center;
  }
  100% {
    background-position: 200% center;
  }
}

/* 3D Passport Cover Opening Physics */
@keyframes passportPageCurl {
  0% {
    transform: rotateY(0deg);
  }
  100% {
    transform: rotateY(-180deg);
  }
}

/* Audio Playing Wave Equalizer */
@keyframes audioWaveEqualizer {
  0%, 100% {
    height: 4px;
  }
  50% {
    height: 16px;
  }
}

/* Passport Ink Stamp Slam & Imprint */
@keyframes stampSlam {
  0% {
    opacity: 0;
    transform: scale(2.4) rotate(var(--stamp-angle, 0deg));
    filter: blur(4px);
  }
  70% {
    opacity: 0.95;
    transform: scale(0.96) rotate(var(--stamp-angle, 0deg));
    filter: blur(0px);
  }
  85% {
    transform: scale(1.04) rotate(var(--stamp-angle, 0deg));
  }
  100% {
    opacity: 0.88;
    transform: scale(1) rotate(var(--stamp-angle, 0deg));
  }
}

/* Flight Path Golden Route Arc Animation */
@keyframes goldenRouteGlow {
  0% {
    stroke-dashoffset: 400;
    opacity: 0.3;
  }
  50% {
    opacity: 1;
  }
  100% {
    stroke-dashoffset: 0;
    opacity: 0.85;
  }
}

/* Destination Pulse Beacon (Gold & Blue) */
@keyframes passportBeaconPulse {
  0% {
    transform: scale(0.85);
    box-shadow: 0 0 0 0 rgba(201, 164, 106, 0.7);
  }
  70% {
    transform: scale(1.15);
    box-shadow: 0 0 0 14px rgba(201, 164, 106, 0);
  }
  100% {
    transform: scale(0.85);
    box-shadow: 0 0 0 0 rgba(201, 164, 106, 0);
  }
}

/* Floating Polaroid / Postcard Hover Animation */
@keyframes postcardFloat {
  0%, 100% {
    transform: translateY(0) rotate(var(--card-tilt, 0deg));
  }
  50% {
    transform: translateY(-6px) rotate(var(--card-tilt, 0deg));
  }
}

/* Animation Utility Classes */
.animate-fade-up {
  animation: fadeSlideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.35s; }
.delay-4 { animation-delay: 0.5s; }

.status-badge-glow {
  animation: statusGlow 3s ease-in-out infinite;
}

.beacon-pulse {
  animation: beaconPing 2.4s cubic-bezier(0, 0.2, 0.8, 1) infinite;
}

.flight-path-animated {
  stroke-dasharray: 6 8;
  animation: flightPathDash 2.5s linear infinite;
}

.float-card {
  animation: floatGentle 5s ease-in-out infinite;
}

/* Respect Accessibility Preferences */
@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;
  }
  .passport-cover,
  .passport-page,
  .aircraft-flyer {
    animation: none !important;
    transition: none !important;
  }
  .cloud-layer,
  .flight-path-animated,
  .beacon-pulse,
  .animated-route-plane,
  .audio-waves .wave-bar {
    animation: none !important;
  }
}
