/* ==========================================================================
   andreasen.dev resume
   Single stylesheet: tokens, reset, layout, print.
   ========================================================================== */

/* --- Design tokens ------------------------------------------------------ */

:root {
	color-scheme: light dark;

	--font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Inter,
		Roboto, "Helvetica Neue", Arial, sans-serif;
	--font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
		"Liberation Mono", monospace;

	--measure: 68ch;
	--page: 72rem;
	--rail: 11rem;
	--gutter: clamp(1.25rem, 4vw, 3rem);

	--bg: #ffffff;
	--surface: #f7f8fa;
	--text: #15171c;
	--muted: #565d6d;
	--faint: #858c9b;
	--rule: #e3e6ec;
	--accent: #2352c9;
	--accent-soft: #eaf0ff;

	--lang-1: #2352c9;
	--lang-2: #3f8fd4;
	--lang-3: #63b6bd;
	--lang-4: #9aa6bd;
	--lang-5: #c3c9d6;
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #0e1014;
		--surface: #171a20;
		--text: #e7e9ee;
		--muted: #a2a9b7;
		--faint: #7d8493;
		--rule: #262a33;
		--accent: #86a9ff;
		--accent-soft: #1a2033;

		--lang-1: #86a9ff;
		--lang-2: #5f9fd6;
		--lang-3: #57b0b8;
		--lang-4: #6d7789;
		--lang-5: #444c5c;
	}
}

/* --- Reset -------------------------------------------------------------- */

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

* {
	margin: 0;
}

html {
	-webkit-text-size-adjust: 100%;
}

body {
	background: var(--bg);
	color: var(--text);
	font-family: var(--font-sans);
	font-size: 1rem;
	line-height: 1.6;
	font-variant-numeric: tabular-nums;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

ul,
ol {
	list-style: none;
	padding: 0;
}

a {
	color: inherit;
	text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
	text-underline-offset: 0.18em;
}

a:hover {
	color: var(--accent);
	text-decoration-color: currentColor;
}

:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 3px;
	border-radius: 2px;
}

h1,
h2,
h3,
h4 {
	font-weight: 650;
	line-height: 1.25;
	text-wrap: balance;
}

p {
	text-wrap: pretty;
}

/* --- Page shell --------------------------------------------------------- */

.page {
	max-width: var(--page);
	margin-inline: auto;
	padding: clamp(2.5rem, 6vw, 4.5rem) var(--gutter) 4rem;
}

.skip-link {
	position: absolute;
	left: -9999px;
}

.skip-link:focus {
	left: var(--gutter);
	top: 1rem;
	z-index: 10;
	background: var(--bg);
	padding: 0.5rem 0.875rem;
	border: 1px solid var(--rule);
	border-radius: 6px;
}

/* --- Masthead ----------------------------------------------------------- */

.masthead {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	justify-content: space-between;
	gap: 1rem 2rem;
	padding-bottom: 1.75rem;
	border-bottom: 1px solid var(--rule);
}

.masthead__name {
	font-size: clamp(2.125rem, 6vw, 3rem);
	letter-spacing: -0.025em;
	font-weight: 700;
}

.masthead__headline {
	margin-top: 0.5rem;
	max-width: 46ch;
	color: var(--muted);
	font-size: clamp(0.9375rem, 2vw, 1.0625rem);
	font-weight: 500;
}

.masthead__headline .part {
	white-space: nowrap;
}

.masthead__headline .sep {
	color: var(--accent);
}

.contact {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.35rem 1.1rem;
	margin-top: 1.125rem;
	font-size: 0.9375rem;
	color: var(--muted);
}

.contact a {
	text-decoration: none;
	border-bottom: 1px solid var(--rule);
	padding-bottom: 1px;
}

.contact a:hover {
	border-bottom-color: var(--accent);
}

.actions {
	display: flex;
	gap: 0.5rem;
	margin-left: auto;
}

.btn {
	font: inherit;
	font-size: 0.875rem;
	font-weight: 500;
	color: var(--muted);
	background: var(--surface);
	border: 1px solid var(--rule);
	border-radius: 999px;
	padding: 0.4rem 0.95rem;
	cursor: pointer;
}

.btn:hover {
	color: var(--accent);
	border-color: var(--accent);
}

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

.section {
	display: grid;
	grid-template-columns: var(--rail) minmax(0, 1fr);
	gap: 0 3rem;
	padding-block: clamp(2rem, 5vw, 3.25rem);
	border-bottom: 1px solid var(--rule);
}

.section:last-of-type {
	border-bottom: 0;
}

.section__label {
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--faint);
	position: sticky;
	top: 2rem;
	align-self: start;
}

.section__body > * + * {
	margin-top: 1.25rem;
}

.lede {
	font-size: clamp(1.0625rem, 2.2vw, 1.1875rem);
	line-height: 1.65;
	max-width: var(--measure);
	color: var(--text);
}

@media (max-width: 56rem) {
	.section {
		grid-template-columns: minmax(0, 1fr);
		gap: 0.875rem 0;
	}

	.section__label {
		position: static;
	}
}

/* Phones: the date range no longer fits beside the role title. */
@media (max-width: 34rem) {
	.job__title,
	.earlier__title {
		flex: 1 0 100%;
	}

	.job__org {
		order: 2;
	}

	.job__dates,
	.earlier__dates {
		order: 3;
		flex: 1 0 100%;
		white-space: normal;
	}

	.actions {
		margin-left: 0;
	}
}

/* --- Experience --------------------------------------------------------- */

.jobs {
	display: flex;
	flex-direction: column;
	gap: 2.5rem;
}

.job {
	position: relative;
	padding-left: 1.75rem;
	border-left: 1px solid var(--rule);
}

.job::before {
	content: "";
	position: absolute;
	left: -4.5px;
	top: 0.55em;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--bg);
	border: 1.5px solid var(--faint);
}

.job--current::before {
	background: var(--accent);
	border-color: var(--accent);
}

.job__head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 0.15rem 1.5rem;
}

.job__title {
	font-size: 1.1875rem;
	letter-spacing: -0.01em;
}

.job__dates {
	font-size: 0.875rem;
	color: var(--muted);
	white-space: nowrap;
}

.job__duration::before {
	content: "·";
	padding-inline: 0.4em;
	color: var(--faint);
}

.job__org {
	flex: 1 0 100%;
	font-size: 0.9375rem;
	color: var(--muted);
	margin-top: 0.1rem;
}

.job__company {
	font-weight: 600;
	color: var(--text);
}

.job__where::before {
	content: "·";
	padding-inline: 0.45em;
	color: var(--faint);
}

.job__lead {
	margin-top: 0.9rem;
	max-width: var(--measure);
}

.job__points {
	margin-top: 0.9rem;
	max-width: var(--measure);
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
}

.job__points li {
	position: relative;
	padding-left: 1.1rem;
}

.job__points li::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0.66em;
	width: 5px;
	height: 5px;
	border-radius: 50%;
	background: color-mix(in srgb, var(--accent) 55%, transparent);
}

/* --- Language mix ------------------------------------------------------- */

.lang {
	margin-top: 1.1rem;
	max-width: 34rem;
}

.lang__bar {
	display: flex;
	height: 6px;
	border-radius: 999px;
	overflow: hidden;
	background: var(--rule);
}

.lang__seg {
	height: 100%;
	print-color-adjust: exact;
	-webkit-print-color-adjust: exact;
}

.lang__legend {
	display: flex;
	flex-wrap: wrap;
	gap: 0.15rem 1.1rem;
	margin-top: 0.55rem;
	font-size: 0.8125rem;
	color: var(--muted);
}

.lang__key {
	display: inline-block;
	width: 0.5rem;
	height: 0.5rem;
	border-radius: 2px;
	margin-right: 0.45em;
	print-color-adjust: exact;
	-webkit-print-color-adjust: exact;
}

.lang__pct {
	color: var(--faint);
}

/* --- Earlier experience ------------------------------------------------- */

.earlier {
	margin-top: 2.5rem;
	border-top: 1px dashed var(--rule);
	padding-top: 1.25rem;
}

.earlier > summary {
	cursor: pointer;
	font-size: 0.8125rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--faint);
	list-style: none;
}

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

.earlier > summary::after {
	content: " +";
	font-family: var(--font-mono);
}

.earlier[open] > summary::after {
	content: " −";
}

.earlier > summary:hover {
	color: var(--accent);
}

.earlier__list {
	margin-top: 1.5rem;
	display: flex;
	flex-direction: column;
	gap: 1.35rem;
}

.earlier__head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 0.1rem 1.5rem;
}

.earlier__title {
	font-size: 1rem;
	font-weight: 600;
}

.earlier__company {
	color: var(--muted);
	font-weight: 500;
}

.earlier__company::before {
	content: "·";
	padding-inline: 0.45em;
	color: var(--faint);
}

.earlier__dates {
	font-size: 0.8125rem;
	color: var(--faint);
	white-space: nowrap;
}

.earlier__text {
	margin-top: 0.25rem;
	max-width: var(--measure);
	font-size: 0.9375rem;
	color: var(--muted);
}

/* --- Skills ------------------------------------------------------------- */

.skill-grid {
	columns: 18rem;
	column-gap: 2.5rem;
}

.skill-group {
	break-inside: avoid;
	margin-bottom: 1.75rem;
}

.skill-group__name {
	font-size: 0.9375rem;
	margin-bottom: 0.7rem;
}

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

.chip {
	display: inline-block;
	font-size: 0.8125rem;
	line-height: 1.45;
	padding: 0.2rem 0.6rem;
	border: 1px solid var(--rule);
	border-radius: 999px;
	background: var(--surface);
	color: var(--muted);
}

a.chip {
	text-decoration: none;
}

a.chip:hover {
	color: var(--accent);
	border-color: var(--accent);
	background: var(--accent-soft);
}

/* --- Footer / noscript -------------------------------------------------- */

.colophon {
	margin-top: 3rem;
	padding-top: 1.5rem;
	border-top: 1px solid var(--rule);
	font-size: 0.8125rem;
	color: var(--faint);
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1.5rem;
	justify-content: space-between;
}

.fallback {
	max-width: var(--measure);
	padding: 1.25rem 1.5rem;
	border: 1px solid var(--rule);
	border-radius: 10px;
	background: var(--surface);
}

/* --- Print -------------------------------------------------------------- */

@page {
	margin: 14mm 14mm 16mm;
}

@media print {
	:root {
		--bg: #fff;
		--surface: #fff;
		--text: #000;
		--muted: #333;
		--faint: #666;
		--rule: #ccc;
		--accent: #1a3f9e;
		--accent-soft: #fff;
		--measure: 78ch;
		color-scheme: light;
	}

	body {
		font-size: 10pt;
		line-height: 1.45;
	}

	.page {
		max-width: none;
		padding: 0;
	}

	.actions,
	.skip-link,
	.colophon {
		display: none !important;
	}

	.section {
		grid-template-columns: 7rem minmax(0, 1fr);
		gap: 0 1.5rem;
		padding-block: 0.7rem;
		break-inside: auto;
	}

	.section__label {
		position: static;
		font-size: 8pt;
	}

	.masthead {
		padding-bottom: 0.75rem;
	}

	.masthead__name {
		font-size: 21pt;
	}

	.masthead__headline,
	.lede {
		font-size: 10pt;
	}

	.contact {
		margin-top: 0.5rem;
		font-size: 9pt;
	}

	.contact a {
		border-bottom: 0;
	}

	.jobs {
		gap: 1.1rem;
	}

	/* A whole job is far too tall to keep on one page - avoiding a break inside it
	   strands half-empty pages. Let jobs flow and only protect the small pieces. */
	.job {
		break-inside: auto;
	}

	.job__head,
	.masthead {
		break-after: avoid;
	}

	.earlier,
	.earlier__list > li,
	.skill-group,
	.lang {
		break-inside: avoid;
	}

	p,
	li {
		orphans: 2;
		widows: 2;
	}

	.job__title {
		font-size: 11.5pt;
	}

	.job__lead,
	.job__points,
	.lang,
	.earlier__list {
		margin-top: 0.5rem;
	}

	.job__points {
		gap: 0.28rem;
	}

	.earlier {
		margin-top: 1rem;
		padding-top: 0.7rem;
	}

	.earlier > summary::after {
		content: "";
	}

	/* Earlier roles print as a compact history line; the detail lives on the web page. */
	.earlier__text {
		display: none;
	}

	.earlier__list {
		gap: 0.3rem;
		margin-top: 0.6rem;
	}

	.skill-grid {
		columns: 2;
		column-gap: 2rem;
	}

	.skill-group {
		margin-bottom: 0.75rem;
	}

	.skill-group__name {
		margin-bottom: 0.35rem;
	}

	.chips {
		gap: 0.2rem;
	}

	.chip {
		font-size: 8.5pt;
		padding: 0.05rem 0.4rem;
	}

	.chip {
		background: none;
	}

	a {
		text-decoration: none;
	}
}
