/* Motion polish, full-site QA round 2026-11-22 (03-MOTION-SPEC.md + the Orbai direction).
   Loads last (sections/*.css are enqueued by filename). Rules:
   - every loop runs only under html.motion-ok, on a [data-loop] vignette that motion.js marks
     .is-inview, after its card has revealed (.is-in). Off screen the animation is removed, so
     nothing paints; reduced motion and "Pause animations" remove it too (motion.css);
   - the first keyframe of every loop equals the static design, so a loop that has not started
     (no JS, JS failed, off screen, paused) shows exactly the approved still;
   - transform and opacity only, except stroke-dashoffset on two small SVG lines. */

/* ================================================================ Reveal tuning (spec 3.3, 3.4, 5.3) */
/* Home rises 56px on desktop (spec 3.3: 40px, home 56px). */
@media (min-width: 1024px) { body.home { --dist-reveal: 56px; } }
/* Home section headers lead their grids by --lead-gap (motion.css only knew .head). */
.hm-head + [data-stagger] > [data-reveal],
.hm-head + .hm-bento > [data-stagger]:first-child > [data-reveal] { --extra: var(--lead-gap); }

/* Section header choreography (5.3): the block rises; inside it the chip pops from 0.92 and
   the sub line follows 80ms later (rich and medium pages; light pages keep plain up and fade).
   Home only: the chip icon spins in (4.3 chip icon values). */
html.motion-ok body:is([data-motion="rich"], [data-motion="medium"]) :is(.head, .hm-head)[data-reveal] > .chip {
	transition: transform 700ms var(--ease-spring-ui);
}
html.motion-ok body:is([data-motion="rich"], [data-motion="medium"]) :is(.head, .hm-head)[data-reveal]:not(.is-in) > .chip { transform: scale(.92); }
html.motion-ok body:is([data-motion="rich"], [data-motion="medium"]) :is(.head, .hm-head)[data-reveal] > p {
	transition: opacity calc(var(--dur-reveal) * .8) var(--ease-out-quart) 80ms, transform var(--dur-reveal) var(--ease-spring) 80ms;
}
html.motion-ok body:is([data-motion="rich"], [data-motion="medium"]) :is(.head, .hm-head)[data-reveal]:not(.is-in) > p { opacity: 0; transform: translateY(12px); }
html.motion-ok .hm-head[data-reveal] .chip__ico { transition: transform 1300ms var(--ease-out-quint) 150ms; }
html.motion-ok .hm-head[data-reveal]:not(.is-in) .chip__ico { transform: rotate(-200deg) scale(0); }
html.motion-ok :is(.head, .hm-head).is-instant > *,
html.motion-ok :is(.head, .hm-head).is-instant .chip__ico { transition: none !important; }

/* Image settle (6.1): images in frames settle from 1.06 when their container reveals. */
html.motion-ok [data-reveal] [data-settle] img { transition: transform var(--dur-settle) var(--ease-out-expo); }
html.motion-ok [data-reveal]:not(.is-in) [data-settle] img { transform: scale(1.06); }
html.motion-ok .is-instant [data-settle] img { transition: none; }

/* ================================================================ Bento lead (9.1, 6.5)
   After it settles, the decorative 3D render drifts very slowly while in view. */
@keyframes sth-drift { from { transform: none; } to { transform: scale(1.035) translateY(-6px); } }
html.motion-ok .bento__lead.is-in.is-inview [data-settle] img {
	animation: sth-drift 7s var(--ease-in-out) 1.4s infinite alternate;
}

/* ================================================================ Footer offset (5.4, 6.3)
   Orbai's one scroll-linked effect, at 60px instead of 150px: the footer content rises into
   place as the footer enters. Compositor only; desktop; no fallback where unsupported. */
@supports (animation-timeline: view()) {
	@media (min-width: 1024px) {
		html.motion-ok .site-footer { view-timeline: --sth-foot block; overflow: clip; }
		html.motion-ok .site-footer > .foot {
			animation: sth-foot linear both;
			animation-timeline: --sth-foot;
			animation-range: entry 0% entry 100%;
		}
	}
}
@keyframes sth-foot { from { transform: translateY(-60px); } to { transform: none; } }

/* ================================================================ Bottom progressive blur (3.5, 3.6)
   Desktop fine pointers only; motion.js adds the strip. QA round 2: the first version (72px,
   up to 7px) made buttons and copy in the lowest band unreadable. Now a 40px edge softening:
   three static backdrop layers (0.5, 1 and 2.5px), the strongest only in the last 10px,
   never animated. It hides while keyboard focus is on the page (so it never sits over a
   focused control), while the menu is open, and from 480px before the page end. */
.sth-blurband {
	position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-blurband, 40);
	height: 40px; pointer-events: none; transition: opacity 300ms var(--ease-out-quart);
}
.sth-blurband i { position: absolute; inset: 0; }
.sth-blurband i:nth-child(1) { backdrop-filter: blur(.5px); -webkit-mask: linear-gradient(transparent, #000 60%); mask: linear-gradient(transparent, #000 60%); }
.sth-blurband i:nth-child(2) { backdrop-filter: blur(1px); -webkit-mask: linear-gradient(transparent 45%, #000 85%); mask: linear-gradient(transparent 45%, #000 85%); }
.sth-blurband i:nth-child(3) { backdrop-filter: blur(2.5px); -webkit-mask: linear-gradient(transparent 75%, #000); mask: linear-gradient(transparent 75%, #000); }
.sth-blurband.is-end, html.menu-open .sth-blurband, html:has(:focus-visible) .sth-blurband { opacity: 0; }
@media (max-width: 1023px), (hover: none), print { .sth-blurband { display: none; } }

/* ================================================================ Scene pulse (4.4, 12.1)
   The flow scene's active-step ring (motion.css) is an `animation` shorthand, which resets
   animation-play-state and so beat the "loops only in view" pause rule: it kept running off
   screen. Remove it whenever the scene is out of view or motion is not allowed. */
[data-scene="flow"]:not(.is-inview) .scene__step.is-active .scene__num::after,
html:not(.motion-ok) [data-scene="flow"] .scene__step.is-active .scene__num::after { animation: none; }

/* ================================================================ Mobile menu sheet (8.3)
   The sheet fades in over the page and its content rises; closing fades it out (motion.js
   holds .is-closing for 200ms). The Mist surface moves to a layer so it can fade. */
@media (max-width: 1279px) {
	html.motion-ok .mnav.is-open { background: transparent; }
	html.motion-ok .mnav.is-open::before {
		content: ""; position: absolute; inset: 0; z-index: -1; background: var(--c-mist);
		animation: sth-fade-in 240ms var(--ease-out-quart) both;
	}
	html.motion-ok .mnav.is-open .msheet { animation: sth-sheet-in var(--dur-panel) var(--ease-out-quart) both; }
	html.motion-ok .mnav.is-open.is-closing { animation: sth-fade-out 200ms var(--ease-in) both; }
}
@keyframes sth-fade-in { from { opacity: 0; } }
@keyframes sth-fade-out { to { opacity: 0; } }
@keyframes sth-sheet-in { from { opacity: 0; transform: translateY(-10px); } }

/* ================================================================ Home vignettes (desktop art, >= 1024px)
   One idea per vignette, 4.8 to 6.4s loops, --ease-in-out. Each starts 1.2 to 1.8s after its
   card revealed so the entrance finishes first. */
.hm-track__done, .hm-track__now { position: absolute; border-radius: 50%; opacity: 0; }
.hm-track__done { inset: 0; display: grid; place-items: center; background: var(--grad-brand); }
.hm-track__now { left: 13px; top: 13px; width: 14px; height: 14px; background: rgba(1, 14, 208, .85); }
.hm-track__stop[data-st="done"] .hm-track__done, .hm-track__stop[data-st="now"] .hm-track__now { opacity: 1; }

@media (min-width: 1024px) {
	/* ---- 01 Phone: the cursor leaves, comes back from the option cards, glides to
	   "Get started" and presses it; the rings ripple back in; a sheen passes over the cards;
	   the two label chips float. */
	html.motion-ok .hm-step.is-in .is-inview .hm-phone__cursor { transform-origin: 20% 10%; animation: hm-cursor 6.4s 1.2s infinite; }
	html.motion-ok .hm-step.is-in .is-inview .hm-phone__cta { animation: hm-press 6.4s 1.2s infinite; }
	html.motion-ok .hm-step.is-in .is-inview .hm-phone__ring--a { animation: hm-ring-a 6.4s 1.2s infinite; }
	html.motion-ok .hm-step.is-in .is-inview .hm-phone__ring--b { animation: hm-ring-b 6.4s 1.2s infinite; }
	html.motion-ok .hm-step.is-in .is-inview :is(.hm-phone__card, .hm-phone__mini) { overflow: hidden; }
	html.motion-ok .hm-step.is-in .is-inview :is(.hm-phone__card, .hm-phone__mini)::after {
		content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
		background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .75) 50%, transparent 70%);
		transform: translateX(-110%); animation: hm-sheen 6.4s var(--ease-in-out) 1.2s infinite;
	}
	html.motion-ok .hm-step.is-in .is-inview .hm-phone__mini::after { animation-delay: 1.45s; }
	html.motion-ok .hm-step.is-in .is-inview .hm-phone__mini + .hm-phone__mini::after { animation-delay: 1.6s; }
	html.motion-ok .hm-step.is-in .is-inview .hm-phone__tag { animation: hm-float 4.8s var(--ease-in-out) 1.2s infinite alternate; }
	html.motion-ok .hm-step.is-in .is-inview .hm-phone__tag--click { animation-duration: 5.6s; animation-delay: .4s; }

	/* ---- 02 Track: Test completes, the line runs on to Deploy, then the run resets and
	   fills again stop by stop, ending where the design rests (Test in progress). */
	html.motion-ok .hm-step.is-in .is-inview .hm-track__fill { animation: hm-fill 6s var(--ease-in-out) 1.6s infinite; }
	html.motion-ok .hm-step.is-in .is-inview .hm-track__stop .hm-track__done { animation: hm-done-0 6s 1.6s infinite; }
	html.motion-ok .hm-step.is-in .is-inview .hm-track__stop:nth-child(4) .hm-track__done { animation-name: hm-done-1; }
	html.motion-ok .hm-step.is-in .is-inview .hm-track__stop:nth-child(5) .hm-track__done { animation-name: hm-done-2; }
	html.motion-ok .hm-step.is-in .is-inview .hm-track__stop:nth-child(6) .hm-track__done { animation-name: hm-done-3; }
	html.motion-ok .hm-step.is-in .is-inview .hm-track__stop:nth-child(5) .hm-track__now { animation: hm-now 6s 1.6s infinite; }

	/* ---- 03 Chart: the line fades, redraws left to right, and the Reliability point pops
	   back in at its end; a soft ring pulses from the point (2.4s, spec pulse period). */
	html.motion-ok .hm-step.is-in .is-inview .hm-chart__line { animation: hm-draw 6s 1.8s infinite; }
	html.motion-ok .hm-step.is-in .is-inview .hm-chart__area { animation: hm-area 6s var(--ease-in-out) 1.8s infinite; }
	html.motion-ok .hm-step.is-in .is-inview .hm-chart__end { animation: hm-end 6s 1.8s infinite; }
	html.motion-ok .hm-step.is-in .is-inview .hm-chart__end::after {
		content: ""; position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 2px rgba(1, 14, 208, .45);
		opacity: 0; animation: hm-pulse 2.4s var(--ease-out-quart) 1.8s infinite;
	}

	/* ---- Capabilities, insight: signals light up one source at a time and flow along the
	   dashed lines into the hub, which answers with a soft ring. */
	html.motion-ok .hm-cap.is-in .is-inview .hm-cap__lines path { animation: hm-dash 1.6s linear 1.2s infinite; }
	html.motion-ok .hm-cap.is-in .is-inview .hm-cap__pill i::after {
		content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--c-blue);
		opacity: 0; animation: hm-sig 4.8s var(--ease-in-out) 1.2s infinite;
	}
	html.motion-ok .hm-cap.is-in .is-inview .hm-cap__pill:nth-of-type(2) i::after { animation-delay: 1.6s; }
	html.motion-ok .hm-cap.is-in .is-inview .hm-cap__pill:nth-of-type(3) i::after { animation-delay: 2s; }
	html.motion-ok .hm-cap.is-in .is-inview .hm-cap__hub::after {
		content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: 0 0 0 2px rgba(1, 14, 208, .35);
		opacity: 0; animation: hm-hub 4.8s var(--ease-out-quart) 1.2s infinite;
	}
	html.motion-ok .hm-cap.is-in .is-inview .hm-cap__label { animation: hm-nudge 4.8s var(--ease-in-out) 1.2s infinite; }

	/* ---- Capabilities, modernize: the modern stack rebuilds row by row out of the arrow. */
	html.motion-ok .hm-cap.is-in .is-inview .hm-cap__new { animation: hm-row 5.2s var(--ease-in-out) 1.4s infinite; }
	html.motion-ok .hm-cap.is-in .is-inview .hm-cap__new:nth-of-type(2) { animation-delay: 1.55s; }
	html.motion-ok .hm-cap.is-in .is-inview .hm-cap__new:nth-of-type(3) { animation-delay: 1.7s; }
	html.motion-ok .hm-cap.is-in .is-inview .hm-cap__arrow { animation: hm-arrow 5.2s var(--ease-in-out) 1.4s infinite; }
}

/* Phone */
@keyframes hm-cursor {
	0%, 10% { transform: none; opacity: 1; animation-timing-function: var(--ease-in); }
	16% { transform: translate(6px, 10px); opacity: 0; }
	18% { transform: translate(-18px, -172px); opacity: 0; animation-timing-function: var(--ease-out-quart); }
	26% { transform: translate(-18px, -172px); opacity: 1; animation-timing-function: var(--ease-in-out); }
	52% { transform: none; opacity: 1; animation-timing-function: var(--ease-out-quart); }
	56% { transform: scale(.84); }
	62%, 100% { transform: none; opacity: 1; }
}
@keyframes hm-press {
	0%, 52% { transform: none; animation-timing-function: var(--ease-out-quart); }
	56% { transform: scale(.97); animation-timing-function: var(--ease-spring-ui); }
	64%, 100% { transform: none; }
}
@keyframes hm-ring-a {
	0%, 10% { transform: none; opacity: 1; animation-timing-function: var(--ease-in); }
	16%, 55% { transform: scale(.7); opacity: 0; animation-timing-function: var(--ease-spring-ui); }
	64%, 100% { transform: none; opacity: 1; }
}
@keyframes hm-ring-b {
	0%, 10% { transform: none; opacity: 1; animation-timing-function: var(--ease-in); }
	16%, 57% { transform: scale(.6); opacity: 0; animation-timing-function: var(--ease-out-quint); }
	70%, 100% { transform: none; opacity: 1; }
}
@keyframes hm-sheen { 0% { transform: translateX(-110%); } 22%, 100% { transform: translateX(110%); } }
@keyframes hm-float { from { transform: none; } to { transform: translateY(-5px); } }

/* Track: fill is 240px wide (Requirements to Test); 0.5 = Build, 1.5 = Deploy. */
@keyframes hm-fill {
	0%, 18% { transform: none; opacity: 1; }
	30%, 52% { transform: scaleX(1.5); opacity: 1; }
	58% { transform: scaleX(1.5); opacity: 0; }
	59% { transform: scaleX(0); opacity: 0; }
	61%, 64% { transform: scaleX(0); opacity: 1; }
	74%, 78% { transform: scaleX(.5); opacity: 1; }
	88%, 100% { transform: none; opacity: 1; }
}
@keyframes hm-done-0 {
	0%, 52% { opacity: 1; transform: none; animation-timing-function: var(--ease-in); }
	58%, 62% { opacity: 0; transform: scale(.6); animation-timing-function: var(--ease-spring-ui); }
	67%, 100% { opacity: 1; transform: none; }
}
@keyframes hm-done-1 {
	0%, 52% { opacity: 1; transform: none; animation-timing-function: var(--ease-in); }
	58%, 75% { opacity: 0; transform: scale(.6); animation-timing-function: var(--ease-spring-ui); }
	80%, 100% { opacity: 1; transform: none; }
}
@keyframes hm-done-2 {
	0%, 12% { opacity: 0; transform: scale(.6); animation-timing-function: var(--ease-spring-ui); }
	17%, 52% { opacity: 1; transform: none; animation-timing-function: var(--ease-in); }
	58%, 100% { opacity: 0; transform: scale(.6); }
}
@keyframes hm-done-3 {
	0%, 30% { opacity: 0; transform: scale(.6); animation-timing-function: var(--ease-spring-ui); }
	35%, 52% { opacity: 1; transform: none; animation-timing-function: var(--ease-in); }
	58%, 100% { opacity: 0; transform: scale(.6); }
}
@keyframes hm-now {
	0%, 12% { opacity: 1; transform: none; }
	16%, 88% { opacity: 0; transform: scale(.4); animation-timing-function: var(--ease-spring-ui); }
	94%, 100% { opacity: 1; transform: none; }
}

/* Chart */
@keyframes hm-draw {
	0%, 60% { stroke-dashoffset: 0; opacity: 1; animation-timing-function: var(--ease-in); }
	68% { stroke-dashoffset: 0; opacity: 0; }
	69% { stroke-dashoffset: 1; opacity: 0; }
	71% { stroke-dashoffset: 1; opacity: 1; animation-timing-function: var(--ease-in-out); }
	96%, 100% { stroke-dashoffset: 0; opacity: 1; }
}
@keyframes hm-area { 0%, 60% { opacity: 1; } 68%, 78% { opacity: 0; } 100% { opacity: 1; } }
@keyframes hm-end {
	0%, 60% { opacity: 1; transform: none; animation-timing-function: var(--ease-in); }
	68%, 94% { opacity: 0; transform: scale(.5); animation-timing-function: var(--ease-spring-ui); }
	100% { opacity: 1; transform: none; }
}
@keyframes hm-pulse { 0% { opacity: .9; transform: none; } 100% { opacity: 0; transform: scale(2.4); } }

/* Capabilities */
@keyframes hm-dash { to { stroke-dashoffset: -16; } }
@keyframes hm-sig { 0% { opacity: 0; } 8%, 22% { opacity: .85; } 34%, 100% { opacity: 0; } }
@keyframes hm-hub { 0%, 38% { opacity: 0; transform: none; } 40% { opacity: 1; transform: none; } 70%, 100% { opacity: 0; transform: scale(1.35); } }
@keyframes hm-nudge { 0%, 46% { transform: none; } 54% { transform: translateX(4px); } 66%, 100% { transform: none; } }
@keyframes hm-row {
	0%, 58% { opacity: 1; transform: none; animation-timing-function: var(--ease-in); }
	66% { opacity: 0; transform: translateX(6px); }
	68% { opacity: 0; transform: translateX(-14px); animation-timing-function: var(--ease-out-quart); }
	82%, 100% { opacity: 1; transform: none; }
}
@keyframes hm-arrow { 0%, 64% { transform: none; } 72% { transform: translateX(5px); } 84%, 100% { transform: none; } }
