/* Scroll + page motion — .motion-ready set by animations.js (graceful no-JS) */

:root {
  --motion-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --motion-duration: 0.75s;
  --motion-duration-snappy: 0.55s;
}

/* First paint: no hidden content until JS opts in */
.motion-ready .motion-section:not(.is-inview):not(.motion-section--hero) {
  opacity: 0;
  transform: translate3d(0, 1.75rem, 0);
  will-change: opacity, transform;
}

.motion-ready .motion-section--hero:not(.is-inview) {
  opacity: 0;
  transform: translate3d(0, 1.25rem, 0);
  will-change: opacity, transform;
}

.motion-ready .motion-section.is-inview {
  opacity: 1;
  transform: none;
  transition:
    opacity var(--motion-duration) var(--motion-ease),
    transform var(--motion-duration) var(--motion-ease);
}

.motion-ready .motion-section--hero.is-inview {
  transition:
    opacity 0.85s var(--motion-ease),
    transform 0.85s var(--motion-ease);
}

/* Nested grid stagger when section is visible */
.motion-ready .motion-section.is-inview .stat-card {
  animation: motion-pop var(--motion-duration-snappy) var(--motion-ease) backwards;
}

.motion-ready .motion-section.is-inview .stat-card:nth-child(1) {
  animation-delay: 0.05s;
}

.motion-ready .motion-section.is-inview .stat-card:nth-child(2) {
  animation-delay: 0.12s;
}

.motion-ready .motion-section.is-inview .stat-card:nth-child(3) {
  animation-delay: 0.19s;
}

.motion-ready .motion-section.is-inview .stat-card:nth-child(4) {
  animation-delay: 0.26s;
}

.motion-ready .motion-section.is-inview .stat-card:nth-child(n + 5) {
  animation-delay: 0.32s;
}

.motion-ready .motion-section.is-inview .feature-row .feature {
  animation: motion-pop var(--motion-duration-snappy) var(--motion-ease) backwards;
}

.motion-ready .motion-section.is-inview .feature-row .feature:nth-child(1) {
  animation-delay: 0.06s;
}

.motion-ready .motion-section.is-inview .feature-row .feature:nth-child(2) {
  animation-delay: 0.12s;
}

.motion-ready .motion-section.is-inview .feature-row .feature:nth-child(3) {
  animation-delay: 0.18s;
}

.motion-ready .motion-section.is-inview .feature-row .feature:nth-child(4) {
  animation-delay: 0.24s;
}

.motion-ready .motion-section.is-inview .feature-row .feature:nth-child(n + 5) {
  animation-delay: 0.3s;
}

.motion-ready .motion-section.is-inview .highlights-gallery__cell {
  animation: motion-gallery-reveal var(--motion-duration-snappy) var(--motion-ease) backwards;
}

.motion-ready .motion-section.is-inview .highlights-gallery__cell:nth-child(1) {
  animation-delay: 0.04s;
}

.motion-ready .motion-section.is-inview .highlights-gallery__cell:nth-child(2) {
  animation-delay: 0.09s;
}

.motion-ready .motion-section.is-inview .highlights-gallery__cell:nth-child(3) {
  animation-delay: 0.14s;
}

.motion-ready .motion-section.is-inview .highlights-gallery__cell:nth-child(4) {
  animation-delay: 0.19s;
}

.motion-ready .motion-section.is-inview .highlights-gallery__cell:nth-child(5) {
  animation-delay: 0.24s;
}

.motion-ready .motion-section.is-inview .highlights-gallery__cell:nth-child(6) {
  animation-delay: 0.29s;
}

.motion-ready .motion-section.is-inview .highlights-gallery__cell:nth-child(7) {
  animation-delay: 0.34s;
}

.motion-ready .motion-section.is-inview .highlights-gallery__cell:nth-child(n + 8) {
  animation-delay: 0.38s;
}

.motion-ready .motion-section.is-inview .gallery-full__item {
  animation: motion-gallery-reveal var(--motion-duration-snappy) var(--motion-ease) backwards;
}

.motion-ready .motion-section.is-inview .gallery-full__item:nth-child(1) {
  animation-delay: 0.02s;
}

.motion-ready .motion-section.is-inview .gallery-full__item:nth-child(2) {
  animation-delay: 0.04s;
}

.motion-ready .motion-section.is-inview .gallery-full__item:nth-child(3) {
  animation-delay: 0.06s;
}

.motion-ready .motion-section.is-inview .gallery-full__item:nth-child(4) {
  animation-delay: 0.08s;
}

.motion-ready .motion-section.is-inview .gallery-full__item:nth-child(5) {
  animation-delay: 0.1s;
}

.motion-ready .motion-section.is-inview .gallery-full__item:nth-child(6) {
  animation-delay: 0.12s;
}

.motion-ready .motion-section.is-inview .gallery-full__item:nth-child(7) {
  animation-delay: 0.14s;
}

.motion-ready .motion-section.is-inview .gallery-full__item:nth-child(8) {
  animation-delay: 0.16s;
}

.motion-ready .motion-section.is-inview .gallery-full__item:nth-child(9) {
  animation-delay: 0.18s;
}

.motion-ready .motion-section.is-inview .gallery-full__item:nth-child(10) {
  animation-delay: 0.2s;
}

.motion-ready .motion-section.is-inview .gallery-full__item:nth-child(11) {
  animation-delay: 0.22s;
}

.motion-ready .motion-section.is-inview .gallery-full__item:nth-child(12) {
  animation-delay: 0.24s;
}

.motion-ready .motion-section.is-inview .gallery-full__item:nth-child(n + 13) {
  animation-delay: 0.26s;
}

@keyframes motion-gallery-reveal {
  from {
    opacity: 0;
    transform: translate3d(0, 1.1rem, 0) scale(0.97);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes motion-pop {
  from {
    opacity: 0;
    transform: translate3d(0, 1rem, 0);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Home hero: headline + CTAs */
.motion-ready .hero--home.motion-section--hero.is-inview .hero__title {
  animation: motion-title-reveal 0.95s var(--motion-ease) 0.1s both;
}

.motion-ready .hero--home.motion-section--hero.is-inview .hero__actions .btn {
  animation: motion-scale-pop 0.68s var(--motion-ease) backwards;
}

.motion-ready .hero--home.motion-section--hero.is-inview .hero__actions .btn:nth-child(1) {
  animation-delay: 0.32s;
}

.motion-ready .hero--home.motion-section--hero.is-inview .hero__actions .btn:nth-child(2) {
  animation-delay: 0.4s;
}

@keyframes motion-title-reveal {
  from {
    opacity: 0;
    transform: translate3d(0, 0.65rem, 0);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes motion-scale-pop {
  from {
    opacity: 0;
    transform: scale(0.94);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Page enter: light fade so it doesn’t fight section motion */
.motion-ready #main.motion-page-enter {
  animation: motion-page-in 0.45s var(--motion-ease) both;
}

@keyframes motion-page-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Cross-page soft transition (Chrome / Edge / Safari 18+) */
@supports (view-transition-name: none) {
  ::view-transition-old(root) {
    animation: motion-vt-out 0.28s ease-out both;
  }

  ::view-transition-new(root) {
    animation: motion-vt-in 0.4s var(--motion-ease) both;
  }
}

@keyframes motion-vt-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes motion-vt-in {
  from {
    opacity: 0;
    transform: translate3d(0, 12px, 0);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .motion-ready .motion-section:not(.is-inview):not(.motion-section--hero),
  .motion-ready .motion-section--hero:not(.is-inview) {
    opacity: 1;
    transform: none;
    will-change: auto;
  }

  .motion-ready .motion-section.is-inview {
    transition: none;
  }

  .motion-ready .motion-section.is-inview .stat-card,
  .motion-ready .motion-section.is-inview .feature-row .feature,
  .motion-ready .motion-section.is-inview .highlights-gallery__cell,
  .motion-ready .motion-section.is-inview .gallery-full__item {
    animation: none;
  }

  .motion-ready .hero--home.motion-section--hero.is-inview .hero__title,
  .motion-ready .hero--home.motion-section--hero.is-inview .hero__actions .btn {
    animation: none;
  }

  .motion-ready #main.motion-page-enter {
    animation: none;
  }

  @supports (view-transition-name: none) {
    ::view-transition-old(root),
    ::view-transition-new(root) {
      animation: none;
    }
  }
}

/* Mobile nav drawer: respect reduced motion */
@media (max-width: 899px) and (prefers-reduced-motion: reduce) {
  .site-nav-backdrop {
    transition: none !important;
  }

  .site-nav {
    transition: none !important;
  }

  .site-nav a {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  .site-nav.is-open a {
    animation: none !important;
  }

  .nav-toggle__bar,
  .nav-toggle__bar::before,
  .nav-toggle__bar::after {
    transition: none !important;
  }
}
