/**
 * Shared onboarding overlay styles.
 * Built entirely on the --mc-* tokens from monaco-tokens.css so any direction
 * can retheme the overlay just by overriding --mc-red / --mc-font-display /
 * --mc-paper / --mc-ink-deep etc. before mounting it.
 *
 * Owner directive (2026-07-03), supersedes ROUND4.md R4.7's full-bleed translucent
 * veil: the previous full-screen veil let the underlying page's text ghost through
 * everywhere and let the particle cloud wander behind the readable form ("les
 * particules font n'importe quoi"). The overlay is now a solid-feeling CARD anchored
 * to one side only (left on desktop, bottom on mobile) — the rest of the viewport is
 * left completely free (app.js fades #ui out + calls engine.setFigureRect with that
 * free zone, so the ambient cloud composes beside/above the card, never behind it).
 * NO backdrop-filter. --mc-ob-* tokens are dedicated (not reusing style.css's
 * --mc-page-bg/--mc-stage-ink) so this file stays self-contained per the header
 * contract above.
 */
:root[data-theme="dark"] {
	/* Fully opaque, not "near-opaque" — the mobile clamp inside morph-engine.js's
	   setFigureRect (±12% of visible world height) can leave the ambient cloud
	   sitting partly under the card rather than fully inside the top free band; a
	   solid card is the only way to guarantee zero ghosting regardless. */
	--mc-ob-veil: #0f0d10;
	--mc-ob-ink: #f6f6f9;
	--mc-ob-ink-soft: rgba(246, 246, 249, 0.7);
	--mc-ob-border: rgba(246, 246, 249, 0.18);
	--mc-ob-focus: #54c7d0;
	--mc-ob-edge-shadow: rgba(0, 0, 0, 0.35);
}

:root[data-theme="light"],
:root {
	--mc-ob-veil: #f6f3ec;
	--mc-ob-ink: var(--mc-ink-deep);
	--mc-ob-ink-soft: color-mix(in srgb, var(--mc-ink-deep) 70%, transparent);
	--mc-ob-border: color-mix(in srgb, var(--mc-ink-deep) 18%, transparent);
	--mc-ob-focus: var(--mc-ink-mid);
	--mc-ob-edge-shadow: rgba(20, 16, 8, 0.16);
}

/* Desktop: left-anchored card, `width` MUST mirror app.js's
   ONBOARDING_FORM_WIDTH_RATIO/ONBOARDING_FORM_WIDTH_CAP_PX (0.46 / 40rem) — the
   engine centers the ambient cloud in whatever screen-space the card does NOT
   occupy, so the two must agree on where the card actually ends. */
.mc-ob {
	position: fixed;
	top: 0;
	left: 0;
	bottom: 0;
	width: min(40rem, 46vw);
	z-index: 999;
	display: flex;
	flex-direction: column;
	height: 100dvh;
	height: 100vh;
	background: var(--mc-ob-veil);
	box-shadow: 12px 0 40px var(--mc-ob-edge-shadow);
	color: var(--mc-ob-ink);
	font-family: var(--mc-font-body);
	padding-top: env(safe-area-inset-top);
	padding-bottom: env(safe-area-inset-bottom);
	padding-left: env(safe-area-inset-left);
	isolation: isolate;
	animation: mc-ob-veil-in var(--mc-duration-slow) var(--mc-easing-elegant);
}

.mc-ob::before {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	top: -3.5rem;
	height: 3.5rem;
	pointer-events: none;
	background: linear-gradient(
		to top,
		var(--mc-ob-veil),
		color-mix(in srgb, var(--mc-ob-veil) 78%, transparent),
		transparent
	);
}

/* Mobile: bottom-anchored card, `top` MUST mirror app.js's
   ONBOARDING_FREE_BAND_RATIO — that top band is left free for the wordmark instead
   of the form. ROUND9.md R9.5: 46svh (was 51svh, itself a workaround for the
   engine's now-removed mobile dy clamp — R9.2 made setFigureRect honored
   faithfully, so the figure genuinely centers in whatever band this leaves). The
   wordmark figure is width-bound (its visual height is well under the band either
   way), so trading ~5svh of band for card height costs the figure nothing and is
   what lets every step fit with ZERO scroll at 393x852 with real safe-areas. */
@media (max-width: 899px) {
	.mc-ob {
		top: 46svh;
		left: 0;
		right: 0;
		bottom: 0;
		width: auto;
		height: auto;
		box-shadow: 0 -12px 40px var(--mc-ob-edge-shadow);
		padding-left: env(safe-area-inset-left);
		padding-right: env(safe-area-inset-right);
	}

	.mc-ob::before {
		top: -4.5rem;
		height: 4.5rem;
	}
}

@keyframes mc-ob-veil-in {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

.mc-ob__chrome {
	display: flex;
	align-items: center;
	gap: var(--mc-space-md);
	padding: var(--mc-space-lg) var(--mc-space-lg) var(--mc-space-sm);
	flex: 0 0 auto;
}

.mc-ob__nav {
	flex: 0 0 auto;
	width: var(--mc-touch-min);
	height: var(--mc-touch-min);
	min-width: 44px;
	min-height: 44px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: none;
	background: transparent;
	color: var(--mc-ob-ink);
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
	border-radius: var(--mc-radius-full);
	transition:
		opacity var(--mc-duration-fast) var(--mc-easing-out),
		background var(--mc-duration-fast) var(--mc-easing-out);
}

@media (hover: hover) {
	.mc-ob__nav:hover {
		background: color-mix(in srgb, var(--mc-ob-ink) 8%, transparent);
	}
}

.mc-ob__nav:active {
	opacity: var(--mc-opacity-hover);
}

.mc-ob__nav[hidden] {
	visibility: hidden;
	pointer-events: none;
}

.mc-ob__pills {
	flex: 1 1 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: var(--mc-space-xs);
	height: var(--mc-touch-min);
}

.mc-ob__pill {
	height: 4px;
	width: 1.25rem;
	border-radius: var(--mc-radius-full);
	background: color-mix(in srgb, var(--mc-ob-ink) 18%, transparent);
	transition:
		width var(--mc-duration-base) var(--mc-easing-smooth),
		background var(--mc-duration-base) var(--mc-easing-smooth);
}

.mc-ob__pill.is-active {
	width: 2.5rem;
	background: var(--mc-red);
}

.mc-ob__stage {
	position: relative;
	flex: 1 1 auto;
	overflow: hidden;
	display: flex;
}

.mc-ob__panel {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: flex-start;
	justify-content: stretch;
	padding: var(--mc-space-lg);
	padding-top: var(--mc-space-md);
	overflow-y: auto;
	opacity: 0;
	transform: translateX(2rem);
	transition:
		opacity var(--mc-duration-base) var(--mc-easing-smooth),
		transform var(--mc-duration-base) var(--mc-easing-smooth);
}

/* ROUND9.md R9.5: the round-8 scroll-fade affordance (mc-ob__panel--scrollable /
   --at-bottom ::after gradient) is deleted — every step now fits the card with
   zero scroll at the target mobile viewports (taller card + 2-col fork cards +
   tightened field sizing below), so an affordance for overflow that no longer
   exists was dead code. overflow-y: auto stays on .mc-ob__panel purely as a
   safety net for extreme viewports, not as a designed-for state. */

.mc-ob__panel--enter-back {
	transform: translateX(-2rem);
}

.mc-ob__panel--settled {
	opacity: 1;
	transform: translateX(0);
}

.mc-ob__panel--exit-fwd {
	opacity: 0;
	transform: translateX(-2rem);
}

.mc-ob__panel--exit-back {
	opacity: 0;
	transform: translateX(2rem);
}

.mc-ob__screen {
	display: flex;
	flex-direction: column;
	gap: var(--mc-space-xl);
	width: 100%;
	max-width: 32rem;
	margin: 0 auto;
	padding-top: var(--mc-space-xl);
}

.mc-ob__title {
	font-family: var(--mc-font-display);
	font-size: var(--mc-fs-h1);
	font-weight: 600;
	line-height: 1.1;
	margin: 0;
}

.mc-ob__sub {
	font-size: var(--mc-fs-body);
	color: color-mix(in srgb, var(--mc-ob-ink) 70%, transparent);
	margin: 0;
}

/* Fork + business cards */

.mc-ob__cards {
	display: flex;
	flex-direction: column;
	gap: var(--mc-space-md);
}

.mc-ob__card {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--mc-space-xs);
	text-align: left;
	padding: var(--mc-space-lg);
	min-height: var(--mc-touch-min);
	border: 1px solid var(--mc-ob-border);
	border-radius: var(--mc-radius-md);
	background: transparent;
	color: var(--mc-ob-ink);
	cursor: pointer;
	transition:
		border-color var(--mc-duration-fast) var(--mc-easing-out),
		transform var(--mc-duration-fast) var(--mc-easing-out),
		background var(--mc-duration-fast) var(--mc-easing-out);
}

@media (hover: hover) {
	.mc-ob__card:hover {
		border-color: var(--mc-red);
		background: color-mix(in srgb, var(--mc-red) 6%, transparent);
	}
}

.mc-ob__card:focus-visible {
	border-color: var(--mc-red);
	background: color-mix(in srgb, var(--mc-red) 6%, transparent);
}

.mc-ob__card:active {
	transform: scale(0.98);
}

.mc-ob__card-title {
	font-family: var(--mc-font-display);
	font-size: var(--mc-fs-h3);
	font-weight: 600;
}

.mc-ob__card-tagline {
	font-size: var(--mc-fs-small);
	color: color-mix(in srgb, var(--mc-ob-ink) 65%, transparent);
}

.mc-ob__card-delay {
	font-size: var(--mc-fs-xs);
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--mc-red);
}

/* Forms + fields */

.mc-ob__form {
	display: flex;
	flex-direction: column;
	gap: var(--mc-space-md);
}

.mc-ob__input,
.mc-ob__textarea {
	display: block;
	width: 100%;
	min-height: var(--mc-touch-min);
	padding: var(--mc-space-md);
	font-size: var(--mc-fs-body);
	font-family: var(--mc-font-body);
	color: var(--mc-ob-ink);
	background: color-mix(in srgb, var(--mc-ob-ink) 4%, transparent);
	border: 1px solid var(--mc-ob-border);
	border-radius: var(--mc-radius-sm);
	box-sizing: border-box;
	text-overflow: ellipsis;
	transition:
		border-color var(--mc-duration-fast) var(--mc-easing-out),
		box-shadow var(--mc-duration-fast) var(--mc-easing-out);
}

.mc-ob__textarea {
	min-height: 7rem;
	resize: vertical;
}

.mc-ob__input:focus,
.mc-ob__textarea:focus {
	outline: none;
	border-color: var(--mc-ob-focus);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--mc-ob-focus) 18%, transparent);
}

.mc-ob__continue {
	min-height: var(--mc-touch-min);
	padding: var(--mc-space-md) var(--mc-space-xl);
	font-size: var(--mc-fs-body);
	font-weight: 600;
	color: var(--mc-paper);
	background: var(--mc-red);
	border: none;
	border-radius: var(--mc-radius-full);
	cursor: pointer;
	transition:
		opacity var(--mc-duration-fast) var(--mc-easing-out),
		transform var(--mc-duration-fast) var(--mc-easing-out);
}

.mc-ob__continue:hover {
	opacity: var(--mc-opacity-hover);
}

.mc-ob__continue:active {
	transform: scale(0.98);
}

/* Style chips (detail/site) */

.mc-ob__chips {
	display: flex;
	flex-wrap: wrap;
	gap: var(--mc-space-sm);
}

.mc-ob__chip {
	min-height: var(--mc-touch-min);
	padding: 0 var(--mc-space-lg);
	font-size: var(--mc-fs-body);
	color: var(--mc-ob-ink);
	background: transparent;
	border: 1px solid color-mix(in srgb, var(--mc-ob-ink) 25%, transparent);
	border-radius: var(--mc-radius-full);
	cursor: pointer;
	transition:
		border-color var(--mc-duration-fast) var(--mc-easing-out),
		background var(--mc-duration-fast) var(--mc-easing-out),
		transform var(--mc-duration-fast) var(--mc-easing-out);
}

@media (hover: hover) {
	.mc-ob__chip:hover {
		border-color: var(--mc-red);
		background: color-mix(in srgb, var(--mc-red) 6%, transparent);
	}
}

.mc-ob__chip:focus-visible {
	border-color: var(--mc-red);
	background: color-mix(in srgb, var(--mc-red) 6%, transparent);
}

.mc-ob__chip:active {
	transform: scale(0.96);
}

/* Confirm screen */

.mc-ob__screen--confirm {
	align-items: center;
	text-align: center;
	padding-top: var(--mc-space-3xl);
}

.mc-ob__check {
	width: 3.5rem;
	height: 3.5rem;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: var(--mc-radius-full);
	background: var(--mc-red);
	color: var(--mc-paper);
	font-size: 1.5rem;
	animation: mc-ob-spring-in var(--mc-duration-slow) var(--mc-easing-elegant);
}

@keyframes mc-ob-spring-in {
	0% {
		opacity: 0;
		transform: scale(0.5);
	}
	60% {
		opacity: 1;
		transform: scale(1.08);
	}
	100% {
		opacity: 1;
		transform: scale(1);
	}
}

.mc-ob__trust {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: var(--mc-space-sm);
}

.mc-ob__badge {
	padding: var(--mc-space-xs) var(--mc-space-md);
	font-size: var(--mc-fs-xs);
	text-transform: uppercase;
	letter-spacing: 0.06em;
	border: 1px solid color-mix(in srgb, var(--mc-ob-ink) 20%, transparent);
	border-radius: var(--mc-radius-full);
	color: color-mix(in srgb, var(--mc-ob-ink) 75%, transparent);
}

@media (prefers-reduced-motion: reduce) {
	.mc-ob {
		animation: none;
	}
	.mc-ob__check {
		animation: none;
	}
}

/* ROUND9.md R9.5: mobile zero-scroll budget. Together with the taller card
   (top 46svh above) these keep EVERY step's content inside the card at 393x852
   with real safe-areas (ben-audited: .mc-ob__screen bottom < panel bottom on all
   of fork / business / detail(site+ai) / email / confirm) — no scrolling, no
   scroll-fade affordance needed. */
@media (max-width: 899px) {
	/* ROUND10.md R10.1 "same bottom-space kill on onboarding": tighter chrome so
	   the fork cards below (R10.5) get more of the card's vertical budget. The nav
	   buttons stay at --mc-touch-min (WCAG floor, untouched); only the surrounding
	   padding and the purely decorative progress pills shrink. */
	.mc-ob__chrome {
		padding: var(--mc-space-sm) var(--mc-space-md) var(--mc-space-xs);
	}

	.mc-ob__pills {
		height: 1.5rem;
	}

	.mc-ob__panel {
		padding-left: var(--mc-space-md);
		padding-right: var(--mc-space-md);
		/* md bottom (not lg): keeps the Continuer/Envoyer button clear of the
		   home-indicator gesture strip once real safe-area-inset-bottom is
		   accounted for at the card level. */
		padding-top: var(--mc-space-xs);
		padding-bottom: var(--mc-space-sm);
	}

	.mc-ob__screen {
		gap: var(--mc-space-sm);
		padding-top: var(--mc-space-xs);
	}

	.mc-ob__title {
		/* one step down from the desktop/tablet display heading -- the fork/detail
		   titles are questions, not the hero headline; freeing ~10-18px per line
		   (and often collapsing a 2-line title to 1) matters more here than parity
		   with the larger desktop size. */
		font-size: var(--mc-fs-h2);
	}

	/* ROUND9.md R9.5: the two fork cards sit SIDE BY SIDE on mobile (the stacked
	   pair was the single biggest overflow: ~130px past the card at 393x852).
	   Each card is a compact tappable tile — title, tagline, delay badge.
	   ROUND10.md R10.5: the 2-line clamp truncated the tagline mid-word
	   ("Maquett…", "Un…") — the owner wants it fully readable. R10.1's chrome/
	   screen/panel compaction above frees enough vertical budget on the "fork"
	   step (verified via the ben DOM-rect audit: card bottom stays well clear of
	   the panel's own bottom edge) that the tagline can simply wrap in full,
	   no clamp, no scroll. */
	.mc-ob__cards {
		flex-direction: row;
		gap: var(--mc-space-xs);
	}

	.mc-ob__cards .mc-ob__card {
		flex: 1 1 0;
		min-width: 0;
	}

	.mc-ob__card {
		padding: var(--mc-space-sm);
	}

	.mc-ob__card-tagline {
		font-size: var(--mc-fs-xs);
		line-height: 1.35;
	}

	.mc-ob__textarea {
		/* ~2-3 visible lines while writing — enough to draft the workflow answer,
		   small enough that textarea + tools input + button all fit the card. */
		min-height: 3.5rem;
	}

	.mc-ob__form {
		gap: var(--mc-space-xs);
	}

	/* The confirm screen's desktop-sized 3xl top pad pushed the trust badges
	   toward the card's bottom edge — the check + title carry the moment fine
	   starting higher. */
	.mc-ob__screen--confirm {
		padding-top: var(--mc-space-lg);
	}
}
