/* Visibility */
.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Text alignment */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

/* Spacing */
.mt-0 { margin-top: 0 !important; }
.mt-2 { margin-top: var(--space-2) !important; }
.mt-4 { margin-top: var(--space-4) !important; }
.mt-8 { margin-top: var(--space-8) !important; }
.mt-16 { margin-top: var(--space-16) !important; }

.mb-0 { margin-bottom: 0 !important; }
.mb-2 { margin-bottom: var(--space-2) !important; }
.mb-4 { margin-bottom: var(--space-4) !important; }
.mb-8 { margin-bottom: var(--space-8) !important; }
.mb-16 { margin-bottom: var(--space-16) !important; }

/* Scroll Animations
   Anti-FOUC Engine: Elements with data-animate are hidden by default ONLY if 
   the JS-enabled flag is present on the root HTML element before first paint.
   Once the IntersectionObserver marks them as .is-visible, they animate in. */

html[data-js="true"] [data-animate]:not(.is-visible) {
  opacity: 0;
  transform: translateY(0);
}

/* We solely apply the translation matrix if JS explicitly flags it as off-screen */
[data-animate].will-animate {
  transform: translateY(20px);
}

html[data-js="true"] [data-animate] {
  transition: opacity 600ms ease-out, transform 600ms ease-out;
}

[data-animate].is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered children base transition */
html[data-js="true"] [data-animate-children]:not(.is-visible) > * {
  opacity: 0;
  transform: translateY(0);
}

[data-animate-children].will-animate > * {
  transform: translateY(20px);
}

html[data-js="true"] [data-animate-children] > * {
  transition: opacity 600ms ease-out, transform 600ms ease-out;
}

[data-animate-children].is-visible > * {
  opacity: 1;
  transform: translateY(0);
}

/* Create delays up to 6 items */
[data-animate-children].is-visible > *:nth-child(1) { transition-delay: 50ms; }
[data-animate-children].is-visible > *:nth-child(2) { transition-delay: 150ms; }
[data-animate-children].is-visible > *:nth-child(3) { transition-delay: 250ms; }
[data-animate-children].is-visible > *:nth-child(4) { transition-delay: 350ms; }
[data-animate-children].is-visible > *:nth-child(5) { transition-delay: 450ms; }
[data-animate-children].is-visible > *:nth-child(6) { transition-delay: 550ms; }

@media (prefers-reduced-motion: reduce) {
  html[data-js="true"] [data-animate]:not(.is-visible),
  html[data-js="true"] [data-animate-children]:not(.is-visible) > * {
    transition: none !important;
    opacity: 1;
    transform: none;
  }
}
