/* ==========================================================================
   Résumé: one layout for the web page and the PDF (npm run cv)
   Loaded on resume.html only. Everything is scoped to .cv so site.css is untouched.
   ========================================================================== */

/* Tokens. Change the look here; the rules below use only these. */
.cv {
	--ink: #1b2533;          /* body text, deep navy rather than black */
	--ink-soft: #4a5566;     /* secondary text: dates, places */
	--accent: #2c5a85;       /* links */
	--rule: #d5dce5;         /* column divider */
	--paper: #ffffff;
	--desk: var(--color-page); /* screen background around the sheet: the site's page colour */

	--serif: "Literata", Georgia, "Times New Roman", serif;
	--sans: "Public Sans", "Helvetica Neue", Arial, sans-serif;

	--size-name: 26pt;
	--size-lede: 13pt;
	--size-h2: 11pt;
	--size-role: 10.5pt;
	--size-body: 9.25pt;
	--size-small: 8.25pt;

	--sidebar: 50mm;
	--gutter: 9mm;
}

/* Dark theme, matching site.css: system setting unless data-theme is set. Screen only, so the PDF stays light.
   The two blocks hold the same values: keep them in step. */
@media screen and (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .cv {
		--ink: #ebe5d9;
		--ink-soft: #a5a69c;
		--accent: #8fb9df;
		--rule: #3a413c;
		--paper: var(--color-surface);
	}
}

@media screen {
	:root[data-theme="dark"] .cv {
		--ink: #ebe5d9;
		--ink-soft: #a5a69c;
		--accent: #8fb9df;
		--rule: #3a413c;
		--paper: var(--color-surface);
	}
}

/* Base */
.cv {
	padding: 24px 12px;
	background: var(--desk);
	color: var(--ink);
	font: var(--size-body)/1.5 var(--sans);
}

.cv *,
.cv *::before,
.cv *::after {
	box-sizing: border-box;
}

.cv a {
	color: var(--accent);
	text-decoration: underline;
	text-decoration-thickness: 0.06em;
	text-underline-offset: 0.18em;
}

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

.cv a:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
	border-radius: 1px;
}

.cv p,
.cv ul {
	margin: 0;
}

.cv ul {
	padding: 0;
	list-style: none;
}

.print-only {
	display: none;
}

/* The sheet: A4 proportions on screen, real A4 in print */
.cv .sheet {
	max-width: 210mm;
	margin: 0 auto;
	padding: 16mm 18mm;
	background: var(--paper);
	box-shadow: 0 1px 3px rgb(20 30 45 / 0.12);
}

/* Masthead: the one bold moment, set in serif */
.cv .masthead {
	max-width: 140mm;
	margin-bottom: 9mm;
}

.cv .masthead h1 {
	margin: 0 0 3mm;
	color: var(--ink);
	font: 600 var(--size-name)/1.1 var(--serif);
	letter-spacing: -0.01em;
}

.cv .lede {
	font: 400 var(--size-lede)/1.4 var(--serif);
}

/* Download link: top right of the sheet, centred on the heading's line */
.cv .sheet {
	position: relative;
}

.cv .cv-download {
	position: absolute;
	top: calc(16mm + 7pt);
	right: 18mm;
	font-weight: 600;
}

.cv .cv-download a {
	display: inline-flex;
	align-items: center;
	gap: 0.4em;
}

/* Two columns. Experience comes first in the source; grid puts the sidebar on the left. */
.cv .layout {
	display: grid;
	grid-template-columns: var(--sidebar) minmax(0, 1fr);
	column-gap: var(--gutter);
}

.cv .experience {
	grid-column: 2;
	grid-row: 1;
}

.cv .sidebar {
	grid-column: 1;
	grid-row: 1;
	padding-right: var(--gutter);
	border-right: 1px solid var(--rule);
	font-size: var(--size-small);
}

.cv .sidebar section + section {
	margin-top: 7mm;
}

.cv .sidebar li + li {
	margin-top: 1.2mm;
}

.cv h2 {
	margin: 0 0 2.5mm;
	color: var(--ink);
	font: 600 var(--size-h2)/1.3 var(--serif);
}

/* Experience */
.cv .role + .role {
	margin-top: 6mm;
}

.cv .role h3 {
	margin: 0;
	color: var(--ink);
	font: 600 var(--size-role)/1.35 var(--sans);
	break-after: avoid;
}

.cv .meta {
	margin: 0.5mm 0 2mm;
	color: var(--ink-soft);
	font-size: var(--size-small);
	break-after: avoid;
}

.cv .role h3 + p:not(.meta) {
	margin-top: 2mm;
}

.cv .role p + p,
.cv .role p + ul {
	margin-top: 2mm;
}

.cv .earlier p + p {
	margin-top: 1.6mm;
}

.cv strong {
	font-weight: 600;
}

/* The dash sits in the flow, not absolutely positioned: positioned items are painted
   after the rest of the page, which would put the list text last in the PDF's text layer. */
.cv .points li {
	padding-left: 4mm;
	break-inside: avoid;
}

.cv .points li + li {
	margin-top: 1.6mm;
}

.cv .points li::before {
	content: "";
	display: inline-block;
	width: 1.6mm;
	height: 0.35mm;
	margin: 0 1.9mm 0 -3.5mm;
	vertical-align: 0.3em;
	background: var(--ink-soft);
}

.cv .subrole {
	margin-top: 3.5mm;
	break-inside: avoid;
}

/* Small screens: one column, Experience first */
@media (max-width: 640px) {
	.cv {
		padding: 0;
	}

	.cv .sheet {
		padding: 28px 20px;
		box-shadow: none;
	}

	.cv .cv-download {
		top: calc(28px + 7pt);
		right: 20px;
	}
}

/* Very narrow screens: no room beside the heading, so the link sits under the summary */
@media (max-width: 380px) {
	.cv .cv-download {
		position: static;
		margin-top: 4mm;
	}

	.cv .layout {
		grid-template-columns: minmax(0, 1fr);
		row-gap: 28px;
	}

	.cv .experience,
	.cv .sidebar {
		grid-column: auto;
		grid-row: auto;
	}

	.cv .sidebar {
		padding-right: 0;
		border-right: 0;
	}
}

/* Print and PDF. site.css already hides the site header, skip link and .no-print. */
@page {
	size: A4;
	margin: 15mm 17mm;
}

@media print {
	html,
	body {
		background: none;
	}

	.screen-only {
		display: none;
	}

	.print-only {
		display: inline;
	}

	/* No ligatures, so "fi" and "fl" extract as plain letters for applicant tracking systems */
	.cv {
		padding: 0;
		background: none;
		font-variant-ligatures: none;
	}

	.cv .sheet {
		max-width: none;
		padding: 0;
		box-shadow: none;
	}

	.cv a {
		color: inherit;
		text-decoration: none;
	}

	.cv .sidebar a {
		color: var(--accent);
	}

	.cv h2,
	.cv h3 {
		break-after: avoid;
	}
}
