/* ============================================
   PAGE TRANSITIONS & ANIMATIONS
   ============================================ */

/* Page fade in/out */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* Slide up animation */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Scale in animation */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Pulse animation */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Glow animation */
@keyframes glow {
  0%, 100% {
    box-shadow: var(--brand-glow-soft);
  }
  50% {
    box-shadow: var(--brand-glow-strong);
  }
}

/* Page transition classes */
.page-enter {
  animation: fadeIn 400ms ease-in-out;
}

.page-exit {
  animation: fadeOut 300ms ease-in-out;
}

.content-enter {
  animation: slideUp 500ms ease-out;
}

/* Element animations */
.animate-fade-in {
  animation: fadeIn 600ms ease-in-out;
}

.animate-slide-up {
  animation: slideUp 600ms ease-out;
}

.animate-scale-in {
  animation: scaleIn 400ms ease-out;
}

.animate-pulse {
  animation: pulse 2s infinite;
}

.animate-glow {
  animation: glow 3s infinite;
}

/* Staggered animations */
.stagger-children > * {
  animation: slideUp 600ms ease-out;
}

.stagger-children > *:nth-child(1) { animation-delay: 0ms; }
.stagger-children > *:nth-child(2) { animation-delay: 100ms; }
.stagger-children > *:nth-child(3) { animation-delay: 200ms; }
.stagger-children > *:nth-child(4) { animation-delay: 300ms; }
.stagger-children > *:nth-child(5) { animation-delay: 400ms; }
.stagger-children > *:nth-child(6) { animation-delay: 500ms; }

/* Smooth transitions for theme switching */
html {
  transition: background-color 300ms ease-in-out, color 300ms ease-in-out;
}

/* Optional link hover utility (opt-in) */
.link-underline {
  position: relative;
}

.link-underline::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: currentColor;
  transition: width var(--transition-fast);
}

.link-underline:hover::after {
  width: 100%;
}

/* Button animations */
button {
  transition: all var(--transition-fast);
}

/* Card animations */
.card {
  transition: all var(--transition-base);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

/* Navbar animations */
.navbar {
  transition: all var(--transition-base);
}

/* Scroll animations */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

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