/*
 * Motion: the reduced-motion guard, and scroll reveal.
 *
 * Kept out of shared.css, which build-child-css.js generates and whose banner
 * says not to hand-edit. This file is hand-authored and self-contained, so the
 * reveal can be removed by deleting it and its enqueue.
 */

/* -------------------------------------------------------------------------
 * Reduced motion
 *
 * The site had 7 animations and 55 transforms and no guard at all. Anyone who
 * has asked their OS to reduce motion was getting every hover lift, every
 * fade and the hero's fadeInUp regardless. This comes first because the
 * reveal below leans on it: with this in place, reveal transitions collapse
 * to nothing rather than needing to be special-cased.
 * ---------------------------------------------------------------------- */

@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;
  }
}

/* -------------------------------------------------------------------------
 * Scroll reveal
 *
 * Sections rise in slightly as they enter the viewport.
 *
 * The hidden state is gated on `.js-reveal`, which reveal.js puts on <html>
 * and ONLY when it is actually going to run. So with JavaScript off, with
 * reduced motion requested, or on a browser without IntersectionObserver,
 * none of these rules match and every section is simply visible. Hiding
 * content in CSS and relying on script to bring it back is how pages end up
 * blank; this cannot do that.
 *
 * The hero is never revealed - it is above the fold and already animates.
 * ---------------------------------------------------------------------- */

.js-reveal .reveal {
  opacity: 0;
  transform: translateY(18px);
}

.js-reveal .reveal.is-visible {
  opacity: 1;
  transform: none;
  transition: opacity 0.55s ease-out, transform 0.55s ease-out;
}

/* Within a revealed section, direct children of a two-column block come in
   one after the other rather than together: text, then the image beside it.
   The delay is set per child by the script. */
.js-reveal .reveal .two-column > * {
  opacity: 0;
  transform: translateY(14px);
}

.js-reveal .reveal.is-visible .two-column > * {
  opacity: 1;
  transform: none;
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
  transition-delay: var(--reveal-delay, 0ms);
}
