/*
 * ilias-piotopoulos.com
 *
 * 1. Fonts and design tokens
 * 2. Base elements
 * 3. Layout primitives and utilities
 * 4. Components (header, hero, terminal, timeline, cards, skills, form, command palette, footer, message pages)
 * 5. Motion (opt-in, progressive)
 * 6. Print
 */

/* ---------- 1. Fonts and design tokens ---------- */

@font-face {
	font-family: "Space Mono";
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url("../fonts/space-mono-400.woff2") format("woff2");
}

@font-face {
	font-family: "Space Mono";
	font-style: normal;
	font-weight: 700;
	font-display: swap;
	src: url("../fonts/space-mono-700.woff2") format("woff2");
}

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

	/* Dark is the default and the fallback for browsers without light-dark(). */
	color-scheme: dark;
	--bg: #0e0e10;
	--bg-raised: #16161a;
	--border: #2b2b31;
	--text: #ece8e1;
	--text-muted: #a8a39a;
	--accent: #e5bf95;
	--accent-ink: #17130d;
	--ok: #4ade80;

	--container: 68rem;
	--gutter: clamp(1.25rem, 5vw, 2.5rem);
	--header-height: 4rem;
	--label-column: 12.5rem;
	--radius: 0.625rem;
	--radius-sm: 0.375rem;
}

@supports (color: light-dark(#000, #fff)) {
	:root {
		color-scheme: dark light;
		--bg: light-dark(#faf7f2, #0e0e10);
		--bg-raised: light-dark(#ffffff, #16161a);
		--border: light-dark(#e2d9ca, #2b2b31);
		--text: light-dark(#1d1b18, #ece8e1);
		--text-muted: light-dark(#5c564d, #a8a39a);
		--accent: light-dark(#855a1c, #e5bf95);
		--accent-ink: light-dark(#ffffff, #17130d);
		--ok: light-dark(#15803d, #4ade80);
	}

	/* An explicit choice from the theme toggle overrides the system preference. */
	:root[data-theme="light"] {
		color-scheme: light;
	}

	:root[data-theme="dark"] {
		color-scheme: dark;
	}
}

/* ---------- 2. Base elements ---------- */

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

html {
	scroll-behavior: smooth;
	scroll-padding-top: calc(var(--header-height) + 1rem);
	scrollbar-color: var(--accent) var(--bg);
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font-family: var(--font-sans);
	font-size: 1.0625rem;
	line-height: 1.65;
	-webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
	margin: 0;
	font-family: var(--font-mono);
	font-weight: 700;
	line-height: 1.2;
	text-wrap: balance;
}

h1 {
	font-size: clamp(2.25rem, 1.2rem + 4.6vw, 4rem);
	letter-spacing: -0.04em;
}

h2 {
	font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2rem);
	letter-spacing: -0.02em;
}

h3 {
	font-size: 1.0625rem;
}

p {
	margin: 0 0 1em;
	text-wrap: pretty;
}

ul,
ol,
dl,
dd {
	margin: 0;
	padding: 0;
}

ul,
ol {
	list-style: none;
}

a {
	color: var(--accent);
	text-decoration-thickness: 1px;
	text-underline-offset: 0.2em;
}

a:hover {
	text-decoration-thickness: 2px;
}

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

::selection {
	background: var(--accent);
	color: var(--accent-ink);
}

[hidden] {
	display: none !important;
}

/* Scrollbars in the accent color, which already differs per theme. Browsers that support the standard
   scrollbar-color property (set on html above) ignore this block; it is the fallback for Safari. */
@supports not (scrollbar-color: auto) {
	::-webkit-scrollbar {
		width: 0.75rem;
		height: 0.75rem;
	}

	::-webkit-scrollbar-track {
		background: var(--bg);
	}

	::-webkit-scrollbar-thumb {
		border: 3px solid var(--bg);
		border-radius: 999px;
		background: var(--accent);
	}

	.terminal__body::-webkit-scrollbar-track {
		background: transparent;
	}

	.terminal__body::-webkit-scrollbar-thumb {
		border-color: var(--t-bg);
	}
}

/* ---------- 3. Layout primitives and utilities ---------- */

.container {
	width: 100%;
	max-width: var(--container);
	margin-inline: auto;
	padding-inline: var(--gutter);
}

.section {
	padding-block: clamp(3.5rem, 9vw, 6.5rem);
	border-top: 1px solid var(--border);
}

.section__head {
	margin-bottom: clamp(2rem, 5vw, 3rem);
}

.section__more {
	margin: 2rem 0 0;
	color: var(--text-muted);
}

.eyebrow {
	margin: 0 0 0.25rem;
	color: var(--accent);
	font-family: var(--font-mono);
	font-size: 0.8125rem;
	letter-spacing: 0.2em;
}

.visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.skip-link {
	position: absolute;
	top: 0.5rem;
	left: 0.5rem;
	z-index: 100;
	padding: 0.6rem 1rem;
	background: var(--accent);
	color: var(--accent-ink);
	font-family: var(--font-mono);
	font-size: 0.875rem;
	border-radius: var(--radius-sm);
	transform: translateY(-200%);
}

.skip-link:focus {
	transform: none;
}

.icon {
	width: 1.25em;
	height: 1.25em;
	flex: none;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.75;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.icon--solid {
	fill: currentColor;
	stroke: none;
}

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

.tags li {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.15rem 0.55rem;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	color: var(--text-muted);
	font-family: var(--font-mono);
	font-size: 0.75rem;
	line-height: 1.6;
	white-space: nowrap;
}

.tags img {
	width: 0.875rem;
	height: 0.875rem;
	object-fit: contain;
}

.button,
.icon-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.6rem;
	min-height: 2.75rem;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	background: transparent;
	color: var(--text);
	font-family: var(--font-mono);
	font-size: 0.8125rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	text-decoration: none;
	cursor: pointer;
	transition: border-color 0.2s, background-color 0.2s, color 0.2s;
}

.button {
	padding: 0 1.25rem;
}

.icon-button {
	width: 2.75rem;
	padding: 0;
}

.button:hover,
.icon-button:hover {
	border-color: var(--accent);
	color: var(--accent);
}

.button--primary {
	border-color: var(--accent);
	background: var(--accent);
	color: var(--accent-ink);
	font-weight: 700;
}

.button--primary:hover {
	background: transparent;
	color: var(--accent);
}

/* ---------- 4. Components ---------- */

/* Header */

.site-header {
	position: sticky;
	top: 0;
	z-index: 50;
	border-bottom: 1px solid var(--border);
	background: var(--bg);
}

@supports (backdrop-filter: blur(1px)) and (background: color-mix(in srgb, red 50%, blue)) {
	.site-header {
		background: color-mix(in srgb, var(--bg) 82%, transparent);
		backdrop-filter: blur(14px) saturate(1.4);
	}
}

.site-header__inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.25rem 1.5rem;
	min-height: var(--header-height);
}

.brand {
	margin-right: auto;
	color: var(--accent);
	font-family: var(--font-mono);
	font-weight: 700;
	letter-spacing: 0.15em;
	text-decoration: none;
}

.site-nav ul {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 1.75rem;
}

.site-nav a {
	display: inline-block;
	padding-block: 0.5rem;
	color: var(--text-muted);
	font-family: var(--font-mono);
	font-size: 0.75rem;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	text-decoration: none;
	transition: color 0.2s;
}

.site-nav a:hover,
.site-nav a[aria-current="true"] {
	color: var(--accent);
}

.site-nav a[aria-current="true"] {
	text-decoration: underline;
	text-underline-offset: 0.5em;
}

.site-header__controls {
	display: flex;
	gap: 0.5rem;
}

.site-header .icon-button {
	width: 2.5rem;
	min-height: 2.5rem;
}

kbd {
	padding: 0.1rem 0.4rem;
	border: 1px solid var(--border);
	border-radius: 0.25rem;
	color: var(--text-muted);
	font-family: var(--font-mono);
	font-size: 0.6875rem;
	letter-spacing: 0;
	text-transform: none;
	white-space: nowrap;
}

.site-header .palette-button {
	width: auto;
	min-width: 2.5rem;
	padding-inline: 0.6rem;
}

.palette-button kbd {
	display: none;
}

@media (min-width: 60rem) {
	.palette-button kbd {
		display: inline;
	}
}

/* The toggle shows the theme you would switch to. main.js keeps data-mode in sync. */
#theme-toggle .icon--moon,
#theme-toggle[data-mode="light"] .icon--sun {
	display: none;
}

#theme-toggle[data-mode="light"] .icon--moon {
	display: block;
}

.nav-toggle {
	display: none;
}

@media (max-width: 52rem) {
	.site-header__inner {
		position: relative;
	}

	/* Without JavaScript the links simply wrap under the brand. With it, they collapse behind a menu button. */
	.js .nav-toggle {
		display: inline-flex;
	}

	.js .site-nav {
		display: none;
		order: 3;
		flex-basis: 100%;
		padding-bottom: 0.75rem;
	}

	.js .site-nav.is-open {
		display: block;
	}

	.js .site-nav ul {
		flex-direction: column;
		gap: 0;
	}

	.js .site-nav a {
		display: block;
		padding-block: 0.7rem;
		font-size: 0.8125rem;
	}
}

/* Hero */

.hero {
	position: relative;
	isolation: isolate;
	display: flex;
	align-items: center;
	min-height: calc(100vh - var(--header-height));
	min-height: calc(100svh - var(--header-height));
	padding-block: clamp(3rem, 8vw, 5rem);
}

/* A dot grid that is only revealed around the pointer. main.js sets --spot-x / --spot-y and .is-lit. */
.hero::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background-image: radial-gradient(circle, var(--accent) 1px, transparent 1.5px);
	background-size: 1.5rem 1.5rem;
	-webkit-mask-image: radial-gradient(18rem circle at var(--spot-x, 50%) var(--spot-y, 50%), #000, transparent);
	mask-image: radial-gradient(18rem circle at var(--spot-x, 50%) var(--spot-y, 50%), #000, transparent);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.5s;
}

.hero.is-lit::before {
	opacity: 0.45;
}

.hero__grid {
	display: grid;
	gap: clamp(2.5rem, 6vw, 4rem);
	align-items: center;
}

@media (min-width: 60rem) {
	.hero__grid {
		grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
	}
}

.status {
	display: inline-flex;
	align-items: center;
	gap: 0.6rem;
	margin-bottom: 1.5rem;
	padding: 0.35rem 0.85rem;
	border: 1px solid var(--border);
	border-radius: 999px;
	color: var(--text-muted);
	font-family: var(--font-mono);
	font-size: 0.75rem;
	letter-spacing: 0.1em;
	text-transform: uppercase;
}

.status__label {
	flex: none;
	padding-right: 0.7rem;
	border-right: 1px solid var(--border);
	color: var(--accent);
}

.status__label::after {
	content: ":";
	/* Read aloud as "Status: Seeking…", but the divider replaces the colon visually. */
	position: absolute;
	clip-path: inset(50%);
}

.status__dot {
	position: relative;
	flex: none;
	width: 0.5rem;
	height: 0.5rem;
	border-radius: 50%;
	background: var(--ok);
}

.status__dot::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background: var(--ok);
	opacity: 0;
}

.hero__role {
	margin: 0.75rem 0 1.25rem;
	color: var(--accent);
	font-family: var(--font-mono);
	font-size: clamp(0.9375rem, 0.85rem + 0.5vw, 1.125rem);
}

.hero__role span {
	color: var(--text-muted);
}

.hero__lede {
	max-width: 34rem;
	margin-bottom: 2rem;
	color: var(--text-muted);
	font-size: 1.125rem;
}

.hero__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
}

/* Terminal. Deliberately dark in both themes, like a real terminal window. */

.terminal {
	--t-bg: #0a0a0c;
	--t-border: #2b2b31;
	--t-text: #b9b5ae;
	--t-accent: #e5bf95;
	--t-command: #4ade80;
	--t-error: #ff5f56;

	overflow: hidden;
	border: 1px solid var(--t-border);
	border-radius: var(--radius);
	background: var(--t-bg);
	color: var(--t-text);
	font-family: var(--font-mono);
	font-size: 0.8125rem;
	line-height: 1.75;
	box-shadow: 0 1.5rem 3rem -1rem rgb(0 0 0 / 0.45);
	transition: border-color 0.2s;
}

.terminal:focus-within {
	border-color: var(--t-accent);
}

.terminal__bar {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.65rem 0.9rem;
	border-bottom: 1px solid var(--t-border);
	background: #131316;
}

.terminal__dot {
	width: 0.65rem;
	height: 0.65rem;
	border-radius: 50%;
	background: var(--t-error);
}

.terminal__dot:nth-child(2) {
	background: #ffbd2e;
}

.terminal__dot:nth-child(3) {
	background: var(--t-command);
}

.terminal__title {
	margin-left: 0.5rem;
	color: #8a8690;
	font-size: 0.6875rem;
	letter-spacing: 0.05em;
}

.terminal__body {
	position: relative;
	height: 19.5rem;
	padding: 0.9rem 1.1rem 1.1rem;
	overflow-y: auto;
	overscroll-behavior: contain;
	scrollbar-width: thin;
	scrollbar-color: var(--accent) transparent;
}

.terminal p {
	margin: 0;
	text-wrap: wrap;
	overflow-wrap: anywhere;
}

.t-prompt {
	color: var(--t-accent);
}

.t-cmd {
	color: var(--t-command);
}

.t-out {
	padding-left: 1.2em;
	white-space: pre-wrap;
}

.t-out--error {
	color: var(--t-error);
}

.t-comment {
	color: #8a8690;
}

.t-pending,
.intro-pending #terminal-intro > * {
	visibility: hidden;
}

.t-typing::after {
	content: "";
	display: inline-block;
	width: 0.55em;
	height: 1.1em;
	margin-left: 0.1em;
	background: var(--t-accent);
	vertical-align: text-bottom;
}

.terminal__form {
	display: flex;
	gap: 0.6em;
}

.terminal__form input {
	flex: 1;
	min-width: 0;
	padding: 0;
	border: 0;
	outline: 0;
	background: transparent;
	color: var(--t-command);
	caret-color: var(--t-accent);
	font: inherit;
}

.terminal__form input::placeholder {
	color: #7d7982;
	opacity: 1;
}

.terminal__try {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.4rem;
	padding: 0.6rem 0.9rem;
	border-top: 1px solid var(--t-border);
	background: #131316;
	color: #8a8690;
	font-size: 0.6875rem;
	letter-spacing: 0.05em;
}

.terminal__try span {
	margin-right: 0.2rem;
	text-transform: uppercase;
}

.terminal__try button {
	padding: 0.15rem 0.55rem;
	border: 1px solid var(--t-border);
	border-radius: var(--radius-sm);
	background: transparent;
	color: var(--t-command);
	font: inherit;
	cursor: pointer;
	transition: border-color 0.2s, background-color 0.2s;
}

.terminal__try button:hover {
	border-color: var(--t-command);
	background: rgb(74 222 128 / 0.08);
}

.terminal__try button:focus-visible {
	outline-color: var(--t-accent);
}

/* About */

.about {
	display: grid;
	gap: clamp(2rem, 5vw, 4rem);
}

@media (min-width: 60rem) {
	.about {
		grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
	}
}

.prose {
	max-width: 40rem;
}

.prose p:last-child {
	margin-bottom: 0;
}

.facts {
	display: grid;
	gap: 1.1rem;
	align-content: start;
}

.facts dt,
.skills dt,
.field label,
.card__kind {
	color: var(--text-muted);
	font-family: var(--font-mono);
	font-size: 0.6875rem;
	letter-spacing: 0.16em;
	text-transform: uppercase;
}

.facts dt {
	margin-bottom: 0.15rem;
}

/* Timeline (experience, education) */

.timeline {
	display: grid;
	gap: clamp(2rem, 5vw, 3rem);
}

.entry {
	display: grid;
	gap: 0.5rem 2rem;
}

.entry__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.1rem 1rem;
	margin: 0;
	color: var(--text-muted);
	font-family: var(--font-mono);
	font-size: 0.8125rem;
}

.entry__dates {
	color: var(--text);
}

.entry__body > * + * {
	margin-top: 0.9rem;
}

.entry__body p {
	margin-bottom: 0;
}

.entry__head {
	display: flex;
	align-items: center;
	gap: 0.9rem;
}

/* Company and school marks sit on a white tile in both themes: the logos are drawn for a light background. */
.entry__logo {
	display: grid;
	flex: none;
	place-items: center;
	width: 2.75rem;
	height: 2.75rem;
	overflow: hidden;
	border: 1px solid var(--border);
	border-radius: 0.6rem;
	background: #fff;
}

.entry__logo img {
	max-width: 72%;
	max-height: 72%;
	object-fit: contain;
}

/* A logo that is already a full square fills the tile edge to edge. */
.entry__logo--fill img {
	width: 100%;
	height: 100%;
	max-width: none;
	max-height: none;
	object-fit: cover;
}

/* A wordmark with wide margins is enlarged so the name stays legible at this size. */
.entry__logo--zoom img {
	transform: scale(1.3);
}

/* Where there is no logo to show: an icon on a plain tile. */
.entry__logo--mono {
	background: var(--bg-raised);
	color: var(--accent);
}

.entry__logo--mono .icon {
	width: 1.5rem;
	height: 1.5rem;
	stroke-width: 1.5;
}

.entry__org {
	display: block;
	margin-top: 0.25rem;
	color: var(--accent);
	font-size: 0.875rem;
	font-weight: 400;
}

.entry__points {
	display: grid;
	gap: 0.45rem;
}

.entry__points li {
	position: relative;
	padding-left: 1.25rem;
}

.entry__points li::before {
	content: "";
	position: absolute;
	top: 0.7em;
	left: 0;
	width: 0.5rem;
	height: 1px;
	background: var(--accent);
}

@media (min-width: 48rem) {
	.entry {
		grid-template-columns: var(--label-column) minmax(0, 1fr);
	}

	.entry__meta {
		flex-direction: column;
		padding-top: 0.3rem;
	}

	/* The rail and its marker live on the body column, so no absolute page-level positioning is needed. */
	.entry__body {
		position: relative;
		padding-left: 2rem;
		border-left: 1px solid var(--border);
	}

	.entry__body::before {
		content: "";
		position: absolute;
		top: 1.1rem;
		left: -0.3125rem;
		width: 0.5625rem;
		height: 0.5625rem;
		border-radius: 50%;
		background: var(--accent);
		box-shadow: 0 0 0 0.25rem var(--bg);
	}
}

/* Project cards */

.cards {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
	gap: 1.25rem;
}

.card {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	padding: 1.5rem;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--bg-raised);
	transition: border-color 0.2s, transform 0.2s;
}

.card:hover,
.card:focus-within {
	border-color: var(--accent);
}

.card p {
	margin: 0;
}

.card > p:not(.card__kind) {
	color: var(--text-muted);
	font-size: 0.9688rem;
}

.card h3 {
	font-size: 1.1875rem;
}

.card h3 a {
	color: var(--text);
	text-decoration: none;
}

/* Stretch the title link over the whole card so the card is one large, single tab stop. */
.card h3 a::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
}

/* Corner arrow: these cards lead off-site. */
.card::after {
	content: "\2197";
	position: absolute;
	top: 1.1rem;
	right: 1.25rem;
	color: var(--text-muted);
	font-family: var(--font-sans);
	line-height: 1;
	transition: color 0.2s, transform 0.2s;
}

.card:hover::after,
.card:focus-within::after {
	color: var(--accent);
}

.card h3 a:focus-visible {
	outline: none;
}

.card h3 a:focus-visible::after {
	outline: 2px solid var(--accent);
	outline-offset: 3px;
}

.card .tags {
	margin-top: auto;
	padding-top: 0.5rem;
}

/* Skills */

.skills {
	display: grid;
	gap: 1.5rem;
}

.skills > div {
	display: grid;
	gap: 0.6rem 2rem;
}

@media (min-width: 48rem) {
	.skills > div {
		grid-template-columns: var(--label-column) minmax(0, 1fr);
		align-items: baseline;
	}
}

.skills .tags li {
	gap: 0.5rem;
	padding: 0.3rem 0.7rem;
	background: var(--bg-raised);
	color: var(--text);
	font-size: 0.8125rem;
	transition: border-color 0.2s, transform 0.2s;
}

.skills .tags li:hover {
	border-color: var(--accent);
}

.skills .tags img {
	width: 1.125rem;
	height: 1.125rem;
}

.cert {
	display: flex;
	align-items: center;
	gap: 0.9rem;
}

.cert img {
	flex: none;
	width: 2.75rem;
	height: 2.75rem;
}

/* Contact */

.contact {
	display: grid;
	gap: clamp(2rem, 5vw, 4rem);
}

@media (min-width: 60rem) {
	.contact {
		grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
	}
}

.contact__lede {
	margin-bottom: 2rem;
	font-size: 1.125rem;
}

.form {
	display: grid;
	gap: 1.25rem;
	justify-items: start;
}

.form__row {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
	gap: 1.25rem;
	width: 100%;
}

.form__trap {
	display: none;
}

.field {
	display: grid;
	gap: 0.4rem;
	width: 100%;
}

.field__hint {
	letter-spacing: 0.05em;
	text-transform: none;
}

.field input,
.field textarea {
	width: 100%;
	padding: 0.75rem 0.9rem;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	background: var(--bg-raised);
	color: var(--text);
	font: inherit;
	transition: border-color 0.2s;
}

.field textarea {
	min-height: 9rem;
	resize: vertical;
}

.field input:hover,
.field textarea:hover {
	border-color: var(--text-muted);
}

.field input:focus-visible,
.field textarea:focus-visible {
	border-color: var(--accent);
	outline-offset: 0;
}

/* Command palette */

.palette {
	width: min(34rem, calc(100vw - 2rem));
	margin-top: 16vh;
	padding: 0;
	overflow: hidden;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--bg-raised);
	color: var(--text);
	box-shadow: 0 2rem 4rem -1rem rgb(0 0 0 / 0.5);
}

.palette::backdrop {
	background: rgb(0 0 0 / 0.55);
	-webkit-backdrop-filter: blur(3px);
	backdrop-filter: blur(3px);
}

.palette__field {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.9rem 1rem;
	border-bottom: 1px solid var(--border);
	color: var(--text-muted);
}

.palette__field input {
	flex: 1;
	min-width: 0;
	padding: 0;
	border: 0;
	outline: 0;
	background: transparent;
	color: var(--text);
	font: inherit;
}

.palette__list {
	max-height: min(23rem, 55vh);
	padding: 0.4rem;
	overflow-y: auto;
	overscroll-behavior: contain;
	scrollbar-width: thin;
	scrollbar-color: var(--accent) transparent;
}

.palette__list li {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 1rem;
	padding: 0.6rem 0.75rem;
	border-radius: var(--radius-sm);
	cursor: pointer;
}

.palette__list span {
	color: var(--text-muted);
	font-family: var(--font-mono);
	font-size: 0.6875rem;
}

.palette__list li[aria-selected="true"] {
	background: var(--bg);
	color: var(--accent);
}

.palette__empty {
	margin: 0;
	padding: 1.25rem 1rem;
	color: var(--text-muted);
}

/* Footer */

.site-footer {
	border-top: 1px solid var(--border);
	color: var(--text-muted);
	font-family: var(--font-mono);
	font-size: 0.75rem;
}

.site-footer__inner {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 0.25rem 2rem;
	padding-block: 1.75rem;
}

.site-footer p {
	margin: 0;
}

/* Standalone message pages (thanks, 404) */

.message {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	justify-content: center;
	gap: 1.25rem;
	max-width: 36rem;
	min-height: 100vh;
	min-height: 100svh;
	padding-block: 3rem;
}

.message .brand {
	margin: 0 0 1rem;
}

.message .terminal {
	width: 100%;
	margin-bottom: 0.75rem;
}

.message .terminal__body {
	height: auto;
}

.message h1 {
	font-size: clamp(1.75rem, 1.2rem + 3vw, 2.75rem);
}

.message p {
	margin: 0;
	color: var(--text-muted);
}

.message .terminal p {
	color: inherit;
}

.message .terminal .t-out--ok {
	color: var(--t-command);
}

.message .terminal .t-out--error {
	color: var(--t-error);
}

/* ---------- 5. Motion ---------- */

.scroll-progress {
	display: none;
}

@keyframes pulse {
	from {
		opacity: 0.6;
		transform: scale(1);
	}

	to {
		opacity: 0;
		transform: scale(2.8);
	}
}

@keyframes blink {
	50% {
		opacity: 0;
	}
}

@keyframes grow-x {
	from {
		transform: scaleX(0);
	}

	to {
		transform: scaleX(1);
	}
}

@keyframes grow-y {
	from {
		transform: scaleY(0);
	}

	to {
		transform: scaleY(1);
	}
}

@keyframes theme-reveal {
	from {
		clip-path: circle(0 at var(--reveal-x, 50%) var(--reveal-y, 0));
	}

	to {
		clip-path: circle(150vmax at var(--reveal-x, 50%) var(--reveal-y, 0));
	}
}

@keyframes reveal {
	from {
		opacity: 0;
		transform: translateY(1rem);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

@media (prefers-reduced-motion: no-preference) {
	.status__dot::after {
		animation: pulse 2s ease-out infinite;
	}

	.t-typing::after {
		animation: blink 1s step-end infinite;
	}

	.brand span {
		animation: blink 1.2s step-end infinite;
	}

	.card:hover,
	.skills .tags li:hover {
		transform: translateY(-2px);
	}

	.palette[open] {
		animation: reveal 0.18s ease-out;
	}

	.card:hover::after {
		transform: translate(2px, -2px);
	}

	/* Theme switch: the new theme grows out of the toggle button. main.js starts the view transition. */
	::view-transition-old(root) {
		animation: none;
	}

	::view-transition-new(root) {
		animation: theme-reveal 0.55s ease-in-out;
	}

	/* Scroll-driven animations need no JavaScript. Browsers without them show static content. */
	@supports (animation-timeline: view()) {
		.scroll-progress {
			display: block;
			position: fixed;
			inset: 0 0 auto;
			z-index: 60;
			height: 2px;
			background: var(--accent);
			transform-origin: 0 50%;
			animation: grow-x linear both;
			animation-timeline: scroll(root);
		}

		.reveal {
			animation: reveal linear both;
			animation-timeline: view();
			animation-range: entry 0% entry 30%;
		}

		/* The timeline rail fills with the accent color as each entry passes the middle of the viewport.
		   The insets shrink the tracked area to a line just above center, so progress follows the reader. */
		@media (min-width: 48rem) {
			.entry__body::after {
				content: "";
				position: absolute;
				inset: 0 auto 0 -1px;
				width: 1px;
				background: var(--accent);
				transform-origin: 50% 0;
				animation: grow-y linear both;
				animation-timeline: view(block 45% 55%);
			}
		}
	}
}

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	* {
		transition: none !important;
	}
}

/* ---------- 6. Print: the page doubles as a clean, paper-friendly CV ---------- */

@media print {
	:root {
		color-scheme: light;
		--bg: #fff;
		--bg-raised: #fff;
		--border: #ccc;
		--text: #000;
		--text-muted: #333;
		--accent: #000;
		--accent-ink: #fff;
	}

	body {
		font-size: 10.5pt;
	}

	.site-header,
	.hero::before,
	.card::after,
	.scroll-progress,
	.skip-link,
	.terminal,
	.hero__actions,
	.status,
	.form,
	.contact__lede,
	#local-time-row,
	.site-footer {
		display: none !important;
	}

	.hero {
		min-height: 0;
		padding-block: 0 1rem;
	}

	.section {
		padding-block: 1rem;
	}

	/* Keep a section's number and title together, and attached to what follows. */
	.section__head {
		margin-bottom: 0.75rem;
		break-inside: avoid;
		break-after: avoid;
	}

	.reveal {
		animation: none;
	}

	.entry,
	.card,
	.skills > div {
		break-inside: avoid;
	}

	.entry__body::after {
		content: none;
	}

	.cards {
		grid-template-columns: 1fr;
		gap: 0.75rem;
	}

	.card {
		padding: 0.9rem 1rem;
	}

	h2,
	h3 {
		break-after: avoid;
	}

	a {
		text-decoration: none;
	}

	/* Spell out link targets on paper. This also replaces the stretched card overlay. */
	main a[href^="http"]::after {
		content: " (" attr(href) ")";
		position: static;
		font-family: var(--font-sans);
		font-size: 0.85em;
		font-weight: 400;
		overflow-wrap: anywhere;
	}
}
