/* Case study — Editorial showcase (template-parts/case/editorial-showcase.php).

   The approved hybrid: A's calm opening, type and spacing, then one
   execution on the project's own colour (look closely), the campaign, the
   featured message in every size on a tone step (see it adapt), and the
   whole campaign on paper as one grid (see the breadth), with filters that
   narrow it but never hide it by default. Then the close.

   Every creative is its own pixels times one shared factor, never above its
   own size: actual size wherever the column allows, smaller only to fit.
   Loaded after direction-c.css, only on a case study that uses it
   (bannerjoy_case_assets()). The viewer is appended to the body, so the
   tokens are set on it as well as on the case study. Class prefixes: cs- for
   the parts (piece, controls, viewer), h- for the page's sections. */

.cs-case,
.cs-viewer {
	/* The tallest a piece may be drawn on the page: the screen less the fixed
	   header, the caption under the piece and some air, so a whole creative
	   and its caption are seen at once on a laptop (768–800px high) as on a
	   phone. 10rem is chosen so a 600px-tall IAB format (half page,
	   skyscraper) still shows at actual size on a 768px-high laptop. Never under 20rem, so a short landscape phone still shows the
	   work at a readable size. Portrait creative is the case it exists for —
	   a 1080×1920 Story, an email's first screen — and anything already
	   shorter than this is untouched. The full size is a click away in the
	   viewer, which has its own "Actual size". */
	--cs-hmax: max(20rem, calc(100svh - 10rem));
	--cs-ink: var(--color-fg, #121318);
	--cs-ink-dim: #3e424c;
	--cs-paper: var(--color-bg, #f7f8fa);
	--cs-tint: #eceef2;
	--cs-ease: cubic-bezier(0.23, 1, 0.32, 1);
}

/* ---- Compositions ---------------------------------------------------------
   One shared scale per composition. A piece is its real width times the
   composition's factor, where the factor is the smaller of smax and what
   the container allows for the composition's reference width (--W, less
   its gaps --G). Every piece shrinks by the same amount; none grows past
   its own pixels times smax (never above 1). Narrow containers wrap the
   pieces instead, at the factor that fits --Wn (less --Gn).

   Height is the other bound: no piece is drawn taller than --cs-hmax, its
   width scaled to keep its proportions (never cropped, never stretched).
   The only composition holding several pieces at one factor is none today
   — the feature is a single piece — and the caption's scale note is
   measured from the drawn size, so "actual size" is still only said when
   it is true. */

.cs-comp {
	container-type: inline-size;
	width: 100%;
}

.cs-row {
	display: flex;
	align-items: flex-start;
	gap: var(--gap);
}

.cs-row + .cs-row {
	margin-top: var(--gap);
}

.cs-col {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--gap);
	min-width: 0;
}

.cs-piece {
	/* A piece outside any composition is simply its own size, capped by
	   its container (the fallbacks). */
	--pw: min(calc(var(--w) * var(--smax, 1) * 1px), calc((100cqw - var(--G, 0px)) * var(--w) / var(--W, var(--w))), calc(var(--cs-hmax, 100svh) * var(--w) / var(--h)));
	flex: none;
	max-width: 100%;
	width: var(--pw);
	margin: 0;
}

/* ---- A piece -------------------------------------------------------------- */

.cs-piece__frame {
	position: relative;
	width: 100%;
	aspect-ratio: var(--w) / var(--h);
	overflow: hidden;
	background: var(--cs-tint);
}

.cs-piece__poster {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}

/* A poster and its backup both failed: say what is missing, never show an
   unrelated picture. */
.cs-piece.is-missing .cs-piece__poster {
	visibility: hidden;
}

.cs-piece.is-missing .cs-piece__frame::after {
	content: attr(data-missing);
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	padding: 0.5rem;
	color: var(--cs-ink-dim);
	font-family: var(--font-body);
	font-size: 0.8125rem;
	text-align: center;
}

/* A live creative runs behind its poster until it has started, then the
   poster gives way in the same box (assets/js/preview.js sets .is-live). */
.cs-piece__frame iframe {
	position: absolute;
	top: 0;
	left: 0;
	border: 0;
	transform-origin: 0 0;
	opacity: 0;
}

.cs-piece__frame.is-live iframe {
	opacity: 1;
}

.cs-piece__frame.is-live .cs-piece__poster {
	visibility: hidden;
}

/* A piece playing where it is stays a pointer shortcut to its viewer: its
   click-through is already removed, so the click goes to the frame. */
.cs-piece__frame.is-openable iframe {
	pointer-events: none;
}

.cs-piece__cap {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0.15rem 0.6rem;
	padding-top: 0.55rem;
	color: var(--cs-ink-dim);
	font-size: 0.8125rem;
	line-height: 1.35;
}

.cs-piece__cap:empty {
	display: none;
}

.cs-cap-msg {
	flex-basis: 100%;
	color: var(--cs-ink);
	font-size: 0.9375rem;
	line-height: 1.35;
}

/* Dimensions are measurements: the one place the mono face belongs. */
.cs-dim {
	font-family: var(--font-mono); /* taste-skill-ignore: dimensions are measurements, in the approved brand mono */
	font-size: 0.8125rem;
	font-variant-numeric: tabular-nums;
	letter-spacing: 0;
}

.cs-scale:empty {
	display: none;
}

.cs-count {
	font-family: var(--font-body);
	font-weight: 400;
	color: var(--cs-ink-dim);
	font-size: 0.875rem;
	letter-spacing: 0;
}

/* Opening a piece: a visible "View" beside its size (case-editorial.js adds
   it), never over the artwork. The artwork is a pointer shortcut to the same
   button, so it takes the zoom cursor but no focus of its own. */
.cs-piece__frame.is-openable {
	cursor: zoom-in;
}

.cs-act {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	min-height: 2rem;
	padding: 0 0.6rem;
	background: rgba(18, 19, 24, 0.07);
	color: var(--cs-ink);
	font-family: var(--font-body);
	font-size: 0.8125rem;
	font-weight: 650;
	line-height: 1;
	white-space: nowrap;
	border-radius: 0;
	transition: background-color 160ms ease, transform 140ms var(--cs-ease);
}

/* Size, action and scale read as one line. */
.cs-piece__cap:has(.cs-act) {
	align-items: center;
}

/* The target reaches 44px without the caption growing to match. */
.cs-act::before {
	content: "";
	position: absolute;
	inset: -0.375rem -0.125rem;
}

.cs-act__icon {
	flex: none;
}

.cs-act:active {
	transform: scale(0.97);
}

.cs-act:focus-visible {
	outline: 3px solid var(--color-blue);
	outline-offset: 2px;
}

@media (hover: hover) and (pointer: fine) {
	.cs-act:hover {
		background: rgba(18, 19, 24, 0.13);
	}

	.cs-piece__frame.is-openable {
		transition: transform 200ms var(--cs-ease);
	}

	.cs-piece__frame.is-openable:hover,
	.cs-piece:has(.cs-act:hover) .cs-piece__frame.is-openable {
		transform: translateY(-2px);
	}
}

/* ---- Controls ------------------------------------------------------------- */

.cs-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.45rem;
	min-height: 2.75rem;
	padding: 0.55rem 1.05rem;
	background: var(--color-blue);
	color: #ffffff;
	font-family: var(--font-body);
	font-size: 0.9375rem;
	font-weight: 650;
	line-height: 1.1;
	border-radius: 0;
	transition: transform 140ms var(--cs-ease), background-color 160ms ease;
}

.cs-btn:active {
	transform: scale(0.97);
}

.cs-btn[aria-pressed="true"] {
	background: var(--cs-ink);
}

.cs-btn--quiet[aria-pressed="true"] {
	background: var(--cs-ink);
	color: #ffffff;
}

.cs-btn--quiet {
	background: rgba(18, 19, 24, 0.07);
	color: inherit;
}

.cs-btn:focus-visible {
	outline: 3px solid var(--color-blue);
	outline-offset: 3px;
}

@media (hover: hover) and (pointer: fine) {
	.cs-btn:hover {
		background: var(--color-blue-deep);
	}

	.cs-btn--quiet:hover {
		background: rgba(18, 19, 24, 0.06);
	}
}

.cs-play-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem 1rem;
	margin-top: 0.75rem;
}

.cs-status {
	color: var(--cs-ink-dim);
	font-size: 0.875rem;
}

.cs-status:empty {
	display: none;
}

/* ---- Viewer -------------------------------------------------------------- */

.cs-viewer {
	/* Grows with the creative it shows (case-editorial.js sizes the stage from the
	   measured space), never wider or taller than the viewport, and never
	   so narrow that its header and controls crowd. */
	width: fit-content;
	min-width: min(100vw - 2rem, 34rem);
	max-width: calc(100vw - 2rem);
	max-height: calc(100dvh - 2rem);
	margin: auto;
	padding: 0;
	border: 0;
	overflow: hidden;
	background: var(--cs-paper);
	color: var(--cs-ink);
	box-shadow: 0 24px 64px rgba(10, 12, 20, 0.35); /* taste-skill-ignore: a real overlay */
	opacity: 1;
	transform: none;
	transition: opacity 200ms var(--cs-ease), transform 200ms var(--cs-ease), overlay 200ms allow-discrete, display 200ms allow-discrete;
}

@starting-style {
	.cs-viewer[open] {
		opacity: 0;
		transform: scale(0.97);
	}
}

.cs-viewer::backdrop {
	background: rgba(10, 12, 20, 0.72);
}

.cs-viewer__inner {
	display: flex;
	flex-direction: column;
}

.cs-viewer__head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 1rem;
	padding: 1rem 1.25rem 0.75rem;
}

.cs-viewer__title {
	margin: 0;
	max-width: 46ch;
	font-family: var(--font-body);
	font-size: 1.0625rem;
	font-weight: 650;
	line-height: 1.35;
	letter-spacing: 0;
}

.cs-viewer__meta {
	margin: 0.2rem 0 0;
	color: var(--cs-ink-dim);
	font-size: 0.875rem;
}

/* The presentation area: given the creative's size (plus its padding) by
   case-editorial.js, centred both ways; actual size larger than the screen scrolls
   inside it from the top left. */
.cs-viewer__stage {
	box-sizing: border-box;
	display: grid;
	place-items: center;
	align-self: stretch;
	min-width: 100%;
	padding: 20px;
	overflow: auto;
	background: var(--project-bg, #121318);
	overscroll-behavior: contain;
}

.cs-viewer.is-overflow .cs-viewer__stage {
	place-items: start;
}

.cs-viewer__stage .cs-piece {
	max-width: none;
}

.cs-viewer__stage .cs-piece__frame {
	background: rgba(255, 255, 255, 0.08);
}

.cs-viewer__stage:focus-visible {
	outline: 3px solid var(--color-blue);
	outline-offset: -3px;
}

.cs-viewer__modes {
	display: inline-flex;
	gap: 0.35rem;
}

/* A segmented pair, quieter than Play: the chosen mode is a deeper tone
   step with heavier type, not a second solid button. */
.cs-viewer__modes .cs-btn--quiet {
	background: transparent;
	font-weight: 500;
}

.cs-viewer__modes .cs-btn--quiet[aria-pressed="true"] {
	background: #dfe2e8;
	color: var(--cs-ink);
	font-weight: 700;
}

.cs-viewer__scroll-note {
	color: var(--cs-ink-dim);
	font-size: 0.875rem;
}

.cs-viewer__modes[hidden] {
	display: none;
}

.cs-viewer__foot {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem;
	padding: 0.75rem 1.25rem 1rem;
}

.cs-viewer__foot .cs-spacer {
	flex: 1 1 auto;
}

.cs-viewer__close {
	flex: none;
	min-height: 2.75rem;
	padding: 0.5rem 0.9rem;
	background: rgba(18, 19, 24, 0.07);
	font-weight: 650;
}

.cs-viewer__close:focus-visible {
	outline: 3px solid var(--color-blue);
	outline-offset: 3px;
}

/* ---- The next Project's cover ------------------------------------------- */

.cs-case [class$="__cover"] {
	position: relative;
	display: block;
	width: 100%;
	max-width: 40rem;
	aspect-ratio: 16 / 10;
	overflow: hidden;
	background: var(--next-bg, #121318);
}

.cs-case [class$="__cover"] img {
	position: absolute;
	box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06), 0 10px 24px rgba(0, 0, 0, 0.22); /* taste-skill-ignore: matches the approved site's Work covers */
}

/* ---- Motion ----------------------------------------------------------------
   Reduced motion keeps opacity changes (they explain state) and drops
   movement. Nothing on these pages animates by itself. */
@media (prefers-reduced-motion: reduce) {
	.cs-viewer {
		transition: opacity 120ms linear, overlay 120ms allow-discrete, display 120ms allow-discrete;
	}

	@starting-style {
		.cs-viewer[open] {
			transform: none;
		}
	}

	.cs-btn,
	.cs-act,
	.cs-piece__frame {
		transition: none !important;
	}

	.cs-btn:active,
	.cs-act:active,
	.cs-piece__frame.is-openable:hover,
	.cs-piece:has(.cs-act:hover) .cs-piece__frame.is-openable {
		transform: none !important;
	}
}

/* Still or animated, said in words where a project mixes them. */
.cs-kind {
	color: var(--cs-ink-dim);
	font-size: 0.8125rem;
}

.cs-h {
	--h-gap: clamp(5rem, 3rem + 6vw, 9rem);
}

/* ---- Opening (cobalt, Direction C) ---- */

.h-mast {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: clamp(1rem, 1.6vw, 1.5rem);
	padding-top: calc(var(--header-h) + clamp(0.5rem, 1.2vw, 1.25rem));
	padding-bottom: clamp(2rem, 3vw, 2.5rem);
	/* The title's column, for its size cap (below). */
	container-type: inline-size;
	--h-col: 100cqi;
}

.h-mast__crumbs a {
	display: inline-flex;
	min-height: 2.75rem;
	align-items: center;
	color: var(--color-blue-soft);
	font-size: 0.9375rem;
}

/* The designed size, capped so the title's widest word (--h-word, in ems,
   from bannerjoy_case_title_fit()) fits its column: a long name is set a
   little smaller rather than broken or run off the page. A title whose words
   all fit is not affected. */
.h-mast__title {
	--h-word: 1;
	margin: 0;
	font-size: min(clamp(3.25rem, 1.6rem + 6.4vw, 7.5rem), calc(var(--h-col) / var(--h-word)));
	font-weight: 700;
	line-height: 0.92;
	letter-spacing: -0.04em;
	color: #ffffff;
}

/* A hyphenated word in the title stays on one line ("COVID-19"). */
.h-nowrap {
	white-space: nowrap;
}

.h-mast__discipline,
.b-case__discipline {
	margin: 0;
	font: 600 clamp(0.875rem, 0.8rem + 0.25vw, 1rem) / 1.35 var(--font-mono);
	letter-spacing: 0;
	color: #ffffff;
}

.h-mast__intro {
	max-width: 34ch;
	margin: 0;
	font-size: clamp(1.1875rem, 0.95rem + 0.7vw, 1.5rem);
	line-height: 1.32;
	letter-spacing: -0.01em;
	color: #ffffff;
	text-wrap: pretty;
}

.h-facts {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem clamp(2rem, 4vw, 4rem);
	margin: 0;
}

.h-facts dt {
	color: var(--color-blue-soft);
	font-size: 0.875rem;
}

.h-facts dd {
	margin: 0.2rem 0 0;
	color: #ffffff;
	font-size: 1.0625rem;
}

@media (min-width: 64rem) {
	.h-mast {
		grid-template-columns: minmax(0, 1fr) minmax(0, 30rem);
		grid-template-areas:
			"crumbs crumbs"
			"title intro"
			"facts intro";
		align-items: end;
		column-gap: clamp(2rem, 5vw, 6rem);
		row-gap: 1.25rem;
		/* What the summary's column and the gap leave the title. */
		--h-col: calc(100cqi - 30rem - clamp(2rem, 5vw, 6rem));
	}

	/* The facts sit under the title, beside the longer summary. */
	.h-mast__crumbs {
		grid-area: crumbs;
	}

	.h-mast__title {
		grid-area: title;
	}

	.h-mast__intro {
		grid-area: intro;
		align-self: end;
	}

	.h-facts {
		grid-area: facts;
		align-self: end;
	}

	/* The production discipline sits directly under the title, above the
	   facts (inc/project-discipline.php). Only when there is one, so an
	   opening without it keeps its rows exactly as before. */
	.h-mast:has(.h-mast__discipline) {
		grid-template-areas:
			"crumbs crumbs"
			"title intro"
			"discipline intro"
			"facts intro";
	}

	.h-mast__discipline {
		grid-area: discipline;
		margin-top: -0.25rem;
	}
}

/* The campaign sits on the opening's column line. */
@media (min-width: 64rem) {
	.h-context {
		grid-template-columns: minmax(0, 1fr) minmax(0, 30rem);
		column-gap: clamp(2rem, 5vw, 6rem);
		align-items: start;
	}

	.h-context__body p {
		max-width: none;
		font-size: clamp(1.25rem, 0.95rem + 0.55vw, 1.5rem);
	}
}

/* ---- Featured execution: one piece, at its own size, with room ---- */

.h-feature {
	background: var(--project-bg);
	color: var(--project-fg);
	padding-block: clamp(2rem, 1.5rem + 1.6vw, 3rem) clamp(3.5rem, 2.5rem + 4vw, 7rem);
}

/* One axis: heading, artwork, caption and controls share the left edge. */
.h-feature__inner {
	display: grid;
	justify-items: start;
	gap: clamp(1rem, 1.6vw, 1.5rem);
}

.h-feature__title {
	max-width: 48ch;
	margin: 0;
	font-size: clamp(1.875rem, 1.2rem + 1.8vw, 2.75rem);
	font-weight: 700;
	line-height: 1;
	letter-spacing: -0.035em;
	color: var(--project-fg);
	text-wrap: balance;
}

.h-feature__title.is-long {
	max-width: 34ch;
	font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2.25rem);
	line-height: 1.12;
	letter-spacing: -0.025em;
}

/* The artwork's wrapper spans the column (a composition is a size
   container: shrink-wrapped, it would measure zero); the piece inside sits
   on the left edge. */
.h-feature__art {
	justify-self: stretch;
	width: 100%;
}

.h-feature__comp {
	display: grid;
	justify-items: start;
}

.h-feature .cs-piece__frame {
	background: rgba(255, 255, 255, 0.07);
}

.h-feature .cs-piece__cap,
.h-feature .cs-kind,
.h-feature .cs-status {
	color: var(--project-fg);
}

.h-feature .cs-piece__cap {
	opacity: 0.86;
}

.h-feature .cs-btn--quiet {
	background: rgba(255, 255, 255, 0.14);
	color: var(--project-fg);
}

@media (hover: hover) and (pointer: fine) {
	.h-feature .cs-btn--quiet:hover {
		background: rgba(255, 255, 255, 0.22);
	}
}

/* A skyscraper and its companion box (bannerjoy_case_feature()) share the
   composition's top line, as every composition does: their captions differ in
   length (the skyscraper's wraps), so aligning feet would misalign the frames.
   Both scale together within the column. */

/* Below 30rem, side by side would show both pieces at about half size (52%
   at 320px), too small to read the skyscraper's copy. Stacked, each is
   measured against the column alone: the 160×600 at its own size, the
   300×250 at its own size or just under. */
@media (max-width: 29.99rem) {
	.h-feature__pair {
		flex-direction: column;
	}

	.h-feature__pair .cs-piece {
		--W: var(--w);
		--G: 0px;
	}
}

/* On a phone the same message is featured in a size that fits it. */
.h-feature__art--alt {
	display: none;
}

@media (max-width: 47.99rem) {
	.h-feature__art--main.has-alt {
		display: none;
	}

	.h-feature__art--alt {
		display: block;
	}
}

/* ---- Sections ---- */

.h-context {
	margin-top: var(--h-gap);
}

.h-section-head {
	margin-bottom: clamp(1.75rem, 3vw, 2.75rem);
}

.h-section-title {
	margin: 0;
	max-width: 22ch;
	font-size: clamp(2rem, 1.3rem + 2.6vw, 3.5rem);
	font-weight: 700;
	line-height: 1;
	letter-spacing: -0.035em;
	text-wrap: balance;
}

/* A message's own text (the editor's text row above its media): under its
   heading in the collection, or under the feature title when the case has a
   single message. The section-note measure and tone, so it reads as context,
   not as a new section. */
.h-msg-note {
	max-width: 60ch;
	margin: -0.25rem 0 1.25rem;
	color: var(--cs-ink-dim);
	font-size: 1rem;
	line-height: 1.55;
	text-wrap: pretty;
}

.h-msg-note > :first-child {
	margin-top: 0;
}

.h-msg-note > :last-child {
	margin-bottom: 0;
}

.h-msg-note p + p {
	margin-top: 0.6em;
}

.h-feature__note {
	margin: 0;
	/* On the Project colour: the feature's own foreground, as the title. */
	color: var(--project-fg);
	opacity: 0.88;
}

.h-section-note {
	max-width: 56ch;
	margin: 0.9rem 0 0;
	color: var(--cs-ink-dim);
	font-size: 1.0625rem;
	line-height: 1.55;
	text-wrap: pretty;
}

/* The campaign, as A tells it. */
.h-context {
	display: grid;
	gap: 1.25rem;
}

.h-context__body p {
	max-width: 40ch;
	margin: 0;
	font-size: clamp(1.25rem, 1.05rem + 0.75vw, 1.75rem);
	line-height: 1.38;
	letter-spacing: -0.01em;
	text-wrap: pretty;
}

.h-context__body p + p {
	margin-top: 1em;
}

/* ---- Grids: every piece at its own size, scaled only to fit ----------

   A piece is its own pixels times --s (1 in the family; half in the
   collection's overview; 1 again once a filter narrows it), never wider
   than its column. Captions carry the real size and, measured by case-editorial.js,
   how large it is shown. */

.h-grid__list {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: var(--grid-gap, 2rem);
	margin: 0;
	padding: 0;
	list-style: none;
}

.h-grid__item,
.h-grid__stack {
	min-width: 0;
	max-width: 100%;
}

.h-fam .cs-piece,
.h-coll .cs-piece,
.h-camps .cs-piece {
	--pw: min(calc(var(--w) * var(--s, 1) * 1px), calc(var(--cs-hmax, 100svh) * var(--w) / var(--h)));
	max-width: 100%;
}

/* A narrow piece keeps a readable caption: the figure is at least 11rem
   wide (on a phone, just under half the screen, so two still share a line),
   the artwork inside it keeps its own width. */
.h-fam .cs-piece,
.h-coll .cs-piece,
.h-camps .cs-piece {
	width: max(var(--pw), min(11rem, 50vw - 2rem));
}

.h-fam .cs-piece__frame,
.h-coll .cs-piece__frame,
.h-camps .cs-piece__frame {
	width: min(var(--pw), 100%);
}

.h-grid__list--stack {
	flex-direction: column;
	gap: 1rem;
}

.h-group-title,
.h-coll__heading {
	margin: 0 0 1rem;
	max-width: 64ch;
	font-family: var(--font-body);
	font-size: 1.1875rem;
	font-weight: 650;
	line-height: 1.35;
	letter-spacing: 0;
	text-wrap: pretty;
}

.h-group-title .cs-count,
.h-coll__heading .cs-count {
	margin-left: 0.35rem;
	color: var(--cs-ink-dim);
	font-weight: 400;
	font-variant-numeric: tabular-nums;
}

/* The family: wide formats as one band (the mobile banners stacked beside
   the widest), then the compact and portrait formats side by side where
   the column allows. */
.h-family {
	margin-top: var(--h-gap);
	padding-block: clamp(3.5rem, 2.5rem + 4vw, 6.5rem);
	background: var(--cs-tint);
}

.h-family .cs-piece__frame {
	background: #ffffff;
}

.h-fam {
	--s: 1;
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: clamp(2.5rem, 4vw, 3.5rem) clamp(2.5rem, 5vw, 4.5rem);
}

.h-fam__group {
	min-width: 0;
	max-width: 100%;
}

.h-fam__group--wide,
.h-fam__group--media {
	flex: 1 1 100%;
}

/* Where the mobile banners cannot sit beside the widest format (a column
   narrower than about 1,320px), they follow the other wide formats, so the
   group reads widest first. */
@media (max-width: 86.99rem) {
	.h-fam .h-grid__stack {
		order: 1;
	}
}

/* ---- The whole campaign ---- */

.h-coll-section {
	margin-top: var(--h-gap);
}

.h-filters {
	display: grid;
	gap: 1.25rem;
	margin: 0 0 1.25rem;
}

.h-filters[hidden],
.h-results[hidden],
.h-empty[hidden],
.h-coll [hidden] {
	display: none;
}

.h-filters__field {
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
}

.h-filters__label {
	display: block;
	margin: 0 0 0.5rem;
	padding: 0;
	color: var(--cs-ink);
	font-size: 0.9375rem;
	font-weight: 650;
}

.h-select {
	width: 100%;
	max-width: 32rem;
	min-height: 2.75rem;
	padding: 0.55rem 2.75rem 0.55rem 0.85rem;
	border: 0;
	border-radius: 0;
	background: var(--cs-tint) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23121318' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 0.95rem center;
	color: var(--cs-ink);
	font: inherit;
	font-size: 1rem;
	line-height: 1.35;
	appearance: none;
	cursor: pointer;
	/* A long option ("Cytiva" has some) is clipped inside the box: WebKit
	   otherwise lets the chosen label run past it and widens a 320px page. */
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.h-select:focus-visible {
	outline: 3px solid var(--color-blue);
	outline-offset: 2px;
}

.h-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.h-chip {
	position: relative;
	display: inline-flex;
}

.h-chip input {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: 0;
	opacity: 0;
}

.h-chip > span {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	min-height: 2.75rem;
	padding: 0.4rem 0.85rem;
	background: var(--cs-tint);
	color: var(--cs-ink);
	font-size: 0.9375rem;
	font-variant-numeric: tabular-nums;
	cursor: pointer;
	transition: transform 160ms var(--cs-ease);
}

.h-chip .cs-count {
	color: var(--cs-ink-dim);
}

.h-chip input:checked + span {
	background: var(--cs-ink);
	color: #ffffff;
	font-weight: 650;
}

.h-chip input:checked + span .cs-count {
	color: #c9ccd4;
	font-weight: 400;
}

.h-chip input:focus-visible + span {
	outline: 3px solid var(--color-blue);
	outline-offset: 2px;
}

.h-chip input:disabled + span {
	opacity: 0.45;
	cursor: default;
}

.h-chip:active input:not(:disabled) + span {
	transform: scale(0.97);
}

@media (hover: hover) and (pointer: fine) {
	.h-chip:hover input:not(:checked):not(:disabled) + span,
	.h-select:hover {
		background-color: #dfe2e8;
	}
}

.h-results {
	margin: 0 0 clamp(1.75rem, 3vw, 2.5rem);
	color: var(--cs-ink-dim);
	font-size: 0.9375rem;
	font-variant-numeric: tabular-nums;
}

.h-empty {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem 1rem;
	margin: 0;
}

/* Overview: grouped by message, at half size. */
.h-coll {
	--s: 0.5;
	--grid-gap: 1.25rem;
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: clamp(2.5rem, 4vw, 3.5rem);
}

.h-coll .cs-cap-msg {
	display: none;
}

/* A filter shows what is left at its own size, where it fits. */
.h-coll.is-filtered {
	--s: 1;
	--grid-gap: 2rem;
}

/* Within a message: the wide formats, then compact and portrait on a row. */
.h-coll__rows {
	display: flex;
	flex-direction: column;
	gap: var(--grid-gap);
}

.h-coll__featured {
	color: var(--cs-ink-dim);
}

/* Where the mobile banners cannot sit beside the widest format, they follow
   the other wide formats (as in the family). */
@media (max-width: 47.99rem) {
	.h-coll .h-grid__stack {
		order: 1;
	}
}

@media (max-width: 86.99rem) {
	.h-coll.is-filtered .h-grid__stack {
		order: 1;
	}
}

/* One size across the messages: one grid, each piece captioned with its
   message (the group headings would each head a single piece). */
.h-coll.is-by-size {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 2rem;
}

.h-coll.is-by-size .h-coll__group,
.h-coll.is-by-size .h-coll__rows,
.h-coll.is-by-size .h-grid__list,
.h-coll.is-by-size .h-grid__stack {
	display: contents;
}

.h-coll.is-by-size .h-coll__heading {
	display: none;
}

.h-coll.is-by-size .cs-cap-msg {
	display: block;
	width: 100%;
	font-size: 1rem;
	text-wrap: pretty;
}

/* ---- Close: the previous and next case studies, an enquiry, all work ---- */

.h-close {
	display: grid;
	gap: clamp(2.5rem, 4vw, 4rem);
	margin-top: var(--h-gap);
	padding-block: clamp(3rem, 5vw, 5rem) var(--h-gap);
}

.h-close__next {
	display: grid;
	gap: 1.25rem;
	color: var(--cs-ink);
}

.h-close__next-text {
	display: grid;
	gap: 0.5rem;
}

.h-close__next-title {
	font-family: var(--font-display);
	font-size: clamp(2rem, 1.3rem + 2.6vw, 3.5rem);
	font-weight: 700;
	line-height: 1;
	letter-spacing: -0.035em;
}

.h-close__next-desc {
	max-width: 46ch;
	color: var(--cs-ink-dim);
	font-size: 1rem;
	line-height: 1.5;
}

.h-close__enquiry {
	display: grid;
	align-content: start;
	gap: 0.75rem;
}

.h-close__enquiry-link {
	justify-self: start;
	font-family: var(--font-display);
	font-size: clamp(1.5rem, 1.15rem + 1.3vw, 2.25rem);
	font-weight: 700;
	letter-spacing: -0.03em;
	color: var(--color-blue);
	border-bottom: 3px solid currentColor;
}

.h-close__all {
	justify-self: start;
	display: inline-flex;
	align-items: center;
	min-height: 2.75rem;
	margin-top: 1rem;
	font-size: 0.9375rem;
}

.h-close__next:focus-visible,
.h-close__enquiry-link:focus-visible,
.h-close__all:focus-visible {
	outline: 3px solid var(--color-blue);
	outline-offset: 4px;
}

@media (hover: hover) and (pointer: fine) {
	.h-close__next:hover .h-close__next-title,
	.h-close__all:hover {
		color: var(--color-blue);
	}

	.h-close__enquiry-link:hover {
		border-bottom-color: transparent;
	}
}

/* Previous and next: the next case study keeps its cover and leads; the
   previous one is a line beneath it. Both say what they are in words. */
.h-close__nav {
	display: grid;
	gap: clamp(1.75rem, 3vw, 2.5rem);
	min-width: 0;
}

.h-close__label {
	font-family: var(--font-mono);
	font-size: 0.8125rem;
	line-height: 1.3;
	letter-spacing: 0;
	color: var(--cs-ink-dim);
}

.h-close__prev {
	display: grid;
	gap: 0.35rem;
	padding-top: 1.25rem;
	border-top: 1px solid var(--color-line, rgba(18, 19, 24, 0.14));
	color: var(--cs-ink);
}

.h-close__prev-title {
	max-width: 32ch;
	font-family: var(--font-display);
	font-size: clamp(1.25rem, 1.05rem + 0.8vw, 1.625rem);
	font-weight: 700;
	line-height: 1.12;
	letter-spacing: -0.025em;
	text-wrap: balance;
}

.h-close__prev:focus-visible {
	outline: 3px solid var(--color-blue);
	outline-offset: 4px;
}

@media (hover: hover) and (pointer: fine) {
	.h-close__prev:hover .h-close__prev-title {
		color: var(--color-blue);
	}
}

@media (min-width: 64rem) {
	.h-close {
		grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
		align-items: start;
		column-gap: clamp(2rem, 5vw, 6rem);
	}

	.h-close__next {
		grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
		align-items: center;
		gap: 2rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.h-chip > span {
		transition: none;
	}
}

/* ---- In the theme ---------------------------------------------------------- */

/* A film plays in its own frame, at the poster's box, with its own controls
   once Play is pressed (assets/js/case-editorial.js). */
.cs-piece__frame video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	background: #000000;
	opacity: 0;
}

.cs-piece__frame.is-live video {
	opacity: 1;
}

/* The site's demo note, for a Project of demo creative. */
.h-mast__note {
	margin: 0;
	color: var(--color-blue-soft);
	font-size: 0.875rem;
}

@media (min-width: 64rem) {
	.h-mast__note {
		grid-column: 1 / -1;
	}
}

/* Any other Project Content rows, after the work. */
.h-body {
	margin-top: var(--h-gap);
}

/* ---- The format explorer (Project Details → Collection display) ----------
   For a large body of work: each campaign's messages as one representative
   example each, at their own size (each opens every size of its message in
   the viewer), then the explorer, which starts on the first campaign. */

.h-camps {
	--s: 1;
	--grid-gap: 2rem;
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: clamp(2.5rem, 4vw, 3.5rem);
}

.h-camps .cs-cap-msg {
	display: block;
	width: 100%;
	font-size: 1rem;
	text-wrap: pretty;
}

.cs-cap-note {
	flex-basis: 100%;
	color: var(--cs-ink-dim);
	font-size: 0.8125rem;
}

.h-explore-title {
	margin: clamp(3.5rem, 6vw, 5rem) 0 1.25rem;
	font-family: var(--font-display);
	font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem);
	font-weight: 700;
	line-height: 1.1;
	letter-spacing: -0.03em;
}

/* Later campaigns wait for the explorer; without script all of them show. */
html:not(.no-js) .h-coll .is-later {
	display: none;
}
