/* THE MOTION PASS, home page only. Kavalsia Inc. / Siavash Sadighi, 2026-10-05 (#500).
   One layer over the page's existing vocabulary (lot-extra.css "every section
   arrives": 26px up, a hair of scale, the 0.22/0.7/0.2/1 curve). It adds four
   things and replaces none:

   1. THE HEADING RISES OUT OF A LINE. Each section h2 already rises, focuses
      and takes its amber wash; here a clip-path mask is added on the same
      scroll range, so the glyphs come up from under their own baseline rather
      than fading in place. It is a mask on the h2 box, not a span per line:
      the h2s are background-clip:text gradients, and a transformed child span
      paints outside that clip and turns the text transparent.
   2. THE #made LIST ARRIVES ITEM BY ITEM, on the same staggered range the
      rest of the page uses, instead of as one glass slab.
   3. THE LIFE PHOTOS DRIFT. Each photo in assets/life/ (not the hero, which
      has its own boot) moves 4% against the scroll inside its own frame,
      scaled 1.1 so no edge ever shows. Scroll-driven in CSS; lp-fx.js writes
      the same --lp-fx-p where the browser has no view() timeline.
   4. THE LIGHT SWEEP AND THE MAGNET reach every primary call, not only the
      hero's: the same diagonal light the hero button carries, and a 5px lean
      toward the cursor (lp-fx.js). Fine pointers with hover only.

   EVERYTHING HERE IS INSIDE prefers-reduced-motion: no-preference. Under
   reduce, nothing in this file applies, so every part sits at its natural
   final state: h2 unclipped, photos unmoved, buttons still. Animations use
   `translate`/`scale`/`clip-path`, never `transform`, so no hover lift on the
   page loses its property to a filled keyframe. No WebGL. */

@media (prefers-reduced-motion: no-preference) {

  /* ---- 1. the line mask on h2 ------------------------------------------- */
  @supports (animation-timeline: view()) and (clip-path: inset(0)) {
    /* The list repeats the incumbent three (arrive, focus, wash) with their
       exact ranges, then adds the mask; a shorter list would drop the wash. */
    #main .lp-in > .lp-wrap > * > .lp-h2 {
      animation:
        lp-arrive 0.74s cubic-bezier(0.22, 0.7, 0.2, 1) both,
        lp-focus 0.74s cubic-bezier(0.22, 0.7, 0.2, 1) backwards,
        lp-h2-wash 1.5s cubic-bezier(0.22, 0.7, 0.2, 1) both,
        lp-fx-mask 0.74s cubic-bezier(0.22, 0.7, 0.2, 1) backwards;
      animation-timeline: view(), view(), view(), view();
      animation-range:
        entry 2% cover calc(22% + var(--lp-ai, 0) * 7%),
        entry 8% cover 32%,
        entry 2% cover calc(22% + var(--lp-ai, 0) * 7%),
        entry 0% cover 24%;
    }
  }

  /* ---- 2. the #made list, item by item ---------------------------------- */
  @supports (animation-timeline: view()) {
    #main #made .lp-made-list > * {
      animation: lp-arrive 0.74s cubic-bezier(0.22, 0.7, 0.2, 1) both;
      animation-timeline: view();
      animation-range: entry 2% cover calc(20% + var(--lp-fx-i, 0) * 6%);
    }
    #main #made .lp-made-list > :nth-child(2) { --lp-fx-i: 1; }
    #main #made .lp-made-list > :nth-child(3) { --lp-fx-i: 2; }
    #main #made .lp-made-list > :nth-child(n + 4) { --lp-fx-i: 3; }
  }

  /* ---- 3. the life photos drift inside their frames --------------------- */
  #main .lp-queue-night,
  #main #start .lp-start-ph { overflow: clip; }

  #main .lp-life img,
  #main .lp-queue-night img,
  #main #start .lp-start-ph img {
    /* Slack on the block axis only: a scale grew the box sideways and the
       full-bleed night photo's rect crossed the viewport (proof.mjs overflow
       at 360/768/1280, 2026-10-05). 10% taller, centred, drifts +-4% of the
       frame (3.636% of the 110% box). */
    block-size: 110%;
    translate: 0 calc(-4.545% + var(--lp-fx-p, 0) * 3.636%);
  }
  /* THE TIMELINE IS THE FRAME'S, NAMED. A bare view() on the img resolves
     against its nearest scroll container, and .lp-life is overflow:hidden,
     which IS one: it never scrolls, so the drift sat at 50% forever
     (measured 2026-10-05). The frame's own view timeline tracks the page;
     #start's photo sits in a clipped card, so there the section carries it. */
  @supports (animation-timeline: view()) {
    #main .lp-life,
    #main .lp-queue-night,
    #main #start { view-timeline: --lp-fx-ph block; }
    #main .lp-life img,
    #main .lp-queue-night img,
    #main #start .lp-start-ph img {
      animation: lp-fx-drift linear both;
      animation-timeline: --lp-fx-ph;
      animation-range: cover 0% cover 100%;
    }
  }

  /* ---- 4. the light sweep on every primary call ------------------------- */
  @media (hover: hover) and (pointer: fine) {
    #main .lp-btn-go:not(.lp-hero .lp-btn-go),
    #lp-mast .lp-mast-cta {
      position: relative;
      overflow: hidden;
      isolation: isolate;
    }
    #main .lp-btn-go:not(.lp-hero .lp-btn-go)::after,
    #lp-mast .lp-mast-cta::after {
      content: "";
      position: absolute;
      inset-block: -40%;
      inset-inline-start: -55%;
      inline-size: 42%;
      z-index: -1;
      background: linear-gradient(100deg, #ffffff00 0%, #ffffff8a 48%, #ffffff00 100%);
      transform: translateX(0) skewX(-18deg);
      transition: transform 720ms cubic-bezier(0.22, 0.7, 0.2, 1);
      pointer-events: none;
    }
    #main .lp-btn-go:not(.lp-hero .lp-btn-go):hover::after,
    #lp-mast .lp-mast-cta:hover::after { transform: translateX(420%) skewX(-18deg); }

    /* The magnet lean, written by lp-fx.js as two custom properties. */
    [data-lp-fx-mag] {
      translate: var(--lp-fx-mx, 0px) var(--lp-fx-my, 0px);
      transition: translate 420ms cubic-bezier(0.16, 1, 0.3, 1);
    }
  }
}

@keyframes lp-fx-mask {
  from { clip-path: inset(0 -0.4em 100% -0.4em); }
  to   { clip-path: inset(-0.4em -0.4em -0.4em -0.4em); }
}

@keyframes lp-fx-drift {
  from { translate: 0 -8.181%; }
  to   { translate: 0 -0.909%; }
}
