/* Smooth, stable scroll reveal animations
   Place this after your existing CSS files. */

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  overflow-x: clip;
}

.hero,
main,
section {
  overflow-x: clip;
}

/* Prevent image-load jumps while scrolling */
img {
  display: block;
  max-width: 100%;
}

.image-panel img,
.hero-image img,
.parents-image img,
.facility-tile img,
.activity-card img {
  backface-visibility: hidden;
  transform: translateZ(0);
}

/* Base reveal state */
[data-reveal] {
  opacity: 0;
  transform: translate3d(0, 18px, 0);
  transition:
    opacity 520ms ease,
    transform 620ms cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}

[data-reveal="left"] {
  transform: translate3d(-18px, 0, 0);
}

[data-reveal="right"] {
  transform: translate3d(18px, 0, 0);
}

[data-reveal="down"] {
  transform: translate3d(0, -14px, 0);
}

[data-reveal="zoom"] {
  transform: scale(0.975);
}

[data-reveal].is-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
  will-change: auto;
}

/* The sticky header must never be transformed (a transform here creates a
   stacking context that traps the nav dropdown behind page content). */
.site-header,
.site-header[data-reveal] {
  opacity: 1 !important;
  transform: none !important;
  will-change: auto !important;
}

.inner-hero + .section [data-reveal],
.inner-hero + .section .reveal-group > * {
  opacity: 1;
  transform: none;
  transition: none;
  will-change: auto;
}

/* Optional subtle stagger for cards inside groups */
.reveal-group > * {
  --reveal-delay: 0ms;
}

/* Keep hover animation light and smooth */
.facility-tile img {
  will-change: transform;
}

.facility-tile:hover img {
  transform: translateZ(0) scale(1.035);
}

.site-header[data-reveal] {
  transition-duration: 420ms;
}

.hero-info-item,
.main-nav a,
.brand-mark {
  transition:
    transform 0.24s ease,
    color 0.24s ease,
    background 0.24s ease,
    box-shadow 0.24s ease;
}

.hero-info-item:hover,
.main-nav a:hover,
.brand:hover .brand-mark {
  transform: translateY(-3px);
}

@media (max-width: 768px) {
  [data-reveal],
  [data-reveal="left"],
  [data-reveal="right"],
  [data-reveal="zoom"] {
    transform: translate3d(0, 14px, 0);
  }
}

/* Accessibility: respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }

  [data-reveal],
  [data-reveal].is-visible {
    opacity: 1;
    transform: none;
  }
}
