/* Lane y-motion: site-wide motion that Adam asked for on 11/4. Everything here is calm and short, moves only opacity
   and transform, and is off under reduced motion. Hidden states come only from y-motion.js (or the strip's one-line
   script in y-motion.php), so a page without scripts shows everything at once. */

/* ---------- Page-to-page fade ---------- */

/* A link to another page on the site crossfades the old page into the new one, in browsers that support cross-page
   view transitions. Others just open the page. The header is captured on its own and shows the new page's header at
   once, so it doesn't ghost when the old page's header was the compact one stuck to the top. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
}
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 220ms; animation-timing-function: cubic-bezier(.23, 1, .32, 1); }
#header .header-wrapper { view-transition-name: gl-header; }
::view-transition-group(gl-header), ::view-transition-new(gl-header) { animation: none; }
::view-transition-old(gl-header) { display: none; }

/* ---------- Numbers strip ---------- */

/* The figures fade in one after another while the counts run. The typed figure keeps its place under the count, so
   the strip never changes size. */
.gl-stats.gl-y-pre .gl-stat dd { opacity: 0; }
.gl-stats.gl-y-on .gl-stat dd { position: relative; transition: opacity 320ms cubic-bezier(.23, 1, .32, 1); }
.gl-stats .gl-stat dd.gl-y-counting .gl-y-final { color: transparent; }
.gl-stats .gl-stat dd .gl-y-live { position: absolute; inset: 0; white-space: nowrap; text-align: inherit; pointer-events: none; }

/* ---------- Section reveals ---------- */

/* y-motion.js adds .gl-y-rv only to parts of a section that start below the screen, and .is-in as the section comes
   into view. It takes both off once the reveal ends, so no transform stays on the page. */
.gl-y-rv { opacity: 0; transform: translateY(12px); }
.gl-y-rv.is-in { opacity: 1; transform: none; transition: opacity 400ms cubic-bezier(.23, 1, .32, 1), transform 400ms cubic-bezier(.23, 1, .32, 1); }

/* ---------- Client quotes ---------- */

/* The Pause button sits with Previous and Next and looks like them. */
.gl-quotes .gl-y-qplay svg { width: 16px; height: 16px; fill: currentColor; stroke: none; }
.gl-quotes .gl-y-qplay:focus-visible { outline: 3px solid #5b7bd5; outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .gl-stats.gl-y-pre .gl-stat dd, .gl-y-rv { opacity: 1; transform: none; transition: none; }
  .gl-quotes .gl-y-qplay { display: none; }
}
@media print {
  .gl-stats.gl-y-pre .gl-stat dd, .gl-y-rv { opacity: 1 !important; transform: none !important; }
  .gl-stats .gl-stat dd.gl-y-counting .gl-y-final { color: inherit; }
  .gl-stats .gl-stat dd .gl-y-live, .gl-quotes .gl-y-qplay { display: none; }
}
