/* ==========================================================================
   Buttercup Café — the full-bleed case study
   A second shape for a case study, beside the paper sheet in css/project.css.
   That one is an object on a desk: one column, photographs taped into the
   margin, read at your own pace. This one is a sequence of screens, each
   holding exactly one idea, and the scroll is the argument.

   Everything below is built out of the same tokens and the same primitives —
   .paper, .stitch, .chip, .plaque, .btn, .eyebrow all come in unchanged from
   base.css and components.css. Nothing here re-states a colour or a size that
   already has a name.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Page
   -------------------------------------------------------------------------- */

:root {
	/* This case study's accent, the way [data-theme] sets it on the sheet
	   pages. The lightbox reads it, so it has to be on :root rather than on a
	   wrapper — the <dialog> is rendered in the top layer, outside everything. */
	--accent: var(--moss-deep);
	--chip-bg: var(--moss-deep);

	/* The accent is a line colour, not a text colour: moss-deep on cream is
	   about 1.9:1, which is fine for a rule or an outline and nowhere near
	   readable as words. Anything that says something in the accent uses this
	   instead — the same hue, walked most of the way to the ink. */
	--accent-ink: color-mix(in oklab, var(--moss-deep) 40%, var(--ink));

	/* Grey and white hair for the five drawn participants. Mixed off the
	   faintest ink rather than picked as new greys, so they sit in the same
	   warm family as the rest of the page — and so white hair on a paper card
	   stays a shape instead of a hole. */
	--hair-grey: color-mix(in srgb, var(--ink-faint) 80%, var(--paper));
	--hair-white: color-mix(in srgb, var(--ink-faint) 40%, var(--paper));

	/* One number, written by js/case-scroll.js and read only here. */
	--progress: 0;
}

html {
	/* There is no sticky nav on this page to duck under, and the anchors are
	   whole screens: base.css's 5.5rem would land every jump that much early. */
	scroll-padding-top: 0;
}

body {
	background: var(--bg-page);
	/* Full bleed. Each screen owns its own gutter, because each screen owns
	   its own background colour and they have to meet edge to edge. */
	padding: 0;
}

/* --------------------------------------------------------------------------
   2. Reading progress
   A width, not a transform: the bar starts at zero width, so there is nothing
   to see before the first scroll event lands.
   -------------------------------------------------------------------------- */

.progress {
	position: fixed;
	inset: 0 auto auto 0;
	z-index: 900;
	height: 3px;
	width: calc(var(--progress) * 100%);
	background: var(--accent);
}

/* --------------------------------------------------------------------------
   3. The section rail
   Only appears once there is room for it beside the text. Below that the
   screens themselves are the navigation — a thirteen-item list stacked over
   the writing would be the widest thing on a phone.
   -------------------------------------------------------------------------- */

.rail {
	display: none;
}

/* The breakpoint is arithmetic, not a guess: the writing column is --wrap
   (68rem), so the margin beside it is (100vw − 68rem) / 2. The rail needs
   about 11rem of that — its longest label plus its offset from the edge —
   which is the first viewport where it can sit beside the text instead of
   on top of it. */
@media (min-width: 90rem) {
	.rail {
		position: fixed;
		inset-block-start: 50%;
		inset-inline-start: clamp(1rem, 2.4vw, 2.75rem);
		z-index: 800;
		display: grid;
		gap: var(--sp-1);
		translate: 0 -50%;
		font-family: var(--ff-display);
		font-size: var(--fs-100);
		letter-spacing: 0.02em;
	}
}

.rail__link {
	display: grid;
	grid-template-columns: 10px auto;
	align-items: center;
	gap: var(--sp-2);
	padding-block: 0.15rem;
	color: var(--ink-faint);
	transition: color var(--dur) var(--ease-out);
}

.rail__dot {
	width: 7px;
	height: 7px;
	border: 1.5px solid var(--accent);
	border-radius: var(--r-pill);
	scale: 0.6;
	transition: scale var(--dur) var(--ease-out),
		background var(--dur) var(--ease-out);
}

.rail__link:hover,
.rail__link[aria-current="true"] {
	color: var(--ink);
}

.rail__link[aria-current="true"] .rail__dot {
	background: var(--accent);
	scale: 1.15;
}

/* --------------------------------------------------------------------------
   4. A screen
   One idea, one viewport, vertically centred. `min-height` rather than
   `height`, always: a screen whose content outgrows the window — a phone in
   landscape, a large font size — has to be allowed to get taller instead of
   hiding the bottom of itself.
   -------------------------------------------------------------------------- */

.screen {
	display: grid;
	align-content: center;
	min-height: 100svh;
	padding: clamp(4.5rem, 11vh, 8rem) var(--gutter);
	/* Contained here rather than on <html>: setting overflow on the root
	   element stops Chromium's implicit IntersectionObserver root from firing,
	   which would silently kill every entrance on the page. Same reasoning as
	   the note in base.css. */
	overflow-x: clip;
}

.screen__inner {
	display: grid;
	gap: clamp(2rem, 5vh, 3rem);
	width: 100%;
	max-width: var(--wrap);
	margin-inline: auto;
}

.screen--sage {
	background: var(--sage);
}

/* Cream, stated rather than inherited. It is the page colour a plain screen
   already falls back to, but this screen is named for it on purpose: what
   carries the colour on it is the deck of moss cards, and those need a ground
   that is definitely not green. */
.screen--cream {
	background: var(--cream);
}

/* For a screen whose one idea is a figure rather than a sentence. The figure
   needs the height more than the screen needs the air around it, and this is
   the difference between the whole comparison landing in one view and the
   third lane of it starting below the fold. */
.screen--tight {
	padding-block: clamp(2.75rem, 6vh, 4.5rem);
}

.screen--tight .screen__inner {
	gap: clamp(1.25rem, 3vh, 2rem);
}

.screen--dark {
	background: var(--slate);
	color: var(--cream);
}

.screen--dark .eyebrow {
	color: color-mix(in srgb, var(--cream) 60%, transparent);
}

.screen--sage .eyebrow {
	color: color-mix(in srgb, var(--ink) 55%, transparent);
}

/* --- the parts every screen is made of ----------------------------------- */

.screen__head {
	display: grid;
	gap: var(--sp-3);
	align-content: start;
}

.screen__head h2 {
	max-width: 18ch;
}

/* Two steps up from the default h2, for the screens that carry the argument
   rather than a section of it. */
.screen__title--lg {
	font-size: clamp(2rem, 1.3rem + 3vw, 3.75rem);
	max-width: 19ch;
}

.screen__title--xl {
	font-size: clamp(2rem, 1.3rem + 3vw, 4rem);
	max-width: 15ch;
}

/* The line that finishes the heading's sentence, set in the display face so
   it reads as part of the title rather than as the first paragraph. */
.screen__kicker {
	font-family: var(--ff-display);
	font-size: clamp(1.4rem, 1rem + 1.6vw, 2.4rem);
	font-weight: 700;
	letter-spacing: -0.02em;
	line-height: var(--lh-tight);
	color: var(--butter-deep);
}

.screen__body {
	max-width: 54ch;
	font-size: var(--fs-500);
	line-height: 1.6;
}

.screen--dark .screen__body {
	color: color-mix(in srgb, var(--cream) 88%, transparent);
}

/* For a block inside a screen that has an eyebrow but no h2 — the sentence
   has to carry the weight the missing heading would have carried, without
   taking a heading's short measure. */
.screen__body--lead {
	font-family: var(--ff-display);
	font-weight: 700;
	line-height: 1.45;
	max-width: 62ch;
}

/* A conclusion, not a paragraph. Display face, short measure, no more than a
   couple of lines — it is meant to be read as one gesture. */
.screen__pull {
	max-width: 38ch;
	font-family: var(--ff-display);
	font-size: clamp(1.15rem, 1rem + 0.7vw, 1.6rem);
	font-weight: 700;
	letter-spacing: -0.02em;
	line-height: 1.35;
}

/* A pull that has to finish a whole argument rather than land one line: the
   short measure would break these three clauses across five ragged lines. */
.screen__pull--wide {
	max-width: 52ch;
}

/* Where the number came from, and how much weight it will carry. */
.screen__note {
	font-family: var(--ff-display);
	font-size: var(--fs-200);
	color: var(--ink-faint);
}

.screen--sage .screen__note {
	color: color-mix(in srgb, var(--ink) 55%, transparent);
}

/* --------------------------------------------------------------------------
   5. Entrances
   Scoped to `.js`, like every entrance on the home page: with scripting off
   each screen is simply present. The screen is what is observed and the
   children stagger themselves off --in-delay, so thirteen observers do the
   work of forty.
   -------------------------------------------------------------------------- */

.js [data-reveal] {
	opacity: 0;
	translate: 0 22px;
	transition: opacity var(--dur-slow) var(--ease-out),
		translate var(--dur-slow) var(--ease-out);
	transition-delay: var(--in-delay, 0ms);
}

.js .screen.is-in [data-reveal] {
	opacity: 1;
	translate: none;
}

/* The chibi and the say panel bring their own entrance from components.css,
   which waits for `is-in` on the element itself. Here it is the screen that
   gets it, so they are let in by the screen like everything else on it. */
.js .screen.is-in :is(.chibi, .saypanel) {
	opacity: 1;
	scale: 1;
}

@media (prefers-reduced-motion: reduce) {
	/* Matches the specificity of the rule above, so nothing is left invisible
	   waiting for a transition that will never run. */
	.js [data-reveal],
	[data-reveal] {
		opacity: 1;
		translate: none;
	}
}

/* --------------------------------------------------------------------------
   6. Hero
   -------------------------------------------------------------------------- */

.screen--hero {
	position: relative;
	padding-block: clamp(4rem, 9vh, 7rem) clamp(5rem, 10vh, 7rem);
}

.back-row {
	position: absolute;
	inset: clamp(1.25rem, 4vh, 2.5rem) var(--gutter) auto;
	max-width: var(--wrap);
	margin-inline: auto;
}

.hero {
	gap: clamp(1.5rem, 4vh, 3.25rem);
}

/* The title and the deck travel together — on a wide window the drawing sits
   beside the pair of them, not beside one of them. */
.hero__lede {
	display: grid;
	align-content: center;
	gap: clamp(1.5rem, 4vh, 3.25rem);
}

/* Line art on a transparent ground: no card, no thread, nothing between the
   drawing and the sage. It is the one image on the page that is an
   illustration rather than a photograph or a diagram, and it should read that
   way — as something drawn straight onto the page.

   This is the stacked size, for a phone, where the hero is already four lines
   of title and five of deck: big enough to be the opening image, small enough
   that it is not a second screen of scrolling on its own. */
.hero__art {
	justify-self: center;
	width: min(100%, 15rem);
	margin: 0;
}

.hero__art img {
	width: 100%;
	height: auto;
}

/* Two columns only once there is room for the drawing without squeezing the
   title into three words a line. Under that it goes back under the words,
   where it still reads as the opening image. The credits stay full width in
   both: they are the masthead of the piece, not a third column of it. */
@media (min-width: 62rem) {
	.hero {
		grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
		align-items: center;
		column-gap: clamp(2rem, 5vw, 4rem);
	}

	/* Sized against the window's height as well as its width, the same way the
	   title is: a laptop is wide and short, and a drawing wide enough to fill
	   the column there is taller than the hero has to give it. */
	.hero__art {
		grid-column: 2;
		grid-row: 1;
		width: min(100%, 28rem, 50vh);
	}

	.credits {
		grid-column: 1 / -1;
	}
}

/* A plain block, not a grid: the stamp beside the title is a float, and a
   grid container has no floats in it to flow around. */
.hero__title-block {
	display: block;
}

/* The stamp goes beside the title rather than above it — an award pressed
   into the top corner of a poster, not a label filed in front of its name.

   Floated rather than placed, because the title is the one piece of type on
   the site whose line breaks are the window's business and not mine: it is
   sized against the height as well as the width, so how many lines it is and
   how long each one runs changes with the shape of the screen. A float is the
   one arrangement that cannot collide with any of that — the lines beside the
   stamp are shortened by the stamp, and `shape-outside` shortens them to the
   disc rather than to the box it sits in. */
.hero__title-block .seal {
	/* Down from 1.3rem: the stamp is taking a bite out of the title now, and
	   the title is the thing the hero is for. */
	font-size: clamp(1rem, 0.75rem + 0.5vw, 1.2rem);
	float: right;
	shape-outside: circle(50%);
	margin-inline-start: clamp(var(--sp-3), 2vw, var(--sp-5));
	margin-block-end: var(--sp-2);
}


/* Sized against the height as well as the width. The title is four lines at
   its largest, and a laptop is a wide, short window — left to grow on vw
   alone it pushes the credits, and then "read on", off the bottom of the
   screen the hero is supposed to be. */
.hero__title {
	font-size: min(clamp(2.6rem, 1.2rem + 4vw, 4.75rem), 1.5rem + 5.5vh);
	max-width: 15ch;
}

.hero__deck {
	max-width: 46ch;
	font-size: clamp(1.15rem, 1rem + 0.55vw, 1.6rem);
	line-height: 1.5;
	color: var(--ink-soft);
}

/* The credits card from the sheet pages, unrolled into a row of columns —
   there is no aside to put it in here, and under the deck it reads as the
   masthead of the piece. */
.credits {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
	gap: var(--sp-6) var(--sp-8);
	padding-block-start: var(--sp-6);
	border-block-start: 2px dashed color-mix(in srgb, var(--tan-deep) 55%, transparent);
}

.credits__row dt {
	margin-block-end: 0.35rem;
}

.credits__row dd {
	font-size: var(--fs-300);
	line-height: 1.45;
}

.readon {
	position: absolute;
	inset: auto auto clamp(1.5rem, 4vh, 3rem) 50%;
	display: grid;
	justify-items: center;
	gap: var(--sp-1);
	translate: -50% 0;
	font-family: var(--ff-display);
	font-size: var(--fs-100);
	font-weight: 600;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--ink-faint);
	transition: color var(--dur) var(--ease-out);
}

.readon:hover {
	color: var(--ink);
}

.readon svg {
	animation: nudge 2.6s var(--ease-out) infinite;
}

@keyframes nudge {
	0%,
	100% {
		translate: 0 0;
	}
	50% {
		translate: 0 7px;
	}
}

/* --------------------------------------------------------------------------
   7. Card decks
   The one grid that most of the screens are built on: as many equal columns
   as fit, and never a column so narrow the writing in it breaks up.
   -------------------------------------------------------------------------- */

.deck {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
	gap: var(--sp-5);
}

/* A cream card wants a thread that is not also cream — the home cards get
   theirs from the coloured fill underneath, and these have no fill to borrow
   from. Tan at 45% is the same thread the footer chips use. */
.brief,
.verbatim,
.plate,
.routes,
.person,
.snap {
	--stitch-color: color-mix(in srgb, var(--tan-deep) 45%, transparent);
}

.brief {
	display: grid;
	gap: var(--sp-3);
	align-content: start;
	border-radius: var(--r-card);
}

/* Moss cards on the cream screen. Paper on cream is the site's quietest card
   there is, and this deck is the summary — the four things the whole page
   argues. Moss gives it an edge without a second material: same sheet, one
   step greener, and a lighter green than the sage screens it sits between. */
.screen--cream .brief {
	--card-bg: var(--moss);
}

.brief p {
	font-size: var(--fs-300);
	line-height: 1.55;
}

/* The card the screen is actually about. An outline rather than a different
   fill: the deck has to stay one material. */
.brief--key {
	outline: 2px solid var(--accent);
	outline-offset: -2px;
}

.brief--key .eyebrow {
	color: var(--accent-ink);
}

/* --------------------------------------------------------------------------
   8. Two-column splits
   -------------------------------------------------------------------------- */

.split {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr));
	gap: clamp(1.5rem, 4vw, 3rem);
	align-items: center;
}

.split--intro {
	grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
}

.split__text {
	display: grid;
	gap: var(--sp-5);
	align-content: start;
}

.split__text .screen__body {
	max-width: 46ch;
	font-size: var(--fs-400);
	line-height: 1.65;
}

/* --------------------------------------------------------------------------
   9. Figures
   Three shapes, one material. `.plate` is a diagram mounted on paper,
   `.snap` is a photograph pinned to the page at an angle, and both put their
   caption below in the display face.
   -------------------------------------------------------------------------- */

.plate,
.snap {
	display: grid;
	gap: var(--sp-3);
	border-radius: var(--r-card);
}

.plate img,
.plate svg,
.snap img {
	width: 100%;
	border-radius: var(--r-sm);
}

.plate figcaption,
.snap figcaption,
.finding figcaption {
	font-family: var(--ff-display);
	font-size: var(--fs-200);
	line-height: 1.5;
	color: var(--ink-soft);
}

/* The brain diagram arrives with its own pale grey card baked into the file.
   Multiply drops that ground into the paper underneath, so the drawing sits
   on the same sheet as everything else instead of in a grey rectangle. */
.plate--diagram img {
	mix-blend-mode: multiply;
}

.snap {
	rotate: var(--rot, 0deg);
	transition: rotate var(--dur) var(--ease-spring),
		translate var(--dur) var(--ease-spring),
		box-shadow var(--dur) var(--ease-out);
}

.snap:hover,
.snap:focus-within {
	rotate: 0deg;
	translate: 0 -4px;
	box-shadow: var(--shadow-lift);
}

.snap img {
	aspect-ratio: 4 / 5;
	object-fit: cover;
}

/* Narrower than the column it is given. A portrait crop at the full column
   width is 470px tall on its own, which is the whole screen's height budget
   spent on the one thing on it that is not the finding. */
.split--intro .snap {
	/* A moss sheet with the page's white thread on it, the same stock the
	   trigger cards are cut from. The research screen is the one place a
	   photograph and a figure make the same point, so the card is the colour
	   of the twelve below it rather than plain paper. */
	--card-bg: var(--moss);
	--stitch-color: var(--paper);
	rotate: 1.6deg;
	justify-self: center;
	max-width: 20rem;
}

.split--intro .snap img {
	aspect-ratio: 3 / 4;
}

.split--intro .snap figcaption {
	text-align: center;
}

/* Narrower than the column it sits in. Three portrait crops given the full
   68rem are 26rem tall each, which turns a supporting aside into the tallest
   thing on the page — these are evidence, not the argument. */
.gallery {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
	gap: var(--sp-5);
	align-items: start;
	width: 100%;
	max-width: 52rem;
}

/* The zoom button is the figure's only child that can take a hover, so the
   hint has to be asked for by name. */
.plate .zoom:hover img,
.snap .zoom:hover img {
	scale: 1.02;
}

/* --------------------------------------------------------------------------
   10. Inline diagrams
   Drawn in the page rather than exported, so they take the palette, the type
   and the theme with them — and stay sharp at any size.
   -------------------------------------------------------------------------- */

.plan__label {
	font-family: var(--ff-display);
	font-size: 11px;
	fill: var(--ink-soft);
}

.plate .plan__label {
	font-size: 12px;
}

/* The pattern the two plans share. It is only in the page to hold a <defs>,
   so it must not take a line box of its own. */
.plate .plan__defs {
	position: absolute;
	width: 0;
	height: 0;
}

/* Which framing of the room is on. Wide by default; the portrait one takes
   over where the column is too narrow for the wide plan to survive — under
   about 52rem the wide room is already down to nine-pixel labels.

   The portrait plan is capped rather than fluid: it is half a page tall at its
   own width, and a tablet handed the full column would make it taller than the
   window. */
.plan--tall {
	display: none;
}

@media (max-width: 52rem) {
	.plan--wide {
		display: none;
	}

	.plan--tall {
		display: block;
	}

	/* The plate comes in with it. The portrait room is half a page tall at its
	   own width, and a tablet handed the full column would make it taller than
	   the window — so the sheet stops at the width the drawing wants and sits
	   in the middle, rather than framing it in a field of empty paper. */
	.plate--plan {
		justify-self: center;
		max-width: 26rem;
	}
}

/* The room plan, re-targeted three times.

   The whole drawing runs on one clock. Every bar and the target ring share a
   single --cycle-long animation and take their place in it with a delay, so
   they cannot drift apart however long the page has been open — a second
   shorter animation for the ring would be out of step with the bars within a
   minute. The cycle is cut in three, one slot per route, and a route's bars
   are 90ms apart inside its slot: that stagger is what makes the trail lay
   itself from the person's feet outwards instead of appearing all at once.

   What is deliberately absent is travel. The bars only fade — no drift, no
   dash offset, no slide toward the target. A cue you cannot step on because
   it has moved is the failure this whole system is trying to avoid, and a
   drawing that shows one is lying about the build. */
.plan {
	--cycle: 13.5s;
}

.plan__route--a {
	--slot: 0s;
}

.plan__route--b {
	--slot: calc(var(--cycle) / 3);
}

.plan__route--c {
	--slot: calc(var(--cycle) / 3 * 2);
}

.cue {
	fill: var(--moss-deep);
	opacity: 0;
	animation: cue-lay var(--cycle) var(--ease-out) infinite;
	animation-delay: calc(var(--slot) + var(--i) * 90ms);
}

/* Percentages of 13.5s: down in 0.3s, lit for 2.3s, gone by 3s. The last bar
   of a route starts 1.44s into its slot, so it has cleared the floor with
   0.06s to spare before the next route's first bar lands. */
@keyframes cue-lay {
	0% {
		opacity: 0;
	}
	2.4%,
	19.3% {
		opacity: 1;
	}
	22.2%,
	100% {
		opacity: 0;
	}
}

/* The ring moves in the gap between two routes — after one trail has wiped
   out and before the next starts laying — so the drawing never shows a path
   pointing at a target that has already left. One set of stops per framing,
   because the same three spots sit at different coordinates in each. */
.plan__target {
	animation: point-wide var(--cycle) var(--ease-out) infinite;
}

.plan--wide .plan__target {
	translate: 856px 58px;
}

.plan--tall .plan__target {
	translate: 300px 55px;
	animation-name: point-tall;
}

@keyframes point-wide {
	0%,
	24.4% {
		translate: 856px 58px;
	}
	29.6%,
	57.8% {
		translate: 856px 238px;
	}
	63%,
	91.1% {
		translate: 762px 150px;
	}
	96.3%,
	100% {
		translate: 856px 58px;
	}
}

@keyframes point-tall {
	0%,
	24.4% {
		translate: 300px 55px;
	}
	29.6%,
	57.8% {
		translate: 70px 60px;
	}
	63%,
	91.1% {
		translate: 332px 276px;
	}
	96.3%,
	100% {
		translate: 300px 55px;
	}
}

/* The label takes whichever side of the ring the trail is not arriving from:
   above at the first two spots, below at the third, where in both framings the
   route comes in over the top of it. Its own animation, but on the same clock,
   so it can never be caught on the wrong side. */
.plan__tag {
	animation: tag-side var(--cycle) var(--ease-out) infinite;
}

@keyframes tag-side {
	0%,
	57.8% {
		translate: 0 0;
	}
	63%,
	91.1% {
		translate: 0 56px;
	}
	96.3%,
	100% {
		translate: 0 0;
	}
}

/* Held at the first frame until the screen is reached, the same way every
   other entrance on the page waits: arriving halfway through a re-target
   reads as a glitch rather than as a system answering you. */
.js .cue,
.js .plan__target,
.js .plan__tag {
	animation-play-state: paused;
}

.js .screen.is-in .cue,
.js .screen.is-in .plan__target,
.js .screen.is-in .plan__tag {
	animation-play-state: running;
}

@media (prefers-reduced-motion: reduce) {
	/* One route, laid, and nothing moving. The drawing's claim — a path that
	   goes around the furniture to a spot you chose — is fully made by a
	   single still frame; the cycling only adds that you can change your
	   mind, which the caption says in words. */
	.js .cue,
	.cue,
	.js .plan__target,
	.plan__target,
	.js .plan__tag,
	.plan__tag {
		animation: none;
	}

	.plan__route--a .cue {
		opacity: 1;
	}
}

/* --------------------------------------------------------------------------
   11. The two gaits
   Two trails of footprints seen from above, drawn to one scale — one SVG unit
   is one centimetre in both lanes, and both lanes set out across the same six
   metres. So the only thing the drawing asserts is what the measurements say:
   one trail arrives in ten steps and the other never arrives at all.

   Everything is authored in the markup because the coordinates *are* the
   content. What lives here is the scale, the colour and the timing.
   -------------------------------------------------------------------------- */

	.gait {
	display: grid;
	gap: clamp(var(--sp-3), 2.2vh, var(--sp-4));

	/* The lane's own ink. The typical trail is the page's paper colour; the
	   parkinsonian one is warm and a shade off it, so the two read as a pair
	   rather than as good and bad. */
	--gait-ink: var(--cream);
}

/* Referenced, never drawn — but a bare <svg> still takes a replaced element's
   default 300×150 out of the grid. */
.gait__defs {
	position: absolute;
	width: 0;
	height: 0;
}

.gait__lane {
	display: grid;
	gap: var(--sp-1);
}

/* The one thing on the figure in a colour of its own is the fall, because the
   fall is the only event on it — and it is the page's attention yellow, which
   already means exactly that. The trail it ends is in the lane's own warm ink,
   not a third colour, because the freeze is where that walk goes, not a
   separate thing that happens to it. */
.gait__lane--freeze {
	--gait-ink: var(--peach);
	--gait-alert: var(--butter-deep);
}

.gait__name {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: var(--sp-1) var(--sp-3);
	font-family: var(--ff-display);
	font-size: var(--fs-300);
	font-weight: 700;
	letter-spacing: 0.01em;
	color: var(--gait-ink);
}

/* The count is the finding, so it is set as a count rather than as more of
   the sentence. */
.gait__name span {
	padding: 0.15em 0.6em 0.25em;
	border: 1px solid color-mix(in srgb, var(--gait-ink) 45%, transparent);
	border-radius: var(--r-pill);
	font-size: var(--fs-100);
	font-weight: 500;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.gait__meta {
	max-width: 68ch;
	font-size: var(--fs-200);
	line-height: 1.4;
	color: color-mix(in srgb, var(--cream) 62%, transparent);
}

.gait__track {
	width: 100%;
	height: auto;
	/* The viewBox is 700 units wide and the drawing is to scale, so the whole
	   figure has one job: be as wide as it is allowed to be. Below this the
	   feet stop being feet, and the lane scrolls instead of shrinking. */
	min-width: 34rem;
	margin-block-start: var(--sp-1);
	color: var(--gait-ink);
	overflow: visible;
}

/* Under about 36rem the drawing can't shrink any further and stay a drawing,
   so the two lanes and the ruler scroll together inside one window. They have
   to be *one* scroller or the lanes would come out of register with each
   other, which is the only comparison the figure makes. */
@media (max-width: 38rem) {
	.gait {
		overflow-x: auto;
		overscroll-behavior-x: contain;
		padding-block-end: var(--sp-2);
	}

	.gait__meta {
		max-width: 34rem;
	}
}

/* --- a footprint ---------------------------------------------------------- */

.fp {
	transform-box: fill-box;
	transform-origin: center;
}

/* --- the room, the fall, and the floor that is left ----------------------- */

/* The freeze lane is half a metre of floor taller than the other one: the
   hands land wider than the feet ever do, and they have to be at the same
   centimetre as everything else. Same 700 units across, so the ruler under
   both still lines up. */
.gait__track--tall {
	margin-block-start: var(--sp-2);
}

/* Once the step is down to a few centimetres the soles land on top of each
   other, which is the truth about festination and a smudge on paper. A
   hairline of the screen's own background behind each print, painted under
   the fill rather than over it, keeps the pile legible as prints. */
.fp--stuck {
	stroke: var(--slate);
	stroke-width: 1.1;
	paint-order: stroke fill;
}

.gait__note {
	font-family: var(--ff-display);
	font-size: 8.5px;
	font-weight: 500;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	fill: color-mix(in srgb, var(--cream) 55%, transparent);
}

.gait__alert {
	color: var(--gait-alert);
}

.gait__note--alert {
	fill: var(--gait-alert);
	font-weight: 700;
	letter-spacing: 0.08em;
}

.gait__rest {
	color: color-mix(in srgb, var(--cream) 40%, transparent);
}

/* --- the shared ruler ----------------------------------------------------- */

.gait__ruler {
	position: relative;
	min-width: 34rem;
	height: 1.4rem;
	margin-block-start: calc(var(--sp-3) * -1);
	border-block-start: 1px solid color-mix(in srgb, var(--cream) 22%, transparent);
	font-family: var(--ff-display);
	font-size: var(--fs-100);
	color: color-mix(in srgb, var(--cream) 55%, transparent);
}

/* The tick sits at its own centimetre: the same 700-unit space the two lanes
   are drawn in, so a metre mark lands under the print that reached it. */
.gait__ruler span {
	position: absolute;
	inset-block-start: 0;
	inset-inline-start: calc(var(--x) * 100% / 700);
	width: 1px;
	height: 5px;
	background: color-mix(in srgb, var(--cream) 35%, transparent);
}

.gait__ruler span[data-m]::after {
	content: attr(data-m);
	position: absolute;
	inset-block-start: 7px;
	inset-inline-start: 0;
	translate: -50% 0;
	white-space: nowrap;
}

.gait__caption {
	max-width: 56ch;
	font-family: var(--ff-display);
	font-size: var(--fs-200);
	line-height: 1.5;
	color: color-mix(in srgb, var(--cream) 60%, transparent);
}

/* --- walking -------------------------------------------------------------- */
/* Each print carries the millisecond it lands on, taken from the cadence the
   lane is drawn at, and both lanes run on the same clock. So the two play the
   way the measurements read: the first lane is across in ten unhurried
   footfalls; the second is still putting feet down, faster and faster and
   barely moving, when the first has already arrived.

   It plays once, when the screen comes into view, and the state it settles
   into is the state the figure is meant to be read in — so with scripting off,
   or with motion turned down, nothing at all is missing. */

@keyframes gait-land {
	from {
		opacity: 0;
		transform: scale(1.55);
	}
	65% {
		opacity: 1;
	}
	to {
		opacity: 1;
		transform: scale(1);
	}
}

.js .gait .fp {
	opacity: 0;
}

.js .screen.is-in .gait .fp {
	animation: gait-land 240ms var(--ease-spring) both;
	animation-delay: calc(var(--d) + var(--gait-lead, 450ms));
}

/* The skid, the momentum line, the mark on the floor and the two notes. They
   are not footfalls, so they don't land like one — they arrive after the last
   print has, on the same clock, and only fade. */
@keyframes gait-mark {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

.js .gait .gait__mark {
	opacity: 0;
}

.js .screen.is-in .gait .gait__mark {
	animation: gait-mark 420ms var(--ease-out) both;
	animation-delay: calc(var(--d) + var(--gait-lead, 450ms));
}

@media (prefers-reduced-motion: reduce) {
	.js .gait .fp,
	.js .screen.is-in .gait .fp,
	.js .gait .gait__mark,
	.js .screen.is-in .gait .gait__mark {
		animation: none;
		opacity: 1;
	}
}

/* --------------------------------------------------------------------------
   12. The two routes
   -------------------------------------------------------------------------- */

.routes {
	display: grid;
	gap: var(--sp-4);
	border-radius: var(--r-card);
}

.route {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: var(--sp-4);
	align-items: center;
}

.route strong {
	font-family: var(--ff-display);
	font-size: var(--fs-300);
}

.route p {
	font-size: var(--fs-200);
	line-height: 1.5;
	color: var(--ink-soft);
}

.route__dot {
	width: 12px;
	height: 12px;
	border-radius: var(--r-pill);
}

.route--broken .route__dot {
	background: var(--peach-deep);
}

.route--intact .route__dot {
	background: var(--moss-deep);
}

/* --------------------------------------------------------------------------
   13. Survey figures
   Twelve people answered, so the figure on the research screen is twelve
   people. It ran as a ring for a while and the ring was the wrong instrument:
   at this n the denominator is half the finding, and a rate drawn as area
   quietly throws it away. A row of twelve is countable, which is the honest
   claim — you can check the number by looking at it.
   -------------------------------------------------------------------------- */

/* 13a. The twelve ---------------------------------------------------------- */

/* The number, the row and the sentence, in that reading order: the eye lands
   on 58%, counts the marks, then finds out what they mean. */
.finding {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	gap: var(--sp-4) clamp(var(--sp-5), 4vw, var(--sp-8));
	align-items: center;
	padding-block-start: var(--sp-5);
	border-block-start: 2px dashed
		color-mix(in srgb, var(--tan-deep) 55%, transparent);
}

.finding__num {
	display: grid;
	gap: 0.15em;
	font-family: var(--ff-display);
	font-size: clamp(3rem, 2rem + 4vw, 5.5rem);
	font-weight: 700;
	line-height: 0.85;
	letter-spacing: -0.04em;
	color: var(--accent-ink);
}

.finding__num span {
	font-size: var(--fs-200);
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--ink-faint);
}

.finding__mark {
	display: grid;
	gap: var(--sp-4);
	justify-items: start;
}

.finding figcaption {
	max-width: 52ch;
}

/* The caption finishes the number's sentence, so the part that finishes it
   carries the number's weight and its colour. */
.finding figcaption b {
	color: var(--ink);
}

/* Sized so a figure stays about a thumbnail tall — big enough to read the
   pose, small enough that twelve of them are one object rather than a crowd. */
.tally {
	width: 100%;
	max-width: 34rem;
	height: auto;
}

/* One figure twelve times, so the only difference along the row is ink: the
   seven are the page's moss and the five are held back to a tint of it — far
   enough apart that the split reads as position, not as two hues to tell
   apart, and the caption says the number in words either way. */
.tally__mark {
	color: color-mix(in srgb, var(--moss-deep) 42%, transparent);
}

.tally__mark.is-freeze {
	color: var(--moss-deep);
}

/* On a phone the number cannot sit beside a row of twelve and leave either of
   them a usable width. */
@media (max-width: 40rem) {
	.finding {
		grid-template-columns: minmax(0, 1fr);
		gap: var(--sp-4);
	}
}

/* 13b. The two headline counts -------------------------------------------- */

/* Twelve squares per question, twice over, was two rows of counting for two
   facts that land in a second: none of them had ever seen AR, and seven of
   twelve said no to it anyway. The numbers say it faster, and the screen
   keeps its air for the words they did ask for. */
.counts {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
	gap: var(--sp-5) var(--sp-8);
	align-items: start;
	padding-block-start: var(--sp-5);
	border-block-start: 1px solid
		color-mix(in srgb, var(--cream) 22%, transparent);
}

/* The number and its gloss share a baseline, so the small type reads as a
   caption hung off the figure rather than as a line underneath it. */
.count {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: var(--sp-2) var(--sp-4);
}

.count__num {
	font-family: var(--ff-display);
	font-size: clamp(2.2rem, 1.4rem + 2.8vw, 3.6rem);
	font-weight: 700;
	letter-spacing: -0.03em;
	line-height: 1;
	color: var(--cream);
}

.count__label {
	flex: 1 1 9rem;
	max-width: 24ch;
	font-family: var(--ff-display);
	font-size: var(--fs-200);
	line-height: 1.35;
	color: color-mix(in srgb, var(--cream) 70%, transparent);
}

/* Three answers to one question, so they stay one run of type: wider gaps
   between the pairs than inside them is the only thing grouping them. */
.count__split {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: var(--sp-2) var(--sp-4);
}

.count__pair {
	display: inline-flex;
	align-items: baseline;
	gap: 0.3em;
}

.count__unit {
	font-family: var(--ff-display);
	font-size: var(--fs-200);
	color: color-mix(in srgb, var(--cream) 70%, transparent);
}

/* Monochrome, and not for want of colour: the bar further down already spends
   butter, moss, tan and peach on the four things they asked for. Reusing
   those hues here would have peach meaning *non* in one figure and “not on my
   nose” in the next. So refusal is drawn as one ramp — the further from the
   background, the harder the no, and nought is barely there at all. */
.count__num.is-yes {
	color: color-mix(in srgb, var(--cream) 45%, transparent);
}

.count__num.is-maybe {
	color: color-mix(in srgb, var(--cream) 72%, transparent);
}

/* --------------------------------------------------------------------------
   14. Triggers
   Thirteen answers sorted into three tinted sheets, side by side, with the
   verdict as a band under all three. Three abreast rather than a 2×2: the
   families are one comparison and want to be read across, and the conclusion
   is not a fourth family — it is what the row adds up to, so it sits after it.

   Each sheet is `.paper.stitch` with two custom properties swapped: --tone is
   the ink the family is drawn in, --tone-bg the paper it is printed on. No
   new material, only a different fill and the page's own white thread.

   The tints are the raw palette walked most of the way to `--paper`. At full
   strength, moss beside butter beside peach on a cream page is three loud
   sheets competing with the ground they sit on; diluted, they land at the same
   value as each other and read as one deck in three inks.
   -------------------------------------------------------------------------- */

/* Title left, the sentence it needs right — set on the title's last line
   rather than centred, so the two read as one line of type. */
.triggers__head {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
	gap: var(--sp-4) clamp(1.5rem, 4vw, 3rem);
	align-items: end;
}

.triggers__head h2 {
	max-width: 13ch;
}

.triggers__head .screen__body--lead {
	max-width: 38ch;
	font-size: var(--fs-400);
}

.triggers {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: clamp(var(--sp-4), 2.5vh, var(--sp-6));
	align-items: stretch;
}

.trigger {
	--card-bg: var(--tone-bg, var(--moss));
	--stitch-color: var(--paper);
	/* Cut slips of paper on a coloured sheet — the page's own stock, unmixed.
	   Once the sheet is a dilute tint, a chip carrying a breath of the same hue
	   has nothing left to separate it from the card it lies on. */
	--chip-bg: var(--paper);
	display: grid;
	grid-template-rows: auto minmax(0, 1fr);
	gap: var(--sp-4);
	align-content: start;
}

.trigger__body {
	display: grid;
	gap: var(--sp-3);
	align-content: start;
}

/* The family's hue walked most of the way to the ink, the same way --accent-ink
   is built at the top of this file: a count is information, and moss-deep on
   moss is a decoration. */
/* Number and denominator on one baseline rather than stacked. Three narrow
   columns cannot spare the second line, and "6 of 13" is one fact anyway. */
.trigger__count {
	display: flex;
	align-items: baseline;
	gap: 0.4em;
	font-family: var(--ff-display);
	font-size: clamp(2.2rem, 1.5rem + 2vw, 3rem);
	font-weight: 700;
	line-height: 0.85;
	letter-spacing: -0.03em;
	color: color-mix(in oklab, var(--tone, var(--moss-deep)) 45%, var(--ink));
}

.trigger__count span {
	font-size: var(--fs-100);
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: color-mix(in oklab, var(--tone, var(--moss-deep)) 30%, var(--ink-faint));
}

.trigger .eyebrow {
	color: color-mix(in oklab, var(--tone, var(--moss-deep)) 35%, var(--ink-soft));
}

/* Not the same percentage three times: peach is the darkest of the three raw
   tints and butter the palest against a cream ground, so each is diluted to
   the point where the three sheets weigh the same. */
.trigger--terrain {
	--tone: var(--moss-deep);
	--tone-bg: color-mix(in oklab, var(--moss) 68%, var(--paper));
}
.trigger--body {
	--tone: var(--tan-deep);
	--tone-bg: color-mix(in oklab, var(--butter) 60%, var(--paper));
}
.trigger--mind {
	--tone: var(--peach-deep);
	--tone-bg: color-mix(in oklab, var(--peach) 46%, var(--paper));
}

/* The conclusion, not a fourth family — it spans the row it is drawn from,
   and it is slate: no thread, no count, and the only thing on the screen that
   is not a colour of paper. One sentence, one column: the band carries nothing
   else, so it has no reason to be divided. */
.trigger--verdict {
	--card-bg: var(--slate);
	grid-column: 1 / -1;
	grid-template-columns: minmax(0, 1fr);
	grid-template-rows: auto;
	gap: var(--sp-3);
	color: var(--cream);
}

.trigger--verdict .eyebrow {
	color: color-mix(in srgb, var(--cream) 60%, transparent);
}

/* Ranged left off the band's edge, on the same line as everything else on the
   screen, and given the whole box: the band is already the measure, and a cap
   inside it only leaves a hole on the right. Balanced so the short last line
   is shared out rather than left hanging. */
.trigger--verdict .screen__pull {
	max-width: none;
	font-size: clamp(1.05rem, 0.9rem + 0.55vw, 1.35rem);
	text-wrap: balance;
}

/* One column — at this width three families side by side are three ribbons of
   text too narrow to hold a chip line. The verdict keeps its place last. */
@media (max-width: 52rem) {
	.triggers {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* --------------------------------------------------------------------------
   15. Verbatims
   The French is the answer; the English is a gloss the reader can ask for.
   A <details> rather than a scripted toggle — it opens with scripting off,
   and the disclosure state is the platform's rather than this page's.
   -------------------------------------------------------------------------- */

.verbatim {
	display: grid;
	gap: var(--sp-3);
	align-content: start;
	border-radius: var(--r-card);
}

.verbatim > p[lang] {
	font-size: var(--fs-500);
	line-height: 1.4;
	letter-spacing: -0.01em;
}

.verbatim cite {
	font-family: var(--ff-display);
	font-size: var(--fs-100);
	font-style: normal;
	letter-spacing: 0.02em;
	color: var(--ink-faint);
}

.gloss > summary {
	display: block; /* removes the disclosure triangle in every engine */
	width: fit-content;
	font-family: var(--ff-display);
	font-size: var(--fs-200);
	font-weight: 600;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--accent-ink);
	cursor: pointer;
	transition: color var(--dur) var(--ease-out);
}

.gloss > summary:hover {
	color: var(--ink);
	text-decoration: underline;
	text-underline-offset: 3px;
}

.gloss > summary::-webkit-details-marker {
	display: none;
}

.gloss > p {
	margin-block-start: var(--sp-2);
	font-size: var(--fs-300);
	line-height: 1.5;
	color: var(--ink-soft);
}

.gloss__open,
.gloss[open] .gloss__closed {
	display: none;
}

.gloss[open] .gloss__open {
	display: inline;
}

/* --------------------------------------------------------------------------
   16. What they asked for
   -------------------------------------------------------------------------- */

.bigwords {
	display: flex;
	flex-wrap: wrap;
	gap: clamp(1rem, 4vw, 3.5rem);
	font-family: var(--ff-display);
	font-size: clamp(1.6rem, 1rem + 2.6vw, 3.4rem);
	font-weight: 700;
	letter-spacing: -0.03em;
	line-height: 1.1;
}

/* Each word is tinted with its own share of the bar below, in the bar's own
   order — the word and the segment have to be the same colour, or the figure
   and the sentence are telling different stories. Set per word, the way
   .wants__bar sets --fill, because the mapping is data and not style. */
.bigwords > span {
	color: var(--tint, inherit);
}

/* Wide enough that the bar reads as the same measure as the three words above
   it — a short bar under long words looks like a different figure. */
.wants {
	display: grid;
	gap: var(--sp-3);
	max-width: 56rem;
}

.wants__bar {
	display: flex;
	height: 22px;
	border-radius: var(--r-sm);
	overflow: hidden;
}

.wants__bar > span {
	flex: var(--share, 1);
	background: var(--fill, var(--tan));
}

.wants__legend {
	display: flex;
	flex-wrap: wrap;
	gap: var(--sp-2) var(--sp-5);
	font-family: var(--ff-display);
	font-size: var(--fs-200);
	color: color-mix(in srgb, var(--cream) 75%, transparent);
}

/* A four-colour bar with an unkeyed list under it is a legend that does not
   legend. Each entry carries the swatch of the segment it names. */
.wants__legend > span {
	display: inline-flex;
	align-items: center;
	gap: var(--sp-2);
}

.wants__legend > span::before {
	content: "";
	width: 0.7em;
	height: 0.7em;
	border-radius: 2px;
	background: var(--fill, var(--tan));
}

/* --------------------------------------------------------------------------
   17. How it works
   -------------------------------------------------------------------------- */

.steps {
	display: grid;
	gap: var(--sp-5);
}

.step {
	display: grid;
	grid-template-columns: 2.25rem 1fr;
	gap: var(--sp-4);
	align-items: start;
}

.step__n {
	display: grid;
	place-items: center;
	width: 2.25rem;
	height: 2.25rem;
	background: var(--paper);
	border-radius: var(--r-pill);
	box-shadow: var(--sh-contact);
	font-family: var(--ff-display);
	font-weight: 700;
}

.step strong {
	font-family: var(--ff-display);
	font-size: var(--fs-400);
	letter-spacing: -0.02em;
}

.step p {
	margin-block-start: 0.25rem;
	font-size: var(--fs-300);
	line-height: 1.55;
}

/* The same three steps read across instead of down, under the drawing they
   describe. The numbers come off with the turn: side by side they are told by
   reading order, and three numbered badges in a row compete with the plan for
   the eye. The thread above is the seam the cohort strip uses, in whatever ink
   the screen is already set in. */
.steps--row {
	grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
	gap: clamp(var(--sp-6), 4vw, var(--sp-10));
	padding-block-start: var(--sp-6);
	border-block-start: 2px dashed color-mix(in srgb, currentColor 22%, transparent);
}

/* `align-content: start` matters: the columns are stretched to the tallest of
   the three, and without it the two auto rows share that slack and the short
   column's paragraph floats away from its heading. */
.steps--row .step {
	grid-template-columns: 1fr;
	align-content: start;
	gap: 0;
}

.screen--dark .step strong {
	color: var(--butter-deep);
}

/* --------------------------------------------------------------------------
   18. The pilot
   The study design is a comparison, so the screen is one: the photograph of
   the room, then the same room three times with only its floor redrawn.

   Everything here is sized to arrive in a single view. A method read half now
   and half after a scroll is not read as a comparison at all — the reader has
   to hold three conditions in their head at once to see that they differ in
   one thing each. So the heading sits beside its paragraph instead of above
   it, and the drawings are capped in viewport units rather than given a fixed
   height: on a short window they hand their height back to the writing.
   -------------------------------------------------------------------------- */

.pilot__head {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
	gap: var(--sp-4) clamp(1.5rem, 4vw, 3rem);
	align-items: end;
}

.pilot__head h2 {
	max-width: 15ch;
}

.pilot__head .screen__body--lead {
	max-width: 52ch;
	font-size: var(--fs-400);
}

/* The photograph and the three panels it introduces, on one line. The photo
   is given a shade under a panel's width: it is the evidence the drawings are
   abstracted from, not a fourth condition. */
.setup {
	display: grid;
	grid-template-columns: minmax(0, 1.25fr) minmax(0, 3.2fr);
	gap: var(--sp-5);
}

/* Only in the page to hold a <defs>, so it must not take a line box of its
   own — the same reasoning as the plan's defs above. */
.floor__defs {
	position: absolute;
	width: 0;
	height: 0;
}

.setup__room,
.condition {
	--stitch-color: color-mix(in srgb, var(--tan-deep) 45%, transparent);
	display: grid;
	gap: var(--sp-3);
	align-content: start;
	border-radius: var(--r-card);
}

/* Label and caption take what they need and the photograph takes the rest, so
   the card ends flush with the panels beside it however tall the tallest of
   them turns out to be. */
.setup__room {
	grid-template-rows: auto minmax(6rem, 1fr) auto;
	align-content: stretch;
}

/* The lightbox wraps every figure's image in its own button, so the thing the
   grid is actually sizing is the button. Both need the row's height, and both
   need their automatic minimum taken off — left on, a grid item's minimum is
   its content, and the photograph's intrinsic height would push this card
   taller than the panels it is supposed to end level with. */
.setup__room .zoom,
.setup__room img {
	display: block;
	inline-size: 100%;
	block-size: 100%;
	min-block-size: 0;
	border-radius: var(--r-sm);
}

.setup__room img {
	object-fit: cover;
	/* A portrait frame in a taller box loses its sides, and what it must not
	   lose is the far half of the room: the cues on the floor and the label on
	   the obstacles they are avoiding. So the crop is taken off the near left
	   corner rather than evenly off both edges. */
	object-position: 82% 64%;
}

.setup__room figcaption {
	font-family: var(--ff-display);
	font-size: var(--fs-200);
	line-height: 1.5;
	color: var(--ink-soft);
}

.conditions {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	grid-template-rows: repeat(5, auto);
	gap: var(--sp-3) var(--sp-5);
}

/* The five parts of a panel line up across all three of them, so the drawings
   sit on one line, the titles sit on one line, and the rule under the writing
   is a single rule crossing the row. Three panels that agree about where their
   parts go read as one instrument; three that each pack from the top read as
   three cards that happen to be adjacent. */
@supports (grid-template-rows: subgrid) {
	.condition {
		grid-row: span 5;
		grid-template-rows: subgrid;
	}
}

.condition strong {
	font-family: var(--ff-display);
	font-size: var(--fs-400);
	letter-spacing: -0.02em;
}

.condition p {
	font-size: var(--fs-300);
	line-height: 1.55;
}

/* What the condition was *for*, ruled off from what it was. It is the line
   that makes each panel a method rather than a description, and run on from
   the sentence above it at this measure the two read as one block. */
.condition__goal {
	padding-block-start: var(--sp-3);
	border-block-start: 2px dashed
		color-mix(in srgb, var(--tan-deep) 40%, transparent);
	font-size: var(--fs-200);
	line-height: 1.5;
	color: var(--ink-soft);
}

/* Narrowed rather than letterboxed when the cap bites: an SVG held to a height
   inside a wider box centres itself and leaves a band of empty paper down each
   side, which on a card this size reads as a mistake. */
.floor {
	--floor-h: min(20vh, 10rem);
	display: block;
	inline-size: min(100%, calc(var(--floor-h) * 328 / 210));
	aspect-ratio: 328 / 210;
	margin-inline: auto;
	border-radius: var(--r-sm);
}

/* Moss for a cue you step on, peach for where you are headed — the two inks
   the plan on the build screen already uses for the same two things. */
.floor__cues rect {
	fill: var(--moss-deep);
}

/* The destination the first two conditions were handed, drawn the way it is
   drawn on the study's own room plan: a diamond, filled. */
.floor__goal {
	fill: var(--peach-deep);
}

/* And the destination the third condition asks the patient to pick, drawn as
   the ring the build screen labels "your target". Two markers rather than one
   because the difference between the second condition and the third is only
   who chose the spot, and a drawing that shows the same marker twice is not
   showing that. */
.floor__goal--chosen circle {
	fill: none;
	stroke: var(--peach-deep);
	stroke-width: 2.5;
}

.floor__goal--chosen circle + circle {
	fill: var(--peach-deep);
	stroke: none;
}

/* Dotted, not dashed: a line of round dots reads as a direction being
   indicated rather than as one more thing lying on the floor. */
.floor__aim {
	fill: none;
	stroke: var(--peach-deep);
	stroke-width: 2.2;
	stroke-linecap: round;
	stroke-dasharray: 0.1 8;
}

/* Four columns become four ribbons before the writing in them gives out, so
   the photograph leaves the row first and takes the full measure on its own.
   It is cropped wide there — a portrait frame at the whole width is half the
   screen's height spent on the picture rather than on the comparison. */
@media (max-width: 64rem) {
	.setup {
		grid-template-columns: minmax(0, 1fr);
	}

	.setup__room {
		grid-template-rows: auto auto auto;
	}

	.setup__room img {
		aspect-ratio: 3 / 1;
		block-size: auto;
	}
}

/* One panel at a time. Three columns of writing this narrow break up before
   they run out of width, and stacked there is nothing left for the subgrid to
   line up — each panel is simply as tall as it needs to be. */
@media (max-width: 44rem) {
	.conditions {
		grid-template-columns: minmax(0, 1fr);
		grid-template-rows: none;
		gap: var(--sp-5);
	}

	.condition {
		grid-row: auto;
		grid-template-rows: none;
	}
}

.facts {
	display: grid;
	gap: var(--sp-4);
	align-content: start;
}

/* The three cohort facts read across, above the participants they describe.
   They are the things true of all five, so they sit outside the carousel
   rather than repeating on every card. */
.facts--row {
	grid-auto-flow: column;
	grid-auto-columns: 1fr;
	gap: var(--sp-5);
	max-width: 54rem;
	padding-block-start: var(--sp-6);
	border-block-start: 2px dashed color-mix(in srgb, var(--tan-deep) 55%, transparent);
}

@media (max-width: 34rem) {
	.facts--row {
		grid-auto-flow: row;
		gap: var(--sp-4);
	}
}

.fact dt {
	font-family: var(--ff-display);
	font-size: clamp(1.8rem, 1.4rem + 1.2vw, 2.6rem);
	font-weight: 700;
	letter-spacing: -0.03em;
	line-height: 1;
}

.fact dd {
	margin-block-start: 0.15rem;
}

/* One participant at a time, on a scroll-snap strip.

   The strip is the mechanism, not a fallback for one: with scripting off it
   is still a horizontal scroller you can drag, and on a touchscreen it is a
   swipe without a line of code. The buttons below only call scrollBy and
   scrollIntoView — which card is current is read back off scroll position by
   an observer, never stored, so a drag and a chevron press cannot disagree
   about where the strip is.

   The notes are shown, not hidden behind a hover: two of the five getting
   little out of the system is the study's finding, and a finding does not
   live in a tooltip. */
.cohort {
	display: grid;
	gap: var(--sp-4);
	max-width: 54rem;
}

/* Only in the page to hold a <defs>, so it must not take a line box. */
.cohort__defs {
	position: absolute;
	width: 0;
	height: 0;
}

.cohort__bar {
	display: flex;
	flex-wrap: wrap;
	gap: var(--sp-3) var(--sp-4);
	align-items: center;
	justify-content: space-between;
}

.cohort__nav {
	display: flex;
	gap: var(--sp-2);
	align-items: center;
}

.cohort__arrow {
	display: grid;
	place-items: center;
	width: 2.25rem;
	height: 2.25rem;
	border: 0;
	border-radius: var(--r-pill);
	background: var(--paper);
	box-shadow: var(--sh-contact);
	color: var(--ink-soft);
	cursor: pointer;
	transition: background var(--dur) var(--ease-out),
		color var(--dur) var(--ease-out), translate var(--dur) var(--ease-spring);
}

.cohort__arrow svg {
	width: 1.125rem;
	height: 1.125rem;
}

.cohort__arrow:hover:not(:disabled) {
	background: var(--accent);
	color: var(--paper);
}

/* Kept in place rather than removed at the ends of the strip: five dots that
   reflow when you reach P5 is a worse answer than a button that says it has
   nothing left to do. */
.cohort__arrow:disabled {
	opacity: 0.35;
	cursor: default;
}

.cohort__dots {
	display: flex;
	gap: var(--sp-1);
	list-style: none;
	margin: 0;
	padding: 0;
}

.cohort__dots button {
	padding: 0.25rem var(--sp-2);
	border: 0;
	border-radius: var(--r-sm);
	background: none;
	font-family: var(--ff-display);
	font-size: var(--fs-200);
	font-weight: 600;
	letter-spacing: 0.04em;
	color: var(--ink-faint);
	cursor: pointer;
	transition: background var(--dur) var(--ease-out),
		color var(--dur) var(--ease-out);
}

.cohort__dots button:hover {
	color: var(--accent-ink);
}

.cohort__dots button[aria-current="true"] {
	background: var(--accent);
	color: var(--paper);
}

.cohort__track {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: 100%;
	gap: var(--sp-4);
	list-style: none;
	margin: 0;
	padding: 0;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	overscroll-behavior-inline: contain;
	scrollbar-width: none;
	/* The glide between two participants lives here, so the buttons can stay
	   a plain scrollBy and the reduced-motion rule below can switch it off in
	   one place. */
	scroll-behavior: smooth;
}

.cohort__track::-webkit-scrollbar {
	display: none;
}

.patient {
	display: grid;
	grid-template-columns: minmax(6rem, 9rem) 1fr;
	gap: clamp(var(--sp-4), 3vw, var(--sp-8));
	align-items: center;
	scroll-snap-align: center;
	border-radius: var(--r-card);
}

.patient__fig {
	display: grid;
	place-items: center;
}

.patient__art {
	width: 100%;
	max-width: 8rem;
	height: auto;
}

.patient__body {
	display: grid;
	gap: var(--sp-3);
	align-content: start;
}

.patient__id {
	font-family: var(--ff-display);
	font-size: var(--fs-700);
	font-weight: 700;
	letter-spacing: -0.03em;
	line-height: 1;
}

.patient__result {
	font-size: var(--fs-300);
	line-height: 1.6;
	color: var(--ink-soft);
	max-width: 46ch;
}

/* The outcome, said once in the display face. Underlined rather than boxed:
   a badge would rank the five against each other, and "no measurable gain" is
   as much a result as "26 → 10". */
.patient__out {
	justify-self: start;
	padding-block-end: 0.15rem;
	border-block-end: 2px solid var(--accent);
	font-family: var(--ff-display);
	font-size: var(--fs-400);
	letter-spacing: -0.01em;
	color: var(--accent-ink);
}

.patient__out b {
	font-weight: 700;
}

.patient--key {
	outline: 2px solid var(--accent);
	outline-offset: -2px;
}

@media (max-width: 38rem) {
	.patient {
		grid-template-columns: 1fr;
		justify-items: center;
		text-align: center;
	}

	.patient__body {
		justify-items: center;
	}

	.patient .chips {
		justify-content: center;
	}
}

@media (prefers-reduced-motion: reduce) {
	.cohort__track {
		scroll-behavior: auto;
	}
}

/* --------------------------------------------------------------------------
   19. What I'd change
   -------------------------------------------------------------------------- */

.admissions {
	display: grid;
	gap: var(--sp-6);
	max-width: 52rem;
}

.admit {
	display: grid;
	gap: var(--sp-2);
	padding-inline-start: var(--sp-5);
	border-inline-start: 4px solid var(--tone, var(--moss-deep));
}

.admit strong {
	font-family: var(--ff-display);
	font-size: var(--fs-500);
	letter-spacing: -0.02em;
}

.admit p {
	font-size: var(--fs-300);
	line-height: 1.6;
	color: var(--ink-soft);
}

.admit--1 {
	--tone: var(--moss-deep);
}
.admit--2 {
	--tone: var(--tan-deep);
}
.admit--3 {
	--tone: var(--peach-deep);
}
.admit--4 {
	--tone: var(--slate);
}

/* --------------------------------------------------------------------------
   20. Close
   -------------------------------------------------------------------------- */

.outro {
	padding: clamp(3.5rem, 9vh, 6rem) var(--gutter) clamp(3rem, 6vh, 4rem);
	background: color-mix(in srgb, var(--paper-warm) 55%, var(--cream));
	border-block-start: 2px dashed color-mix(in srgb, var(--tan-deep) 60%, transparent);
}

.outro .screen__inner {
	gap: var(--sp-8);
	justify-items: center;
	text-align: center;
}

.outro p {
	max-width: 44ch;
	font-size: var(--fs-400);
	line-height: 1.6;
	color: var(--ink-soft);
}

.outro__links {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: var(--sp-4);
}

/* --------------------------------------------------------------------------
   21. Print
   The screens stop being screens: no forced height, no fixed chrome, and
   nothing tilted.
   -------------------------------------------------------------------------- */

@media print {
	.progress,
	.rail,
	.readon {
		display: none;
	}

	.screen {
		min-height: 0;
		padding-block: var(--sp-8);
		break-inside: avoid;
	}

	.snap {
		rotate: none;
		box-shadow: none;
	}
}

/* --------------------------------------------------------------------------
   22. Operation Serval
   The same shape re-inked for a game: the screens, the reveal, the credits
   row and the outro are all the ones above, but in the game's own kit — its
   brown-and-orange palette, Oswald for titles and Chakra Petch for reading.

   Everything is scoped to <html data-case="serval">. The token overrides sit
   on :root rather than on <main> because the lightbox is mounted on <body>,
   outside the page's content, and has to be the same colour as the page it
   opened from.
   -------------------------------------------------------------------------- */

:root[data-case="serval"] {
	/* The rest of the kit's palette. Orange, sand and the sand paper are in
	   base.css, because the home card wears them too. */
	--serval-orange-text: color-mix(in srgb, var(--serval-orange), #fff 25%);
	--serval-glass: #342d22;
	--serval-head: #1d1913;
	--serval-field: #14110c;
	--serval-navy: #16212d;
	--serval-text: #ede6d6;
	--serval-body: #ddd4c0;
	--serval-muted: #afa285;

	--bg-page: var(--serval-field);
	--paper: var(--serval-glass);
	--paper-warm: color-mix(in srgb, var(--serval-glass), var(--serval-sand) 14%);
	--ink: var(--serval-text);
	--ink-soft: var(--serval-body);
	--ink-faint: var(--serval-muted);
	--accent: var(--serval-orange);
	--accent-ink: var(--serval-orange-text);
	--stitch-color: color-mix(in srgb, var(--serval-sand) 40%, transparent);
	/* base.css draws the focus ring in slate, which disappears on brown. */
	--slate: var(--serval-sand);

	--ff-display: "Oswald", "Arial Narrow", sans-serif;
	--ff-body: "Chakra Petch", "Segoe UI", system-ui, sans-serif;
	/* Chakra Petch is already a firm face at 400. Baloo's 600 here would
	   set every paragraph semi-bold. */
	--fw-body: 400;

	/* The site's shadows are a warm brown chosen to read on cream. On a brown
	   page they have to be darker than the ground to read at all. */
	--sh-contact: 0 1px 2px rgb(0 0 0 / 0.45);
	--sh-ambient: 0 10px 24px -10px rgb(0 0 0 / 0.6);
	--shadow-lift: 0 4px 8px -2px rgb(0 0 0 / 0.5),
		0 22px 44px -14px rgb(0 0 0 / 0.7);
}

/* Oswald is a condensed face that wants caps and a little air, the opposite
   of the tightened tracking base.css gives Space Grotesk. */
[data-case="serval"] :is(h1, h2, h3, h4) {
	font-weight: 600;
	line-height: 1.02;
	letter-spacing: 0.01em;
	text-transform: uppercase;
}

[data-case="serval"] strong,
[data-case="serval"] b {
	font-weight: 600;
}

/* The kit's section label: tracked caps in the reading face, behind a small
   orange square. */
[data-case="serval"] .eyebrow {
	display: flex;
	align-items: center;
	gap: 0.7em;
	font-family: var(--ff-body);
	font-size: var(--fs-100);
	letter-spacing: 0.22em;
}

[data-case="serval"] .eyebrow::before {
	content: "";
	flex: none;
	width: 0.6em;
	height: 0.6em;
	background: var(--accent);
}

[data-case="serval"] :is(.screen__pull, .screen__note) {
	letter-spacing: 0.01em;
}

/* The way back to the café is the café's furniture, so it keeps the face it
   is set in on every other case study instead of taking the game's. */
[data-case="serval"] :is(.back, .readon, .outro .btn) {
	font-family: var(--face-display);
}

.sv-screen--head {
	background: var(--serval-head);
}

/* The light screens: the scrapbook intro and the colours. The game's sand
   paper, with the inks swapped for the field brown, so the swatches on it
   are seen against something that is not one of them. */
.sv-screen--sand {
	--ink: var(--serval-field);
	--ink-soft: color-mix(in srgb, var(--serval-field) 80%, var(--serval-paper));
	--ink-faint: color-mix(in srgb, var(--serval-field) 62%, var(--serval-paper));
	background: var(--serval-paper);
	color: var(--ink);
}

/* The kit's buttons: square, a hairline of sand, orange only on the way in.
   One class for every control on the page, because they are one control in
   the game. */
.sv-btn,
[data-case="serval"] .btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--sp-2);
	min-width: 2.75rem;
	min-height: 2.75rem;
	padding: 0 var(--sp-3);
	border: 1px solid color-mix(in srgb, var(--serval-sand) 50%, transparent);
	border-radius: 0;
	background: none;
	box-shadow: none;
	font-family: var(--ff-display);
	font-size: var(--fs-300);
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--serval-sand);
	transition: background var(--dur) var(--ease-out),
		border-color var(--dur) var(--ease-out), color var(--dur) var(--ease-out);
}

[data-case="serval"] .btn {
	padding-inline: var(--sp-5);
}

.sv-btn:hover:not(:disabled),
[data-case="serval"] .btn:hover {
	border-color: var(--accent);
	background: var(--accent);
	color: var(--serval-text);
	translate: none;
	box-shadow: none;
}

.sv-btn:disabled {
	opacity: 0.35;
	cursor: default;
}

.sv-btn svg,
[data-case="serval"] .btn svg {
	width: 1.125rem;
	height: 1.125rem;
	flex: none;
}

/* The one loud button, the way BATTLE is the one loud button in the
   garage: orange at rest, for the link that leaves for the game itself. The
   words are in the field brown rather than the game's white, which on this
   orange is under 3:1. On the way in it turns dark, inside the same orange
   line. */
[data-case="serval"] .btn--go {
	border-color: var(--accent);
	background: var(--accent);
	color: var(--serval-field);
}

[data-case="serval"] .btn--go:hover {
	background: var(--serval-field);
	color: var(--serval-text);
}

/* --- hero ----------------------------------------------------------------- */

/* The title sits in the sky, above the sun, rather than in the middle of the
   screen where the tanks are. */
.sv-hero {
	isolation: isolate;
	align-content: start;
	padding-block-start: clamp(6rem, 20svh, 13rem);
	background: var(--serval-field);
}

/* Cropped, never letterboxed. Off-centre towards the sun, so that on a phone
   the narrow slice that is left is the sun and the tank under it. */
.sv-hero__land {
	position: absolute;
	inset: 0;
	z-index: -1;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: 62% 100%;
}

.sv-hero__inner {
	justify-items: center;
	text-align: center;
}

.sv-hero__title {
	display: grid;
	justify-items: center;
	gap: 0.15em;
	color: var(--serval-text);
}

/* "Operation" as the kit's micro label. Tracking adds space after the last
   letter as well as between them, so the end margin takes it back and the
   word sits on the same centre line as the name under it. */
.sv-hero__op {
	margin-inline-end: -0.5em;
	font-family: var(--ff-body);
	font-size: clamp(0.85rem, 0.6rem + 0.9vw, 1.35rem);
	letter-spacing: 0.5em;
	color: var(--serval-sand);
}

/* Capped against the height too: a laptop is a wide, short window, and the
   name must not grow down into the sun. */
.sv-hero__name {
	font-size: min(clamp(4.5rem, 1.5rem + 11vw, 11rem), 26svh);
	font-weight: 700;
	line-height: 0.9;
	letter-spacing: 0.04em;
}

/* The kit's anchor: the short orange rule every panel carries in its square
   corner. */
.sv-hero__title::after {
	content: "";
	width: 3rem;
	height: 3px;
	margin-block-start: 0.6rem;
	background: var(--accent);
}

/* --- how it started ------------------------------------------------------- */

/* A page out of the café's scrapbook, laid on the same sand paper as the
   colours screen (.sv-screen--sand, which also brings the dark inks). It is
   the one screen here in the café's own materials — cream sheets, a dashed
   thread, washi tape — and in the café's own faces, because it is the chibi
   talking, in the say panel from the home page. Everything after it is the
   game. */
.sv-intro {
	--ff-display: var(--face-display);
	--ff-body: var(--face-body);
	--fw-body: 600;
	/* The serval :root makes paper the panel glass, which is right for the
	   game's screens and wrong for a scrapbook. */
	--card-bg: var(--cream);
	/* The portrait's size and how far it is pulled down over its panel — the
	   same pair the home hero uses on a phone, for the same move. */
	--chibi-size: clamp(6.5rem, 20vw, 8.75rem);
	--chibi-dip: calc(var(--chibi-size) * 0.42);
	/* The café's things, in the game's colours: the tape is the orange. */
	--tape: var(--serval-orange);
	font-family: var(--ff-body);
	font-weight: var(--fw-body);
}

/* The portrait sits on the top edge of its own panel. In flow, with the
   panel pulled up under it, so nothing above has to know the two overlap. */
.sv-intro__say {
	display: grid;
	justify-items: start;
}

.sv-intro__chibi {
	--chibi-bg: var(--peach-deep);
	z-index: 1;
	width: var(--chibi-size);
	padding: var(--sp-4);
	margin-inline-start: var(--sp-6);
	margin-block-end: calc(var(--chibi-dip) * -1);
}

/* The awning down the panel's edge is striped in the game's orange and sand
   instead of the café's butter. */
.sv-intro__panel {
	--awning-a: var(--serval-orange);
	--awning-b: var(--serval-sand);
	padding-block-start: calc(var(--chibi-dip) + var(--sp-3));
}

.sv-intro__panel .saypanel__line + .saypanel__line {
	margin-block-start: var(--sp-3);
}

.sv-intro__panel .btn {
	margin-block-start: var(--sp-5);
}

/* Parked on the panel's top edge. Sized off the portrait so the two share
   one pixel grid: the chibi is 54 of its pixels across inside its padding,
   the tank is 30. */
.sv-intro__tank {
	position: absolute;
	inset-block-end: 100%;
	inset-inline-end: clamp(var(--sp-6), 10%, var(--sp-12));
	width: calc((var(--chibi-size) - var(--sp-4) * 2) * 30 / 54);
	image-rendering: pixelated;
}

/* Mounted the way the logo is on the colours screen: the game's panel glass
   with a sand thread, rather than the café's cream. The caption is on that
   glass, so it takes the page's light ink back from the sand screen. */
.sv-intro__photo {
	--rot: -1.5deg;
	--card-bg: var(--paper);
	--stitch-color: color-mix(in srgb, var(--serval-sand) 40%, transparent);
	--ink-soft: var(--serval-body);
	justify-self: center;
	width: min(100%, 26rem);
}

.sv-intro__photo img {
	aspect-ratio: 4 / 3;
}

.sv-intro__photo figcaption {
	text-align: center;
}

/* Cut from the game's sand, the khaki its second buttons and lines are
   drawn in: one step darker than the sand paper it is pinned to, so it reads
   as a separate sheet, and the cream thread the café's cards wear still
   shows on it.

   Stacked, the note is pulled up over the photograph's bottom margin, the
   way a scrapbook gets layered — by less than that margin, so it never
   sits on the caption. */
.sv-note {
	--card-bg: var(--serval-sand);
	--stitch-color: var(--cream);
	position: relative;
	z-index: 1;
	justify-self: end;
	width: min(100%, 16rem);
	margin-block-start: calc(var(--sp-3) * -1);
	rotate: 3deg;
}

.sv-note dl {
	display: grid;
	gap: var(--sp-3);
}

/* The label the home page's shelf cards wear, mixed towards the note — less
   far than the shelf mixes it, because sand is darker than any of the café's
   cards and 62% left this size of type at about 4:1. */
.sv-note dt {
	font-family: var(--ff-display);
	font-size: var(--fs-100);
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: color-mix(in srgb, var(--ink) 72%, var(--card-bg));
}

.sv-note dd {
	font-size: var(--fs-300);
	line-height: var(--lh-snug);
}

/* The collage. The photograph is the centrepiece across seven columns, the
   note is pinned beside its top corner, and the panel is laid over its
   right edge — one column of overlap, painted on top — with the portrait
   sitting on the panel. */
@media (min-width: 62rem) {
	.sv-intro__inner {
		grid-template-columns: repeat(12, minmax(0, 1fr));
		grid-template-rows: auto 1fr;
		gap: var(--sp-6) var(--sp-5);
		align-items: start;
	}

	.sv-intro__photo {
		grid-column: 1 / 8;
		grid-row: 1 / 3;
		width: 100%;
	}

	.sv-note {
		grid-column: 9 / 12;
		grid-row: 1;
		justify-self: start;
		align-self: end;
		margin: 0;
	}

	.sv-intro__say {
		grid-column: 7 / 13;
		grid-row: 2;
		z-index: 2;
	}
}

/* --- the screen reel ------------------------------------------------------ */

/* As wide as the window and, wherever the window is shaped like a screen, as
   tall as it too: the reel is the one screen on the page that is a picture,
   so the chrome around it is cut to one line above — the title with the
   controls beside it — and the caption below. Under that size the
   screenshots simply take their own height. */
.sv-reel {
	/* How long a screenshot stays up. The script has no number of its own:
	   it moves on when the pip's fill animation ends. */
	--dwell: 6s;
	grid-template-rows: auto auto;
	align-content: start;
	gap: clamp(var(--sp-3), 2vh, var(--sp-5));
	min-height: 0;
	padding: clamp(1.75rem, 4.5vh, 3rem) 0 clamp(1.25rem, 3vh, 2.25rem);
	background: var(--serval-field);
}

.sv-reel__head {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: var(--sp-3) var(--sp-6);
	width: 100%;
	max-width: calc(var(--wrap) + var(--gutter) * 2);
	margin-inline: auto;
	padding-inline: var(--gutter);
}

.sv-reel__title {
	font-size: var(--fs-700);
}

/* The cohort strip's mechanism: a native scroller that snaps a whole screen
   at a time and works with no script at all. */
.sv-reel__track {
	position: relative;
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: 100%;
	min-height: 0;
	overflow-x: auto;
	overscroll-behavior-inline: contain;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	scrollbar-width: none;
}

.sv-reel__track::-webkit-scrollbar {
	display: none;
}

.sv-reel__track:focus-visible {
	outline-offset: -3px;
}

.sv-reel__slide {
	display: grid;
	min-height: 0;
	padding-inline: var(--gutter);
	scroll-snap-align: center;
	scroll-snap-stop: always;
}

.sv-shot {
	display: grid;
	grid-template-rows: minmax(0, 1fr) auto;
	gap: var(--sp-3);
	min-height: 0;
}

.sv-shot img {
	width: 100%;
}

.sv-shot figcaption {
	justify-self: center;
	max-width: 90ch;
	font-size: var(--fs-300);
	line-height: 1.5;
	text-align: center;
	color: var(--ink-soft);
}

.sv-shot figcaption b {
	font-family: var(--ff-display);
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--ink);
}

/* Screen-shaped windows: the reel fills the height and the screenshot is
   fitted inside what is left, never cropped — a menu with its edge cut off
   is a different menu. */
@media (min-width: 48rem) and (min-height: 34rem) {
	.sv-reel {
		grid-template-rows: auto minmax(0, 1fr);
		height: 100svh;
	}

	.sv-shot .zoom,
	.sv-shot img {
		height: 100%;
		min-height: 0;
	}

	.sv-shot img {
		object-fit: contain;
	}
}

/* The controls only do anything with the script running, so without it
   there are none — the track still scrolls. */
.sv-reel__bar {
	display: none;
}

.js .sv-reel__bar {
	display: flex;
	align-items: center;
	gap: var(--sp-2);
}

.sv-reel__pips {
	display: flex;
	gap: var(--sp-1);
}

/* A pip is a hairline, as in the game's own progress bars. The button around
   it is a full touch target; the line is only what it looks like. */
/* Narrow enough that the whole bar fits beside the title on a laptop. */
.sv-pip {
	position: relative;
	display: block;
	width: clamp(1.75rem, 2.5vw, 2.25rem);
	height: 2.75rem;
}

.sv-pip::before,
.sv-pip__fill {
	content: "";
	position: absolute;
	inset: calc(50% - 1.5px) 0 auto;
	height: 3px;
}

.sv-pip::before {
	background: color-mix(in srgb, var(--serval-sand) 28%, transparent);
	transition: background var(--dur) var(--ease-out);
}

.sv-pip:hover::before {
	background: color-mix(in srgb, var(--serval-sand) 60%, transparent);
}

.sv-pip__fill {
	background: var(--accent);
	scale: 0 1;
	transform-origin: left;
}

/* Paused, the current pip is simply lit. Playing, it fills over the dwell,
   and the end of that fill is what moves the reel on. */
.sv-pip[aria-current="true"] .sv-pip__fill {
	scale: 1 1;
}

.sv-reel[data-playing] .sv-pip[aria-current="true"] .sv-pip__fill {
	animation: reel-dwell var(--dwell) linear both;
}

@keyframes reel-dwell {
	from {
		scale: 0 1;
	}
	to {
		scale: 1 1;
	}
}

.sv-reel__play {
	margin-inline-end: var(--sp-3);
}

.sv-reel__play > span {
	display: inline-flex;
	align-items: center;
	gap: var(--sp-2);
}

.sv-reel:not([data-autoplay]) .sv-reel__when-on,
.sv-reel[data-autoplay] .sv-reel__when-off {
	display: none;
}

/* A small phone has room for the five pips and the chevrons or for the word
   "Pause", not both. The word stays the button's name; only the eye loses
   it, and the icon beside it already says the same thing. */
@media (max-width: 30rem) {
	.sv-pip {
		width: 1.5rem;
	}

	.sv-reel__label {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip-path: inset(50%);
		white-space: nowrap;
	}
}

@media (prefers-reduced-motion: reduce) {
	.sv-reel__track {
		scroll-behavior: auto;
	}

	/* No autoplay at all, rather than one that flicks through the screens:
	   base.css cuts every animation to a hundredth of a millisecond, which
	   would end the dwell the moment it began. Same selector as the rule
	   that starts it, so this one wins on order. */
	.sv-reel[data-playing] .sv-pip[aria-current="true"] .sv-pip__fill {
		animation: none;
	}

	.js .sv-reel__play {
		display: none;
	}
}

/* --- colours -------------------------------------------------------------- */

/* The logo on a sheet of the café's paper, stitched and pinned at an angle
   the way the photographs on the Parkinson's page are: the one place the two
   halves of this page's look meet on one object. */
.sv-logo {
	justify-self: center;
	width: min(100%, 18rem);
	border-radius: var(--r-card);
	rotate: -2deg;
}

.sv-logo img {
	width: 100%;
	border-radius: var(--r-sm);
}

.sv-swatches {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
	gap: var(--sp-6) var(--sp-4);
}

.sv-swatch {
	display: grid;
	gap: 0.1rem;
	align-content: start;
	font-size: var(--fs-200);
	line-height: 1.4;
	color: var(--ink-soft);
}

/* Cut like the kit's own swatches: three corners off, top-left square. */
.sv-swatch::before {
	content: "";
	height: clamp(3.5rem, 9vh, 5rem);
	margin-block-end: var(--sp-3);
	background: var(--fill);
	clip-path: polygon(
		0 0,
		calc(100% - 12px) 0,
		100% 12px,
		100% calc(100% - 12px),
		calc(100% - 12px) 100%,
		12px 100%,
		0 calc(100% - 12px)
	);
}

.sv-swatch b {
	font-family: var(--ff-display);
	font-size: var(--fs-500);
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--ink);
}

.sv-swatch code {
	font-family: var(--ff-body);
	letter-spacing: 0.06em;
}

/* --- close ---------------------------------------------------------------- */

[data-case="serval"] .outro {
	background: var(--serval-field);
	border-block-start-color: color-mix(in srgb, var(--serval-sand) 30%, transparent);
}

/* The logo as the kit's badge: three corners cut, top-left square. */
.sv-outro__badge {
	width: 4.5rem;
	height: 4.5rem;
	clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% calc(100% - 10px), calc(100% - 10px) 100%, 10px 100%, 0 calc(100% - 10px));
}

/* --- the lightbox --------------------------------------------------------- */

/* The screenshots are 1920 across and full of small type, so on a window
   wide enough to spare it the lightbox gives them more of the screen than it
   gives a photograph. The phone sizes in lightbox.css are left alone. */
@media (min-width: 60.0625rem) {
	[data-case="serval"] .lightbox {
		--img-max-w: min(76rem, calc(100vw - 35rem));
		--img-max-h: min(48rem, calc(100svh - 11rem));
	}
}

[data-case="serval"] .lightbox__sheet {
	--card-bg: var(--serval-head);
}

/* A <dialog> takes the browser's own text colour, which is black — unseen
   on the café's cream, unreadable on this brown. And its caption is an h2
   only for the outline: it reads as a sentence, so it is set as one rather
   than in the page's capitals. */
[data-case="serval"] .lightbox {
	color: var(--ink);
}

[data-case="serval"] .lightbox__title {
	font-family: var(--ff-body);
	font-weight: 500;
	line-height: 1.45;
	letter-spacing: 0;
	text-transform: none;
}

@media print {
	.sv-reel__bar {
		display: none;
	}

	.sv-reel {
		height: auto;
	}
}
