/* Motion for the home page (index.html only). Pairs with motion.js.
   Every hidden starting state is under .mo, a class motion.js adds as its last step, so without the script
   nothing is hidden. Reduced motion never enters this block: the page stays in its final state.
   Animated properties: transform (and its individual translate/scale), opacity, plus a short blur on text and cards. */

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

/* ---- Hero glow: drifts slowly on its own; motion.js leans it toward the cursor ---- */
.hero__glow i { will-change: transform, translate; }
.hero__glow i:first-child { animation: drift-a 26s var(--ease-io) infinite alternate; }
.hero__glow i:last-child { animation: drift-b 34s var(--ease-io) infinite alternate; }
@keyframes drift-a { from { translate: -1.5% 0; scale: 1; } to { translate: 2.5% 3%; scale: 1.07; } }
@keyframes drift-b { from { translate: 3% 1%; scale: 1.05; } to { translate: -3% -3%; scale: 1; } }

/* ---- Reveal: fade, rise, blur to sharp. motion.js sets --d (stagger) and .in, then removes both attributes. ---- */
.mo [data-r] {
  opacity: 0; transform: translate3d(0, 28px, 0); filter: blur(7px);
  transition: opacity 0.9s var(--ease), transform 1.1s var(--ease), filter 0.9s var(--ease), scale 1.1s var(--ease);
  transition-delay: var(--d, 0ms);
}
/* Mockup layers keep their own transform and filter (parallax, tilt, drop shadow), so they fade and grow in instead. */
.mo [data-r="m"] { transform: none; filter: none; scale: 0.94; }
.mo [data-r].in { opacity: 1; transform: none; filter: blur(0); scale: 1; }
.mo [data-r="m"].in { filter: none; }

/* ---- Headlines, line by line. motion.js wraps each line in .ln > .ln__i; the mask hides it below its line. ---- */
.lines { display: flex; flex-direction: column; } /* flex: the lines' negative margins must not collapse into each other */
.ln { display: block; white-space: nowrap; overflow: hidden; padding: 0.1em 0 0.16em; margin: -0.1em 0 -0.16em; }
.ln__i { display: inline-block; }
.mo .ln__i {
  opacity: 0; transform: translate3d(0, 112%, 0);
  transition: transform 1.2s var(--ease), opacity 0.9s var(--ease);
  transition-delay: calc(var(--d, 0ms) + var(--i, 0) * 110ms);
}
.mo .in > .ln > .ln__i { opacity: 1; transform: none; }

/* ---- Parallax: motion.js writes translate on these; they are promoted once so scrolling only composites ---- */
.mo .stage .mac, .mo .stage .phone, .mo .mirrormedia .phone { will-change: transform, translate; }
.mo .shot--card > svg { scale: 1.06; will-change: transform, translate; } /* the drawing drifts inside its frame; a real screenshot covers it */

/* ---- Tilt toward the cursor (fine pointers only: motion.js never sets data-tilt otherwise) ---- */
[data-tilt] { transform-style: preserve-3d; will-change: transform; }
.glare { position: absolute; inset: 0; z-index: 1; overflow: hidden; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity 0.6s var(--ease); }
.phone > .glare { border-radius: 15% / 7.2%; }
.is-hot .glare { opacity: 1; }
.glare b {
  position: absolute; left: 0; top: 0; width: 60%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.1) 50%, transparent);
  transform: translate3d(-200%, 0, 0); will-change: transform;
}

/* ---- Buttons: a shine sweeps across on hover; motion.js adds a small magnetic pull through translate ---- */
.btn--primary { position: relative; overflow: hidden; isolation: isolate; }
.btn--primary::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 50%; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  transform: skewX(-18deg); transition: transform 0s linear 0.9s;
}
@media (hover: hover) { .btn--primary:hover::after { transform: skewX(-18deg) translateX(400%); transition: transform 0.9s var(--ease); } }
.mo .btn--primary { transition: transform 0.15s ease, background-color 0.15s ease, translate 0.5s var(--ease); }

/* ---- Cards and plans: a glow follows the cursor, brightest on the border ----
   Two layers under the content: the glow (moved with transform) and a slightly see-through plate 1.5px inside the edge. */
@media (hover: hover) and (pointer: fine) {
  .mo .card, .mo .plan { position: relative; overflow: hidden; isolation: isolate; }
  .mo :is(.card, .plan)::before {
    content: ""; position: absolute; left: 0; top: 0; z-index: -2; width: 460px; height: 460px; border-radius: 50%; pointer-events: none;
    background: radial-gradient(closest-side, color-mix(in srgb, var(--c-sky) 92%, transparent), color-mix(in srgb, var(--c-purple) 55%, transparent) 55%, transparent);
    transform: translate3d(calc(var(--mx, -999px) - 50%), calc(var(--my, -999px) - 50%), 0);
    opacity: 0; transition: opacity 0.6s var(--ease);
  }
  .mo :is(.card, .plan)::after {
    content: ""; position: absolute; inset: 1.5px; z-index: -1; border-radius: calc(var(--r-card) - 2px); pointer-events: none;
    background: color-mix(in srgb, var(--card) 91%, transparent);
  }
  .mo :is(.card, .plan):hover::before { opacity: 1; }
}

/* ---- DeX: the phone turns sideways and grows into the desktop window as you scroll ----
   motion.js adds .dex-pin on wide, tall-enough screens and writes the layers' transform and opacity from the scroll position.
   Both layers are authored at their largest size and only ever scaled down, so they stay sharp. */
/* The block starts a little under the hero, whose bottom is empty, so it must not catch clicks meant for the hero. */
.dex-pin { height: 240vh; margin-top: -10vh; pointer-events: none; }
.dex-pin .wrap { pointer-events: auto; }
#dex:has(.dex-pin) { padding-top: 0; }
.dex-pin .dexseq__pin {
  position: sticky; top: 0; height: 100vh; height: 100svh; box-sizing: border-box; padding-top: 72px;
  display: grid; align-items: center;
}
.dex-pin .dexstage__phone {
  display: block; position: absolute; left: 50%; top: 50%; z-index: 2; width: 46.8%; /* its long side then equals the window's width */
  translate: -50% -50% 24px; transform: scale(0.56); opacity: 0; pointer-events: none; will-change: transform, opacity;
}
.dex-pin .dexstage .shot { transform: scale(0.56); opacity: 0; will-change: transform, opacity; }

}
