/* ============================================
   AstroVault Animations
   ============================================ */

/* Fade In */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInDown { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInLeft { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes fadeInRight { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes fadeInScale { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }

.animate-fade-in      { animation: fadeIn 0.5s ease forwards; }
.animate-fade-in-up   { animation: fadeInUp 0.5s ease forwards; }
.animate-fade-in-down { animation: fadeInDown 0.5s ease forwards; }
.animate-fade-in-left { animation: fadeInLeft 0.5s ease forwards; }
.animate-fade-in-right{ animation: fadeInRight 0.5s ease forwards; }
.animate-fade-in-scale{ animation: fadeInScale 0.5s ease forwards; }

/* Staggered Delays */
.delay-1 { animation-delay: 0.1s; opacity: 0; }
.delay-2 { animation-delay: 0.2s; opacity: 0; }
.delay-3 { animation-delay: 0.3s; opacity: 0; }
.delay-4 { animation-delay: 0.4s; opacity: 0; }
.delay-5 { animation-delay: 0.5s; opacity: 0; }
.delay-6 { animation-delay: 0.6s; opacity: 0; }

/* Pulse / Glow */
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }
@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 10px rgba(240, 194, 127, 0.2); }
  50% { box-shadow: 0 0 25px rgba(240, 194, 127, 0.5); }
}
.animate-pulse { animation: pulse 2s ease-in-out infinite; }
.animate-glow  { animation: glowPulse 2s ease-in-out infinite; }

/* Spin */
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes spinSlow { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.animate-spin     { animation: spin 1s linear infinite; }
.animate-spin-slow{ animation: spinSlow 20s linear infinite; }

/* Float */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.animate-float { animation: float 4s ease-in-out infinite; }

/* Star Twinkle */
@keyframes twinkle {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}
.animate-twinkle { animation: twinkle 3s ease-in-out infinite; }

/* Particle Drift */
@keyframes drift {
  0% { transform: translate(0, 0) rotate(0deg); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translate(var(--drift-x, 100px), var(--drift-y, -200px)) rotate(360deg); opacity: 0; }
}

/* Gradient Shift (for backgrounds) */
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.animate-gradient {
  background-size: 200% 200%;
  animation: gradientShift 8s ease infinite;
}

/* Typing Indicator */
@keyframes typingDot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

.typing-indicator {
  display: inline-flex;
  gap: 4px;
  padding: var(--space-3) var(--space-4);
}
.typing-indicator span {
  width: 8px; height: 8px;
  background: var(--color-accent-teal);
  border-radius: var(--radius-full);
  animation: typingDot 1.4s ease-in-out infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

/* Star Field Background */
.starfield {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: -1;
  pointer-events: none;
}
.star {
  position: absolute;
  width: 2px; height: 2px;
  background: white;
  border-radius: 50%;
  animation: twinkle var(--star-duration, 3s) ease-in-out infinite;
  animation-delay: var(--star-delay, 0s);
  opacity: 0.3;
}

/* Constellation Lines */
@keyframes constellationDraw {
  from { stroke-dashoffset: 1000; }
  to { stroke-dashoffset: 0; }
}
.constellation-line {
  stroke: rgba(240, 194, 127, 0.2);
  stroke-width: 1;
  stroke-dasharray: 1000;
  animation: constellationDraw 3s ease forwards;
}

/* Page Transition */
.page-enter { animation: fadeInUp 0.4s ease forwards; }
.page-exit  { animation: fadeIn 0.3s ease reverse forwards; }

/* Hover Scale */
.hover-scale { transition: transform var(--transition-base); }
.hover-scale:hover { transform: scale(1.03); }

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