/**
 * Animation Styles
 * ================
 * Keyframes, transitions, and scroll reveal animations.
 */

/* ===========================================
   SCROLL REVEAL
   =========================================== */

.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition:
    opacity var(--duration-slower) var(--ease-out),
    transform var(--duration-slower) var(--ease-out);
}

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

/* Reveal Directions */
.reveal--up {
  transform: translateY(40px);
}

.reveal--down {
  transform: translateY(-40px);
}

.reveal--left {
  transform: translateX(40px);
}

.reveal--right {
  transform: translateX(-40px);
}

.reveal--scale {
  transform: scale(0.95);
}

.reveal--up.revealed,
.reveal--down.revealed,
.reveal--left.revealed,
.reveal--right.revealed,
.reveal--scale.revealed {
  transform: translate(0, 0) scale(1);
}

/* Reveal Delays */
.reveal-delay-1 { transition-delay: 100ms; }
.reveal-delay-2 { transition-delay: 200ms; }
.reveal-delay-3 { transition-delay: 300ms; }
.reveal-delay-4 { transition-delay: 400ms; }
.reveal-delay-5 { transition-delay: 500ms; }
.reveal-delay-6 { transition-delay: 600ms; }

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

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

/* Gradient Animation */
@keyframes hero-gradient {
  0%, 100% {
    transform: translate(0, 0) rotate(0deg);
  }
  25% {
    transform: translate(2%, 2%) rotate(1deg);
  }
  50% {
    transform: translate(-1%, 1%) rotate(-0.5deg);
  }
  75% {
    transform: translate(1%, -2%) rotate(0.5deg);
  }
}

.hero__bg-gradient {
  animation: hero-gradient 20s ease-in-out infinite;
}

/* Floating Particles */
@keyframes float {
  0%, 100% {
    transform: translate(0, 0) scale(1);
    opacity: 0.3;
  }
  25% {
    transform: translate(20px, -30px) scale(1.2);
    opacity: 0.5;
  }
  50% {
    transform: translate(-15px, -20px) scale(0.8);
    opacity: 0.2;
  }
  75% {
    transform: translate(25px, 10px) scale(1.1);
    opacity: 0.4;
  }
}

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

.particle:nth-child(1) { animation-delay: 0s; animation-duration: 12s; }
.particle:nth-child(2) { animation-delay: 2s; animation-duration: 18s; }
.particle:nth-child(3) { animation-delay: 4s; animation-duration: 14s; }
.particle:nth-child(4) { animation-delay: 6s; animation-duration: 16s; }
.particle:nth-child(5) { animation-delay: 8s; animation-duration: 20s; }
.particle:nth-child(6) { animation-delay: 1s; animation-duration: 13s; }
.particle:nth-child(7) { animation-delay: 3s; animation-duration: 17s; }
.particle:nth-child(8) { animation-delay: 5s; animation-duration: 15s; }

/* Scroll Indicator */
@keyframes scroll-bounce {
  0%, 100% {
    transform: translateY(0);
    opacity: 1;
  }
  50% {
    transform: translateY(8px);
    opacity: 0.5;
  }
}

.scroll-indicator {
  animation: scroll-bounce 2s ease-in-out infinite;
}

/* ===========================================
   COUNTER ANIMATION
   =========================================== */

@keyframes count-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.counter-animate {
  animation: count-up 0.5s var(--ease-out) forwards;
}

/* ===========================================
   PULSE & GLOW
   =========================================== */

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

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

@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 20px var(--color-accent-glow);
  }
  50% {
    box-shadow: 0 0 40px var(--color-accent-glow);
  }
}

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

/* ===========================================
   SPIN & ROTATE
   =========================================== */

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

.animate-spin {
  animation: spin 1s linear infinite;
}

.animate-spin-slow {
  animation: spin 3s linear infinite;
}

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

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fade-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

.animate-fade-in {
  animation: fade-in var(--duration-normal) var(--ease-out) forwards;
}

.animate-fade-out {
  animation: fade-out var(--duration-normal) var(--ease-out) forwards;
}

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

@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slide-down {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slide-left {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slide-right {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.animate-slide-up {
  animation: slide-up var(--duration-slow) var(--ease-out) forwards;
}

.animate-slide-down {
  animation: slide-down var(--duration-slow) var(--ease-out) forwards;
}

.animate-slide-left {
  animation: slide-left var(--duration-slow) var(--ease-out) forwards;
}

.animate-slide-right {
  animation: slide-right var(--duration-slow) var(--ease-out) forwards;
}

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

@keyframes scale-in {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes scale-out {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.9);
  }
}

.animate-scale-in {
  animation: scale-in var(--duration-normal) var(--ease-out) forwards;
}

/* ===========================================
   HOVER TRANSITIONS
   =========================================== */

.hover-lift {
  transition: transform var(--transition-normal);
}

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

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

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

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

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

/* ===========================================
   PROGRESS BAR
   =========================================== */

@keyframes progress-fill {
  from {
    width: 0;
  }
}

.progress-bar {
  height: 8px;
  background: var(--color-bg-surface);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-accent-500), var(--color-accent-400));
  border-radius: var(--radius-full);
  animation: progress-fill 1s var(--ease-out) forwards;
}

/* ===========================================
   TYPING CURSOR
   =========================================== */

@keyframes blink {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

.typing-cursor::after {
  content: '|';
  animation: blink 1s step-end infinite;
  margin-left: 2px;
  color: var(--color-accent);
}

/* ===========================================
   PAGE TRANSITION OVERLAY
   =========================================== */

.page-transition-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-bg-primary);
  z-index: var(--z-modal);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--duration-normal) var(--ease-out),
    visibility var(--duration-normal);
}

.page-transition-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ===========================================
   REDUCED MOTION
   =========================================== */

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .particle,
  .hero__bg-gradient,
  .scroll-indicator,
  .animate-pulse,
  .animate-glow,
  .animate-spin,
  .animate-spin-slow {
    animation: none;
  }

  .hover-lift:hover,
  .hover-scale:hover {
    transform: none;
  }
}
