/* ===========================================================================
   Pati by OVPRIDE — shared motion layer for the pages outside the Vite bundle
   (the public about page and the legal documents).

   Two things live here, both lifted from Stride's own system
   (archive/src/styles/tokens.css and app.css, "Scroll reveal"):

     1. the easing tokens, so everything on these pages slows down the same way
     2. scroll reveal, which lets a long page arrive a block at a time instead
        of sitting fully drawn before it is read
     3. cross-document view transitions, so moving between about and the legal
        pages is one continuous movement rather than a white flash

   The HIDING for scroll reveal is done here in CSS but keyed on a class that
   assets/motion.js puts on <html> at parse time. A browser without
   IntersectionObserver, or one with JavaScript off, never gets the class and
   so simply sees the page as written. Nothing can be hidden for good.
   =========================================================================== */

:root {
  /* Stride's curves, verbatim.
       --ease-out     the default: hovers, fades, most entrances
       --ease-emph    larger entrances (dialogs): a longer glide in
       --ease-spring  a small overshoot and settle, for things that pop
       --ease-glide   an even glide, for things travelling a distance
       --ease-in      exits: leaves quickly without lingering */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-emph: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-glide: cubic-bezier(0.33, 1, 0.68, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
}

/* --- Scroll reveal ---------------------------------------------------------
   Opt in with `data-reveal` on a block, or `data-reveal-group` on a container
   whose direct children should arrive one after another. assets/motion.js
   drives it.
   ========================================================================== */
@media (prefers-reduced-motion: no-preference) {
  html.reveal-on [data-reveal]:not(.is-revealed),
  html.reveal-on [data-reveal-group] > *:not(.is-revealed) {
    opacity: 0;
    /* translate3d rather than translateY: it stays on the compositor, so a
       page with twenty waiting blocks costs the main thread nothing. */
    transform: translate3d(0, var(--reveal-shift, 16px), 0);
  }

  /* Carried only while the element is actually moving, then taken back off by
     motion.js. A permanent transition here would outrank the ones elements set
     for themselves (a card's hover lift, say) and swallow them. */
  html.reveal-on .is-revealing {
    transition:
      opacity 0.5s var(--ease-out),
      transform 0.62s var(--ease-glide);
    transition-delay: var(--reveal-delay, 0ms);
  }
}

/* --- Cross-document view transitions ---------------------------------------
   Chrome and Edge animate between two same-origin pages when both opt in. The
   header keeps its own name on both sides, so the bar holds still while the
   body of the page crosses over. Browsers without support navigate exactly as
   they always did: there is no fallback to write, and nothing to clean up.
   ========================================================================== */
@view-transition { navigation: auto; }

@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(page) {
    animation: vt-out 0.18s var(--ease-in) both;
  }
  ::view-transition-new(page) {
    animation: vt-in 0.42s var(--ease-emph) both;
  }

  @keyframes vt-out {
    to { opacity: 0; transform: translate3d(0, -8px, 0); }
  }
  @keyframes vt-in {
    from { opacity: 0; transform: translate3d(0, 14px, 0); }
  }
}

/* A reader who asked for less motion gets the plain swap, not the slide. */
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) { animation: none !important; }
}
