/* Case-study page — a sequence of flexible-content "moments" following
   a rich, media-first hero. Everything here is driven by ACF field
   values; nothing is specific to any one project. */

.project-hero {
	position: relative;
	min-height: 94dvh;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	background: var(--project-bg, #111);
	color: var(--project-fg, var(--color-fg));
	overflow: hidden;
}

.project-hero__media {
	position: absolute;
	inset: 0;
	z-index: 0;
}

.project-hero__media img,
.project-hero__media video {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.project-hero__scrim {
	position: absolute;
	inset: 0;
	z-index: 1;
	/* The top stop exists specifically so the fixed header (logo, menu)
	   stays legible over whatever hero media sits beneath it — some
	   source video/imagery has its own brighter content up there (a
	   baked-in eyebrow label, say), so this needs real coverage rather
	   than a token one. */
	background: linear-gradient(
		to top,
		color-mix(in srgb, var(--project-bg, #111) 82%, transparent) 0%,
		color-mix(in srgb, var(--project-bg, #111) 35%, transparent) 45%,
		color-mix(in srgb, var(--project-bg, #111) 35%, transparent) 80%,
		color-mix(in srgb, var(--project-bg, #111) 96%, transparent) 100%
	);
}

.project-hero__top {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	z-index: 2;
	/* Clears the fixed site header (logo + menu toggle), which sits on
	   top of every page regardless of scroll position. */
	padding-top: clamp(6rem, 4.5rem + 4vw, 7.5rem);
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.project-hero__back {
	font-size: var(--size-label);
	font-weight: 700;
	letter-spacing: 0;
	opacity: 0.8;
	transition: opacity var(--duration-fast) var(--ease-out);
}

.project-hero__back:hover,
.project-hero__back:focus-visible {
	opacity: 1;
}

.project-hero__eyebrow {
	font-size: var(--size-label);
	font-weight: 700;
	letter-spacing: 0;
	text-transform: none; /* Direction C: no capitals */
	/* Secondary, but still normal-size body text over a project's own colour
	   and hero media. 0.55 fell below WCAG AA on the lighter project colours
	   (Sky, and Google's eyebrow); 0.72 is the shared value that clears 4.5:1
	   on every current project with margin, while staying clearly below the
	   title and the primary meta. Matches .project-hero__demo-note. */
	opacity: 0.72;
}

.project-hero__content {
	position: relative;
	z-index: 2;
	padding-block: 0 var(--space-xl);
}

.project-hero__title {
	font-size: var(--size-hero);
	max-width: 14ch;
}

.project-hero__meta {
	display: flex;
	gap: var(--space-md);
	margin-top: var(--space-md);
	font-size: var(--size-small);
	text-transform: none; /* Direction C: no capitals */
	letter-spacing: 0;
	opacity: 0.7;
}

.project-hero__desc {
	max-width: 46ch;
	font-size: var(--size-body-lg);
	margin-top: var(--space-sm);
	opacity: 0.86;
}

.project-hero__scroll-cue {
	position: relative;
	z-index: 2;
	align-self: flex-start;
	margin: var(--space-md) var(--gutter) 0;
	padding-bottom: var(--space-md);
	display: flex;
	align-items: center;
	gap: var(--space-2xs);
	font-size: var(--size-label);
	letter-spacing: 0;
	text-transform: none; /* Direction C: no capitals */
	opacity: 0.6;
}

.project-hero__scroll-cue-line {
	width: 1px;
	height: 32px;
	background: linear-gradient(currentColor, transparent);
	position: relative;
	overflow: hidden;
}

.project-hero__scroll-cue-line::after {
	content: "";
	position: absolute;
	top: -100%;
	left: 0;
	width: 100%;
	height: 100%;
	background: currentColor;
	animation: hero-scroll-cue 2.2s var(--ease-out) infinite;
}

@keyframes hero-scroll-cue {
	0% { top: -100%; }
	60%, 100% { top: 100%; }
}

@media (prefers-reduced-motion: reduce) {
	.project-hero__scroll-cue-line::after {
		animation: none;
		top: 0;
	}
}

@media (max-width: 640px) {
	.project-hero {
		min-height: 86dvh;
	}

	.project-hero__meta {
		flex-wrap: wrap;
		gap: var(--space-sm);
	}
}

.project-body > * + * {
	border-top: 1px solid var(--color-line);
}

.flex-block {
	padding-block: var(--space-xl);
	/* Editorial frame — same geometry as .container, applied without wrapper
	   markup so a block's own background/media can still run edge to edge.
	   Previously this was `var(--gutter)` alone: correct at 1440, but with no
	   content ceiling the blocks kept widening while .project-hero__top and
	   .project-hero__content (which do use .container) stopped at 1440 — a
	   560px left-edge split within one case study at 2560.
	   `.flex-block--full-bleed` still overrides this with `padding: 0`. */
	padding-inline: max(
		var(--gutter),
		(100% - (var(--content-max) - 2 * var(--gutter))) / 2
	);
}

.flex-block__heading {
	font-size: var(--size-h2);
	font-weight: 800;
	margin-bottom: var(--space-sm);
	max-width: 20ch;
}

.flex-block__body {
	max-width: 68ch;
	font-size: var(--size-body-lg);
	color: var(--color-fg-dim);
}

/* A single standalone HTML5 format (iframe_banner) sits far smaller than
   its section — inheriting the same block padding as text-heavy sections
   either side of it stacks up to a lot of empty space around one format.
   Desktop-only: mobile's more isolated, spacious presentation of a lone
   format is intentional and stays untouched. */
@media (min-width: 900px) {
	.flex-block--iframe {
		padding-block: calc(var(--space-xl) * 0.82);
	}
}

.flex-block--image img,
.flex-block--image video {
	width: 100%;
	height: auto;
}

.flex-block--image figcaption {
	margin-top: var(--space-xs);
	font-size: var(--size-small);
	color: var(--color-fg-dim);
}

.flex-block--full-bleed {
	padding: 0;
}

/* background_video's overlay text has no guaranteed-dark ground behind
   it — a looping video can bring a bright frame directly behind the
   text at any moment, and a flat white h2 has no protection against
   that. A soft centred vignette (not a hard box, to stay in keeping
   with the rest of the site's chrome-free full-bleed treatments) keeps
   the text readable regardless of what the video is doing underneath. */
.bg-video-scrim {
	/* The two stops are custom properties so Project Content's Background Video
	   can offer Light / Medium / Strong without a second gradient or an opacity
	   field. Bare, they are the values this scrim has always had, so the legacy
	   component renders exactly as before. */
	--scrim-core: 0.55;
	--scrim-mid: 0.15;
	position: absolute;
	inset: 0;
	z-index: 1;
	background: radial-gradient(
		60% 50% at 50% 50%,
		rgba(0, 0, 0, var(--scrim-core)) 0%,
		rgba(0, 0, 0, var(--scrim-mid)) 70%,
		transparent 100%
	);
}

.bg-video-scrim--light {
	--scrim-core: 0.35;
	--scrim-mid: 0.06;
}

.bg-video-scrim--strong {
	--scrim-core: 0.78;
	--scrim-mid: 0.38;
}

.flex-block--full-bleed video,
.flex-block--full-bleed img {
	width: 100%;
	height: 100vh;
	object-fit: cover;
}

/* A cinematic 100vh crop on a landscape (typically ~16:9) source needs a
   wide, short viewport to read well — on a narrow/tall mobile viewport
   the same crop keeps only a sliver of the source's width, routinely
   losing off-center subjects or copy entirely. Below the mobile
   breakpoint the moment stays full-bleed but at a gentler, more
   landscape-shaped height so meaningfully more of the frame survives. */
@media (max-width: 640px) {
	.flex-block--full-bleed video,
	.flex-block--full-bleed img {
		height: 62vh;
	}
}

.flex-block__grid {
	display: grid;
	gap: var(--space-md);
}

.flex-block__grid--2 {
	grid-template-columns: repeat(2, 1fr);
}

.flex-block__grid--3 {
	grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 780px) {
	.flex-block__grid--2,
	.flex-block__grid--3 {
		grid-template-columns: 1fr;
	}
}

.flex-block__grid img {
	width: 100%;
	height: auto;
}

.flex-block--split {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--space-lg);
	align-items: center;
}

/* Unlike every other flex-block image context, split_media never forced
   its image to fill the column — harmless with a source wider than the
   column (it just shrinks to fit either way), but a source narrower
   than the column renders at native size with dead space beside it
   instead of filling the half it was given. */
.flex-block--split img {
	width: 100%;
	height: auto;
}

.flex-block--split.is-reversed {
	direction: rtl;
}

.flex-block--split.is-reversed > * {
	direction: ltr;
}

@media (max-width: 780px) {
	.flex-block--split {
		grid-template-columns: 1fr;
	}
}

.flex-block--quote {
	text-align: center;
}

.flex-block__quote-text {
	font-size: var(--size-h2);
	font-weight: 600;
	max-width: 32ch;
	margin-inline: auto;
	font-style: normal;
	line-height: 1.25;
}

.flex-block__quote-attribution {
	margin-top: var(--space-sm);
	font-size: var(--size-small);
	color: var(--color-fg-dim);
	text-transform: none; /* Direction C: no capitals */
	letter-spacing: 0;
}

.flex-block__stats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
	gap: var(--space-lg);
}

.flex-block__stat-value {
	font-size: var(--size-hero);
	font-weight: 800;
	line-height: 1;
}

.flex-block__stat-label {
	margin-top: var(--space-xs);
	color: var(--color-fg-dim);
	font-size: var(--size-small);
	text-transform: none; /* Direction C: no capitals */
	letter-spacing: 0;
}

.flex-block--iframe-grid .ad-grid {
	margin-top: var(--space-lg);
	align-items: flex-end;
	justify-content: flex-start;
	gap: var(--space-lg) var(--space-md);
}

/* The format wall shows every creative at its true size. (It used to enlarge
   them 1.18× on wide screens; a creative is never shown past its own
   pixels, so the wall keeps .ad-frame's native width at every size.) */

/* Real ad dimensions already vary a great deal by nature (a 728x90 vs
   a 160x600 read completely differently at true size) — this just adds
   a gentle vertical stagger so the row reads as placed rather than
   gridded, without touching each item's own real proportions. */
@media (min-width: 780px) {
	.flex-block--iframe-grid .ad-grid > *:nth-child(3n+2) {
		margin-bottom: var(--space-xl);
	}

	.flex-block--iframe-grid .ad-grid > *:nth-child(3n+3) {
		margin-top: var(--space-lg);
	}
}

/* ---- Next project ---- */
.next-project {
	position: relative;
	min-height: 60dvh;
	display: flex;
	align-items: center;
	justify-content: center;
	text-align: center;
	background: var(--project-bg, #0a0a0a);
	color: var(--project-fg, var(--color-fg));
	overflow: hidden;
}

.next-project__eyebrow {
	font-size: var(--size-label);
	letter-spacing: 0;
	text-transform: none; /* Direction C: no capitals */
	opacity: 0.7;
	margin-bottom: var(--space-sm);
}

.next-project__title {
	font-size: var(--size-hero);
	font-weight: 800;
}
