/* ═══════════════════════════════════════════════════════════════
   SITEPILOT — SPACE ANIMATION LAYER
   Rockets · Stars · Orbits · Trails · Launch sequences
═══════════════════════════════════════════════════════════════ */

/* ── Keyframes ── */

@keyframes rocket-launch {
  0%   { transform: translateY(0) rotate(-45deg) scale(1); opacity: 1; }
  60%  { transform: translateY(-120px) rotate(-45deg) scale(1.1); opacity: 1; }
  100% { transform: translateY(-300px) rotate(-45deg) scale(.6); opacity: 0; }
}

@keyframes rocket-fly-across {
  0%   { transform: translate(-120px, 120px) rotate(-45deg); opacity: 0; }
  8%   { opacity: 1; }
  92%  { opacity: 1; }
  100% { transform: translate(calc(100vw + 120px), calc(-100vh * .6)) rotate(-45deg); opacity: 0; }
}

@keyframes rocket-float {
  0%,100% { transform: translateY(0) rotate(-45deg); }
  50%      { transform: translateY(-18px) rotate(-45deg); }
}

@keyframes rocket-bob {
  0%,100% { transform: translateY(0) rotate(0deg); }
  30%     { transform: translateY(-10px) rotate(3deg); }
  70%     { transform: translateY(-6px) rotate(-2deg); }
}

@keyframes trail-fade {
  0%   { opacity: .8; transform: scaleY(1) scaleX(1); }
  100% { opacity: 0; transform: scaleY(2.5) scaleX(.3); }
}

@keyframes star-twinkle {
  0%,100% { opacity: .15; transform: scale(1); }
  50%      { opacity: .9;  transform: scale(1.3); }
}

@keyframes star-shoot {
  0%   { transform: translate(0,0) rotate(215deg); opacity: 1; clip-path: inset(0 100% 0 0); }
  5%   { clip-path: inset(0 0% 0 0); }
  90%  { opacity: 1; }
  100% { transform: translate(400px, 220px) rotate(215deg); opacity: 0; }
}

@keyframes orbit-spin {
  from { transform: rotate(0deg) translateX(var(--orbit-r, 60px)) rotate(0deg); }
  to   { transform: rotate(360deg) translateX(var(--orbit-r, 60px)) rotate(-360deg); }
}

@keyframes orbit-ring-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes planet-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(11,92,255,.2), 0 0 20px rgba(11,92,255,.1); }
  50%     { box-shadow: 0 0 0 16px rgba(11,92,255,0), 0 0 40px rgba(11,92,255,.25); }
}

@keyframes exhaust-puff {
  0%   { transform: scale(.5) translateY(0); opacity: .9; }
  100% { transform: scale(2.5) translateY(20px); opacity: 0; }
}

@keyframes flame-flicker {
  0%,100% { transform: scaleX(1) scaleY(1); opacity: 1; }
  33%     { transform: scaleX(.85) scaleY(1.15); opacity: .9; }
  66%     { transform: scaleX(1.1) scaleY(.9); opacity: 1; }
}

@keyframes launch-countdown {
  0%   { transform: scaleY(0); transform-origin: bottom; }
  100% { transform: scaleY(1); transform-origin: bottom; }
}

@keyframes trajectory-draw {
  from { stroke-dashoffset: 1000; }
  to   { stroke-dashoffset: 0; }
}

@keyframes smoke-rise {
  0%   { transform: translateY(0) scale(1); opacity: .6; }
  100% { transform: translateY(-60px) scale(2.5); opacity: 0; }
}

@keyframes asteroid-drift {
  0%   { transform: translate(0,0) rotate(0deg); }
  100% { transform: translate(-200px, 150px) rotate(720deg); }
}

@keyframes badge-pop {
  0%   { transform: scale(.8); opacity: 0; }
  70%  { transform: scale(1.06); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes number-launch {
  0%   { transform: translateY(20px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

@keyframes warp-speed {
  0%   { transform: scaleX(1); opacity: .8; }
  100% { transform: scaleX(8); opacity: 0; }
}

@keyframes satellite-orbit {
  from { transform: rotate(0deg) translateX(80px) rotate(0deg); }
  to   { transform: rotate(360deg) translateX(80px) rotate(-360deg); }
}

/* ── Global site rocket decoration ── */

/* Floating mini-rockets on section dividers */
.rocket-divider {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 60px;
  overflow: visible;
}
.rocket-divider svg {
  animation: rocket-bob 3s ease-in-out infinite;
  filter: drop-shadow(0 4px 16px rgba(11,92,255,.35));
}

/* Hero rocket — flies across on load */
.hero-rocket-flyby {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  bottom: 20%;
  left: 0;
  animation: rocket-fly-across 6s cubic-bezier(.25,.46,.45,.94) forwards;
  animation-delay: 1.2s;
  opacity: 0;
}

/* Floating rocket in hero (persistent) */
.hero-rocket-float {
  position: absolute;
  right: 5%;
  top: 18%;
  z-index: 2;
  pointer-events: none;
  animation: rocket-float 4.5s ease-in-out infinite;
  filter: drop-shadow(0 8px 24px rgba(11,92,255,.4));
}

/* Stars canvas wrapper */
.stars-canvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

/* Static star dots (CSS-only backup) */
.star {
  position: absolute;
  border-radius: 50%;
  background: white;
  pointer-events: none;
}

/* Shooting star */
.shooting-star {
  position: absolute;
  height: 2px;
  background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,.8) 50%, white 100%);
  border-radius: 2px;
  pointer-events: none;
}
.shooting-star.active {
  animation: star-shoot 1.2s ease-out forwards;
}

/* Orbit ring around stats/icons */
.orbit-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.orbit-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px dashed rgba(11,92,255,.2);
  animation: orbit-ring-spin 12s linear infinite;
}
.orbit-planet {
  position: absolute;
  border-radius: 50%;
  width: 8px;
  height: 8px;
  background: linear-gradient(135deg, #0B5CFF, #7B2FF7);
  box-shadow: 0 0 8px rgba(11,92,255,.6);
  --orbit-r: 40px;
  animation: orbit-spin 4s linear infinite;
}

/* Rocket trail / exhaust */
.rocket-trail {
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.trail-flame {
  width: 10px;
  height: 16px;
  background: linear-gradient(to bottom, #FF6B2B, #FFB800, transparent);
  border-radius: 50% 50% 60% 60%;
  animation: flame-flicker .15s ease-in-out infinite;
  filter: blur(1px);
}
.trail-smoke {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(180, 140, 255, .4);
  animation: exhaust-puff .8s ease-out infinite;
}

/* Planet decoration */
.planet {
  border-radius: 50%;
  position: absolute;
  pointer-events: none;
}
.planet-blue {
  background: radial-gradient(circle at 35% 35%, #3A7BFF, #0B3A9A);
  box-shadow: 0 0 30px rgba(11,92,255,.3), inset -8px -8px 20px rgba(0,0,50,.4);
  animation: planet-pulse 4s ease-in-out infinite;
}
.planet-purple {
  background: radial-gradient(circle at 35% 35%, #9B59FF, #5A0FA0);
  box-shadow: 0 0 30px rgba(123,47,247,.3), inset -8px -8px 20px rgba(30,0,60,.4);
}
.planet-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotateX(70deg);
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,.15);
  pointer-events: none;
}

/* Satellite */
.satellite {
  position: absolute;
  pointer-events: none;
  animation: satellite-orbit 8s linear infinite;
}

/* Asteroid field (section bg) */
.asteroid {
  position: absolute;
  border-radius: 40% 60% 55% 45% / 45% 55% 60% 40%;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.05);
  pointer-events: none;
  animation: asteroid-drift linear infinite;
}

/* Step icon rocket wrapper */
.step-rocket-wrap {
  position: relative;
  display: inline-flex;
  width: 64px;
  height: 64px;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}
.step-rocket-wrap .orbit-ring {
  width: 76px;
  height: 76px;
}
.step-rocket-wrap .orbit-planet {
  --orbit-r: 38px;
  width: 6px;
  height: 6px;
}

/* Trajectory SVG path */
.trajectory-path {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: visible;
}
.trajectory-path path {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  transition: stroke-dashoffset 2s ease;
}
.trajectory-path.draw path {
  stroke-dashoffset: 0;
}

/* Launch pad base */
.launch-pad {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
}
.launch-pad-base {
  width: 60px;
  height: 8px;
  background: linear-gradient(90deg, transparent, rgba(11,92,255,.4), transparent);
  border-radius: 4px;
  position: relative;
}
.launch-pad-base::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 12px;
  background: rgba(11,92,255,.3);
  border-radius: 2px 2px 0 0;
}
.launch-pad-exhaust {
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 28px;
  background: radial-gradient(ellipse at top, #FF6B2B 0%, #FFB800 40%, transparent 80%);
  border-radius: 0 0 50% 50%;
  animation: flame-flicker .2s ease-in-out infinite;
  filter: blur(2px);
  opacity: .9;
}

/* Speed lines (warp effect) */
.speed-line {
  position: absolute;
  height: 1.5px;
  background: linear-gradient(90deg, transparent, rgba(11,92,255,.5), transparent);
  border-radius: 2px;
  pointer-events: none;
  transform-origin: left center;
  animation: warp-speed .8s ease-out infinite;
}

/* Section badge with rocket */
.rocket-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 100px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.rocket-badge .rb-rocket {
  animation: rocket-bob 2s ease-in-out infinite;
  display: inline-block;
  font-size: .95rem;
}

/* Countdown ring for CTA */
.countdown-ring {
  position: relative;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.countdown-ring svg {
  position: absolute;
  top: 0; left: 0;
  animation: orbit-ring-spin 6s linear infinite;
}
.countdown-ring .cr-rocket {
  font-size: 1.8rem;
  animation: rocket-bob 2s ease-in-out infinite;
  z-index: 1;
}

/* Page transition rocket */
.page-rocket {
  position: fixed;
  z-index: 9998;
  pointer-events: none;
  font-size: 2rem;
  transition: none;
}

/* ── Scroll-triggered classes ── */
.rocket-ready    { animation-play-state: paused; }
.rocket-go       { animation-play-state: running; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .hero-rocket-float { display: none; }
  .planet { transform: scale(.7); }
}
