/* ==========================================================================
   Home — split layout
   Two columns (1:2) that scroll independently on wide viewports and
   collapse into a single, normally scrolling page on narrow ones.
   ========================================================================== */

/* Tokens
   ========================================================================== */

:root {
	--font-sans: "Host Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

	--color-bg: #ffffff;
	--color-text: #454545;
	--color-accent: #8b8f5e;
	/* Darker accent for small text and the selected toggle:
	   5.3:1 on white, 4.6:1 on --color-surface (WCAG AA) */
	--color-accent-text: #6b6f46;
	--color-surface: #f1f1e9;
	--color-border: #dedede;
	/* Captions and the copyright line: lighter than body text,
	   5.1:1 on white (WCAG AA) */
	--color-caption: #6e6e6e;
	--color-link-line: #a1a1a1;
	--color-focus: var(--color-accent);
	--color-scrollbar: hsl(0 0% 0% / 0.15);

	--gutter: clamp(1.5rem, 3.33vw, 4rem);
	/* Room for the section nav between the columns: 128px at 1920 */
	--column-gap: calc(var(--gutter) * 2);
	/* Share of the content width given to the intro column (1:2 with the story column) */
	--split-intro: calc(1 / 3);

	--text-body: clamp(1.0625rem, 0.95rem + 0.3vw, 1.25rem);
	--text-eyebrow: 0.8125rem;
	--text-small: 0.875rem;
	--text-stat-value: clamp(3rem, 2rem + 2vw, 4rem);

	--space-section: clamp(2.5rem, 1.5rem + 2vw, 4.25rem);
	--space-item: clamp(2.5rem, 1.5rem + 2vw, 4.25rem);
	/* Bottom margin matches the top margin */
	--space-bottom: var(--gutter);
	/* Where the intro headline starts (top padding + name line + section
	   space); the right column's content starts level with it */
	--name-size: 1.5rem;
	--content-top: calc(var(--gutter) + var(--name-size) * 1.4 + var(--space-section));
	--card-pad: 1.5rem;
	/* Text under a headline band is indented to line up with the inside
	   of the intro column's cards */
	--inner-pad: 1rem;
	--tile-gap: 0.625rem;
	--radius: 0.25rem;
}

/* Base
   ========================================================================== */

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
	/* No elastic bounce, and scrolling never chains past an end */
	overscroll-behavior: none;
}

body {
	margin: 0;
	overscroll-behavior: none;
	background: var(--color-bg);
	color: var(--color-text);
	font-family: var(--font-sans);
	font-size: var(--text-body);
	font-weight: 400;
	line-height: 1.4;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
p,
ol,
ul,
dl,
dd {
	margin: 0;
}

ol,
ul {
	padding: 0;
	list-style: none;
}

a {
	color: inherit;
	text-decoration: underline;
	text-decoration-color: var(--color-link-line);
	text-decoration-thickness: 1px;
	text-underline-offset: 0.18em;
	transition: text-decoration-color 150ms ease;
}

a:hover {
	text-decoration-color: currentColor;
}

:focus-visible {
	outline: 2px solid var(--color-focus);
	outline-offset: 3px;
	border-radius: 2px;
}

.visually-hidden {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

.skip-link {
	position: absolute;
	top: 0.75rem;
	left: 0.75rem;
	z-index: 10;
	padding: 0.5rem 0.875rem;
	background: var(--color-text);
	color: var(--color-bg);
	font-size: var(--text-small);
	text-decoration: none;
	transform: translateY(-200%);
}

.skip-link:focus {
	transform: none;
}

.eyebrow {
	margin-bottom: 1rem;
	color: var(--color-accent-text);
	font-size: var(--text-eyebrow);
	font-weight: 500;
	line-height: 1.3;
	letter-spacing: 0.02em;
	text-transform: uppercase;
}

.card {
	padding: var(--card-pad);
	border-radius: var(--radius);
	background: var(--color-surface);
}

/* Layout
   ========================================================================== */

.split__pane {
	padding: var(--gutter);
}

/* Scroll containers are focusable for keyboard scrolling; the outline
   would otherwise frame the whole column on click. */
.split__pane:focus:not(:focus-visible) {
	outline: none;
}

.split__pane:focus-visible {
	outline-offset: -4px;
}

@media (min-width: 64em) and (min-height: 40em) {
	html,
	body {
		height: 100%;
		overflow: hidden;
	}

	/* Side margins are twice the top margin (--gutter) at every width, so
	   the columns widen with the viewport and keep the --split-intro ratio.
	   The panes span the full viewport so the margins scroll too. */
	.split {
		--inset: calc(var(--gutter) * 2);
		/* Width of the intro column, i.e. where the two columns meet: the gap
		   is taken out first so the two columns' content keeps the ratio */
		--intro-col: calc(var(--inset) + (100vw - 2 * var(--inset) - var(--column-gap)) * var(--split-intro) + var(--column-gap) / 2);

		display: grid;
		grid-template-columns: var(--intro-col) 1fr;
		grid-template-rows: minmax(0, 1fr) auto;
		height: 100vh;
		height: 100dvh;
	}

	.split__pane {
		min-height: 0;
		overflow-y: auto;
		overscroll-behavior: none;
		scrollbar-width: thin;
		scrollbar-color: var(--color-scrollbar) transparent;
	}

	.split__pane--intro {
		grid-area: 1 / 1;
		padding-right: calc(var(--column-gap) / 2);
		padding-left: var(--inset);
	}

	.split__pane--content {
		grid-area: 1 / 2 / 3 / 3;
		padding-top: var(--content-top);
		padding-right: var(--inset);
		padding-bottom: var(--space-bottom);
		padding-left: calc(var(--column-gap) / 2);
	}
}

/* Intro
   ========================================================================== */

.intro {
	container: intro / inline-size;
}

.intro__name {
	font-size: var(--name-size);
	line-height: 1.4;
	font-weight: 500;
	letter-spacing: -0.01em;
}

.intro__name a {
	text-decoration: none;
}

.intro__headline {
	margin-top: var(--space-section);
	font-size: clamp(2.25rem, 1.4rem + 2.6vw, 3.75rem);
	font-weight: 600;
	line-height: 1.4;
	letter-spacing: -0.03em;
	text-wrap: balance;
}

/* Headline band: each line sits on its own accent band, with a hairline
   of page background between lines. Host Grotesk's text box is ~1.33em
   tall; the block padding makes each band 1.36em of the 1.4 line
   height, leaving a ~0.04em (2px at 48px) gap. White on the accent is
   3.4:1, which passes AA for text this large and bold. */
.band {
	padding: 0.015em 0.17em;
	background: var(--color-accent);
	color: var(--color-bg);
	-webkit-box-decoration-break: clone;
	box-decoration-break: clone;
}

@media (forced-colors: active) {
	.band {
		background: none;
		color: CanvasText;
	}
}

/* Scale to the column so the longest line ("the experts who rely on
   them.", ~13em plus its band padding) always fits. Where it does, keep
   the designed line breaks (.band__line) with one band per line, sized
   to its text; narrower, the single band wraps freely. */
@supports (font-size: 1cqi) {
	.intro__headline {
		font-size: clamp(2rem, 7cqi, 3.75rem);
	}

	@container intro (min-width: 26rem) {
		.intro__headline .band:has(.band__line) {
			display: contents;
		}

		/* Same 1.4 pitch and hairline gap as the wrapping band */
		.intro__headline .band__line {
			display: block;
			width: fit-content;
			padding: 0 0.17em;
			background: var(--color-accent);
			line-height: 1.36;
		}

		.intro__headline .band__line + .band__line {
			margin-top: 0.04em;
		}
	}
}

@media (forced-colors: active) {
	.band__line {
		background: none !important;
	}
}

.intro__summary {
	margin-top: var(--space-section);
	padding-inline: var(--inner-pad);
}

.intro__summary p + p {
	margin-top: 1.4em;
}

/* Stats: three tiles share the row, sized to their labels, and shrink
   (labels wrap) as the column narrows */
.stats {
	display: flex;
	gap: var(--tile-gap);
	margin-top: var(--space-section);
}

.stats__item {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 0.625rem;
	min-width: 0;
	padding: 1.25rem clamp(1rem, 2.5cqi, var(--card-pad));
	border-radius: var(--radius);
	background: var(--color-surface);
}

.stats__value {
	color: var(--color-accent);
	font-size: var(--text-stat-value);
	font-weight: 500;
	line-height: 0.9;
	letter-spacing: -0.02em;
	font-variant-numeric: lining-nums tabular-nums;
}

.stats__label {
	max-width: 10.5em;
	line-height: 1.35;
}

/* Wide enough for the designed two-line labels: tiles size to them */
@container intro (min-width: 42rem) {
	/* Flex drops the space between the spans, which would otherwise
	   render as an empty line */
	.stats__label {
		display: flex;
		flex-direction: column;
		max-width: none;
		white-space: nowrap;
	}
}

/* Narrow column (labels would wrap to 4 lines): one tile per row,
   number beside label */
@container intro (max-width: 37rem) {
	.stats {
		flex-direction: column;
	}

	.stats__item {
		flex-direction: row;
		align-items: center;
		gap: 1rem;
	}

	.stats__value {
		min-width: 1.4em;
	}
}

/* Home, wide layout: the intro fills its column's height. The name and
   headline stay put (the headline lines up with the right column); any
   spare height is shared between the gaps above the summary and above
   the stats, which never shrink below --space-section. */
@media (min-width: 64em) and (min-height: 40em) {
	.split--home .intro {
		display: flex;
		flex-direction: column;
		min-height: 100%;
	}

	.split--home .intro__headline {
		margin-bottom: var(--space-section);
	}

	.split--home .intro__summary {
		margin-top: auto;
		margin-bottom: var(--space-section);
	}

	.split--home .stats {
		margin-top: auto;
	}

	/* The sketch takes whatever height is left under the stats, so the
	   column fits one screen; it keeps its proportions (the width follows
	   the height), sits at the column's left edge, and never drops below
	   6rem tall. Stacked (phones and tablets) it is centred. */
	.split--home .intro__sketch {
		flex: 1 1 0;
		min-height: 6rem;
		margin-top: clamp(1.5rem, 3dvh, var(--space-section));
		container-type: size;
	}

	.split--home .intro__sketch img {
		width: min(100cqw, 100cqh * 1672 / 941);
		margin-inline: 0 auto;
	}
}

/* Sketch under the stats: its edges fade into the page on all four
   sides (two linear masks, intersected) */
.intro__sketch {
	margin: var(--space-section) 0 0;
}

.intro__sketch img {
	display: block;
	width: 100%;
	max-width: 44rem;
	height: auto;
	margin-inline: auto;
	-webkit-mask-image:
		linear-gradient(to right, transparent, #000 14%, #000 86%, transparent),
		linear-gradient(to bottom, transparent, #000 16%, #000 80%, transparent);
	-webkit-mask-composite: source-in;
	mask-image:
		linear-gradient(to right, transparent, #000 14%, #000 86%, transparent),
		linear-gradient(to bottom, transparent, #000 16%, #000 80%, transparent);
	mask-composite: intersect;
}

/* Writing */

.writing {
	margin-top: var(--space-section);
	padding-inline: var(--inner-pad);
}

.writing .eyebrow {
	margin-bottom: 0.75rem;
}

.writing__list li + li {
	margin-top: 0.5rem;
}

/* Experience
   ========================================================================== */

.timeline__item + .timeline__item {
	margin-top: var(--space-item);
}

.eyebrow--sub {
	margin-top: 1rem;
	margin-bottom: 0.75rem;
}

/* One link per row on phones; from there, rows of three equal columns,
   so a role with two highlights lines up with the first two of three */
.highlights {
	display: grid;
	gap: 1rem;
}

@media (min-width: 40em) {
	.highlights {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: 1rem clamp(2rem, 3vw, 3.5rem);
	}
}

/* The card bleeds into the gutter so its text lines up with the list */
.timeline + .card {
	margin-top: calc(var(--space-item) - var(--card-pad));
}

@media (min-width: 64em) and (min-height: 40em) {
	.card {
		margin-inline: calc(-1 * var(--card-pad));
	}
}

/* The left column's bottom fade (see "Left column on laptop screens") */
@property --intro-fade {
	syntax: '<length>';
	inherits: false;
	initial-value: 0px;
}

@keyframes intro-fade {
	0%,
	96% {
		--intro-fade: 32px;
	}

	100% {
		--intro-fade: 0px;
	}
}

/* Left column on laptop screens
   The split layout's vertical spacing follows the window height, so the
   title and brief fit beside the story column; the text keeps its normal
   size (the same body size as the story column). Values match the old
   fixed ones on tall screens. The right column starts level with the
   title, so it moves up with it, which keeps each opener on the first
   screen. When the brief still doesn't fit, the column scrolls inside
   itself (below) rather than shrinking the text.
   ========================================================================== */
@media (min-width: 64em) and (min-height: 40em) {
	:root {
		--space-section: clamp(0.75rem, 5.2vh - 1.6rem, 4.25rem);
		--gutter-block: clamp(1rem, 4vh - 0.75rem, var(--gutter));
		--name-size: clamp(1.125rem, 0.5rem + 1.2vh, 1.5rem);
		--content-top: calc(var(--gutter-block) + var(--name-size) * 1.4 + var(--space-section));
	}

	/* Last resort when the brief is taller than the column: it scrolls
	   inside itself, held in place. The scrollbar is thin and shows on
	   hover or focus; a 32px fade at the bottom shows there is more while
	   there is (see intro-fade below). The footer under this column brings
	   its own space, so the column needs none at the bottom. */
	.split__pane--intro {
		padding-top: var(--gutter-block);
		padding-bottom: 0;
		overscroll-behavior: contain;
		scrollbar-color: transparent transparent;
		-webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - var(--intro-fade)), transparent);
		mask-image: linear-gradient(to bottom, #000 calc(100% - var(--intro-fade)), transparent);
	}

	/* The fade follows the column's own scroll position (CSS only, no
	   script): 32px while more is below, gone at the end. A column that
	   doesn't scroll has no fade, and nor do browsers without
	   scroll-driven animations. */
	@supports (animation-timeline: scroll()) {
		.split__pane--intro {
			animation: intro-fade linear both;
			animation-timeline: scroll(self);
		}
	}

	.split__pane--intro:hover,
	.split__pane--intro:focus-visible {
		scrollbar-color: var(--color-scrollbar) transparent;
	}

	.split__pane--intro::-webkit-scrollbar {
		width: 6px;
	}

	.split__pane--intro::-webkit-scrollbar-thumb {
		border-radius: 3px;
		background: transparent;
	}

	.split__pane--intro:hover::-webkit-scrollbar-thumb,
	.split__pane--intro:focus-visible::-webkit-scrollbar-thumb {
		background: var(--color-scrollbar);
	}

	.site-footer {
		padding-top: clamp(0.5rem, 2vh - 0.25rem, 1.5rem);
		padding-bottom: var(--gutter-block);
	}

	/* The empty space held for the home sketch gives way first */
	.split--home .intro__sketch {
		min-height: clamp(0rem, 20vh - 12rem, 6rem);
	}
}

/* Footer
   ========================================================================== */

.site-footer {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 1rem 1.5rem;
	padding: var(--gutter) var(--gutter) var(--space-bottom);
}

.site-footer__links {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1.5rem;
}

.site-footer__legal {
	color: var(--color-caption);
	font-size: var(--text-small);
}

.site-footer__legal small {
	font-size: inherit;
}

/* Wide layout: pinned under the intro column, sharing its edges */
@media (min-width: 64em) and (min-height: 40em) {
	/* Both reserve the same scrollbar gutter so their right edges match
	   whether or not the intro column is scrolling */
	.split__pane--intro,
	.site-footer {
		scrollbar-gutter: stable;
	}

	.site-footer {
		grid-area: 2 / 1;
		overflow-y: hidden;
		scrollbar-width: thin;
		padding: 1.5rem calc(var(--column-gap) / 2) var(--space-bottom) var(--inset);
	}
}

/* Narrow layout: separate the stacked columns */
@media (max-width: 63.9375em), (max-height: 39.9375em) {
	.split__pane--content {
		padding-top: var(--space-item);
		padding-bottom: 0;
	}
}

/* Print: let both columns flow onto the page
   ========================================================================== */

@media print {
	html,
	body {
		height: auto;
		overflow: visible;
	}

	.split {
		display: block;
		height: auto;
	}

	.split__pane {
		overflow: visible;
	}

	.skip-link {
		display: none;
	}
}
