/* === Page Transitions === */
@keyframes pageEnter {
  from {
    opacity: 0;
    transform: translateY(20px);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes pageExit {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

.page-enter {
  animation: pageEnter 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.page-exit {
  animation: pageExit 0.2s cubic-bezier(0.4, 0, 1, 1) forwards;
}

/* === Staggered Card Entry === */
@keyframes cardReveal {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.stagger-in > * {
  animation: cardReveal 0.5s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.stagger-in > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-in > *:nth-child(2) { animation-delay: 0.10s; }
.stagger-in > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-in > *:nth-child(4) { animation-delay: 0.20s; }
.stagger-in > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-in > *:nth-child(6) { animation-delay: 0.30s; }

/* === Pulse Glow === */
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 5px rgba(124, 58, 237, 0.3); }
  50%      { box-shadow: 0 0 15px rgba(124, 58, 237, 0.6); }
}

.pulse-glow {
  animation: pulseGlow 2s ease-in-out infinite;
}

/* === Toast Animations === */
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(100%) scale(0.8);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateX(100%) scale(0.8);
  }
}

/* === Fade In === */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.fade-in {
  animation: fadeIn 0.3s ease forwards;
}

/* === Slide Up === */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.slide-up {
  animation: slideUp 0.3s ease forwards;
}

/* === Indicator Pulse (LED) === */
@keyframes indicatorPulse {
  0%, 100% {
    opacity: 0.5;
    box-shadow: 0 0 4px rgba(167, 139, 250, 0.4);
  }
  50% {
    opacity: 1;
    box-shadow: 0 0 10px rgba(167, 139, 250, 0.9), 0 0 20px rgba(124, 58, 237, 0.4);
  }
}

/* === Ambient Glow Pulse === */
@keyframes ambientPulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.8; }
}

/* === Solar System Animations === */

/* Center dashed/dotted ring slow spin */
@keyframes orbitSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Ripple frequency wave — expands outward and fades */
@keyframes rippleExpand {
  0% {
    transform: scale(1);
    opacity: 0.7;
    border-color: rgba(167, 139, 250, 0.6);
    box-shadow: 0 0 10px rgba(124, 58, 237, 0.3);
  }
  40% {
    opacity: 0.4;
    border-color: rgba(167, 139, 250, 0.35);
  }
  100% {
    transform: scale(3.2);
    opacity: 0;
    border-color: rgba(167, 139, 250, 0);
    box-shadow: 0 0 0 rgba(124, 58, 237, 0);
  }
}

/* === Sun Pulse (corona breathing) === */
@keyframes sunPulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50%      { transform: scale(1.22); opacity: 1; }
}

/* === Sun Breath (main glow rhythmic pulse) === */
@keyframes sunBreath {
  0%, 100% {
    opacity: 0.45;
    transform: scale(1);
    filter: brightness(1);
  }
  35% {
    opacity: 0.85;
    transform: scale(1.1);
    filter: brightness(1.25);
  }
  65% {
    opacity: 0.6;
    transform: scale(1.04);
    filter: brightness(1.08);
  }
}

/* === Sun Core Shimmer + Breathing === */
@keyframes sunCoreShimmer {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
    box-shadow:
      inset 0 -6px 16px rgba(0, 0, 0, 0.35),
      inset 0 4px 10px rgba(220, 200, 255, 0.08),
      0 0 15px rgba(167, 139, 250, 0.5),
      0 0 35px rgba(124, 58, 237, 0.35),
      0 0 60px rgba(124, 58, 237, 0.2),
      0 0 100px rgba(124, 58, 237, 0.12),
      0 0 160px rgba(124, 58, 237, 0.05);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.06);
    box-shadow:
      inset 0 -6px 16px rgba(0, 0, 0, 0.28),
      inset 0 4px 12px rgba(220, 200, 255, 0.15),
      0 0 22px rgba(167, 139, 250, 0.65),
      0 0 50px rgba(124, 58, 237, 0.45),
      0 0 80px rgba(124, 58, 237, 0.28),
      0 0 130px rgba(124, 58, 237, 0.18),
      0 0 200px rgba(124, 58, 237, 0.08);
  }
}

/* === Sun Internal Energy Sweep (rotating highlight) === */
@keyframes sunInternalSweep {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* === Sun Internal Pulse (energy processing) === */
@keyframes sunInternalPulse {
  0%, 100% {
    opacity: 0.3;
    transform: scale(0.85);
  }
  30% {
    opacity: 0.7;
    transform: scale(1.1);
  }
  60% {
    opacity: 0.4;
    transform: scale(0.95);
  }
  80% {
    opacity: 0.65;
    transform: scale(1.05);
  }
}

/* === Onboarding Slide Transitions === */
@keyframes obSlideInRight {
  from {
    opacity: 0;
    transform: translateX(80px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes obSlideOutLeft {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(-80px);
  }
}

@keyframes obSlideInLeft {
  from {
    opacity: 0;
    transform: translateX(-80px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes obSlideOutRight {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(80px);
  }
}

/* === Onboarding Progress Shimmer === */
@keyframes obProgressShimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(200%); }
}

/* === Onboarding Checkmark Pop === */
@keyframes obCheckPop {
  from {
    opacity: 0;
    transform: scale(0.3);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* === Terminal Sequence Animations === */
@keyframes obTerminalEnter {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(15px);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
    filter: blur(0);
  }
}

@keyframes obTerminalExit {
  0% {
    opacity: 1;
    transform: scale(1) translateY(0);
    filter: blur(0) brightness(1);
  }
  50% {
    opacity: 0.6;
    filter: blur(2px) brightness(1.3);
  }
  100% {
    opacity: 0;
    transform: scale(1.04) translateY(-10px);
    filter: blur(8px) brightness(1.8);
  }
}

@keyframes obTermSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes obTermCheckPop {
  from {
    opacity: 0;
    transform: scale(0.2);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes scanDown {
  0%, 100% {
    top: 0;
    opacity: 0;
  }
  5% {
    opacity: 0.6;
  }
  50% {
    top: 100%;
    opacity: 0.15;
  }
  51%, 100% {
    opacity: 0;
  }
}

/* === Haptic feedback for native feel === */
@keyframes tapFeedback {
  0% { transform: scale(1); }
  50% { transform: scale(0.96); }
  100% { transform: scale(1); }
}

.tap-feedback:active {
  animation: tapFeedback 0.15s ease;
}

/* === Cinematic Core System Animations === */

@keyframes coreOuterPulse {
  0%, 100% {
    box-shadow: inset 0 0 20px rgba(167, 139, 250, 0.3), 0 0 30px rgba(124, 58, 237, 0.2);
  }
  50% {
    box-shadow: inset 0 0 35px rgba(167, 139, 250, 0.5), 0 0 50px rgba(124, 58, 237, 0.35);
  }
}

@keyframes coreEnergyPulse {
  0%, 100% { opacity: 0.4; transform: scale(0.95); }
  50% { opacity: 1; transform: scale(1.05); }
}

@keyframes coreSheenSweep {
  0%, 100% { transform: translateX(-150%) rotate(15deg); }
  50% { transform: translateX(150%) rotate(15deg); }
}

@keyframes holoShimmer {
  0%, 100% { background-position: 200% 200%; }
  50% { background-position: 0% 0%; }
}

@keyframes volRaysSpin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes orbitSegmentSpin {
  from { stroke-dashoffset: 0; }
  to { stroke-dashoffset: -104; }
}

@keyframes panelSlideInLeft {
  from { opacity: 0; transform: translateY(-50%) translateX(-30px); }
  to { opacity: 1; transform: translateY(-50%) translateX(0); }
}

@keyframes panelSlideInRight {
  from { opacity: 0; transform: translateY(-50%) translateX(30px); }
  to { opacity: 1; transform: translateY(-50%) translateX(0); }
}

/* === Core Breathe — gentle scale pulse === */
@keyframes coreBreathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.04); }
}

/* === Ambient Glow Pulse === */
@keyframes ambientGlowPulse {
  0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
  50%      { opacity: 0.8; transform: translate(-50%, -50%) scale(1.08); }
}

/* === Color tint shift — purple/cyan washes drift across the logo === */
@keyframes coreTintShift {
  0%, 100% {
    background: radial-gradient(ellipse at 30% 25%, rgba(139,92,246,0.2) 0%, rgba(124,58,237,0.12) 35%, rgba(57,255,20,0.06) 65%, transparent 85%);
  }
  33% {
    background: radial-gradient(ellipse at 70% 30%, rgba(57,255,20,0.1) 0%, rgba(57,255,20,0.06) 35%, rgba(139,92,246,0.08) 65%, transparent 85%);
  }
  66% {
    background: radial-gradient(ellipse at 45% 75%, rgba(167,139,250,0.18) 0%, rgba(139,92,246,0.1) 35%, rgba(57,255,20,0.04) 65%, transparent 85%);
  }
}

/* === Specular shimmer — radial highlight drifts position === */
@keyframes coreShimmer {
  0%, 100% {
    opacity: 0.5;
    background: radial-gradient(ellipse at 30% 25%, rgba(167,139,250,0.12) 0%, rgba(200,190,255,0.06) 30%, transparent 55%);
  }
  33% {
    opacity: 0.9;
    background: radial-gradient(ellipse at 65% 20%, rgba(57,255,20,0.08) 0%, rgba(200,190,255,0.06) 30%, transparent 55%);
  }
  66% {
    opacity: 0.6;
    background: radial-gradient(ellipse at 50% 70%, rgba(139,92,246,0.1) 0%, rgba(200,190,255,0.04) 30%, transparent 55%);
  }
}

/* === Logo brightness breathing — glow pulses with scene === */
@keyframes coreImgBreath {
  0%, 100% {
    filter: brightness(1.1) contrast(1.1) saturate(1.05)
      drop-shadow(0 0 25px rgba(167,139,250,0.5))
      drop-shadow(0 0 50px rgba(124,58,237,0.3))
      drop-shadow(0 0 90px rgba(76,29,149,0.2));
  }
  50% {
    filter: brightness(1.2) contrast(1.15) saturate(1.1)
      drop-shadow(0 0 35px rgba(167,139,250,0.7))
      drop-shadow(0 0 65px rgba(124,58,237,0.45))
      drop-shadow(0 0 110px rgba(76,29,149,0.3));
  }
}

/* === Neon Green Glow Pulse === */
@keyframes neonGreenGlowPulse {
  0%, 100% { text-shadow: 0 0 8px rgba(57,255,20,0.4), 0 0 20px rgba(57,255,20,0.15); }
  50%      { text-shadow: 0 0 12px rgba(57,255,20,0.6), 0 0 30px rgba(57,255,20,0.25); }
}

/* === Purple Neon Pulse === */
@keyframes purpleGlowPulse {
  0%, 100% { text-shadow: 0 0 6px rgba(139,92,246,0.4), 0 0 14px rgba(139,92,246,0.15); }
  50%      { text-shadow: 0 0 10px rgba(139,92,246,0.6), 0 0 24px rgba(139,92,246,0.25); }
}

/* === Neon Green Dot Pulse === */
@keyframes neonGreenDotPulse {
  0%, 100% { box-shadow: 0 0 6px rgba(57,255,20,0.4), 0 0 14px rgba(57,255,20,0.15); }
  50%      { box-shadow: 0 0 10px rgba(57,255,20,0.7), 0 0 24px rgba(57,255,20,0.3); }
}

/* === Neon Ring Pulse — breathing on/off glow === */
@keyframes neonRingPulse {
  0%, 100% {
    opacity: 0.3;
    filter: drop-shadow(0 0 3px rgba(139,92,246,0.3)) drop-shadow(0 0 8px rgba(139,92,246,0.1));
  }
  50% {
    opacity: 1;
    filter: drop-shadow(0 0 8px rgba(139,92,246,0.7)) drop-shadow(0 0 20px rgba(139,92,246,0.3)) drop-shadow(0 0 40px rgba(139,92,246,0.1));
  }
}

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