/* jeffzellner.com. See DESIGN.md for the reasoning behind every value here. */

@font-face {
	font-family: "IBM Plex Mono";
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url("/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
}
@font-face {
	font-family: "IBM Plex Mono";
	font-style: normal;
	font-weight: 700;
	font-display: swap;
	src: url("/fonts/ibm-plex-mono-latin-700-normal.woff2") format("woff2");
}

:root {
	--paper: #f4f1ea;
	--ink: #16150f;
	--dim: #676253;
	--rule: #cdc6b4;
	--accent: #1f3fd6;
	--slab: #16150f;
	--slab-ink: #f4f1ea;
	--slab-dim: #a8a290;
	--slab-rule: #3a382f;
	--slab-accent: #93a8ff;

	--measure: 864px;
	--gutter: 16px;

	--s1: 0.5rem;
	--s2: 1rem;
	--s3: 1.5rem;
	--s4: 2.5rem;
	--s5: 4rem;
}

/* Dark theme: when the system asks for it and the visitor has not chosen
   light, or when the visitor has chosen dark (see theme.js). */

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--paper: #111110;
		--ink: #e9e5da;
		--dim: #9a9585;
		--rule: #33312b;
		--accent: #93a8ff;
		--slab: #2a2822;
		--slab-ink: #e9e5da;
		--slab-dim: #a8a290;
		--slab-rule: #474438;
	}
}
:root[data-theme="dark"] {
	--paper: #111110;
	--ink: #e9e5da;
	--dim: #9a9585;
	--rule: #33312b;
	--accent: #93a8ff;
	--slab: #2a2822;
	--slab-ink: #e9e5da;
	--slab-dim: #a8a290;
	--slab-rule: #474438;
	color-scheme: dark;
}
:root[data-theme="light"] {
	color-scheme: light;
}

@media (min-width: 480px) {
	:root { --gutter: 24px; }
}
@media (min-width: 800px) {
	:root { --gutter: 32px; }
}

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

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

body {
	margin: 0;
	min-height: 100vh;
	min-height: 100svh;
	display: flex;
	flex-direction: column;
	background: var(--paper);
	color: var(--ink);
	font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 0.9375rem;
	line-height: 1.6;
	font-variant-ligatures: none;
	overflow-wrap: break-word;
	-webkit-font-smoothing: antialiased;
}
@media (min-width: 480px) {
	body { font-size: 1rem; }
}

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

h1,
h2,
p,
ul,
blockquote,
figure {
	margin: 0;
	padding: 0;
	font: inherit;
}
ul {
	list-style: none;
}

/* ---- containers ---------------------------------------------------- */

.page,
.slab-in {
	width: 100%;
	max-width: calc(var(--measure) + 2 * var(--gutter));
	margin-inline: auto;
	padding-inline: var(--gutter);
	container-type: inline-size; /* content box = the column */
}
.page {
	position: relative;
	flex: 1;
	padding-block: var(--s4) var(--s5);
}

/* ---- the lock -------------------------------------------------------
   A block of monospace lines sized so its longest line (--chars
   characters; Plex Mono's advance is 0.6em) is exactly --lock-width
   wide. --col is the width of the column: the container's width where
   container units exist, otherwise a viewport estimate that leaves a
   16px scrollbar allowance so lines stop short instead of clipping.

   From 800px a locked block spans the left column of the content grid
   (5/9 of the column), so the title ends exactly where the links
   column begins. Below that it spans the whole column, up to the width
   the left column has at 800px, so the size is continuous across the
   breakpoint. */

:root {
	--col: min(100vw - 2 * var(--gutter) - 16px, var(--measure));
}
@supports (font-size: 1cqi) {
	:root { --col: 100cqi; }
}

.lock {
	--chars: 18;
	--lock-width: min(var(--col), (800px - 2 * 32px) * 5 / 9);
	font-size: calc(var(--lock-width) / (0.6 * var(--chars)));
	overflow-x: clip;
}
@media (min-width: 800px) {
	.lock { --lock-width: calc(var(--col) * 5 / 9); }
}
.lock .line {
	display: block;
	white-space: nowrap;
}

/* ---- hero ---------------------------------------------------------- */

.hero {
	line-height: 1.1;
	margin-bottom: var(--s4);
}
.hero h1 {
	font-weight: 700;
}
.hero .title {
	font-weight: 400;
	color: var(--dim);
}

/* ---- content ------------------------------------------------------- */

.content {
	border-top: 2px solid var(--ink);
}
.content > * {
	padding-block: var(--s3);
}
.content > * + * {
	border-top: 1px solid var(--rule);
}
.content > :last-child {
	padding-bottom: 0;
}
.content p + p {
	margin-top: var(--s2);
}

h2 {
	color: var(--dim);
	font-weight: 400;
	margin-bottom: var(--s2);
}

.interests li {
	padding-left: 2ch;
	text-indent: -2ch;
}

/* ---- links --------------------------------------------------------- */

a {
	color: inherit;
	padding-block: 0.2em;
	text-decoration: underline;
	text-decoration-color: var(--accent);
	text-decoration-thickness: 2px;
	text-underline-offset: 0.2em;
}
a:hover {
	background: var(--accent);
	color: var(--paper);
	text-decoration-color: transparent;
}
a:focus-visible,
.theme-toggle:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

/* ---- theme toggle: a text button in the link style, top right of the
   column, beside the name ------------------------------------------- */

.theme-toggle {
	position: absolute;
	top: var(--s4);
	right: var(--gutter);
	margin: 0;
	padding: 0.2em 0;
	border: 0;
	border-radius: 0;
	background: none;
	color: var(--ink);
	font: inherit;
	font-size: 0.8125rem;
	letter-spacing: 0.02em;
	line-height: 1.6;
	text-decoration: underline;
	text-decoration-color: var(--accent);
	text-decoration-thickness: 2px;
	text-underline-offset: 0.2em;
	cursor: pointer;
}
.theme-toggle:hover {
	background: var(--accent);
	color: var(--paper);
	text-decoration-color: transparent;
}
.theme-toggle[hidden] {
	display: none;
}

.links a {
	padding-block: 0;
}
.links li {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0 1ch;
	line-height: 2;
}
.links .dots {
	flex: 1 1 1ch;
	min-width: 1ch;
	border-bottom: 1px dotted var(--dim);
	transform: translateY(-0.3em);
}
.links .dest {
	color: var(--dim);
	min-width: 0;
	overflow-wrap: anywhere;
}

/* ---- slab ---------------------------------------------------------- */

.slab {
	background: var(--slab);
	color: var(--slab-ink);
}
.slab-in {
	padding-block: var(--s4) var(--s3);
}
.slab h2 {
	color: var(--slab-dim);
}

.quote blockquote {
	line-height: 1.25;
	color: var(--slab-dim);
}
.quote b {
	font-weight: 700;
	color: var(--slab-ink);
}
.quote figcaption {
	margin-top: var(--s2);
	color: var(--slab-dim);
}

/* The rule that closes the slab, with the validation link beneath it. */
.foot {
	margin-top: var(--s4);
	padding-top: var(--s2);
	border-top: 1px solid var(--slab-rule);
	color: var(--slab-dim);
	font-size: 0.8125rem;
	letter-spacing: 0.02em;
}

/* On the slab the accent is the light cobalt in both themes: the dark
   cobalt is too faint against a dark surface. */
.slab a {
	text-decoration-color: var(--slab-accent);
}
.slab a:hover {
	background: var(--slab-accent);
	color: var(--slab);
	text-decoration-color: transparent;
}
.slab a:focus-visible {
	outline-color: var(--slab-accent);
}

/* The 404 page has no quote: its slab is a plain band. */
.slab-empty {
	height: var(--s5);
}

/* ---- desktop grid: the right column starts at 10/18 of the measure,
   under the "I" of "In" in the hero ---------------------------------- */

@media (min-width: 800px) {
	.content {
		display: grid;
		grid-template-columns: 5fr 4fr;
		grid-template-rows: auto 1fr;
	}
	.intro,
	.interests {
		grid-column: 1;
		margin-right: 6ch;
	}
	.intro {
		grid-row: 1;
		font-size: 1.25rem;
		line-height: 1.5;
		align-self: first baseline;
	}
	.interests {
		grid-row: 2;
	}
	.content > .links {
		grid-column: 2;
		grid-row: 1 / span 2;
		border-top: 0;
		align-self: first baseline;
	}
	.slab-in {
		padding-top: var(--s5);
	}
}

@media print {
	.theme-toggle {
		display: none;
	}
	.slab {
		background: none;
		color: var(--ink);
		border-top: 1px solid var(--ink);
	}
	.slab h2,
	.quote blockquote,
	.quote b,
	.quote figcaption,
	.foot {
		color: var(--ink);
	}
}
