/* The motion layer. Driven by /js/fx.js, which puts .fx-on (full motion) or .fx-calm
   (the visitor asked for reduced motion) on <html>. Without the script, nothing here
   hides or moves anything. */

/* One transition list for both effects. Tilt rides `transform`; the reveal rides the
   separate `translate` and `rotate` properties, so the two never fight over one value. */
.fx-tilt, .fx-r {
  transition:
    transform .45s cubic-bezier(.2,.8,.2,1),
    box-shadow .45s ease,
    opacity .7s ease var(--fx-delay, 0ms),
    translate .9s cubic-bezier(.2,.8,.2,1) var(--fx-delay, 0ms),
    rotate .9s cubic-bezier(.2,.8,.2,1) var(--fx-delay, 0ms);
}

/* ---- reveal ---- */
.cards, .steps, .stats, .brand-wall { perspective: 1100px; }
.fx-r.fx-hide { opacity: 0; }
.fx-on .fx-r.fx-hide { translate: 0 30px; rotate: x 16deg; }
.fx-on .section-head.fx-hide, .fx-on .case-result.fx-hide, .fx-on .prose > h2.fx-hide,
.fx-on .cta-band.fx-hide, .fx-on .faq details.fx-hide { rotate: none; }

/* step numbers pop in just after their card arrives */
.fx-on .step.fx-r::before { transition: scale .5s cubic-bezier(.3,1.6,.5,1) calc(var(--fx-delay, 0ms) + .35s); }
.fx-on .step.fx-hide::before { scale: 0; }

/* ---- tilt ---- */
.fx-tilt { position: relative; transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); }
.fx-tilt:hover {
  transition-duration: .12s, .45s, .7s, .9s, .9s;
  will-change: transform;
  box-shadow: 0 22px 44px -24px rgba(15, 22, 38, .5);
}
.fx-tilt::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(380px circle at var(--gx, 50%) var(--gy, 50%), rgba(255, 255, 255, .5), transparent 46%);
  mix-blend-mode: soft-light; opacity: 0; transition: opacity .3s ease;
}
.fx-tilt:hover::after { opacity: 1; }

/* ---- numbers ---- */
.stat .n { font-variant-numeric: tabular-nums; }

/* ---- hero: a slow drifting glow behind the headline ---- */
.fx-on .ha-hero, .fx-on .hero { position: relative; isolation: isolate; overflow: hidden; }
.fx-on .ha-hero::before, .fx-on .hero::before {
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  width: 46vmax; height: 46vmax; left: -8vmax; top: 0; border-radius: 50%;
  background:
    radial-gradient(closest-side, rgba(47, 91, 255, .16), transparent 70%),
    radial-gradient(closest-side at 80% 70%, rgba(179, 157, 255, .14), transparent 70%);
  animation: fx-drift 22s ease-in-out infinite alternate;
}
@keyframes fx-drift {
  from { transform: translate3d(0, 0, 0) rotate(0deg); }
  to   { transform: translate3d(30vw, -3vmax, 0) rotate(40deg); }
}
.fx-on .ha-hero h1, .fx-on .hero h1 { animation: fx-rise .9s cubic-bezier(.2,.8,.2,1) both; }
.fx-on .ha-hero .lede, .fx-on .hero .lede { animation: fx-rise .9s .12s cubic-bezier(.2,.8,.2,1) both; }
.fx-on .ha-hero .btn-row, .fx-on .hero .btn-row { animation: fx-rise .9s .24s cubic-bezier(.2,.8,.2,1) both; }
@keyframes fx-rise { from { opacity: 0; transform: translateY(18px); } }

/* ---- buttons: a light sweep on hover ---- */
.fx-on .btn { position: relative; overflow: hidden; isolation: isolate; }
.fx-on .btn::after {
  content: ""; position: absolute; inset: -2px auto -2px 0; width: 45%; z-index: -1; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .28), transparent);
  translate: -120% 0; transition: translate 0s;
}
.fx-on .btn:hover::after { translate: 260% 0; transition: translate .7s ease; }

/* ---- the dark call-to-action band: a slow sheen ---- */
.fx-on .cta-band { position: relative; overflow: hidden; isolation: isolate; }
.fx-on .cta-band::before {
  content: ""; position: absolute; inset: -40%; z-index: -1; pointer-events: none;
  background: conic-gradient(from 0deg, transparent 0 60%, rgba(47, 91, 255, .22) 75%, transparent 90%);
  animation: fx-spin 18s linear infinite;
}
@keyframes fx-spin { to { rotate: 1turn; } }

/* ---- reading progress: a thin line along the top, driven by scroll (no script) ---- */
@supports (animation-timeline: scroll()) {
  .fx-on body::before {
    content: ""; position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 1000; pointer-events: none;
    background: linear-gradient(90deg, var(--signal, #2f5bff), #b39dff);
    transform-origin: 0 50%; scale: 0 1;
    animation: fx-progress linear both; animation-timeline: scroll(root);
  }
  @keyframes fx-progress { to { scale: 1 1; } }
}

/* ---- FAQ answers open smoothly where the browser supports it ---- */
.fx-on .faq { interpolate-size: allow-keywords; }
.fx-on .faq details::details-content { block-size: 0; overflow: clip; transition: block-size .35s ease, content-visibility .35s allow-discrete; }
.fx-on .faq details[open]::details-content { block-size: auto; }

/* never print a half-revealed page */
@media print { .fx-r.fx-hide { opacity: 1; translate: none; rotate: none; } body::before { display: none; } }
