/* ==========================================================================
   Homepage stage: five milestones in one fixed 100dvh viewport.

   Markup (header.php / front-page.php / patterns/home-8-blocks.php):
     #stage-viewport > canvas#dru-webgl-canvas, .stage-hud, main#milestone-container
     #milestone-container > section.milestone[data-milestone]
       > .ms-copy   title + text (+ steps / form)
       > .ms-side   one panel (HUD card, pilot, roadmap, FAQ)
       > .ms-cards  card grid (role bento)
       > .ms-stack  stacked cards (research, team)

   Modes:
     html.dru-stage-mode       fixed stage, no native scroll (set before first paint
                          in header.php when DRU_STAGE_QUERY matches; engine in
                          assets/js/immersive-ui.js)
     html.dru-stage-live  the engine has taken over the milestone states
     (neither)            phones, short windows, no JS: milestones are
                          ordinary full-height sections in the document flow.

   Tokens (--glass-*, --cross-img, --laser, --mono, --cyan…) come from
   style.css.
   ========================================================================== */

:root {
	/* Clearance for the corner docks: top cluster and bottom telemetry/pill. */
	--ms-top: calc(var(--wp-admin--admin-bar--height, 0px) + clamp(4.75rem, 9.5vh, 6.25rem));
	--ms-bottom: clamp(4.75rem, 9.5vh, 6.25rem);
	--ms-x: clamp(1.25rem, 4vw, 4.5rem);
	--ms-rail: 4.5rem;
	--ms-gap: clamp(1.5rem, 3vw, 3.5rem);
	--ms-pad: clamp(1.25rem, 3vh, 2.5rem);
	--ms-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- Container and milestones (all modes) ------------------------------ */

#milestone-container {
	position: relative;
	z-index: 1;
	padding: 0;
	counter-reset: ms;
}

.milestone {
	position: relative;
	counter-increment: ms;
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	align-items: center;
	align-content: center;
	column-gap: var(--ms-gap);
	row-gap: 2.5rem;
	box-sizing: border-box;
	min-height: 100svh;
	margin: 0;
	padding: var(--ms-top) calc(var(--ms-x) + var(--ms-rail)) var(--ms-bottom) var(--ms-x);
}

/* Block flow layouts add margins between children; the stage spaces with gaps. */
.milestone > *,
.milestone .is-layout-flow > *,
.milestone .wp-block-group > * {
	margin-block: 0;
}

.milestone > * {
	min-width: 0;
}

/* Safe text bounds: copy never collapses into one-word ribbons. */
.ms-copy,
.ms-side,
.ms-card,
.ms-stack {
	word-break: normal;
	overflow-wrap: normal;
	hyphens: manual;
}

/* --- Copy column ---------------------------------------------------------- */

.ms-copy {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: clamp(1rem, 2.2vh, 1.75rem);
	/* Titles size to their own column (cqi), so a display headline keeps
	   whole words per line inside the 620px bound. */
	container-type: inline-size;
}

.ms-title {
	color: #FFFFFF;
	font-size: clamp(2.5rem, min(5.2vw, 8.6vh), 5.5rem);
	font-size: clamp(2.5rem, min(12cqi, 8.6vh), 5.5rem);
	font-weight: 300;
	line-height: 0.98;
	letter-spacing: -0.035em;
	text-wrap: balance;
}

/* 14cqi ≈ 88px in a 620px column: five lines, "можливості" whole. */
.ms-title--hero {
	font-size: clamp(3.5rem, min(6.5vw, 9.6vh), 5.5rem);
	font-size: clamp(3.5rem, min(14cqi, 9.6vh), 6.5rem);
	font-weight: 400;
	letter-spacing: -0.03em;
}

.ms-lead {
	max-width: 36rem;
	color: var(--ink);
	font-size: clamp(1.0625rem, min(1.35vw, 2.3vh), 1.375rem);
	line-height: 1.5;
}

.ms-note {
	max-width: 34rem;
	color: var(--muted);
	font-size: 0.9375rem;
	line-height: 1.5;
}

.ms-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
}

/* Eyebrow: "[02] // MISSION", generated (no layout shift, alt text empty).
   immersive-ui.js decodes the label (--eyebrow-label) on entry. */
.milestone-mission { --eyebrow-label: "MISSION"; }
.milestone-bento { --eyebrow-label: "VALUE"; }
.milestone-steps { --eyebrow-label: "JOIN"; }
.milestone-cta { --eyebrow-label: "ENROL"; }

.milestone:not(.milestone-hero) .ms-copy > .ms-title::before {
	content: "[" counter(ms, decimal-leading-zero) "] // " var(--eyebrow-label, "STAGE");
	content: "[" counter(ms, decimal-leading-zero) "] // " var(--eyebrow-label, "STAGE") / "";
	display: block;
	margin-bottom: 1.1rem;
	color: var(--cyan);
	font: 500 0.75rem/1.2 var(--mono);
	letter-spacing: 0.16em;
	text-transform: uppercase;
	white-space: nowrap;
}

/* --- Kinetic words (split server-side, functions.php) -------------------
   .dru-word        the mask (overflow window)
   .dru-word__in    moved by the stage engine (milestone transitions)
   .dru-word__txt   runs the CSS entrance on the hero (first paint, no JS) */

.dru-word {
	display: inline-block;
	overflow: hidden;
	vertical-align: top;
	/* Room inside the mask for Cyrillic descenders (у, р) and for marks
	   above capitals (Ї, Й), without changing the line rhythm. */
	padding-block: 0.14em 0.1em;
	margin-block: -0.14em -0.1em;
}

.dru-word__in,
.dru-word__txt {
	display: inline-block;
}

.ms-title--hero .dru-word__txt {
	background: linear-gradient(180deg, #FFFFFF 0%, #94A3B8 100%);
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
}

@media (prefers-reduced-motion: no-preference) {
	.milestone-hero .dru-word__txt {
		animation: ms-word-in 1.15s var(--ms-ease) calc(var(--i, 0) * 65ms + 120ms) backwards;
	}

	.milestone-hero .ms-copy > :not(.ms-title) {
		animation: ms-unit-in 1s var(--ms-ease) backwards;
	}

	.milestone-hero .ms-copy > :nth-child(1) { animation-delay: 60ms; }
	.milestone-hero .ms-copy > :nth-child(3) { animation-delay: 560ms; }
	.milestone-hero .ms-copy > :nth-child(4) { animation-delay: 700ms; }
}

/* Arriving by a page transition (assets/js/page-transitions.js), the engine
   plays the hero's entrance; this one would replay underneath it. */
.dru-page[data-dru-entered] .milestone-hero .dru-word__txt,
.dru-page[data-dru-entered] .milestone-hero .ms-copy > :not(.ms-title) {
	animation: none;
}

/* Words wipe open as they rise; blocks rise out of a clip. Both settle to
   their natural state on their own: the hero is complete without JS. */
@keyframes ms-word-in {
	from { transform: translate3d(0, 110%, 0) rotate(3deg); clip-path: inset(0 0 100% 0); }
	to { transform: none; clip-path: inset(0 0 0 0); }
}

@keyframes ms-unit-in {
	from { transform: translate3d(0, 28px, 0); clip-path: inset(0 0 100% 0); }
	to { transform: none; clip-path: inset(0 0 0 0); }
}

/* --- Glass panels and cards ------------------------------------------------
   05's form column is a card as a whole (title to button), so every
   column's border is the column's own outline. */

.ms-glass,
.milestone-cta > .ms-copy--form {
	position: relative;
	box-sizing: border-box;
	padding: var(--ms-pad);
	border: 1px solid var(--glass-border);
	border-radius: var(--glass-radius);
	background-color: var(--glass-bg);
	background-image: none, var(--cross-img);
	background-position:
		0 0,
		left 12px top 16px, left 16px top 12px,
		right 12px top 16px, right 16px top 12px,
		left 12px bottom 16px, left 16px bottom 12px,
		right 12px bottom 16px, right 16px bottom 12px;
	background-size:
		auto,
		9px 1px, 1px 9px, 9px 1px, 1px 9px,
		9px 1px, 1px 9px, 9px 1px, 1px 9px;
	background-repeat: no-repeat;
	-webkit-backdrop-filter: var(--glass-blur);
	backdrop-filter: var(--glass-blur);
	box-shadow: 0 30px 80px -50px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.ms-glass > * + * {
	margin-top: 0;
}

.milestone .dru-hud-card {
	grid-column: auto;
	min-width: 0;
}

/* Cards, panels: flex columns, so the last item (a link, a button) always
   sits inside the card and the card inside the viewport. */
.ms-side,
.ms-card {
	display: flex;
	flex-direction: column;
	gap: clamp(0.625rem, 1.5vh, 1rem);
}

.ms-side h2,
.ms-card h2 {
	color: #FFFFFF;
	font-size: clamp(1.375rem, 2.6vh, 1.75rem);
	font-weight: 400;
	line-height: 1.15;
	letter-spacing: -0.02em;
}

.ms-side h3,
.ms-card h3 {
	color: #FFFFFF;
	font-size: clamp(1.125rem, 2.3vh, 1.375rem);
	font-weight: 400;
	line-height: 1.25;
	letter-spacing: -0.015em;
}

.ms-side p,
.ms-card p {
	color: var(--ink);
	font-size: 0.9375rem;
	line-height: 1.55;
}

.ms-side .dru-status,
.ms-card .dru-status {
	font-size: 0.75rem;
}

.ms-card .dru-more,
.ms-side .wp-block-buttons {
	margin-top: auto;
	padding-top: 0.25rem;
}

.ms-card .dru-more a {
	color: var(--gold);
	font-size: 0.9375rem;
}

/* --- 02 Місія: pilot card ------------------------------------------------- */

.ms-pilot {
	border-color: rgba(255, 208, 0, 0.22);
	--cross: rgba(255, 208, 0, 0.65);
}

.ms-pilot h3 {
	font-size: clamp(1.375rem, 3vh, 1.875rem);
	font-weight: 300;
	letter-spacing: -0.03em;
}

.ms-pilot::before {
	content: "UA_CLUSTER // PILOT_01";
	content: "UA_CLUSTER // PILOT_01" / "";
	display: block;
	padding-bottom: 0.75rem;
	background: var(--laser) left bottom / 100% 1px no-repeat;
	color: rgba(255, 208, 0, 0.85);
	font: 500 0.6875rem/1.2 var(--mono);
	letter-spacing: 0.14em;
}

.ms-facts {
	display: grid;
	gap: 0.75rem;
	padding-top: 0.875rem;
	background: var(--laser) left top / 100% 1px no-repeat;
}

.ms-facts .dru-fact__value {
	color: var(--on-dark);
	font-size: 0.9375rem;
	font-weight: 400;
	line-height: 1.45;
}

/* --- 03 Bento: role cards --------------------------------------------------- */

.ms-cards {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 1rem;
	perspective: 1400px;
}

.ms-card::before {
	display: block;
	padding-bottom: 0.625rem;
	background: var(--laser) left bottom / 100% 1px no-repeat;
	color: rgba(0, 240, 255, 0.75);
	font: 500 0.6875rem/1.2 var(--mono);
	letter-spacing: 0.14em;
}

.ms-cards > :nth-child(1)::before { content: "LAT 50.4501° N // DATA_NODE_01"; content: "LAT 50.4501° N // DATA_NODE_01" / ""; color: rgba(255, 208, 0, 0.85); }
.ms-cards > :nth-child(2)::before { content: "LAT 52.2297° N // DATA_NODE_02"; content: "LAT 52.2297° N // DATA_NODE_02" / ""; }
.ms-cards > :nth-child(3)::before { content: "LAT 43.6532° N // DATA_NODE_03"; content: "LAT 43.6532° N // DATA_NODE_03" / ""; }
.ms-cards > :nth-child(4)::before { content: "LAT 51.5072° N // DATA_NODE_04"; content: "LAT 51.5072° N // DATA_NODE_04" / ""; }

.ms-cards > :nth-child(1) {
	border-color: rgba(255, 208, 0, 0.2);
	--cross: rgba(255, 208, 0, 0.65);
}

/* Terms as compact chips: three short labels, two lines at most. */
.ms-terms {
	display: flex;
	flex-wrap: wrap;
	gap: 0.375rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ms-terms li {
	margin: 0;
	padding: 0.25rem 0.625rem;
	border: 1px solid var(--line-strong);
	border-radius: var(--radius-pill);
	color: var(--on-dark);
	font-size: 0.8125rem;
	line-height: 1.3;
	white-space: nowrap;
}

/* --- 04 Steps + roadmap ------------------------------------------------------ */

.ms-steps {
	display: grid;
	gap: clamp(0.75rem, 1.8vh, 1.25rem);
	width: 100%;
	counter-reset: ms-step;
}

.ms-step {
	display: grid;
	grid-template-columns: 2.75rem minmax(0, 1fr);
	column-gap: 0.75rem;
	row-gap: 0.25rem;
	padding-top: clamp(0.75rem, 1.8vh, 1.125rem);
	background: var(--laser) left top / 100% 1px no-repeat;
	counter-increment: ms-step;
}

.ms-step::before {
	content: counter(ms-step, decimal-leading-zero);
	content: counter(ms-step, decimal-leading-zero) / "";
	grid-row: 1 / 3;
	color: var(--cyan);
	font: 500 0.8125rem/1.6 var(--mono);
	letter-spacing: 0.1em;
}

.ms-step__line {
	grid-column: 2;
	color: #FFFFFF;
	font-size: clamp(1.125rem, 2.4vh, 1.5rem);
	font-weight: 400;
	line-height: 1.25;
	letter-spacing: -0.02em;
}

.ms-step:last-child .ms-step__line {
	color: var(--cyan);
}

.ms-step__note {
	grid-column: 2;
	color: var(--muted);
	font-size: 0.9375rem;
	line-height: 1.5;
}

.ms-phases {
	display: grid;
	gap: 0.625rem;
	position: relative;
	padding-left: 1.25rem;
}

/* The connecting rail: dim, lit to the current phase. */
.ms-phases::before {
	content: "";
	position: absolute;
	left: 0.25rem;
	top: 0.5rem;
	bottom: 0.5rem;
	width: 1px;
	background: linear-gradient(180deg, var(--cyan) 0%, var(--gold) 40%, var(--line-strong) 40%);
}

.ms-phase {
	position: relative;
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	column-gap: 1rem;
	row-gap: 0.125rem;
	align-items: start;
}

.ms-phase::before {
	content: "";
	position: absolute;
	left: -1.25rem;
	top: 0.45rem;
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: var(--void);
	box-shadow: inset 0 0 0 1px var(--line-strong);
}

.ms-phase.is-done::before {
	background: var(--cyan);
	box-shadow: 0 0 10px var(--cyan-glow);
}

.ms-phase.is-current::before {
	background: var(--gold);
	box-shadow: 0 0 12px rgba(255, 208, 0, 0.7);
}

.ms-phase h3 {
	grid-column: 1;
	font-size: 1.0625rem;
}

.ms-phase p:not(.dru-status) {
	grid-column: 1;
	color: var(--muted);
	font-size: 0.875rem;
	line-height: 1.45;
}

.ms-phase .dru-status {
	grid-column: 2;
	grid-row: 1 / 3;
	align-self: center;
}

/* --- 05 Form, FAQ, research, team --------------------------------------------
   The form column is one glass card and fits a 768px-tall stage at step 1
   with no scrolling: a one-line title, a short note, a dense form and
   single-line role chips. */

.milestone-cta {
	--form-pad: clamp(1rem, 1.75vh, 1.5rem);
}

.ms-copy--form {
	justify-content: space-between;
	gap: 0;
}

.milestone-cta .ms-copy--form > .ms-title {
	margin-bottom: 0.5rem;
	font-size: clamp(1.75rem, 2.5vw, 2.25rem);
	line-height: 1.15;
	letter-spacing: -0.025em;
}

.milestone.milestone-cta .ms-copy > .ms-title::before {
	margin-bottom: 0.5rem;
}

.milestone-cta .ms-copy--form > .ms-note {
	max-width: none;
	margin-bottom: 1rem;
	font-size: 0.875rem;
	line-height: 1.45;
	text-wrap: pretty;
}

.ms-form {
	width: 100%;
}

/* Vertical padding as on the other cards (clear of the corner crosses),
   horizontal as tight as the form needs. */
.milestone-cta > .ms-copy--form {
	padding: var(--ms-pad) var(--form-pad);
}

/* Inside the card the form is plain content: the card is the surface. */
.milestone-cta .ms-copy--form .dru-form {
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none;
	-webkit-backdrop-filter: none;
	backdrop-filter: none;
	box-shadow: none;
}

/* Bars and label on one line. */
.milestone-cta .dru-form__progress {
	grid-template-columns: 1fr 1fr auto;
	align-items: center;
	margin-bottom: 0.75rem;
}

.milestone-cta .dru-form__progress-label {
	grid-column: auto;
	margin: 0 0 0 0.5rem;
	font-size: 0.75rem;
	line-height: 1.2;
	white-space: nowrap;
}

.milestone-cta .dru-form legend {
	margin-bottom: 0.5rem;
	font-size: 1rem;
}

.milestone-cta .dru-form__grid {
	gap: 0.75rem;
}

.milestone-cta .dru-field {
	gap: 0.25rem;
}

.milestone-cta .dru-field input[type="text"],
.milestone-cta .dru-field input[type="email"],
.milestone-cta .dru-field input[type="url"],
.milestone-cta .dru-field input[type="number"],
.milestone-cta .dru-field select {
	height: 40px;
	min-height: 40px;
	padding-block: 0.375rem;
}

.milestone-cta .dru-field textarea {
	height: 4rem;
	min-height: 4rem;
	padding-block: 0.5rem;
}

/* A half-width field left alone in its row (before a textarea) takes the
   whole row, so its label has room for "(необов’язково)". */
.milestone-cta .dru-form__grid > .dru-field:nth-child(odd):not(.dru-field--full):has(+ .dru-field--full) {
	grid-column: 1 / -1;
}

.milestone-cta .dru-field label,
.milestone-cta .dru-field__label {
	font-size: 0.75rem;
	line-height: 1.3;
}

/* A label that wraps in a narrow column (LinkedIn's "(необов’язково)")
   takes its extra line above, so the inputs in a row stay level. */
.milestone-cta .dru-form__grid > .dru-field > label {
	margin-top: auto;
}

/* Roles as single-line pill chips in a 2×2 grid; a column is never
   narrower than its longest label. The hints stay in the markup for the
   inner pages. */
.milestone-cta .dru-roles {
	grid-template-columns: repeat(2, minmax(max-content, 1fr));
	gap: 0.375rem;
}

.milestone-cta .dru-roles label {
	flex-direction: row;
	align-items: center;
	justify-content: center;
	min-height: 36px;
	padding: 0 0.875rem;
	border-radius: var(--radius-pill);
	font-size: 0.8125rem;
	line-height: 1.2;
	white-space: nowrap;
}

.milestone-cta .dru-roles .dru-field__hint {
	display: none;
}

.milestone-cta .dru-form__consent {
	margin-top: 0.75rem;
}

.milestone-cta .dru-consent {
	gap: 0.625rem;
	font-size: 0.8125rem;
	line-height: 1.45;
}

.milestone-cta .dru-form__nav {
	margin-top: 0.875rem;
}

.milestone-cta .dru-form__nav .dru-btn {
	min-height: 40px;
	padding-block: 0.625rem;
}

.ms-faq details {
	border-bottom: 1px solid var(--line);
}

.ms-faq summary {
	position: relative;
	display: block;
	padding: 0.625rem 2rem 0.625rem 0;
	color: var(--on-dark);
	font-size: 0.9375rem;
	font-weight: 500;
	line-height: 1.4;
	list-style: none;
	cursor: pointer;
}

.ms-faq summary::-webkit-details-marker {
	display: none;
}

.ms-faq summary::after {
	content: "+";
	content: "+" / "";
	position: absolute;
	right: 0.25rem;
	top: 0.5rem;
	color: var(--cyan);
	font: 300 1.25rem/1 var(--mono);
	transition: transform var(--dur-fast) var(--ms-ease);
}

.ms-faq details[open] > summary::after {
	transform: rotate(45deg);
}

/* theme.js keeps a closing answer [open] until it has slid shut; its
   cross turns back as soon as the close starts. */
.ms-faq details.is-closing > summary::after {
	transform: none;
}

.ms-faq summary:hover {
	color: var(--cyan);
}

.ms-faq details > :not(summary) {
	padding-bottom: 0.75rem;
	color: var(--ink);
	font-size: 0.875rem;
	line-height: 1.55;
}

.ms-faq__trust {
	padding-top: 0.25rem;
	color: var(--muted) !important;
	font-size: 0.875rem !important;
}

.ms-stack {
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.ms-research__query .wp-block-post-template {
	display: grid;
	gap: 0.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ms-research__query .wp-block-post-template > li {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.375rem 0.75rem;
	padding-top: 0.5rem;
	background: var(--laser) left top / 100% 1px no-repeat;
}

.ms-research__title {
	margin: 0;
	font-size: 0.9375rem;
	font-weight: 500;
	line-height: 1.35;
}

.ms-research__title a {
	color: var(--on-dark);
	text-decoration: none;
}

.ms-research__title a:hover {
	color: var(--cyan);
}

.ms-research__empty {
	color: var(--muted) !important;
	font-size: 0.875rem !important;
}

/* --- Wide layouts (≥ 960px): columns per milestone -------------------------- */

@media (min-width: 960px) {
	.milestone-hero {
		grid-template-columns: minmax(340px, 620px) minmax(340px, 400px);
		justify-content: space-between;
	}

	.milestone-mission {
		grid-template-columns: minmax(340px, 560px) minmax(340px, 560px);
		justify-content: space-between;
	}

	.milestone-bento {
		grid-template-columns: minmax(340px, 400px) minmax(0, 880px);
		justify-content: space-between;
	}

	.milestone-steps {
		grid-template-columns: minmax(340px, 620px) minmax(340px, 540px);
		justify-content: space-between;
	}

	.milestone-cta {
		grid-template-columns: minmax(340px, 540px) minmax(340px, 1fr) minmax(340px, 380px);
		align-items: center;
	}
}

/* Safe bounds on wide screens: no column narrower than 340px or wider than
   620px, and none shrinks below its minimum. */
@media (min-width: 1200px) {
	.ms-copy,
	.ms-side,
	.ms-stack,
	.ms-card {
		min-width: 340px;
		max-width: 620px;
		flex-shrink: 0;
	}

	.ms-cards {
		grid-template-columns: repeat(2, minmax(340px, 1fr));
	}
}

/* Once 05's form column is at its full width, its card is padded like the
   others all round. */
@media (min-width: 1600px) {
	.milestone-cta > .ms-copy--form {
		padding: var(--ms-pad);
	}
}

/* --- Short laptop screens (≤ 820px tall): the bento's two card rows must
   fit the safe area; the coordinate lines are decorative and step aside. */

@media (min-width: 960px) and (max-height: 820px) {
	.ms-cards {
		gap: 0.75rem;
	}

	.ms-cards > .ms-card {
		gap: 0.5rem;
		padding: 1.125rem 1.25rem;
	}

	.ms-cards > .ms-card::before {
		display: none;
	}

	.ms-cards .ms-card p {
		font-size: 0.875rem;
		line-height: 1.5;
	}

	.ms-cards .ms-terms li {
		padding: 0.1875rem 0.5rem;
		font-size: 0.75rem;
	}
}

/* --- Narrow (phones, small tablets): one readable column ---------------------- */

@media (max-width: 959px) {
	.milestone {
		padding-right: var(--ms-x);
		padding-top: calc(var(--wp-admin--admin-bar--height, 0px) + 6rem);
	}

	.ms-title--hero {
		font-size: clamp(2.75rem, 11vw, 3.5rem);
	}
}

@media (max-width: 639px) {
	.ms-cards,
	.milestone-cta .dru-roles {
		grid-template-columns: 1fr;
	}

	/* Phones: the HUD card's bar wraps its clock instead of overflowing. */
	.milestone .dru-hud-card__bar {
		flex-wrap: wrap;
		row-gap: 0.375rem;
	}
}

/* ==========================================================================
   Stage mode: html.dru-stage-mode. One fixed 100dvh viewport, no native scroll.
   ========================================================================== */

html.dru-stage-mode {
	margin-top: 0 !important; /* the admin bar offset moves to the viewport */
}

html.dru-stage-mode,
html.dru-stage-mode body {
	width: 100vw;
	height: 100dvh;
	overflow: hidden;
	overscroll-behavior: none;
}

html.dru-stage-mode body {
	position: fixed;
	inset: 0;
	margin: 0;
}

html.dru-stage-mode #stage-viewport {
	position: fixed;
	top: var(--wp-admin--admin-bar--height, 0px);
	left: 0;
	width: 100vw;
	height: calc(100dvh - var(--wp-admin--admin-bar--height, 0px));
	overflow: hidden;
}

html.dru-stage-mode #milestone-container {
	position: absolute;
	inset: 0;
	min-height: 0;
	overflow: hidden;
}

html.dru-stage-mode .milestone {
	position: absolute;
	inset: 0;
	min-height: 0;
	height: 100%;
	overflow: hidden;
	/* One row exactly as tall as the safe area, so tall columns can be
	   bounded (and scrolled internally) instead of overflowing. */
	grid-template-rows: minmax(0, 1fr);
	pointer-events: none;
	--ms-top: clamp(4.75rem, 9.5vh, 6.25rem);
}

html.dru-stage-mode .milestone.is-active {
	z-index: 2;
	pointer-events: auto;
}

html.dru-stage-mode .milestone > * {
	max-height: 100%;
}

/* Until the engine takes over, only the hero is on stage. */
html.dru-stage-mode:not(.dru-stage-live) .milestone:not(.milestone-hero) {
	visibility: hidden;
}

/* A column taller than the safe area (the form at step 2, short windows)
   scrolls inside itself; the engine adds .is-scroll after measuring. Only
   on the active milestone: an off-stage scroller would still paint its
   scrollbar even with its content clipped away. */
html.dru-stage-mode .milestone.is-active > .is-scroll {
	overflow-x: hidden;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding-right: 0.625rem;
}

/* A hairline rail, no arrow buttons. */
html.dru-stage-mode .milestone > .is-scroll::-webkit-scrollbar {
	width: 4px;
	height: 0;
}

html.dru-stage-mode .milestone > .is-scroll::-webkit-scrollbar-track {
	background: rgba(255, 255, 255, 0.04);
	border-radius: 2px;
}

html.dru-stage-mode .milestone > .is-scroll::-webkit-scrollbar-thumb {
	background: rgba(0, 240, 255, 0.45);
	border-radius: 2px;
}

@supports not selector(::-webkit-scrollbar) {
	html.dru-stage-mode .milestone > .is-scroll {
		scrollbar-width: thin;
		scrollbar-color: rgba(0, 240, 255, 0.45) transparent;
	}
}

/* The form column is bounded by the safe area and clips, rather than
   scrolls, at step 1. Longer content (step 2, validation errors, the
   shortest windows) still gets .is-scroll above, which outranks this:
   a scrollbar is better than an unreachable submit button. */
html.dru-stage-mode .milestone-cta > .ms-copy--form {
	max-height: min(100%, calc(100dvh - 140px));
	overflow: hidden;
}

/* The card keeps its own right padding when it scrolls. */
html.dru-stage-mode .milestone.is-active > .ms-copy--form.is-scroll {
	padding-right: var(--form-pad);
}

/* The card's surface is not one of the engine's moving parts (its title,
   note and form are), so it fades with its milestone, like the eyebrow. */
html.dru-stage-live .milestone-cta > .ms-copy--form {
	transition: opacity 0.6s var(--ms-ease) 0.45s;
}

html.dru-stage-live .milestone-cta:not(.is-active) > .ms-copy--form {
	opacity: 0;
	transition-duration: 0.4s;
	transition-delay: 0s;
}

/* The form's actions stay pinned to the bottom of its scrolling column. */
html.dru-stage-mode .ms-copy--form.is-scroll .dru-form__nav {
	position: sticky;
	bottom: 0;
	z-index: 2;
	margin-inline: calc(-1 * var(--form-pad));
	padding: 0.875rem var(--form-pad);
	border-top: 1px solid var(--line);
	background: rgba(11, 14, 24, 0.98);
}

/* The eyebrow lives outside the word masks (::before on the title); it
   wipes in and out with its own clip-path as the milestone turns. */
html.dru-stage-mode .ms-title::before {
	clip-path: inset(0 0 0 0);
	transition: clip-path 0.6s var(--ms-ease) 0.35s;
}

html.dru-stage-mode .milestone:not(.is-active) .ms-title::before {
	clip-path: inset(0 100% 0 0);
	transition-delay: 0s;
}

/* The join pill would duplicate the form on the last milestone: it steps
   aside, out of the tab order too, once its fade is done. */
html.dru-stage-mode[data-milestone="4"] .dru-dock__cta {
	opacity: 0;
	visibility: hidden;
	translate: 0 0.75rem;
	pointer-events: none;
	transition: opacity 0.4s ease, translate 0.4s ease, visibility 0s linear 0.4s;
}

.dru-dock__cta {
	transition: opacity 0.4s ease, translate 0.4s ease, visibility 0s, background-color var(--dur-fast) ease, box-shadow var(--dur-base) var(--ease), transform 260ms cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

/* --- Right rail: milestone counter ------------------------------------------- */

.stage-rail {
	position: fixed;
	top: 50%;
	right: clamp(1rem, 2.2vw, 2rem);
	z-index: 60;
	transform: translateY(-50%);
	transition: opacity 0.6s var(--ms-ease) 0.3s;
}

.stage-rail[hidden] {
	display: none;
}

/* Steps aside while a page transition runs; back once the stage has landed. */
html.dru-routing .stage-rail {
	opacity: 0;
	transition-duration: 0.35s;
	transition-delay: 0s;
}

.stage-rail__list {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	margin: 0;
	padding: 0;
	list-style: none;
	--rail-progress: 0;
}

/* Track and its lit portion, behind the ticks. */
.stage-rail__list::before,
.stage-rail__list::after {
	content: "";
	position: absolute;
	right: 0.6rem;
	top: 1.1rem;
	bottom: 1.1rem;
	width: 1px;
	background: var(--line-strong);
}

.stage-rail__list::after {
	background: linear-gradient(180deg, var(--cyan), var(--gold));
	box-shadow: 0 0 8px var(--cyan-glow);
	transform: scaleY(var(--rail-progress));
	transform-origin: top;
	transition: transform 1.2s var(--ms-ease);
}

.stage-rail__btn {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 0.625rem;
	min-width: 44px;
	min-height: 44px;
	padding: 0;
	border: 0;
	background: none;
	color: var(--muted);
	font: 500 0.6875rem/1 var(--mono);
	letter-spacing: 0.14em;
	cursor: pointer;
	transition: color 0.3s ease;
}

.stage-rail__tick {
	position: relative;
	z-index: 1;
	width: 9px;
	height: 9px;
	margin-right: calc(0.6rem - 4px);
	border-radius: 50%;
	background: var(--void);
	box-shadow: inset 0 0 0 1px var(--line-strong);
	/* A dot changes as the lit line reaches it (--rail-delay, set by the
	   page's script for the dots a step passes over). */
	transition:
		background-color 0.3s ease var(--rail-delay, 0s),
		box-shadow 0.3s ease var(--rail-delay, 0s),
		transform 0.4s var(--ms-ease) var(--rail-delay, 0s);
}

.stage-rail__btn:hover,
.stage-rail__btn:focus-visible {
	color: var(--on-dark);
}

.stage-rail__btn:hover .stage-rail__tick {
	box-shadow: inset 0 0 0 1px var(--cyan);
}

/* Passed: filled in the lit line's colour where it stands (cyan at the top,
   gold at the foot: --rail-tone, 0..1), quieter than the current one. */
.stage-rail__btn.is-passed .stage-rail__tick {
	background: var(--cyan);
	background: color-mix(in srgb, var(--gold) calc(var(--rail-tone, 0) * 100%), var(--cyan));
	box-shadow: 0 0 6px rgba(0, 240, 255, 0.35);
}

.stage-rail__btn.is-passed {
	color: var(--on-dark-muted);
}

.stage-rail__btn[aria-current="step"] {
	color: var(--cyan);
}

.stage-rail__btn[aria-current="step"] .stage-rail__tick {
	background: var(--cyan);
	box-shadow: 0 0 12px var(--cyan);
	transform: scale(1.25);
}

/* --- Menu overlay on the stage page: nav, then the site footer ---------------- */

.dru-menu--index {
	grid-template-rows: auto auto;
	align-content: start;
	row-gap: 3rem;
}

.dru-menu__footer {
	grid-column: 1 / -1;
	padding-top: 2rem;
	border-top: 1px solid var(--line);
	color: var(--on-dark-muted);
	font-size: 0.9375rem;
}

.dru-menu__footer .dru-wrap {
	max-width: none;
	padding-inline: 0;
}

.dru-menu__footer .dru-footer__cols h2 {
	margin-bottom: 0.75rem;
	color: var(--on-dark);
	font-size: 1rem;
	font-weight: 500;
	letter-spacing: 0;
}

.dru-menu__footer .dru-footer__cols ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

.dru-menu__footer a {
	color: var(--on-dark-muted);
	text-decoration: none;
}

.dru-menu__footer a:hover {
	color: var(--on-dark);
	text-decoration: underline;
}

.dru-menu__footer .dru-footer__notes {
	margin-top: 2rem;
}

.dru-menu__footer .dru-footer__legal {
	margin-top: 1.5rem;
	font-size: var(--fs-small);
}

/* --- Reduced motion ------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
	html.dru-stage-mode .ms-title::before,
	html.dru-stage-live .milestone-cta > .ms-copy--form,
	.stage-rail,
	.stage-rail__list::after {
		transition: none;
	}
}
