/* Bright load motion (v1.0). Two modes, set by a class on <body>:
   .m-fly  Top-level pages: cards fly in from the side they land on, then their contents assemble.
   .m-asm  Case studies: only the contents assemble (screens, images, tiles) as they scroll into view.
   Plays once per group, about 3s at most. html.m-on is added in <head> only when motion is allowed,
   so with reduced motion, old browsers, or a failed script, nothing is hidden or moved. */
@keyframes m-fly { 0% { opacity: 0; translate: var(--fx, 0) var(--fy, 60px); rotate: var(--fr, 0deg); scale: .9; } 60% { opacity: 1; } 100% { opacity: 1; translate: 0 0; rotate: 0deg; scale: 1; } }
@keyframes m-pop { from { opacity: 0; translate: 0 40px; } to { opacity: 1; translate: 0 0; } }
@keyframes m-slide { from { opacity: 0; translate: 56px 0; } to { opacity: 1; translate: 0 0; } }
@keyframes m-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes m-grow { from { scale: 1 0; } to { scale: 1 1; } }

html.m-on, html.m-on body { overflow-x: clip; }

/* Fly pages: whole tiles (hidden by structure, so there's no flash before the script runs) */
html.m-on body.m-fly .grid > .t:not(.in), html.m-on body.m-fly .sec:not(.in) { opacity: 0; }
html.m-on body.m-fly .grid > .t.in { animation: m-fly .9s cubic-bezier(.22, 1.25, .36, 1) both; animation-delay: var(--d, 0s); }
html.m-on body.m-fly .sec.in { animation: m-pop .6s cubic-bezier(.2, .75, .25, 1) both; animation-delay: var(--d, 0s); }

/* Pieces that assemble inside a group (both modes) */
html.m-on .mg:not(.in) .ma { opacity: 0; }
html.m-on .mg.in .ma { animation: m-pop .75s cubic-bezier(.2, .75, .25, 1) both; animation-delay: calc(var(--d, 0s) + var(--land, 0s) + var(--ex, 0s)); }
html.m-on .mg.in .ma.slide { animation-name: m-slide; }
html.m-on .mg.in .ma.tick { animation: m-fade .35s ease both; animation-delay: calc(var(--d, 0s) + var(--land, 0s) + var(--ex, 0s)); }
html.m-on .mg.in .ma.bar { transform-origin: bottom; animation: m-grow .5s cubic-bezier(.2, .75, .25, 1) both; animation-delay: calc(var(--d, 0s) + var(--land, 0s) + var(--ex, 0s)); }

@media (prefers-reduced-motion: reduce) {
  html.m-on .grid > .t, html.m-on .sec, html.m-on .ma { animation: none !important; opacity: 1 !important; }
}
