/* Homepage motion, round 3 (openspec change website-home-scroll-story; page spec 2026-10-22 M1, M2, M4).
   home-sequences.js adds the classes below only when motion is allowed; without it, or under reduced motion, nothing
   here applies and every heading, card and background is its final still frame. Only brand colour tokens and the
   brand motion tokens (--motion-ease, --motion-fast, --motion-slow, --motion-stagger; brand.css) are used. */
@media (prefers-reduced-motion: no-preference) {
  /* M1: a screen heading, the first time it comes into view, sharpens from a slight blur and rises line by line.
     The individual translate property leaves the page's own transforms alone, and nothing here moves layout. */
  html.m1-on .m1-line { opacity: 0; translate: 0 14px; filter: blur(8px); }
  html.m1-on .m1-split > .m1-line { display: inline-block; }
  html.m1-on .m1-line.is-seen {
    opacity: 1; translate: none; filter: none;
    transition-property: opacity, translate, filter;
    transition-duration: var(--motion-slow);
    transition-timing-function: var(--motion-ease);
    transition-delay: calc(var(--m1-i, 0) * var(--motion-stagger));
  }

  /* M2: on a fine pointer, a blue light follows the mouse along the card's border and the card leans up to 2°.
     The lean uses the individual rotate property, so it composes with the Work / Life flip transform; the parent
     gets its perspective only while the mouse is over the card. */
  .m2-rel { position: relative; }
  .m2-card { transition: rotate var(--motion-fast) var(--motion-ease); }
  .m2-lean { perspective: 900px; }
  .m2-glow {
    position: absolute; inset: 0; z-index: 2; padding: 1px; border-radius: inherit; pointer-events: none; opacity: 0;
    background: radial-gradient(220px circle at var(--m2-x, 50%) var(--m2-y, 0%), var(--brand-blue), transparent 70%);
    -webkit-mask: linear-gradient(var(--brand-black) 0 0) content-box, linear-gradient(var(--brand-black) 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(var(--brand-black) 0 0) content-box exclude, linear-gradient(var(--brand-black) 0 0);
    transition: opacity var(--motion-fast) var(--motion-ease);
  }
  .m2-on > .m2-glow { opacity: 1; }

  /* M4: the page background follows the screens' tones; home-sequences.js writes it on <body> as the reader scrolls. */
  html.m4-on body { transition: background-color var(--motion-fast) var(--motion-ease); }
}
