/*
 * Page-by-page landing motion (index.html, college.html, corporates.html).
 *
 * page-motion.js adds .motion to <html> only on screens where the page snaps
 * section by section and the visitor has not asked for reduced motion; without it
 * these rules do nothing and each page keeps its own simple .reveal fade.
 *
 * Each section's content is split into items (.m-item), staggered with --d. The
 * active section's items swing up into place; every other section's items wait out
 * of view on the side the visitor is scrolling from (data-dir on <html>).
 *
 * Waiting state:  cards/art 70px off, tilted back 10deg, 94% size, blurred.
 *                 headlines 36px off, 92% size, hidden behind a rising edge.
 * Landing:        1.15s expo-style ease-out, 0.12s between items (page-motion.js).
 */

/* The page's own reveal containers stay visible; their items do the moving. */
html.motion main > section .reveal {
  opacity: 1;
  transform: none;
  transition: none;
}

/* Waiting (scrolling down): below, tilted back. Leaving uses the same quick exit. */
html.motion main > section .m-item {
  opacity: 0;
  transform: perspective(1200px) translate3d(0, 70px, 0) rotateX(10deg) scale(.94);
  transform-origin: 50% 100%;
  filter: blur(10px);
  transition:
    opacity .5s ease,
    transform .5s cubic-bezier(.5, 0, .75, 0),
    filter .5s ease;
  will-change: opacity, transform, filter;
}
/* Waiting (scrolling up): above, tilted forward. */
html.motion[data-dir="up"] main > section .m-item {
  transform: perspective(1200px) translate3d(0, -70px, 0) rotateX(-10deg) scale(.94);
  transform-origin: 50% 0;
}

/* Headlines: a shorter rise (so they never pass behind the cards below them), a
   bigger grow, and a reveal edge that sweeps up through the text. */
html.motion main > section:not(.is-active) .m-item.m-head {
  transform: translate3d(0, 36px, 0) scale(.92);
  clip-path: inset(100% -10% -20% -10%);
}
html.motion[data-dir="up"] main > section:not(.is-active) .m-item.m-head {
  transform: translate3d(0, -36px, 0) scale(.92);
  clip-path: inset(-20% -10% 100% -10%);
}
html.motion main > section .m-item.m-head {
  transform-origin: 0 100%;
}

/* Landing: long ease-out, staggered by --d. */
html.motion main > section.is-active .m-item,
html.motion[data-dir="up"] main > section.is-active .m-item {
  opacity: 1;
  transform: none;
  filter: none;
  transition:
    opacity .8s cubic-bezier(.16, 1, .3, 1) var(--d, 0s),
    transform 1.15s cubic-bezier(.16, 1, .3, 1) var(--d, 0s),
    filter .9s cubic-bezier(.16, 1, .3, 1) var(--d, 0s),
    clip-path 1s cubic-bezier(.16, 1, .3, 1) var(--d, 0s);
}
/* Only headlines are clipped (artwork shadows and overhanging chips stay whole);
   the open edge leaves room for descenders. */
html.motion main > section.is-active .m-item.m-head {
  clip-path: inset(-20% -10% -20% -10%);
}
/* Centred headlines grow from their middle, not their left edge. */
html.motion main > section .sec-head .m-head,
html.motion main > section .cta-band .m-head,
html.motion main > section .final .m-head {
  transform-origin: 50% 100%;
}
