/* HOME PAGE MOTION: "Arch".
   Each section ("unit": the hero, the statement, the three link bars, the streamers, the about
   section and the footer) is drawn down from its top edge, and the leading edge is always an arch, the
   same curve as the hero's frame. As the shape reaches full height its arch flattens into the unit's real
   bottom edge. The unit fades in as it goes. Everything inside a unit, text and visuals together, is
   uncovered by that one shape, so nothing in a section animates on its own.
   The streamers instead unroll along their own tilted length (the lilac one left to right, the blue one
   right to left). Featured Projects is deliberately left still.

   Only clip-path and opacity are animated, so layout, sizes and styling never change, and once a unit
   has settled every effect is removed, leaving the page exactly as it is without motion.
   The units are marked with data-mx in index.html; assets/home-motion.js plays them. */

@keyframes mx-shape {
  from { clip-path: var(--mx-from); }
  to   { clip-path: var(--mx-to); }
}
@keyframes mx-fade { from { opacity: 0; } to { opacity: 1; } }

html.mx-on:not(.mx-fail) [data-mx] {
  --mx-from: inset(0 0 100% 0 round 0 0 50% 50% / 0 0 150px 150px);
  --mx-to: inset(-60px round 0);
  --mx-ease: cubic-bezier(.7, 0, .2, 1);
  --mx-dur: 1100ms;
  --mx-fade: 380ms;
}
html.mx-on:not(.mx-fail) [data-mx="hero"]    { --mx-from: inset(0 0 100% 0 round 0 0 100px 100px); --mx-to: inset(0 round 0 0 100px 100px); }
html.mx-on:not(.mx-fail) [data-mx="bar"]     { --mx-from: inset(0 0 100% 0 round 0 0 50% 50% / 0 0 56px 56px); --mx-to: inset(-4px round 0); --mx-dur: 900ms; }
html.mx-on:not(.mx-fail) [data-mx="about"]   { --mx-to: inset(-2px round 0); }
html.mx-on:not(.mx-fail) [data-mx="footer"]  { --mx-to: inset(-2px round 0); }

/* streamers: unroll along their own length; the leading edge is rounded and squares off as it goes */
html.mx-on:not(.mx-fail) [data-mx="ribbon"] {
  --mx-from: inset(0 100% 0 0 round 0 28px 28px 0);
  --mx-to: inset(-10px round 0);
  --mx-ease: cubic-bezier(.65, 0, .25, 1);
  --mx-dur: 1000ms;
  --mx-fade: 320ms;
}
html.mx-on:not(.mx-fail) .streamer--blue[data-mx="ribbon"] { --mx-from: inset(0 0 0 100% round 28px 0 0 28px); }

/* before a unit's turn: hidden */
html.mx-on:not(.mx-fail) [data-mx]:not(.mx-in) { clip-path: var(--mx-from); opacity: 0; }
/* its turn: one shape morph and a quick fade */
html.mx-on:not(.mx-fail) [data-mx].mx-in {
  animation:
    mx-shape var(--mx-dur) var(--mx-ease) var(--mx-delay, 0ms) both,
    mx-fade  var(--mx-fade) ease-out var(--mx-delay, 0ms) both;
}
/* settled: all effects removed */
html.mx-on [data-mx].mx-done { animation: none !important; clip-path: none !important; opacity: 1 !important; }

/* the hero's typewriter starts as the arch lands, instead of typing into a frame that is still arriving */
html.mx-on:not(.mx-fail) .hero-typewriter__text { animation-delay: .9s, .9s !important; }
