/* Animations - GPU-Accelerated Only (transform & opacity) */

/* ===== AURORA UI MESH GRADIENT (60s+ cycle) ===== */
@keyframes aurora-gradient {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes aurora-hue-rotate {
  0% {
    filter: hue-rotate(0deg);
  }
  100% {
    filter: hue-rotate(360deg);
  }
}

/* ===== SCROLL REVEAL ANIMATIONS ===== */
.reveal-up {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity var(--transition-slow), transform var(--transition-slow);
}

.reveal-up.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered delays for multiple elements */
.reveal-up:nth-child(1) {
  transition-delay: 0ms;
}

.reveal-up:nth-child(2) {
  transition-delay: 100ms;
}

.reveal-up:nth-child(3) {
  transition-delay: 200ms;
}

.reveal-up:nth-child(4) {
  transition-delay: 300ms;
}

.reveal-up:nth-child(5) {
  transition-delay: 400ms;
}

/* ===== FADE ANIMATIONS ===== */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

.fade-in {
  animation: fadeIn var(--transition-base) ease-in;
}

.fade-out {
  animation: fadeOut var(--transition-base) ease-out;
}

/* ===== SLIDE ANIMATIONS ===== */
@keyframes slideInFromLeft {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

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

@keyframes slideInFromBottom {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ===== SCALE ANIMATIONS ===== */
@keyframes scaleIn {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* ===== PULSE ANIMATION ===== */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ===== SHIMMER EFFECT (for skeleton loaders) ===== */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* ===== FLOAT ANIMATION ===== */
@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.float {
  animation: float 3s ease-in-out infinite;
}

/* ===== ROTATE ANIMATION ===== */
@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* ===== HOVER TRANSITIONS ===== */
.hover-lift {
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-lift:hover {
  transform: translateY(-4px);
}

.hover-scale {
  transition: transform var(--transition-base);
}

.hover-scale:hover {
  transform: scale(1.02);
}

/* ===== LOADING SPINNER ===== */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-bg-secondary);
  border-top-color: var(--color-accent-primary);
  border-radius: 50%;
  animation: rotate 1s linear infinite;
}

/* ===== SMOOTH SCROLL ===== */
html {
  scroll-behavior: smooth;
}

/* ===== REDUCED MOTION SUPPORT ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .reveal-up {
    opacity: 1;
    transform: none;
  }
  
  .aurora-gradient {
    animation: none !important;
  }
  
  html {
    scroll-behavior: auto;
  }
}

/* ===== ENTRANCE ANIMATIONS ===== */
.animate-in {
  animation-duration: var(--transition-slow);
  animation-fill-mode: both;
}

.animate-in-1 {
  animation-delay: 100ms;
}

.animate-in-2 {
  animation-delay: 200ms;
}

.animate-in-3 {
  animation-delay: 300ms;
}

.animate-in-4 {
  animation-delay: 400ms;
}

.animate-in-5 {
  animation-delay: 500ms;
}

/* ===== SLIDE IN ANIMATIONS ===== */
.slide-in-left {
  animation-name: slideInFromLeft;
}

.slide-in-right {
  animation-name: slideInFromRight;
}

.slide-in-bottom {
  animation-name: slideInFromBottom;
}

/* ===== SCALE IN ANIMATION ===== */
.scale-in {
  animation-name: scaleIn;
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */
/* Use will-change for elements that will animate */
.will-animate {
  will-change: transform, opacity;
}

/* Remove will-change after animation completes */
.animation-complete {
  will-change: auto;
}

/* ===== TRANSITION UTILITIES ===== */
.transition-fast {
  transition: all var(--transition-fast);
}

.transition-base {
  transition: all var(--transition-base);
}

.transition-slow {
  transition: all var(--transition-slow);
}

.transition-transform {
  transition: transform var(--transition-base);
}

.transition-opacity {
  transition: opacity var(--transition-base);
}

/* ===== BACKDROP BLUR (Glassmorphism) ===== */
.backdrop-blur {
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
}

.backdrop-blur-sm {
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.backdrop-blur-lg {
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

/* ===== PERSPECTIVE TILT (3D effect) ===== */
.tilt-3d {
  transform-style: preserve-3d;
  transition: transform var(--transition-base);
}

.tilt-3d:hover {
  transform: perspective(1000px) rotateX(2deg) rotateY(-2deg);
}

/* ===== GLOW EFFECT ===== */
@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(3, 105, 161, 0.3);
  }
  50% {
    box-shadow: 0 0 30px rgba(3, 105, 161, 0.5);
  }
}

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

/* ===== SAFE ANIMATIONS (No duration > 500ms) ===== */
/* All animations are kept under 500ms as per anti-patterns */
.safe-transition {
  transition-duration: 300ms;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== STAGGER UTILITY ===== */
.stagger-1 { animation-delay: 100ms; }
.stagger-2 { animation-delay: 200ms; }
.stagger-3 { animation-delay: 300ms; }
.stagger-4 { animation-delay: 400ms; }
.stagger-5 { animation-delay: 500ms; }
