/* AB24 — animation utilities
   Driven by main.js toggling [data-inview] via IntersectionObserver.
   Everything here is inert when prefers-reduced-motion is set. */

/* Every opacity:0 starting state below is scoped under .js (added by an
   inline script in <head> before first paint). If JavaScript fails to load
   or run, none of these rules apply and content renders fully visible —
   scroll-reveal is a progressive enhancement, never a visibility gate. */

.js [data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--duration-slow) var(--ease-standard),
              transform var(--duration-slow) var(--ease-standard);
}

.js [data-reveal][data-inview="true"] {
  opacity: 1;
  transform: none;
}

.js [data-reveal="fade"] {
  transform: none;
}

.js [data-reveal="image"] {
  transform: scale(1.04);
}

.js [data-reveal="image"][data-inview="true"] {
  transform: none;
}

/* Staggered children (service cards, gallery tiles, feature rows) */
.js [data-reveal-group] > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--duration-base) var(--ease-standard),
              transform var(--duration-base) var(--ease-standard);
}

.js [data-reveal-group][data-inview="true"] > * {
  opacity: 1;
  transform: none;
}

.js [data-reveal-group][data-inview="true"] > *:nth-child(1) { transition-delay: 0ms; }
.js [data-reveal-group][data-inview="true"] > *:nth-child(2) { transition-delay: 70ms; }
.js [data-reveal-group][data-inview="true"] > *:nth-child(3) { transition-delay: 140ms; }
.js [data-reveal-group][data-inview="true"] > *:nth-child(4) { transition-delay: 210ms; }
.js [data-reveal-group][data-inview="true"] > *:nth-child(5) { transition-delay: 280ms; }
.js [data-reveal-group][data-inview="true"] > *:nth-child(6) { transition-delay: 350ms; }
.js [data-reveal-group][data-inview="true"] > *:nth-child(7) { transition-delay: 420ms; }
.js [data-reveal-group][data-inview="true"] > *:nth-child(8) { transition-delay: 490ms; }

/* Hero text reveal */
.js .hero-reveal > * {
  opacity: 0;
  transform: translateY(18px);
  animation: ab24-rise var(--duration-slow) var(--ease-standard) forwards;
}

.js .hero-reveal > *:nth-child(1) { animation-delay: 80ms; }
.js .hero-reveal > *:nth-child(2) { animation-delay: 200ms; }
.js .hero-reveal > *:nth-child(3) { animation-delay: 320ms; }
.js .hero-reveal > *:nth-child(4) { animation-delay: 440ms; }

@keyframes ab24-rise {
  to {
    opacity: 1;
    transform: none;
  }
}

/* Count-up number swap target */
[data-count-to] {
  font-variant-numeric: tabular-nums;
}

/* Mobile menu handled via transform transition in components.css;
   this just governs the backdrop fade if present. */
.mobile-nav-backdrop {
  opacity: 0;
  transition: opacity var(--duration-base) var(--ease-standard);
}

.mobile-nav-backdrop[data-open="true"] {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  [data-reveal],
  [data-reveal-group] > *,
  .hero-reveal > * {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
    transition: none !important;
  }

  html {
    scroll-behavior: auto;
  }

  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
