/**
 * Scroll Animations CSS
 * Uses CSS transforms for hardware-accelerated, performant animations
 * Works with Intersection Observer in js/scroll-animations.js
 */

/* ==========================================================================
   Base Animation Setup
   ========================================================================== */

/**
 * Elements with scroll animation classes start hidden/transformed
 * They become visible when .is-visible class is added by Intersection Observer
 */

/* Fade In - Basic fade effect */
.fade-in {
  opacity: 0;
  transition: opacity 0.6s ease-out;
}

.fade-in.is-visible {
  opacity: 1;
}

/* Fade In Up - Fade with upward movement */
.fade-in-up {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

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

/* Fade In Down - Fade with downward movement */
.fade-in-down {
  opacity: 0;
  transform: translateY(-30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in-down.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Fade In Left - Fade with leftward movement (element slides in from right) */
.fade-in-left {
  opacity: 0;
  transform: translateX(30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in-left.is-visible {
  opacity: 1;
  transform: translateX(0);
}

/* Fade In Right - Fade with rightward movement (element slides in from left) */
.fade-in-right {
  opacity: 0;
  transform: translateX(-30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in-right.is-visible {
  opacity: 1;
  transform: translateX(0);
}

/* Scale In - Fade with scale effect */
.scale-in {
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.scale-in.is-visible {
  opacity: 1;
  transform: scale(1);
}

/* Scale In Up - Combine scale with upward movement */
.scale-in-up {
  opacity: 0;
  transform: scale(0.9) translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

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

/* ==========================================================================
   Animation Timing Modifiers
   ========================================================================== */

/* Delay modifiers - stagger animations for child elements */
.delay-100 {
  transition-delay: 0.1s;
}

.delay-200 {
  transition-delay: 0.2s;
}

.delay-300 {
  transition-delay: 0.3s;
}

.delay-400 {
  transition-delay: 0.4s;
}

.delay-500 {
  transition-delay: 0.5s;
}

.delay-600 {
  transition-delay: 0.6s;
}

.delay-700 {
  transition-delay: 0.7s;
}

.delay-800 {
  transition-delay: 0.8s;
}

/* Duration modifiers */
.duration-fast {
  transition-duration: 0.3s;
}

.duration-normal {
  transition-duration: 0.6s;
}

.duration-slow {
  transition-duration: 0.9s;
}

.duration-slower {
  transition-duration: 1.2s;
}

/* ==========================================================================
   Easing Modifiers
   ========================================================================== */

.ease-linear {
  transition-timing-function: linear;
}

.ease-in {
  transition-timing-function: ease-in;
}

.ease-out {
  transition-timing-function: ease-out;
}

.ease-in-out {
  transition-timing-function: ease-in-out;
}

/* Custom cubic-bezier for more dynamic feel */
.ease-bounce {
  transition-timing-function: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.ease-smooth {
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   Stagger Animation for Child Elements
   ========================================================================== */

/**
 * Apply .stagger-children to a parent element
 * Each direct child will animate with increasing delay
 */
.stagger-children > *:nth-child(1) { transition-delay: 0s; }
.stagger-children > *:nth-child(2) { transition-delay: 0.1s; }
.stagger-children > *:nth-child(3) { transition-delay: 0.2s; }
.stagger-children > *:nth-child(4) { transition-delay: 0.3s; }
.stagger-children > *:nth-child(5) { transition-delay: 0.4s; }
.stagger-children > *:nth-child(6) { transition-delay: 0.5s; }
.stagger-children > *:nth-child(7) { transition-delay: 0.6s; }
.stagger-children > *:nth-child(8) { transition-delay: 0.7s; }
.stagger-children > *:nth-child(9) { transition-delay: 0.8s; }
.stagger-children > *:nth-child(10) { transition-delay: 0.9s; }

/* ==========================================================================
   Accessibility: Reduced Motion
   ========================================================================== */

/**
 * Respect user's motion preferences
 * Disables animations for users who prefer reduced motion
 */
@media (prefers-reduced-motion: reduce) {
  .fade-in,
  .fade-in-up,
  .fade-in-down,
  .fade-in-left,
  .fade-in-right,
  .scale-in,
  .scale-in-up {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .stagger-children > * {
    transition-delay: 0s;
  }
}
