/* ========================================
   ANIMATIONS
   ======================================== */

/* === KEYFRAMES === */

/* Neural pulse animation */
@keyframes neuralPulse {
  0% {
    opacity: 0.3;
    transform: scale(0.8);
  }
  50% {
    opacity: 1;
    transform: scale(1.2);
  }
  100% {
    opacity: 0.3;
    transform: scale(0.8);
  }
}

/* Connection line draw animation */
@keyframes drawLine {
  0% {
    stroke-dashoffset: 1000;
  }
  100% {
    stroke-dashoffset: 0;
  }
}

/* Floating animation for neural nodes */
@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-20px);
  }
}

/* Glow pulse animation */
@keyframes glowPulse {
  0%, 100% {
    box-shadow: 0 0 20px var(--color-neural-glow);
  }
  50% {
    box-shadow: 0 0 40px var(--color-neural-glow), 0 0 60px var(--color-neural-glow);
  }
}

/* Text shimmer animation */
@keyframes shimmer {
  0% {
    background-position: -200% center;
  }
  100% {
    background-position: 200% center;
  }
}

/* Fade in from bottom animation */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade in from left animation */
@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Fade in from right animation */
@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

/* === ANIMATION CLASSES === */

/* Scroll-triggered animations */
.animate-on-scroll {
  opacity: 0;
  transition: var(--transition-slow);
}

.animate-on-scroll.in-view {
  opacity: 1;
}

.fade-up {
  transform: translateY(30px);
}

.fade-up.in-view {
  transform: translateY(0);
}

.fade-left {
  transform: translateX(-30px);
}

.fade-left.in-view {
  transform: translateX(0);
}

.fade-right {
  transform: translateX(30px);
}

.fade-right.in-view {
  transform: translateX(0);
}

.scale-in {
  transform: scale(0.8);
}

.scale-in.in-view {
  transform: scale(1);
}

/* Particle-specific animations */
.particle-glow {
  animation: glowPulse 4s ease-in-out infinite;
}

/* Text effects */
.text-shimmer {
  background: linear-gradient(90deg, transparent, var(--color-neural-primary), transparent);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 3s ease-in-out infinite;
}

/* Hover animations */
.hover-lift {
  transition: var(--transition-all);
}

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

.hover-glow {
  transition: var(--transition-all);
}

.hover-glow:hover {
  box-shadow: var(--shadow-neural);
}

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

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

/* Loading animations */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-gray-700);
  border-top: 3px solid var(--color-neural-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Staggered animations */
.stagger-animation > * {
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.6s ease-out forwards;
}

.stagger-animation > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-animation > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-animation > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-animation > *:nth-child(4) { animation-delay: 0.4s; }
.stagger-animation > *:nth-child(5) { animation-delay: 0.5s; }
.stagger-animation > *:nth-child(6) { animation-delay: 0.6s; }

/* Parallax effects */
.parallax-element {
  transform: translateZ(0);
  will-change: transform;
}

/* Performance optimizations */
.gpu-accelerated {
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
}

/* Reduced motion preferences */
@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;
  }
  
  .particle-glow,
  .text-shimmer,
  .loading-spinner {
    animation: none !important;
  }
}

/* === CANVAS ANIMATIONS === */
.neural-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: var(--z-0);
}

/* Intersection observer triggered animations */
.reveal {
  opacity: 0;
  transform: translateY(50px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

.reveal-left {
  opacity: 0;
  transform: translateX(-50px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.reveal-left.active {
  opacity: 1;
  transform: translateX(0);
}

.reveal-right {
  opacity: 0;
  transform: translateX(50px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.reveal-right.active {
  opacity: 1;
  transform: translateX(0);
}

.reveal-scale {
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.reveal-scale.active {
  opacity: 1;
  transform: scale(1);
}

/* Delay classes for staggered reveals */
.delay-1 { transition-delay: 0.1s; }
.delay-2 { transition-delay: 0.2s; }
.delay-3 { transition-delay: 0.3s; }
.delay-4 { transition-delay: 0.4s; }
.delay-5 { transition-delay: 0.5s; }