/* Steps (kit3 R.steps final override + kit3x eqTitles and PATCH6).
   Variants: row, cards, timeline (image, flip), big. Phone rail = kit steps1 mobile.
   Motion: 03-MOTION-SPEC.md 9.3. Start states only under html.motion-ok, keyed on .is-in. */

.steps { position: relative; margin: 0; }
.steps__t {
	font: var(--fw-medium) 20px/26px var(--f-head); letter-spacing: -.3px; color: var(--c-ink);
	text-wrap: pretty;
}
.steps__d { font-size: 15px; line-height: 22px; color: var(--ink-68); }
.steps__num {
	display: inline-grid; place-items: center; flex: none;
	font-family: var(--f-head); font-weight: var(--fw-medium);
	font-variant-numeric: tabular-nums;
}

/* ================================================================ Rail (kit steps1 mobile, timeline desktop)
   Used by row and timeline below 1024px, big below 768px. */
.steps--row, .steps--timeline, .steps--big { display: flex; flex-direction: column; }
.steps--row .steps__item, .steps--timeline .steps__item, .steps--big .steps__item {
	display: flex; gap: 16px;
}
.steps--row .steps__rail, .steps--timeline .steps__rail, .steps--big .steps__rail {
	flex: 0 0 44px; display: flex; flex-direction: column; align-items: center;
}
.steps--row .steps__num, .steps--timeline .steps__num, .steps--big .steps__num {
	width: 44px; height: 44px; border-radius: 50%;
	background: var(--grad-brand); box-shadow: var(--sh-soft);
	font-size: 14px; line-height: 20px; color: var(--c-white);
}
.steps__seg { flex: 1 0 20px; width: 2px; background: var(--ink-12); transform-origin: top; }
.steps--row .steps__copy, .steps--timeline .steps__copy, .steps--big .steps__copy {
	flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; padding: 6px 0 26px;
}
.steps--row .steps__item:last-child .steps__copy,
.steps--timeline .steps__item:last-child .steps__copy,
.steps--big .steps__item:last-child .steps__copy { padding-bottom: 0; }

/* ================================================================ Cards (kit v=cards) */
.steps--cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.steps--cards .steps__item {
	display: flex; flex-direction: column; gap: 8px;
	padding: 20px; border-radius: 18px;
}
.steps--cards .steps__rail, .steps--cards .steps__copy { display: contents; }
.steps--cards .steps__num {
	display: block; margin-bottom: 10px; /* kit spacer 2 + gap 8 */
	font-size: 30px; line-height: 34px; letter-spacing: -1.4px; color: var(--c-blue);
}
.steps--cards .steps__item:not(:first-child) .steps__num { color: rgba(1, 14, 208, .66); } /* was .38 = 2.3:1; .66 = 4.9:1 (WCAG 1.4.3) */
.steps--cards .steps__t { font-size: 18px; line-height: 24px; }
.steps--cards .steps__d { font-size: 14px; line-height: 21px; color: var(--ink-72); }

/* ================================================================ Timeline visual */
.steps-tl { display: flex; flex-direction: column; gap: var(--sec-gap); }
.steps-tl__vis--ph { display: none; }
.steps-tl__img .imgcard__frame { aspect-ratio: 350 / 220; height: auto; border-radius: 22px; }

/* ================================================================ 768+ */
@media (min-width: 768px) {
	/* Cards: two columns on tablets, desktop sizes. */
	.steps--cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
	.steps--cards .steps__item { gap: 12px; padding: 28px 26px; border-radius: 22px; }
	.steps--cards .steps__num { margin-bottom: 30px; /* kit spacer 18 + gap 12 */ font-size: 44px; line-height: 48px; }
	.steps--cards .steps__t { font-size: 21px; line-height: 27px; }
	.steps--cards .steps__d { font-size: 15px; line-height: 23px; }

	/* Big (kit fallback grid): two columns of blocks, 1px top rule, numeral 84 wide. */
	.steps--big { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.steps--big .steps__item {
		gap: 24px; padding: 30px 32px 30px 0;
		border-top: 1px solid var(--ink-12);
	}
	.steps--big .steps__rail { flex: 0 0 84px; align-items: flex-start; }
	.steps--big .steps__num {
		display: block; width: auto; height: auto; border-radius: 0;
		background: none; box-shadow: none;
		font-size: 52px; line-height: 56px; letter-spacing: -1.6px; color: var(--c-blue);
	}
	.steps--big .steps__seg { display: none; }
	.steps--big .steps__copy,
	.steps--big .steps__item:last-child .steps__copy { gap: 6px; padding: 6px 0; }
	.steps--big .steps__t { font-size: 24px; line-height: 30px; letter-spacing: -.4px; }
	.steps--big .steps__d { font-size: 16px; line-height: 24px; }
}

/* ================================================================ 1024+ */
@media (min-width: 1024px) {
	/* Cards: one row (kit HORIZONTAL, layoutGrow), titles equalised via subgrid (kit3x eqTitles). */
	.steps--cards {
		grid-template-columns: repeat(var(--n), minmax(0, 1fr));
		grid-template-rows: auto auto 1fr; row-gap: 0;
	}
	.steps--cards .steps__item {
		display: grid; grid-row: span 3; grid-template-rows: subgrid; row-gap: 12px; align-content: start;
	}
	.steps--cards .steps__d { align-self: start; }
	/* Six cards (B7-06) keep the kit's single row from 1280; three per row on small laptops. */
	.steps--cards.steps--many { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: none; row-gap: 20px; }

	/* Row: one connector line at y 27 across the full width, discs 56 with a 6px Mist ring. */
	.steps--row { flex-direction: row; gap: 40px; }
	.steps--row::before {
		content: ""; position: absolute; left: 0; right: 0; top: 27px; height: 2px;
		background: var(--ink-12); transform-origin: left;
	}
	.steps--row .steps__item { flex: 1 1 0; min-width: 0; flex-direction: column; gap: 14px; }
	.steps--row .steps__rail { flex: none; display: block; position: relative; z-index: 1; }
	.steps--row .steps__num {
		/* 56 disc + 6px outside Mist stroke; a border keeps the soft shadow cast from the ring, as in Figma. */
		width: 68px; height: 68px; margin: -6px;
		border: 6px solid var(--c-mist);
		font-size: 17px; line-height: 22px;
	}
	.steps--row .steps__seg { display: none; }
	.steps--row .steps__copy,
	.steps--row .steps__item:last-child .steps__copy { gap: 14px; padding: 18px 0 0; }
	.steps--row .steps__t { font-size: 23px; line-height: 30px; letter-spacing: -.4px; }
	.steps--row .steps__d { font-size: 16px; line-height: 24px; }

	/* Timeline: 560 rail column + 576 image card, gap 64, image at least 400 tall. */
	.steps-tl {
		display: grid; grid-template-columns: minmax(0, 560fr) minmax(0, 576fr);
		gap: 64px; align-items: center;
	}
	.steps-tl--flip { grid-template-columns: minmax(0, 576fr) minmax(0, 560fr); }
	.steps-tl--flip .steps-tl__vis { order: -1; }
	.steps-tl__vis, .steps-tl__vis--ph { display: block; align-self: stretch; min-height: 400px; }
	.steps-tl__img { height: 100%; }
	.steps-tl__img .imgcard__frame { aspect-ratio: auto; height: 100%; border-radius: 28px; }
	.steps--timeline .steps__item { gap: 20px; }
	.steps--timeline .steps__rail { flex-basis: 48px; }
	.steps--timeline .steps__num { width: 48px; height: 48px; font-size: 15px; line-height: 20px; }
	.steps--timeline .steps__copy { gap: 6px; padding: 8px 0 34px; }
	.steps--timeline .steps__t { font-size: 23px; line-height: 30px; letter-spacing: -.4px; }
	.steps--timeline .steps__d { font-size: 16px; line-height: 24px; }
}

@media (min-width: 1280px) {
	.steps--cards.steps--many { grid-template-columns: repeat(var(--n), minmax(0, 1fr)); grid-template-rows: auto auto 1fr; row-gap: 0; }
}

/* ================================================================ Motion (9.3)
   The list itself carries data-reveal="fade" so motion.js marks it .is-in; it stays opaque so
   the line drawing is the entrance. Delay per item = index x line duration / count. */
.steps[data-steps] {
	--steps-lead: var(--lead-gap);
	--steps-at: calc(var(--steps-lead) + var(--i, 0) * var(--dur-line) / var(--n, 4));
}
.steps[data-steps] .steps__item { --steps-at: calc(var(--steps-lead) + var(--i, 0) * var(--dur-line) / var(--n, 4)); }
html.motion-ok .steps[data-reveal][data-steps]:not(.is-in) { opacity: 1; transform: none; }

html.motion-ok .steps[data-steps] .steps__num,
html.motion-ok .steps[data-steps] .steps__seg,
html.motion-ok .steps[data-steps] .steps__copy,
html.motion-ok .steps--row[data-steps]::before {
	transition:
		opacity 400ms var(--ease-out-quart),
		transform 500ms var(--ease-spring-ui);
}
/* Rail (all rail layouts): discs pop as reached, segment draws down, copy slides 12px from the line side. */
html.motion-ok .steps[data-steps]:not(.is-in) .steps__num { opacity: 0; transform: scale(.6); }
html.motion-ok .steps[data-steps]:not(.is-in) .steps__seg { transform: scaleY(0); }
html.motion-ok .steps[data-steps]:not(.is-in) .steps__copy { opacity: 0; transform: translateX(-12px); }
html.motion-ok .steps[data-steps] .steps__num { transition-delay: var(--steps-at); }
html.motion-ok .steps[data-steps] .steps__seg {
	transition: transform calc(var(--dur-line) / var(--n, 4)) linear;
	transition-delay: var(--steps-at);
}
html.motion-ok .steps[data-steps] .steps__copy {
	transition:
		opacity 500ms var(--ease-out-quart),
		transform 600ms var(--ease-out-quart);
	transition-delay: calc(var(--steps-at) + 100ms);
}

@media (min-width: 768px) {
	/* Big: numerals rise 24px with the spring, descriptions fade 120ms later (grid stagger). */
	.steps--big[data-steps] .steps__item { --steps-at: calc(var(--steps-lead) + min(var(--i, 0) * var(--stagger-grid), var(--stagger-cap))); }
	html.motion-ok .steps--big[data-steps]:not(.is-in) .steps__num { opacity: 0; transform: translateY(24px); }
	html.motion-ok .steps--big[data-steps]:not(.is-in) .steps__copy { opacity: 0; transform: none; }
	html.motion-ok .steps--big[data-steps] .steps__num {
		transition: opacity calc(var(--dur-reveal) * .8) var(--ease-out-quart), transform var(--dur-reveal) var(--ease-spring);
		transition-delay: var(--steps-at);
	}
	html.motion-ok .steps--big[data-steps] .steps__copy {
		transition: opacity 700ms var(--ease-out-quart);
		transition-delay: calc(var(--steps-at) + 120ms);
	}
}
@media (min-width: 1024px) {
	/* Row: the connector draws left to right over --dur-line; labels fade 100ms after their disc. */
	html.motion-ok .steps--row[data-steps]:not(.is-in)::before { transform: scaleX(0); }
	html.motion-ok .steps--row[data-steps]::before {
		transition: transform var(--dur-line) var(--ease-out-quart);
		transition-delay: var(--steps-lead);
	}
	html.motion-ok .steps--row[data-steps]:not(.is-in) .steps__copy { transform: none; }
	html.motion-ok .steps--row[data-steps] .steps__copy { transition: opacity 500ms var(--ease-out-quart); transition-delay: calc(var(--steps-at) + 100ms); }
}

/* Cards: grid stagger "up" comes from motion.css; numbers pop 0.92 to 1 with their card. */
html.motion-ok .steps--cards .steps__item:not(.is-in) .steps__num { transform: scale(.92); }
html.motion-ok .steps--cards .steps__num {
	transform-origin: left center;
	transition: transform 600ms var(--ease-spring-ui);
	transition-delay: min(calc(var(--i, 0) * var(--stagger, 0ms) + var(--extra, 0ms) + 120ms), calc(var(--stagger-cap) + 120ms));
}

/* Already in view on load (deep links, refresh): end state without transitions. */
.steps.is-instant *, .steps.is-instant::before, .steps__item.is-instant * { transition: none !important; }
