/**
 * Scroll Animation Styles
 * Smooth, performant animations triggered on scroll
 */

/* ============================================
   FADE IN + SLIDE UP
   ============================================ */

[data-scroll-animation="fade-up"] {
  opacity: 0;
  transform: translateY(2.5rem);
  transition: opacity 0.7s cubic-bezier(0.34, 1.56, 0.64, 1),
              transform 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}

[data-scroll-animation="fade-up"].scroll-fade-up-active {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================
   SCALE IN + FADE
   ============================================ */

[data-scroll-animation="scale"] {
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.6s ease-out,
              transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

[data-scroll-animation="scale"].scroll-scale-active {
  opacity: 1;
  transform: scale(1);
}

/* ============================================
   SLIDE IN FROM LEFT
   ============================================ */

[data-scroll-animation="slide-left"] {
  opacity: 0;
  transform: translateX(-3rem);
  transition: opacity 0.7s ease-out,
              transform 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}

[data-scroll-animation="slide-left"].scroll-slide-left-active {
  opacity: 1;
  transform: translateX(0);
}

/* ============================================
   SLIDE IN FROM RIGHT
   ============================================ */

[data-scroll-animation="slide-right"] {
  opacity: 0;
  transform: translateX(3rem);
  transition: opacity 0.7s ease-out,
              transform 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}

[data-scroll-animation="slide-right"].scroll-slide-right-active {
  opacity: 1;
  transform: translateX(0);
}

/* ============================================
   STAGGERED CHILDREN
   ============================================ */

.scroll-stagger-child {
  opacity: 0;
  transform: translateY(1.5rem);
  transition: opacity 0.6s ease-out,
              transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  transition-delay: calc(var(--stagger-index, 0) * 0.1s);
}

[data-scroll-animation="stagger"].scroll-stagger-active .scroll-stagger-child {
  opacity: 1;
  transform: translateY(0);
}

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

[data-scroll-animation="counter"] {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  transition: color 0.3s ease;
}

[data-scroll-animation="counter"]:hover {
  color: rgb(16, 185, 129); /* emerald-500 */
}

/* ============================================
   TEXT REVEAL
   ============================================ */

[data-scroll-animation="text-reveal"] {
  overflow: hidden;
}

.scroll-text-reveal-item {
  display: inline-block;
  opacity: 0;
  transform: translateY(0.5rem);
  animation: none;
}

[data-scroll-animation="text-reveal"].scroll-text-reveal-active .scroll-text-reveal-item {
  animation: scrollTextReveal 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  animation-delay: calc(var(--reveal-index, 0) * 0.04s);
}

@keyframes scrollTextReveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   PARALLAX EFFECT
   ============================================ */

[data-scroll-parallax] {
  will-change: transform;
}

/* ============================================
   GRADIENT SHIFT ANIMATION
   ============================================ */

.scroll-gradient-shift {
  background-size: 200% 200%;
  animation: gradientShift 8s ease infinite;
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* ============================================
   SECTION REVEAL (Combine for sections)
   ============================================ */

.scroll-section-reveal {
  opacity: 0;
  transition: opacity 0.8s ease-out;
}

.scroll-section-reveal.active {
  opacity: 1;
}

/* ============================================
   HOVER ENHANCEMENT FOR ANIMATED ELEMENTS
   ============================================ */

[data-scroll-animation="scale"].scroll-scale-active {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

[data-scroll-animation="scale"].scroll-scale-active:hover {
  transform: scale(1.02);
}

/* Cards with fade-up get a subtle hover lift */
.lp-card[data-scroll-animation="fade-up"].scroll-fade-up-active:hover {
  transform: translateY(-4px);
  transition: transform 0.3s ease;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 640px) {
  [data-scroll-animation="fade-up"] {
    transform: translateY(1.5rem);
  }

  [data-scroll-animation="slide-left"] {
    transform: translateX(-2rem);
  }

  [data-scroll-animation="slide-right"] {
    transform: translateX(2rem);
  }

  [data-scroll-animation="scale"] {
    transform: scale(0.95);
  }

  .scroll-stagger-child {
    transition-delay: calc(var(--stagger-index, 0) * 0.08s);
  }
}

/* ============================================
   LIGHT MODE / DARK MODE COMPATIBILITY
   ============================================ */

@media (prefers-color-scheme: dark) {
  [data-scroll-animation="counter"]:hover {
    color: rgb(16, 185, 129);
  }
}

/* ============================================
   REDUCE 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;
  }

  [data-scroll-animation] {
    opacity: 1 !important;
    transform: none !important;
  }

  [data-scroll-animation="stagger"] .scroll-stagger-child {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ============================================
   PERFORMANCE OPTIMIZATION
   ============================================ */

[data-scroll-animation],
[data-scroll-parallax] {
  will-change: auto;
}

.scroll-stagger-child {
  will-change: auto;
}

/* Enable GPU acceleration for smooth animations */
[data-scroll-animation="fade-up"],
[data-scroll-animation="scale"],
[data-scroll-animation="slide-left"],
[data-scroll-animation="slide-right"],
.scroll-stagger-child {
  backface-visibility: hidden;
  -webkit-font-smoothing: antialiased;
}
