/* === 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;
}

/* === Monolith Rise Entry === */
@keyframes monolithRise {
  0% {
    opacity: 0;
    transform: translateY(80px) scaleY(0.85);
    filter: blur(6px) brightness(1.5);
  }
  40% {
    opacity: 0.7;
    filter: blur(2px) brightness(1.2);
  }
  70% {
    transform: translateY(-8px) scaleY(1.02);
    filter: blur(0) brightness(1.05);
  }
  85% {
    transform: translateY(3px) scaleY(0.99);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scaleY(1);
    filter: blur(0) brightness(1);
  }
}

/* === Monolith Scanning Line === */
@keyframes monolithScanline {
  0%, 100% {
    transform: translateY(0);
    opacity: 0;
  }
  5% {
    opacity: 0.7;
  }
  45% {
    transform: translateY(300px);
    opacity: 0.2;
  }
  46%, 100% {
    opacity: 0;
  }
}

/* === 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);
  }
}

/* === Staggered Monolith Entry === */
.monolith-stagger > .monolith-wrapper {
  animation: monolithRise 0.9s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.monolith-stagger > .monolith-wrapper:nth-child(1) { animation-delay: 0.15s; }
.monolith-stagger > .monolith-wrapper:nth-child(2) { animation-delay: 0.35s; }
.monolith-stagger > .monolith-wrapper:nth-child(3) { animation-delay: 0.55s; }
.monolith-stagger > .monolith-wrapper:nth-child(4) { animation-delay: 0.75s; }
.monolith-stagger > .monolith-wrapper:nth-child(5) { animation-delay: 0.95s; }

/* === 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;
}
