/* ==========================================================================
   Case study
   Builds on home-split.css: same split layout, tokens and footer. The
   intro column carries the title and key facts; the story column pairs
   each section heading with its body.
   ========================================================================== */

:root {
	--color-heading: #000000;
	--color-placeholder: #d9d9d9;
	--color-dot: #d1d2bf;
	--color-nav-border: #ededed;
	--text-section-heading: clamp(1.375rem, 1rem + 0.8vw, 1.75rem);
	/* Image and live-view captions: lighter than body text,
	   5.1:1 on white (WCAG AA) */
	--color-caption: #6e6e6e;
}

/* Intro column
   ========================================================================== */

/* Titles vary in length, so the title band (see home-split.css) has no
   designed line breaks: it wraps and balances freely, a band per line */

/* Facts and the Built with card share an inner edge (--inner-pad) */
.case-facts {
	margin-top: var(--space-section);
	padding-inline: var(--inner-pad);
}

.case-facts > div + div {
	margin-top: var(--space-section);
}

.case-facts .eyebrow {
	margin-bottom: 0.75rem;
}

/* Project facts (Built with, Timeline, then Ship date, Pilot or Status):
   one compact row, never stacked, indented with the facts above. Each
   item is a small label in the caption colour over its value. Gaps,
   values and logos scale with the column's width, never below 12px
   gaps, 12px labels, 13px values and 16px logos. */
.case-meta {
	display: flex;
	flex-wrap: nowrap;
	justify-content: flex-start;
	align-items: flex-start;
	gap: clamp(12px, 4cqi - 4px, 24px);
	margin-top: var(--space-section);
	padding-left: var(--inner-pad);
}

.case-meta__item {
	min-width: 0;
}

.case-meta .eyebrow {
	margin-bottom: 0.25rem;
	color: var(--color-caption);
	font-size: max(12px, var(--text-eyebrow));
	white-space: nowrap;
}

.case-meta dd {
	font-size: clamp(13px, 3.4cqi, 15px);
	line-height: 1.4;
	white-space: nowrap;
}

/* Laptop windows (1200px tall or less): tighter gaps between the facts
   and inside the Built with cards, so the brief fits beside the story */
@media (min-width: 64em) and (min-height: 40em) and (max-height: 75em) {
	.case-facts > div + div {
		margin-top: clamp(0.5rem, 2.4vh - 0.75rem, 0.75rem);
	}

	.case-facts .eyebrow {
		margin-bottom: 0.375rem;
	}
}

.logo-list {
	display: flex;
	align-items: center;
	gap: clamp(6px, 2cqi, 12px);
}

/* Logos in the project facts row: 16 to 22px tall */
.logo-list img {
	display: block;
	width: auto;
	height: clamp(16px, 5cqi, 22px);
}

/* Built with (old tile version): still used by the earlier copy at
   work/araceli-ai-agent/ */
.built-with {
	margin: var(--space-section) 0 0;
	padding: var(--inner-pad);
}

.built-with .eyebrow {
	margin-bottom: 0.75rem;
}

.built-with__list {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem 2rem;
}

.built-with__item {
	display: grid;
	place-items: center;
	width: 6rem;
	aspect-ratio: 1;
	padding: 0.75rem;
	border-radius: var(--radius);
	background: var(--color-bg);
	color: var(--color-heading);
	font-size: 1rem;
	line-height: 1.3;
	text-align: center;
}

.built-with__item img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
}

/* Story column
   ========================================================================== */

.case-body {
	container: case / inline-size;
}

.case-section + .case-section {
	margin-top: var(--space-item);
}

/* Heading beside body; stacked until the body can keep ~60+ characters
   a line beside the heading */
.case-section__text {
	display: grid;
	gap: 0.75rem;
}

/* Heading beside the text once the story column is wide enough. The
   breakpoint sits between the column widths of common windows (about
   768px at 1440 and 819px at 1536) so a few pixels of window size, zoom
   or scrollbar never flip the layout, and the embeds sized from the room
   the text leaves stay put. */
@container case (min-width: 49.5rem) {
	.case-section__text {
		grid-template-columns: minmax(0, 3fr) minmax(0, 5fr);
		gap: 1.5rem;
	}
}

/* Animation (an iframe) in place of a section image: 16:10, scaling to the
   column width, with the same space below as a section image. Capped by
   viewport height so it shares one screen with the section text. With
   reduced motion the embed shows its two states stacked, so the frame
   doubles in height. */
.case-embed {
	width: 100%;
	max-width: calc(55vh * 1.6);
	max-width: calc(55dvh * 1.6);
	margin: 0 0 clamp(2rem, 1rem + 2vw, 3.5rem);
}

/* One section per screen (see .case-section below): like a section image,
   the embed shrinks into the height the text leaves, down to 10rem. The
   frame is sized by height and keeps its 16:10 (16:20 with reduced motion). */
@media (min-width: 64em) and (min-height: 45em) {
	.case-embed {
		display: flex;
		flex: 0 1 auto;
		flex-direction: column;
		min-height: 10rem;
		max-width: none;
	}

	.case-embed__frame {
		flex: 0 1 auto;
		align-self: flex-start;
		max-width: 100%;
		min-height: 0;
		height: calc(100cqw / 1.6);
	}

	.case-embed figcaption {
		flex: none;
	}
}

@media (min-width: 64em) and (min-height: 45em) and (prefers-reduced-motion: reduce) {
	.case-embed__frame {
		height: calc(100cqw / 0.8);
	}
}

/* Every embed sits on the surface canvas */
.case-embed__frame {
	overflow: hidden;
	border: 0;
	border-radius: var(--radius);
	background: var(--color-surface);
	aspect-ratio: 16 / 10;
}

.case-embed iframe {
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
}

.case-embed figcaption {
	margin-top: 0.5rem;
	color: var(--color-caption);
	font-size: var(--text-small);
	line-height: 1.45;
}

@media (prefers-reduced-motion: reduce) {
	.case-embed {
		max-width: calc(55vh * 0.8);
		max-width: calc(55dvh * 0.8);
	}

	.case-embed__frame {
		aspect-ratio: 16 / 20;
	}
}

/* Embeds are sized from the room their section's text leaves; the page
   holds them back until the web font is in so they never jump (see the
   script in the page head) */
.fonts-pending .case-embed {
	visibility: hidden;
}

/* An embed that draws its own frame (and a Replay row under it): it
   sits centred on a surface panel that spans the column. The panel is
   16:10 (or takes the height the section leaves on paged desktop); the
   iframe keeps 16:10 inside it at the largest size that fits. Reduced
   motion uses the same layout, since its static state is the final one. */
.case-embed--self-framed {
	--embed-ratio: 1.6;
	max-width: none;
}

.case-embed--self-framed .case-embed__frame {
	display: grid;
	place-items: center;
	width: 100%;
	padding: clamp(0.75rem, 2.5cqw, 2rem) clamp(1rem, 4.5cqw, 3.5rem);
	border: 0;
	border-radius: var(--radius);
	background: var(--color-surface);
	aspect-ratio: var(--embed-ratio);
	container-type: size;
}

.case-embed--self-framed iframe {
	width: min(100cqw, 100cqh * var(--embed-ratio));
	height: auto;
	aspect-ratio: var(--embed-ratio);
}

/* A full-bleed screen recreation set on the canvas: its own edge and corners */
.case-embed--screen iframe {
	box-sizing: border-box;
	background: transparent;
	border: 1px solid var(--color-border);
	border-radius: var(--radius);
}

/* A screenshot set on the canvas the same way: at its own proportions,
   never cropped (--embed-ratio is its width over its height) */
.case-embed--image img {
	display: block;
	box-sizing: border-box;
	width: min(100cqw, 100cqh * var(--embed-ratio));
	height: auto;
	border: 1px solid var(--color-border);
	border-radius: var(--radius);
	aspect-ratio: var(--embed-ratio);
}

.case-embed--16x9 {
	--embed-ratio: 1.7778;
}

/* A photo set smaller: a short, wide panel (2.8:1) whose height the
   photo fills, so the photo and its panel both take less room */
/* The panel is wider than the image (2.8:1 unless the page sets
   --frame-ratio), so the image sits smaller, centred on the surface */
.case-embed--self-framed.case-embed--inset .case-embed__frame {
	aspect-ratio: var(--frame-ratio, 2.8);
}

@media (min-width: 64em) and (min-height: 45em) {
	.case-embed--self-framed.case-embed--inset .case-embed__frame {
		height: calc(100cqw / var(--frame-ratio, 2.8));
	}

	/* Keeps its size instead of shrinking into the room the text leaves;
	   the section grows past one screen if it must */
	.case-embed.case-embed--keep {
		flex: none;
	}
}

/* A quiet data graphic on the surface canvas: 16:9 on wide frames, and never shorter
   than its content, which the embed reports (--embed-min, set by the page).
   Narrow frames stack its figures and take exactly the content's height. */
.case-embed--stat {
	max-width: none;
}

.case-embed--stat .case-embed__frame {
	width: 100%;
	min-height: var(--embed-min, var(--embed-reserve-min, 0px));
	aspect-ratio: 16 / 9;
}

.case-embed--stat.is-stacked .case-embed__frame {
	height: var(--embed-min, var(--embed-reserve, auto));
	aspect-ratio: auto;
}

@media (prefers-reduced-motion: reduce) {
	.case-embed--stat {
		max-width: none;
	}

	.case-embed--stat .case-embed__frame {
		aspect-ratio: 16 / 9;
	}

	.case-embed--stat.is-stacked .case-embed__frame {
		aspect-ratio: auto;
	}
}

@media (min-width: 64em) and (min-height: 45em) {
	.case-embed--stat .case-embed__frame {
		align-self: stretch;
		height: calc(100cqw * 9 / 16);
		aspect-ratio: auto;
	}

	.case-embed--stat.is-stacked .case-embed__frame {
		height: var(--embed-min, var(--embed-reserve, auto));
	}
}

/* An embed whose frame is exactly its content's height, which the embed
   reports (--embed-min, set by the page): no empty area, at any width */
.case-embed--fit {
	max-width: none;
}

.case-embed--fit .case-embed__frame {
	height: var(--embed-min, var(--embed-reserve));
	aspect-ratio: auto;
}

@media (prefers-reduced-motion: reduce) {
	.case-embed--fit {
		max-width: none;
	}
}

@media (min-width: 64em) and (min-height: 45em) {
	.case-embed--fit {
		flex: none;
	}

	.case-embed--fit .case-embed__frame {
		align-self: stretch;
		height: var(--embed-min, var(--embed-reserve));
	}
}

/* On phones a 16:9 frame is too short to use: the screen takes the full
   width at a fixed height, and scrolls inside */
@media (max-width: 40em) {
	.case-embed--phone-tall .case-embed__frame {
		display: block;
		height: auto;
		aspect-ratio: auto;
		container-type: normal;
		padding: 0.75rem;
	}

	.case-embed--phone-tall iframe {
		width: 100%;
		height: 34rem;
		aspect-ratio: auto;
	}
}

@media (prefers-reduced-motion: reduce) {
	.case-embed--self-framed {
		max-width: none;
	}

	.case-embed--self-framed .case-embed__frame {
		aspect-ratio: var(--embed-ratio);
	}

	/* A screen that shows its two states stacked with reduced motion */
	.case-embed--screen:not(.case-embed--16x9):not(.case-embed--image) {
		--embed-ratio: 0.8;
	}
}

@media (min-width: 64em) and (min-height: 45em) {
	.case-embed--self-framed .case-embed__frame {
		align-self: stretch;
		height: calc(100cqw / var(--embed-ratio));
		aspect-ratio: auto;
	}
}

/* A screen recreation at the 16:9 shape of its source screenshot */
.case-embed--wide {
	max-width: calc(55vh * 16 / 9);
	max-width: calc(55dvh * 16 / 9);
}

.case-embed--wide .case-embed__frame {
	aspect-ratio: 16 / 9;
}

@media (prefers-reduced-motion: reduce) {
	.case-embed--wide {
		max-width: calc(55vh * 16 / 9);
		max-width: calc(55dvh * 16 / 9);
	}

	.case-embed--wide .case-embed__frame {
		aspect-ratio: 16 / 9;
	}
}

@media (min-width: 64em) and (min-height: 45em) {
	.case-embed--wide {
		max-width: none;
	}

	.case-embed--wide .case-embed__frame {
		height: calc(100cqw * 9 / 16);
	}
}

/* An embed whose height follows its content (set by the page script
   from the height the iframe reports). On one-screen desktop sections
   it takes the room left and the iframe scales down to fit. */
.case-embed--auto {
	max-width: none;
}

.case-embed--auto .case-embed__frame {
	display: flex;
	justify-content: center;
	align-items: flex-start;
	height: var(--embed-h, var(--embed-reserve));
	aspect-ratio: auto;
}

.case-embed--auto iframe {
	flex: none;
	height: 100%;
	transform-origin: top center;
}

@media (prefers-reduced-motion: reduce) {
	.case-embed--auto {
		max-width: none;
	}

	.case-embed--auto .case-embed__frame {
		aspect-ratio: auto;
	}
}

@media (min-width: 64em) and (min-height: 45em) {
	.case-embed--auto .case-embed__frame {
		align-self: stretch;
		height: var(--embed-h, var(--embed-reserve));
	}
}

/* Reserved heights for embeds that size to their content
   Each frame reserves its final height before the embed loads, so
   nothing below it moves. Heights were measured in the real iframes
   (Chromium and WebKit, the larger of the two) at layout widths 342,
   358, 536, 673, 700, 780, 880, 900, 1000, 1100, 1200, 1300 and 1424px,
   and are interpolated in straight lines between them, split at each
   embed's own 700px stacking point. The page scripts still listen to
   the embeds' height reports and resize only when a report is more than
   4px off (with a console warning).
   On windows at least 45em tall the auto embeds are laid out at a
   minimum width and scaled down to narrower columns, which keeps their
   proportions: there the reserve is a fixed ratio.
   ========================================================================== */

/* agent-directions: 342:1009, 358:1009, 536:986, 673:986, 700:986, 780:439, 880:495, 900:507, 1000:563, 1100:619, 1200:675, 1300:732, 1424:801 */
@container case (width < 358px) {
	.case-embed__frame:has(> iframe[src*="agent-directions.html"]) {
		--embed-reserve: 1010px;
	}
}
@container case (width >= 358px) and (width < 536px) {
	.case-embed__frame:has(> iframe[src*="agent-directions.html"]) {
		--embed-reserve: calc(-0.12921 * 100cqw + 1056.26px);
	}
}
@container case (width >= 536px) and (width < 673px) {
	.case-embed__frame:has(> iframe[src*="agent-directions.html"]) {
		--embed-reserve: 987px;
	}
}
@container case (width >= 673px) and (width < 700.02px) {
	.case-embed__frame:has(> iframe[src*="agent-directions.html"]) {
		--embed-reserve: 987px;
	}
}
@container case (width >= 700.02px) and (width < 880px) {
	.case-embed__frame:has(> iframe[src*="agent-directions.html"]) {
		--embed-reserve: calc(0.56000 * 100cqw + 3.20px);
	}
}
@container case (width >= 880px) and (width < 900px) {
	.case-embed__frame:has(> iframe[src*="agent-directions.html"]) {
		--embed-reserve: calc(0.60000 * 100cqw - 32.00px);
	}
}
@container case (width >= 900px) and (width < 1000px) {
	.case-embed__frame:has(> iframe[src*="agent-directions.html"]) {
		--embed-reserve: calc(0.56000 * 100cqw + 4.00px);
	}
}
@container case (width >= 1000px) and (width < 1100px) {
	.case-embed__frame:has(> iframe[src*="agent-directions.html"]) {
		--embed-reserve: calc(0.56000 * 100cqw + 4.00px);
	}
}
@container case (width >= 1100px) and (width < 1200px) {
	.case-embed__frame:has(> iframe[src*="agent-directions.html"]) {
		--embed-reserve: calc(0.56000 * 100cqw + 4.00px);
	}
}
@container case (width >= 1200px) and (width < 1300px) {
	.case-embed__frame:has(> iframe[src*="agent-directions.html"]) {
		--embed-reserve: calc(0.57000 * 100cqw - 8.00px);
	}
}
@container case (width >= 1300px) {
	.case-embed__frame:has(> iframe[src*="agent-directions.html"]) {
		--embed-reserve: calc(0.55645 * 100cqw + 9.61px);
	}
}
@media (min-width: 64em) and (min-height: 45em) {
	@container case (width < 780px) {
		.case-embed__frame:has(> iframe[src*="agent-directions.html"]) {
			--embed-reserve: calc(100cqw * 439 / 780 + 1px);
		}
	}
}

/* agent-trust-tiles: 342:1105, 358:1136, 536:1463, 673:1699, 700:1750, 780:411, 880:405, 900:412, 1000:447, 1100:482, 1200:518, 1300:555, 1424:604 */
@container case (width < 358px) {
	.case-embed__frame:has(> iframe[src*="agent-trust-tiles.html"]) {
		--embed-reserve: calc(1.93750 * 100cqw + 443.38px);
	}
}
@container case (width >= 358px) and (width < 536px) {
	.case-embed__frame:has(> iframe[src*="agent-trust-tiles.html"]) {
		--embed-reserve: calc(1.83708 * 100cqw + 479.33px);
	}
}
@container case (width >= 536px) and (width < 673px) {
	.case-embed__frame:has(> iframe[src*="agent-trust-tiles.html"]) {
		--embed-reserve: calc(1.72263 * 100cqw + 540.67px);
	}
}
@container case (width >= 673px) and (width < 700.02px) {
	.case-embed__frame:has(> iframe[src*="agent-trust-tiles.html"]) {
		--embed-reserve: calc(1.88889 * 100cqw + 428.78px);
	}
}
@container case (width >= 700.02px) and (width < 880px) {
	.case-embed__frame:has(> iframe[src*="agent-trust-tiles.html"]) {
		--embed-reserve: calc(-0.06000 * 100cqw + 458.80px);
	}
}
@container case (width >= 880px) and (width < 900px) {
	.case-embed__frame:has(> iframe[src*="agent-trust-tiles.html"]) {
		--embed-reserve: calc(0.35000 * 100cqw + 98.00px);
	}
}
@container case (width >= 900px) and (width < 1000px) {
	.case-embed__frame:has(> iframe[src*="agent-trust-tiles.html"]) {
		--embed-reserve: calc(0.35000 * 100cqw + 98.00px);
	}
}
@container case (width >= 1000px) and (width < 1100px) {
	.case-embed__frame:has(> iframe[src*="agent-trust-tiles.html"]) {
		--embed-reserve: calc(0.35000 * 100cqw + 98.00px);
	}
}
@container case (width >= 1100px) and (width < 1200px) {
	.case-embed__frame:has(> iframe[src*="agent-trust-tiles.html"]) {
		--embed-reserve: calc(0.36000 * 100cqw + 87.00px);
	}
}
@container case (width >= 1200px) and (width < 1300px) {
	.case-embed__frame:has(> iframe[src*="agent-trust-tiles.html"]) {
		--embed-reserve: calc(0.37000 * 100cqw + 75.00px);
	}
}
@container case (width >= 1300px) {
	.case-embed__frame:has(> iframe[src*="agent-trust-tiles.html"]) {
		--embed-reserve: calc(0.39516 * 100cqw + 42.29px);
	}
}
@media (min-width: 64em) and (min-height: 45em) {
	@container case (width < 780px) {
		.case-embed__frame:has(> iframe[src*="agent-trust-tiles.html"]) {
			--embed-reserve: calc(100cqw * 411 / 780 + 1px);
		}
	}
}

/* agent-who-decides: 342:780, 358:780, 536:761, 673:761, 700:761, 780:349, 880:317, 900:319, 1000:305, 1100:298, 1200:316, 1300:341, 1424:373 */
@container case (width < 358px) {
	.case-embed__frame:has(> iframe[src*="agent-who-decides.html"]) {
		--embed-reserve: 781px;
	}
}
@container case (width >= 358px) and (width < 536px) {
	.case-embed__frame:has(> iframe[src*="agent-who-decides.html"]) {
		--embed-reserve: calc(-0.10674 * 100cqw + 819.21px);
	}
}
@container case (width >= 536px) and (width < 673px) {
	.case-embed__frame:has(> iframe[src*="agent-who-decides.html"]) {
		--embed-reserve: 762px;
	}
}
@container case (width >= 673px) and (width < 700.02px) {
	.case-embed__frame:has(> iframe[src*="agent-who-decides.html"]) {
		--embed-reserve: 762px;
	}
}
@container case (width >= 700.02px) and (width < 880px) {
	.case-embed__frame:has(> iframe[src*="agent-who-decides.html"]) {
		--embed-reserve: calc(-0.32000 * 100cqw + 599.60px);
	}
}
@container case (width >= 880px) and (width < 900px) {
	.case-embed__frame:has(> iframe[src*="agent-who-decides.html"]) {
		--embed-reserve: calc(0.10000 * 100cqw + 230.00px);
	}
}
@container case (width >= 900px) and (width < 1000px) {
	.case-embed__frame:has(> iframe[src*="agent-who-decides.html"]) {
		--embed-reserve: calc(-0.14000 * 100cqw + 446.00px);
	}
}
@container case (width >= 1000px) and (width < 1100px) {
	.case-embed__frame:has(> iframe[src*="agent-who-decides.html"]) {
		--embed-reserve: calc(-0.07000 * 100cqw + 376.00px);
	}
}
@container case (width >= 1100px) and (width < 1200px) {
	.case-embed__frame:has(> iframe[src*="agent-who-decides.html"]) {
		--embed-reserve: calc(0.18000 * 100cqw + 101.00px);
	}
}
@container case (width >= 1200px) and (width < 1300px) {
	.case-embed__frame:has(> iframe[src*="agent-who-decides.html"]) {
		--embed-reserve: calc(0.25000 * 100cqw + 17.00px);
	}
}
@container case (width >= 1300px) {
	.case-embed__frame:has(> iframe[src*="agent-who-decides.html"]) {
		--embed-reserve: calc(0.25806 * 100cqw + 6.52px);
	}
}
@media (min-width: 64em) and (min-height: 45em) {
	@container case (width < 880px) {
		.case-embed__frame:has(> iframe[src*="agent-who-decides.html"]) {
			--embed-reserve: calc(100cqw * 317 / 880 + 1px);
		}
	}
}

/* endeavoros-case: 342:718, 358:733, 536:904, 673:1036, 700:251, 780:238, 880:255, 900:260, 1000:282, 1100:305, 1200:329, 1300:354, 1424:387 */
@container case (width < 358px) {
	.case-embed__frame:has(> iframe[src*="endeavoros-case.html"]) {
		--embed-reserve: calc(0.93750 * 100cqw + 398.38px);
	}
}
@container case (width >= 358px) and (width < 536px) {
	.case-embed__frame:has(> iframe[src*="endeavoros-case.html"]) {
		--embed-reserve: calc(0.96067 * 100cqw + 390.08px);
	}
}
@container case (width >= 536px) and (width < 700px) {
	.case-embed__frame:has(> iframe[src*="endeavoros-case.html"]) {
		--embed-reserve: calc(0.96350 * 100cqw + 388.56px);
	}
}
@container case (width >= 700px) and (width < 780px) {
	.case-embed__frame:has(> iframe[src*="endeavoros-case.html"]) {
		--embed-reserve: calc(-0.16250 * 100cqw + 365.75px);
	}
}
@container case (width >= 780px) and (width < 880px) {
	.case-embed__frame:has(> iframe[src*="endeavoros-case.html"]) {
		--embed-reserve: calc(0.17000 * 100cqw + 106.40px);
	}
}
@container case (width >= 880px) and (width < 900px) {
	.case-embed__frame:has(> iframe[src*="endeavoros-case.html"]) {
		--embed-reserve: calc(0.25000 * 100cqw + 36.00px);
	}
}
@container case (width >= 900px) and (width < 1000px) {
	.case-embed__frame:has(> iframe[src*="endeavoros-case.html"]) {
		--embed-reserve: calc(0.22000 * 100cqw + 63.00px);
	}
}
@container case (width >= 1000px) and (width < 1100px) {
	.case-embed__frame:has(> iframe[src*="endeavoros-case.html"]) {
		--embed-reserve: calc(0.23000 * 100cqw + 53.00px);
	}
}
@container case (width >= 1100px) and (width < 1200px) {
	.case-embed__frame:has(> iframe[src*="endeavoros-case.html"]) {
		--embed-reserve: calc(0.24000 * 100cqw + 42.00px);
	}
}
@container case (width >= 1200px) and (width < 1300px) {
	.case-embed__frame:has(> iframe[src*="endeavoros-case.html"]) {
		--embed-reserve: calc(0.25000 * 100cqw + 30.00px);
	}
}
@container case (width >= 1300px) {
	.case-embed__frame:has(> iframe[src*="endeavoros-case.html"]) {
		--embed-reserve: calc(0.26613 * 100cqw + 9.03px);
	}
}
@media (min-width: 64em) and (min-height: 45em) {
	@container case (width < 780px) {
		.case-embed__frame:has(> iframe[src*="endeavoros-case.html"]) {
			--embed-reserve: calc(100cqw * 238 / 780 + 1px);
		}
	}
}

/* bli-stages (stages timeline, .case-embed--stat): stacked under 560px it
   takes exactly its content height, 751px up to 366px wide and 730px from
   368px; from 560px to 639px its content needs at least 684px, taller than
   the 16:9 frame; from 640px up its content fits the 16:9 frame. Measured
   in Chromium and WebKit at 300 to 784px. */
@container case (width < 367px) {
	.case-embed__frame:has(> iframe[src*="bli-stages.html"]) {
		--embed-reserve: 752px;
	}
}
@container case (width >= 367px) and (width < 560px) {
	.case-embed__frame:has(> iframe[src*="bli-stages.html"]) {
		--embed-reserve: 731px;
	}
}
@container case (width >= 560px) and (width < 640px) {
	.case-embed__frame:has(> iframe[src*="bli-stages.html"]) {
		--embed-reserve-min: 685px;
	}
}

/* primeseq-path: 342:568, 358:585, 536:765, 673:913, 700:307, 780:331, 880:350, 900:357, 1000:388, 1100:419, 1200:451, 1300:484, 1424:525 */
@container case (width < 358px) {
	.case-embed__frame:has(> iframe[src*="primeseq-path.html"]) {
		--embed-reserve: calc(1.06250 * 100cqw + 205.62px);
	}
}
@container case (width >= 358px) and (width < 536px) {
	.case-embed__frame:has(> iframe[src*="primeseq-path.html"]) {
		--embed-reserve: calc(1.01124 * 100cqw + 223.98px);
	}
}
@container case (width >= 536px) and (width < 700px) {
	.case-embed__frame:has(> iframe[src*="primeseq-path.html"]) {
		--embed-reserve: calc(1.08029 * 100cqw + 186.96px);
	}
}
@container case (width >= 700px) and (width < 780px) {
	.case-embed__frame:has(> iframe[src*="primeseq-path.html"]) {
		--embed-reserve: calc(0.30000 * 100cqw + 98.00px);
	}
}
@container case (width >= 780px) and (width < 880px) {
	.case-embed__frame:has(> iframe[src*="primeseq-path.html"]) {
		--embed-reserve: calc(0.19000 * 100cqw + 183.80px);
	}
}
@container case (width >= 880px) and (width < 900px) {
	.case-embed__frame:has(> iframe[src*="primeseq-path.html"]) {
		--embed-reserve: calc(0.35000 * 100cqw + 43.00px);
	}
}
@container case (width >= 900px) and (width < 1000px) {
	.case-embed__frame:has(> iframe[src*="primeseq-path.html"]) {
		--embed-reserve: calc(0.31000 * 100cqw + 79.00px);
	}
}
@container case (width >= 1000px) and (width < 1100px) {
	.case-embed__frame:has(> iframe[src*="primeseq-path.html"]) {
		--embed-reserve: calc(0.31000 * 100cqw + 79.00px);
	}
}
@container case (width >= 1100px) and (width < 1200px) {
	.case-embed__frame:has(> iframe[src*="primeseq-path.html"]) {
		--embed-reserve: calc(0.32000 * 100cqw + 68.00px);
	}
}
@container case (width >= 1200px) and (width < 1300px) {
	.case-embed__frame:has(> iframe[src*="primeseq-path.html"]) {
		--embed-reserve: calc(0.33000 * 100cqw + 56.00px);
	}
}
@container case (width >= 1300px) {
	.case-embed__frame:has(> iframe[src*="primeseq-path.html"]) {
		--embed-reserve: calc(0.33065 * 100cqw + 55.16px);
	}
}

/* An embed with the shared controls row beneath it: the row and caption
   never shrink */
@media (min-width: 64em) and (min-height: 45em) {
	.case-embed--controls .embed-controls,
	.case-embed--controls figcaption {
		flex: none;
	}
}

/* The controls sit on the caption's line, at its right end. The caption
   keeps clear of them by the row's width (--controls-w, set by
   controls.js) and is at least as tall as a button; the row takes the
   caption's height (--caption-h) so the buttons sit centred on it.
   Phones keep the row above the caption. */
@media (min-width: 40em) {
	.case-embed--controls:has(.embed-controls) {
		position: relative;
	}

	.case-embed--controls .embed-controls {
		position: absolute;
		right: 0;
		bottom: 0;
		height: var(--caption-h, 44px);
		margin: 0;
	}

	.case-embed--controls:has(.embed-controls) figcaption {
		display: flex;
		align-items: center;
		min-height: 44px;
		margin-top: 12px;
		padding-right: calc(var(--controls-w, 0px) + 1.5rem);
	}
}

/* Section image (16:9), above the section text. Capped by viewport height
   so image and text share one screen; a real image is cropped to fit
   rather than squashed. */
.case-figure {
	margin: 0 0 clamp(2rem, 1rem + 2vw, 3.5rem);
	overflow: hidden;
	border-radius: var(--radius);
	background: var(--color-placeholder);
	aspect-ratio: 16 / 9;
	max-height: 55vh;
	max-height: 55dvh;
}

.case-figure img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Two captioned images side by side, each at its own proportions;
   stacked when the story column is narrow */
.case-figure--pair {
	display: grid;
	gap: 1.5rem 1rem;
	align-items: start;
	overflow: visible;
	border-radius: 0;
	background: none;
	aspect-ratio: auto;
	max-height: none;
}

@container case (min-width: 36rem) {
	.case-figure--pair {
		grid-template-columns: 1fr 1fr;
	}
}

.case-figure--pair figure {
	margin: 0;
}

/* Every image in a pair or stack sits on its own surface panel, like the
   embeds: the panel is the image's padding, so the image keeps its
   proportions; the caption stays on the page below it */
.case-figure--pair,
.case-figure--stack {
	--panel-pad: clamp(0.5rem, 1.2vw, 1.25rem);
}

.case-figure--pair img,
.case-figure--stack img {
	box-sizing: border-box;
	padding: var(--panel-pad);
	background: var(--color-surface);
}

/* Captioned images stacked, each the full column width at its own
   proportions, 24px apart */
.case-figure--stack {
	display: grid;
	gap: 1.5rem;
	overflow: visible;
	border-radius: 0;
	background: none;
	aspect-ratio: auto;
	max-height: none;
}

.case-figure--stack figure {
	margin: 0;
}

.case-figure--stack img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: var(--radius);
}

.case-figure--stack figcaption {
	margin-top: 0.5rem;
	color: var(--color-caption);
	font-size: var(--text-small);
	line-height: 1.45;
}

.case-figure--pair img {
	width: 100%;
	height: auto;
	border-radius: var(--radius);
}

.case-figure--pair figcaption {
	margin-top: 0.5rem;
	color: var(--color-caption);
	font-size: var(--text-small);
	line-height: 1.45;
}

/* A group of images has one caption, under all of them, naming each
   image by its place (Left, Middle, Right). In the grid it spans every
   column and sits 8px under the images, not a row gap away. */
.case-figure--pair > figcaption {
	grid-column: 1 / -1;
	margin-top: -1rem;
}

/* Same-height pair: a flex row where each figure's flex-grow is its
   image's aspect ratio (set inline), so both images share one height and
   their widths follow their own proportions. The one caption wraps onto
   its own line under both. Stacked at full width below 640px
   (keeps the pair side by side at 1280, where the column is ~673px). */
.case-figure--match {
	display: flex;
	flex-direction: column;
	align-items: stretch;
}

/* Each figure starts from its panel padding, and the rest of the row is
   shared by aspect ratio, so the images inside the panels match in height */
.case-figure--match figure {
	flex-basis: calc(2 * var(--panel-pad));
	flex-shrink: 1;
	min-width: 0;
}

.case-figure--match img {
	width: 100%;
	height: auto;
	object-fit: contain;
}

.case-figure--match > figcaption {
	flex: 0 0 100%;
}

@container case (min-width: 40rem) {
	.case-figure--match {
		flex-direction: row;
		flex-wrap: wrap;
	}
}

@container case (max-width: 39.9999rem) {
	.case-figure--match figure {
		flex-grow: 0 !important;
		flex-basis: auto;
	}
}

/* Side by side, a pair's panels meet with no gap, so one continuous
   surface runs behind both images; between the images the panels each
   give half their padding, so the space there matches the outer edge.
   Only the outer corners are rounded. The caption stays below, on the page. */
@container case (min-width: 36rem) {
	.case-figure--pair:not(.case-figure--match) {
		column-gap: 0;
	}

	.case-figure--pair:not(.case-figure--match) > figure:not(:first-of-type) img {
		padding-left: calc(var(--panel-pad) / 2);
		border-top-left-radius: 0;
		border-bottom-left-radius: 0;
	}

	.case-figure--pair:not(.case-figure--match) > figure:not(:last-of-type) img {
		padding-right: calc(var(--panel-pad) / 2);
		border-top-right-radius: 0;
		border-bottom-right-radius: 0;
	}

	.case-figure--pair:not(.case-figure--match) > figure:not(:last-of-type) figcaption {
		padding-right: 1rem;
	}
}

@container case (min-width: 40rem) {
	.case-figure--match {
		column-gap: 0;
	}

	/* Each of two figures has 1.5 paddings across its panel */
	.case-figure--match > figure:not(:only-of-type) {
		flex-basis: calc(1.5 * var(--panel-pad));
	}

	.case-figure--match > figure:not(:first-of-type) img {
		padding-left: calc(var(--panel-pad) / 2);
		border-top-left-radius: 0;
		border-bottom-left-radius: 0;
	}

	.case-figure--match > figure:not(:last-of-type) img {
		padding-right: calc(var(--panel-pad) / 2);
		border-top-right-radius: 0;
		border-bottom-right-radius: 0;
	}

	.case-figure--match > figure:not(:last-of-type) figcaption {
		padding-right: 1rem;
	}
}

/* Explorations: labelled rows, two images per row, on one continuous
   full-width surface. The images sit directly on it with their own
   exported corners; under each, its name and a tag (Considered or
   Chosen). The group's caption sits below the surface, on the page.
   Text on the surface uses --color-text (--color-caption is under 4.5:1
   there) and the eyebrow style for the row labels. */
.case-figure--explore {
	overflow: visible;
	border-radius: 0;
	background: none;
	aspect-ratio: auto;
	max-height: none;
}

.case-explore {
	padding: clamp(0.75rem, 1.6vw, 1.5rem);
	border-radius: var(--radius);
	background: var(--color-surface);
	color: var(--color-text);
	line-height: 1.4;
}

/* The rows are centred on the surface; on one-screen desktop sections
   their width is capped by the viewport height (below), so the group
   and the section text share the screen */
.case-explore__rows {
	display: grid;
	gap: 1.25rem;
	max-width: 100%;
	margin-inline: auto;
}

.case-explore .case-explore__label {
	margin-bottom: 0.5rem;
}

.case-explore__grid {
	display: grid;
	gap: 1rem;
}

/* Two per row from 640px of column (the same point as the same-height
   pairs, so the rows stay side by side at 1280) */
@container case (min-width: 40rem) {
	.case-explore__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

.case-explore__item {
	margin: 0;
}

.case-explore__media img {
	display: block;
	width: 100%;
	height: auto;
}

/* Lineage tree: only its dark card shows (the export has a white legend
   strip below it), cropped by display to the dendrogram's 1080 × 598 */
.case-explore__media--crop {
	aspect-ratio: 1080 / 598;
	overflow: hidden;
}

.case-explore__media--crop img {
	height: 100%;
	object-fit: cover;
	object-position: top;
}

/* Name on the left, tag on the right, on one line under the image */
.case-explore__item figcaption {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	margin-top: 0.5rem;
	font-size: 0.9375rem;
}

.case-explore__tag {
	display: inline-flex;
	flex: none;
	align-items: center;
	gap: 0.3rem;
	padding: 0.0625rem 0.625rem;
	border: 1px solid var(--color-border);
	border-radius: 999px;
	background: var(--color-bg);
	color: var(--color-caption);
	font-size: 0.8125rem;
	line-height: 1.5;
}

/* Chosen: green, with a check after the word */
.case-explore__tag--chosen {
	border-color: #2e9e4f;
	color: #1d7a3c;
}

.case-explore__tag svg {
	flex: none;
	width: 0.75rem;
	height: 0.75rem;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.6;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.case-figure--explore > figcaption {
	margin-top: 0.5rem;
	color: var(--color-caption);
	font-size: var(--text-small);
	line-height: 1.45;
}

@media (min-width: 64em) and (min-height: 45em) {
	.case-figure.case-figure--explore {
		flex: none;
	}

	/* The two image rows are about 1.16 times one image's width tall; the
	   rest of the screen (section margins, labels, names, caption and the
	   section text) takes about 41rem. Never narrower than 29rem. */
	.case-explore__rows {
		width: min(100%, max(29rem, calc((100dvh - 41rem) * 1.724 + 1rem)));
	}
}

/* Lightbox: screenshots marked .lightbox-image open full size in a
   native <dialog> (see lightbox.js) */
.lightbox-image {
	cursor: zoom-in;
}

.lightbox-image:focus-visible {
	outline: 2px solid var(--color-text);
	outline-offset: 3px;
}

.lightbox {
	max-width: 95vw;
	max-height: 95vh;
	padding: 0;
	border: 0;
	overflow: visible;
	background: none;
}

.lightbox::backdrop {
	background: rgb(0 0 0 / 0.8);
}

.lightbox img {
	display: block;
	max-width: 95vw;
	max-height: 95vh;
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: var(--radius);
}

.lightbox__close {
	position: fixed;
	top: 1rem;
	right: 1rem;
	padding: 0.5rem 0.875rem;
	border: 0;
	border-radius: 999px;
	background: #fff;
	color: #111;
	font: inherit;
	font-size: var(--text-small);
	cursor: pointer;
}

.lightbox__close:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 3px;
}

.case-figure__placeholder {
	display: grid;
	place-items: center;
	height: 100%;
	color: var(--color-text);
	font-size: var(--text-small);
}

/* End of page: "Back to home" on the left and the next case study on the
   right, as plain links with the site's link style, one section's space
   below the last section. Stacked: one link per line, each at least 44px
   tall to tap. */
.case-end {
	margin-top: var(--space-item);
}

.case-end__links {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 0.5rem 1.5rem;
}

.case-end__links li:last-child:not(:first-child) {
	text-align: right;
}

@media (max-width: 63.9375em), (max-height: 39.9375em) {
	.case-end {
		padding-bottom: var(--space-item);
	}

	.case-end__links {
		flex-direction: column;
		gap: 0;
	}

	.case-end__links li:last-child:not(:first-child) {
		text-align: left;
	}

	.case-end__links a {
		display: inline-flex;
		align-items: center;
		min-height: 44px;
	}
}

/* Section navigation
   A pill of dots in the column gap, one per section; the current one is
   filled. Split layout only; the script reveals it. Each link is 24px
   tall so the dots stay comfortable click targets. */
.case-nav {
	display: none;
}

@media (min-width: 64em) and (min-height: 40em) {
	.case-nav:not([hidden]) {
		display: block;
		position: fixed;
		top: 50%;
		/* Centred in the visible gap: the intro column's scrollbar gutter
		   sits just left of the column boundary */
		left: calc(var(--intro-col) - 0.625rem - 0.375rem);
		z-index: 1;
		width: 1.25rem;
		border: 1px solid var(--color-nav-border);
		border-radius: 999px;
		background: var(--color-bg);
		transform: translateY(-50%);
	}
}

.case-nav__link {
	display: grid;
	place-items: center;
	height: 1.5rem;
	border-radius: 999px;
}

.case-nav__link::before {
	content: "";
	width: 0.5rem;
	height: 0.5rem;
	border-radius: 50%;
	background: var(--color-dot);
	transition: background-color 300ms ease;
}

.case-nav__link:hover::before {
	background: var(--color-accent-text);
	opacity: 0.6;
}

.case-nav__link[aria-current="true"]::before {
	background: var(--color-accent);
}

.case-nav__link:focus-visible {
	outline-offset: 0;
}

/* Sections receive focus when picked from the nav (so keyboard paging
   continues from there); the column is the visible focus context */
.case-section:focus {
	outline: none;
}

@media (prefers-reduced-motion: reduce) {
	.case-nav__link::before {
		transition: none;
	}
}

.case-section__header .eyebrow {
	margin-bottom: 0.25rem;
}

.case-section__header h2 {
	color: var(--color-heading);
	font-size: var(--text-section-heading);
	font-weight: 400;
	line-height: 1.3;
	letter-spacing: -0.01em;
	text-wrap: balance;
}

/* Section reveal (template AOS "fade")
   aos.css hides [data-aos] elements until they get .aos-animate. The script
   adds .aos-ready to <html> only when it runs the reveal, so without JS, on
   the stacked layout, or with reduced motion, content simply shows. */
html:not(.aos-ready) [data-aos] {
	opacity: 1 !important;
	transform: none !important;
	transition: none !important;
}

/* Long-form text */

.prose > * + * {
	margin-top: 1.4em;
}

.prose ol {
	padding-left: 1.5em;
	list-style: decimal;
}

.prose li {
	padding-left: 0.25em;
}

.prose li + li {
	margin-top: 0.15em;
}

/* Lists sit closer to the text that introduces them */
.prose > ol,
.prose > ol + p {
	margin-top: 1.2em;
}

/* Pull quote: a surface panel with a large opening mark above a white
   card holding the quote, and the attribution below the card on the
   panel. The markup stays figure > blockquote + figcaption. Inside a section's text it spans the
   whole text area; in a section's image slot it takes the media's place. */
.case-quote {
	display: grid;
	justify-items: center;
	grid-column: 1 / -1;
	margin: 0;
	padding: clamp(1.75rem, 1rem + 2vw, 2.75rem) clamp(1rem, 4%, 3rem) clamp(2.5rem, 1.5rem + 3vw, 4.5rem);
	border-radius: var(--radius);
	background: var(--color-surface);
	text-align: center;
}

.case-quote::before {
	content: "\201C";
	height: 0.55em;
	margin-bottom: clamp(1.5rem, 1rem + 1.5vw, 2.5rem);
	font-size: clamp(4.5rem, 3.5rem + 2vw, 6rem);
	font-family: Georgia, "Times New Roman", serif;
	font-weight: 700;
	line-height: 0.9;
	color: var(--color-accent-text);
}

.case-quote blockquote {
	box-sizing: border-box;
	width: min(100%, 36rem);
	margin: 0;
	padding: clamp(1.5rem, 1rem + 1.2vw, 2.25rem) clamp(1.25rem, 0.75rem + 2vw, 2.25rem);
	border-radius: var(--radius);
	background: var(--color-bg);
	font-size: clamp(1.25rem, 1.05rem + 0.6vw, 1.5rem);
	line-height: 1.4;
	color: var(--color-heading);
	text-wrap: balance;
}

.case-quote figcaption {
	margin-top: clamp(1rem, 0.75rem + 0.6vw, 1.5rem);
	font-size: 1rem;
	color: var(--color-accent-text);
}

/* One-screen sections: the panel keeps its height and scales with the
   screen height, so it fits beside the section text */
@media (min-width: 64em) and (min-height: 45em) {
	.case-quote {
		flex: none;
		padding-top: clamp(1.25rem, 3vh, 2.75rem);
		padding-bottom: clamp(1.75rem, 4.5vh, 4.5rem);
	}

	.case-quote::before {
		margin-bottom: clamp(1rem, 2.5vh, 2.5rem);
		font-size: clamp(4rem, 8vh, 6rem);
	}

	.case-quote blockquote {
		padding-block: clamp(1.25rem, 3vh, 2.25rem);
		font-size: clamp(1.25rem, 0.5rem + 1.6vh, 1.5rem);
	}

	.case-quote figcaption {
		margin-top: clamp(0.75rem, 2vh, 1.5rem);
	}
}

/* In a section's image slot: the same space below as section media */
.case-section > .case-quote {
	margin-bottom: clamp(2rem, 1rem + 2vw, 3.5rem);
}

/* Term tooltips ([data-term], see assets/js/term-tooltip.js)
   The term reads as part of the sentence, with a dashed underline in the
   caption colour; hover and keyboard focus make it solid and accented.
   The definition is a plain card: the card surface, a rule-coloured
   border and the cards' radius.
   ========================================================================== */
.term {
	display: inline;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	line-height: inherit;
	letter-spacing: inherit;
	text-align: inherit;
	text-decoration-line: underline;
	text-decoration-style: dashed;
	text-decoration-color: var(--color-caption);
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
	cursor: help;
}

.term:hover,
.term:focus-visible {
	text-decoration-style: solid;
	text-decoration-color: var(--color-accent);
}

.term-tip {
	position: absolute;
	z-index: 5;
	box-sizing: border-box;
	width: max-content;
	max-width: min(280px, calc(100vw - 16px));
	padding: 12px 14px;
	border: 1px solid var(--color-border);
	border-radius: var(--radius);
	background: var(--color-surface);
	color: var(--color-text);
	font-family: var(--font-sans);
	font-size: 14px;
	font-weight: 400;
	line-height: 1.45;
	text-align: left;
	opacity: 0;
	transition: opacity 120ms ease;
}

.term-tip.is-open {
	opacity: 1;
}

.term-tip__title {
	display: block;
	font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
	.term-tip {
		transition: none;
	}
}
