/* Motion wave 2, M3: content blocks (icons, steps, facts, stats, cards, featured, groups,
   list). Loads after zz-motion.css. Rules (qa/final-2026-11-22/MOTION.md):
   - everything runs only under html.motion-ok, so reduced motion, "Pause animations", no JS,
     a failed gate and print show today's static build in its end state;
   - entrances are one-off animations with `backwards` fill, started when the block reveals
     (.is-in) and never for blocks that were already on screen (.is-instant);
   - loops run only on Rich and Medium pages while motion2-blocks.js marks the block
     .m2-inview, and only after it revealed; off screen the animation is removed. The first
     keyframe of every loop is the static design;
   - transform and opacity only (stroke-dashoffset on the small icon glyphs). */

/* ================================================================ Shared timing
   --m2-at: when a child detail starts, 160ms after its revealing item (same stagger and cap
   as motion.css). Icon list rows (one card) and featured copy get their own. */
:is([data-sec="icons"], [data-sec="cards"], [data-sec="groups"], [data-sec="list"], [data-sec="featured"]) [data-reveal] {
	--m2-at: calc(min(calc(var(--i, 0) * var(--stagger, 0ms) + var(--extra, 0ms)), var(--stagger-cap)) + 160ms);
}
.icons-list__row { --m2-at: calc(240ms + min(var(--m2i, 0), 8) * var(--stagger-list)); }

@keyframes m2-pop { from { opacity: 0; transform: scale(.86); } }
@keyframes m2-pill { from { opacity: 0; transform: scale(.9); } }
@keyframes m2-draw { from { stroke-dasharray: 1 1; stroke-dashoffset: 1; } to { stroke-dasharray: 1 1; stroke-dashoffset: 0; } }
@keyframes m2-twist { from { opacity: 0; transform: rotate(-35deg) scale(.6); } }
@keyframes m2-sheen { from { transform: translateX(-120%); } to { transform: translateX(120%); } }
@keyframes m2-rise { from { opacity: 0; transform: translateY(6px); } }
@keyframes m2-side { from { opacity: 0; transform: translateX(-6px); } }
@keyframes m2-arrow { from { opacity: 0; transform: translate(-4px, 4px); } }
@keyframes m2-settle { from { transform: scale(1.06); } }

/* ================================================================ Icon tiles (icons, cards)
   The tile pops, its glyph draws (stroke icons; motion2-blocks.js sets pathLength="1" and
   .m2-draw) or twists in (the filled spark), then one soft sheen passes over it. */
html.motion-ok :is([data-sec="icons"], [data-sec="cards"]) :is(.tile, .icons-feat__ico) { position: relative; overflow: hidden; }
html.motion-ok :is([data-sec="icons"], [data-sec="cards"]) .is-in:not(.is-instant) :is(.tile, .icons-feat__ico) {
	animation: m2-pop 700ms var(--ease-spring-ui) var(--m2-at) backwards;
}
html.motion-ok :is([data-sec="icons"], [data-sec="cards"]) .is-in:not(.is-instant) :is(.tile, .icons-feat__ico) .m2-draw path {
	animation: m2-draw 900ms var(--ease-out-quart) calc(var(--m2-at) + 160ms) backwards;
}
html.motion-ok :is([data-sec="icons"], [data-sec="cards"]) .is-in:not(.is-instant) :is(.tile, .icons-feat__ico) .ico--spark {
	animation: m2-twist 800ms var(--ease-spring-ui) calc(var(--m2-at) + 160ms) backwards;
}
html.motion-ok :is([data-sec="icons"], [data-sec="cards"]) .is-in:not(.is-instant) :is(.tile, .icons-feat__ico)::after {
	content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
	background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, .42) 50%, transparent 70%);
	transform: translateX(-120%);
	animation: m2-sheen 1000ms var(--ease-in-out) calc(var(--m2-at) + 520ms) 1;
}
/* Hover (fine pointers): the glyph nudges up and tilts a few degrees. */
@media (hover: hover) and (pointer: fine) {
	html.motion-ok :is([data-sec="icons"], [data-sec="cards"]) :is(.tile, .icons-feat__ico) .ico {
		transition: transform var(--dur-hover) var(--ease-out-quart);
	}
	html.motion-ok :is(.icons__item, .icons-feat__item, .icons-list__row, .cards__item):hover :is(.tile, .icons-feat__ico) .ico {
		transform: translateY(-2px) rotate(-6deg);
	}
}

/* Dark feature lead (icons v=feature, Ink tone): a soft lavender glow drifts across the card
   while it is in view. It starts and ends invisible, so the rest state is the static card. */
html.motion-ok .icons-feat__lead.on-dark { position: relative; isolation: isolate; overflow: hidden; }
html.motion-ok .icons-feat__lead.on-dark.is-in.m2-inview::before {
	content: ""; position: absolute; z-index: -1; pointer-events: none;
	right: -20%; top: -30%; width: 90%; height: 80%; border-radius: 50%;
	background: radial-gradient(closest-side, rgba(131, 138, 236, .3), rgba(131, 138, 236, 0));
	opacity: 0; animation: m2-glow 8s var(--ease-in-out) 1.4s infinite;
}
@keyframes m2-glow {
	0% { opacity: 0; transform: none; }
	35% { opacity: 1; transform: translate(-8px, 6px); }
	70% { opacity: .8; transform: translate(-4px, 8px); }
	100% { opacity: 0; transform: none; }
}

/* ================================================================ Steps (9.3 extension)
   The line already draws and the discs already pop. Loop (Rich and Medium pages, in view,
   after the reveal): a small light travels from the first disc to the last; each disc
   settles (1.03 and back) with a soft ring as the light reaches it. 7s cycle. */
html.motion-ok .steps[data-steps].is-in.m2-inview .steps__num { position: relative; }
html.motion-ok .steps[data-steps].is-in.m2-inview .steps__num::after {
	content: ""; position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
	box-shadow: 0 0 0 2px rgba(1, 14, 208, .45); opacity: 0;
}
@keyframes m2-disc { 0%, 9%, 100% { transform: none; } 3% { transform: scale(1.03); } }
@keyframes m2-ring { 0% { opacity: 0; transform: none; } 1% { opacity: .9; transform: none; } 14%, 100% { opacity: 0; transform: scale(1.3); } }

/* Rail layouts (row and timeline below 1024px, timeline from 1024px, big below 768px): the
   light runs down each segment in turn, 1.1s per segment (up to six segments per cycle). */
html.motion-ok .steps[data-steps].is-in.m2-inview .steps__seg { position: relative; overflow: hidden; }
html.motion-ok .steps[data-steps].is-in.m2-inview .steps__seg::after {
	content: ""; position: absolute; left: 0; right: 0; top: 0; height: 100%; pointer-events: none;
	background: linear-gradient(180deg, rgba(1, 14, 208, 0) 25%, rgba(1, 14, 208, .85) 50%, rgba(1, 14, 208, 0) 75%);
	transform: translateY(-100%);
	animation: m2-fall 7s linear calc(2s + var(--i, 0) * 1.1s) infinite;
}
@keyframes m2-fall { 0% { transform: translateY(-100%); } 15.7%, 100% { transform: translateY(100%); } }
html.motion-ok .steps--timeline[data-steps].is-in.m2-inview .steps__num { animation: m2-disc 7s var(--ease-out-quart) calc(1.9s + var(--i, 0) * 1.1s) infinite; }
html.motion-ok .steps--timeline[data-steps].is-in.m2-inview .steps__num::after { animation: m2-ring 7s var(--ease-out-quart) calc(1.9s + var(--i, 0) * 1.1s) infinite; }
@media (max-width: 1023px) {
	html.motion-ok .steps--row[data-steps].is-in.m2-inview .steps__num { animation: m2-disc 7s var(--ease-out-quart) calc(1.9s + var(--i, 0) * 1.1s) infinite; }
	html.motion-ok .steps--row[data-steps].is-in.m2-inview .steps__num::after { animation: m2-ring 7s var(--ease-out-quart) calc(1.9s + var(--i, 0) * 1.1s) infinite; }
}
@media (max-width: 767px) {
	html.motion-ok .steps--big[data-steps].is-in.m2-inview .steps__num { animation: m2-disc 7s var(--ease-out-quart) calc(1.9s + var(--i, 0) * 1.1s) infinite; }
	html.motion-ok .steps--big[data-steps].is-in.m2-inview .steps__num::after { animation: m2-ring 7s var(--ease-out-quart) calc(1.9s + var(--i, 0) * 1.1s) infinite; }
}
/* Big from 768px shows plain numerals (no discs, no line): no loop. */
@media (min-width: 768px) {
	html.motion-ok .steps--big[data-steps].is-in.m2-inview .steps__num::after { content: none; }
}

/* Row from 1024px: one light along the connector, first disc to last disc, constant speed
   over 3.8s, fading in and out at the ends. motion2-blocks.js measures --m2-x0 (first disc
   centre) and --m2-d (distance to the last disc centre). The light sits under the discs. */
@media (min-width: 1024px) {
	html.motion-ok .steps--row[data-steps].is-in.m2-inview::after {
		content: ""; position: absolute; top: 26px; left: calc(var(--m2-x0, 28px) - 40px);
		width: 80px; height: 4px; pointer-events: none;
		background: radial-gradient(closest-side, rgba(1, 14, 208, .9), rgba(1, 14, 208, 0));
		opacity: 0; animation: m2-run 7s linear 2s infinite;
	}
	html.motion-ok .steps--row[data-steps].is-in.m2-inview .steps__num {
		animation: m2-disc 7s var(--ease-out-quart) calc(2s + 3.8s * var(--i, 0) / max(var(--n, 2) - 1, 1) - 80ms) infinite;
	}
	html.motion-ok .steps--row[data-steps].is-in.m2-inview .steps__num::after {
		animation: m2-ring 7s var(--ease-out-quart) calc(2s + 3.8s * var(--i, 0) / max(var(--n, 2) - 1, 1) - 80ms) infinite;
	}
}
@keyframes m2-run {
	0% { opacity: 0; transform: none; }
	4% { opacity: 1; }
	50% { opacity: 1; }
	54.3% { opacity: 0; transform: translateX(var(--m2-d, 0px)); }
	100% { opacity: 0; transform: translateX(var(--m2-d, 0px)); }
}

/* ================================================================ Facts and stats: dividers draw
   The 1px rules between rows (facts), items (stats strip, 768px up) and figures (dark band,
   1024px up) are redrawn as a layer in the same place and draw in after their item starts.
   Count-up already covers every plain number (stats.php); facts values hold no plain
   numbers (prices, ranges and versions are never counted). */
html.motion-ok .fcard__row + .fcard__row { position: relative; border-top-color: transparent; }
html.motion-ok .fcard__row + .fcard__row::before {
	content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 1px; background: var(--ink-10);
	transform-origin: 0 50%;
	transition: transform 800ms var(--ease-out-quart);
	transition-delay: calc(min(calc(var(--i, 0) * var(--stagger, 0ms) + var(--extra, 0ms)), var(--stagger-cap)) + 60ms);
}
html.motion-ok .fcard__row + .fcard__row:not(.is-in)::before { transform: scaleX(0); }

@media (min-width: 768px) {
	html.motion-ok [data-sec="stats"] .facts--strip .facts__item + .facts__item { position: relative; border-left-color: transparent; }
	html.motion-ok [data-sec="stats"] .facts--strip .facts__item + .facts__item::before {
		content: ""; position: absolute; left: -1px; top: 0; bottom: 0; width: 1px; background: var(--ink-10);
		transform-origin: 50% 0; transition: transform 700ms var(--ease-out-quart);
		transition-delay: calc(min(calc(var(--i, 0) * var(--stagger, 0ms) + var(--extra, 0ms)), var(--stagger-cap)) + 120ms);
	}
	html.motion-ok [data-sec="stats"] .facts--strip .facts__item:not(.is-in) + .facts__item::before { transform: scaleY(0); }
}
@media (min-width: 1024px) {
	html.motion-ok .statband:not(.statband--two) > .statband__fig + .statband__fig { position: relative; border-left-color: transparent; }
	html.motion-ok .statband:not(.statband--two) > .statband__fig + .statband__fig::before {
		content: ""; position: absolute; left: -1px; top: 0; bottom: 0; width: 1px; background: rgba(255, 255, 255, .16);
		transform-origin: 50% 0; transition: transform 800ms var(--ease-out-quart);
		transition-delay: calc(min(calc(var(--i, 0) * var(--stagger, 0ms) + var(--extra, 0ms)), var(--stagger-cap)) + 160ms);
	}
	html.motion-ok .statband:not(.statband--two) > .statband__fig:not(.is-in)::before { transform: scaleY(0); }
}
/* Dark band: the waves image drifts very slowly while in view (like the bento lead). */
@keyframes m2-drift { from { transform: none; } to { transform: scale(1.03) translateY(-6px); } }
html.motion-ok .sec--stats-dark.m2-inview:has(.statband__fig.is-in) .statband__bg img {
	animation: m2-drift 8s var(--ease-in-out) 1.2s infinite alternate;
}

/* ================================================================ Cards, featured, groups, list
   Details settle in after their card: tag pills pop, link arrows slide in, numbers rise. */
html.motion-ok [data-sec="cards"] .is-in:not(.is-instant) .cards__top .pill { animation: m2-pill 600ms var(--ease-spring-ui) var(--m2-at) backwards; }
html.motion-ok [data-sec="cards"] .is-in:not(.is-instant) .arrow-ne { animation: m2-arrow 600ms var(--ease-out-quart) calc(var(--m2-at) + 200ms) backwards; }

html.motion-ok .feat__copy.is-in:not(.is-instant) .pill { animation: m2-pill 600ms var(--ease-spring-ui) var(--m2-at) backwards; }
html.motion-ok .feat__copy.is-in:not(.is-instant) .feat__tag { animation: m2-side 600ms var(--ease-out-quart) calc(var(--m2-at) + 80ms) backwards; }
html.motion-ok .feat__copy.is-in:not(.is-instant) .feat__more .ico { animation: m2-side 600ms var(--ease-out-quart) calc(var(--m2-at) + 400ms) backwards; }
html.motion-ok .feat__media.is-in:not(.is-instant) > img { animation: m2-settle var(--dur-settle) var(--ease-out-expo) backwards; }

html.motion-ok .group.is-in:not(.is-instant) .group__n { animation: m2-rise 600ms var(--ease-out-quart) var(--m2-at) backwards; }
html.motion-ok .group.is-in:not(.is-instant) .group__a .arrow-ne { animation: m2-arrow 600ms var(--ease-out-quart) calc(var(--m2-at) + 240ms) backwards; }

html.motion-ok .rlist__row.is-in:not(.is-instant) .rlist__n { animation: m2-side 600ms var(--ease-out-quart) calc(var(--m2-at) - 60ms) backwards; }
html.motion-ok .rlist__row + .rlist__row { border-top-color: transparent; }
html.motion-ok .rlist__row + .rlist__row::before {
	content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 1px; background: var(--ink-10);
	transform-origin: 0 50%; transition: transform 800ms var(--ease-out-quart);
	transition-delay: calc(min(calc(var(--i, 0) * var(--stagger, 0ms) + var(--extra, 0ms)), var(--stagger-cap)) + 40ms);
}
html.motion-ok .rlist__row + .rlist__row:not(.is-in)::before { transform: scaleX(0); }

/* Already on screen at load: end state, no transitions. */
html.motion-ok .is-instant.fcard__row::before, html.motion-ok .is-instant.rlist__row::before,
html.motion-ok .is-instant.facts__item::before, html.motion-ok .is-instant.statband__fig::before { transition: none; }
