@font-face {
	font-family: "Latin Modern Roman";
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url("/fonts/lmroman10-regular.woff2") format("woff2");
}
@font-face {
	font-family: "Latin Modern Roman";
	font-style: italic;
	font-weight: 400;
	font-display: swap;
	src: url("/fonts/lmroman10-italic.woff2") format("woff2");
}
@font-face {
	font-family: "Latin Modern Roman";
	font-style: normal;
	font-weight: 700;
	font-display: swap;
	src: url("/fonts/lmroman10-bold.woff2") format("woff2");
}

/* KaTeX_Main, for the \text{proofs} rendered by KaTeX at build time. */
@font-face {
	font-family: "KaTeX_Main";
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url("/fonts/KaTeX_Main-Regular.woff2") format("woff2");
}

:root {
	--bg: #f6f4ee;
	--fg: #0b1020;
	--muted: #5d5d66;
	--rule: #dcd9d0;
	--accent: #2f6bff;
	--gold: #e8b04b;
	--serif: "Latin Modern Roman", "CMU Serif", "Computer Modern", "STIX Two Text", Georgia, "Times New Roman", serif;
	color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #0b1020;
		--fg: #f6f4ee;
		--muted: #a2a4b3;
		--rule: #24293d;
		--accent: #7ea1ff;
	}
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
	background: var(--bg);
	color: var(--fg);
	font-family: var(--serif);
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

/* Animated conformal map, behind everything. */
.plane {
	position: fixed;
	inset: 0;
	width: 100%;
	height: 100%;
	z-index: -1;
	pointer-events: none;
}

.page {
	min-height: 100vh;
	min-height: 100dvh;
	display: flex;
	flex-direction: column;
	max-width: 72rem;
	margin: 0 auto;
	padding: 1.25rem 1rem;
}

/* Header and nav */
.top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
}

.brand {
	display: inline-flex;
	align-items: center;
	gap: 0.6rem;
	color: inherit;
	text-decoration: none;
	font-size: 1.35rem;
	letter-spacing: 0.01em;
}

.brand svg { width: 2.1rem; height: 2.1rem; flex: none; }

.nav {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	font-size: 1.15rem;
}

.nav a {
	color: inherit;
	text-decoration: none;
	padding: 0.2rem 0.1rem;
	border-bottom: 1px solid transparent;
}

.nav a:hover, .nav a:focus-visible, .nav a[aria-current="page"] {
	border-bottom-color: var(--accent);
}

.nav .sep { color: var(--muted); }

/* Hero */
.hero {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	padding: 3rem 0 6rem;
}

.hero h1 {
	margin: 0 0 1rem;
	font-weight: 400;
	font-size: clamp(2.4rem, 7vw, 4.75rem);
	line-height: 1.05;
	letter-spacing: -0.005em;
	text-wrap: balance;
}

.hero .tagline {
	margin: 0 0 2.25rem;
	max-width: 60ch;
	font-size: clamp(1.2rem, 2.6vw, 1.65rem);
	font-style: italic;
	color: var(--muted);
	text-wrap: balance;
}

/* Static KaTeX output (subset of katex.min.css). */
.katex {
	font: normal 1.21em KaTeX_Main, math, "Times New Roman", serif;
	line-height: 1.2;
	position: relative;
	text-indent: 0;
	text-rendering: auto;
	white-space: nowrap;
}
.katex .katex-mathml {
	border: 0;
	clip-path: inset(50%);
	height: 1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
}
.katex .katex-base { position: relative; white-space: nowrap; width: min-content; }
.katex .katex-strut { display: inline-block; }
.katex .mord.text { font-style: normal; }

.tagline .code {
	font-family: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
	font-style: normal;
	font-size: 0.88em;
	padding: 0.05em 0.35em;
	border-radius: 0.3em;
	background: color-mix(in srgb, var(--fg) 8%, transparent);
	color: var(--fg);
}

.cta {
	display: inline-block;
	padding: 0.75rem 1.6rem;
	border: 1.5px solid var(--fg);
	border-radius: 999px;
	color: var(--fg);
	background: color-mix(in srgb, var(--bg) 80%, transparent);
	backdrop-filter: blur(4px);
	text-decoration: none;
	font-size: 1.2rem;
	transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}

.cta:hover, .cta:focus-visible {
	background: var(--fg);
	color: var(--bg);
	border-color: var(--fg);
}

/* About page */
.prose {
	flex: 1;
	max-width: 46rem;
	width: 100%;
	margin: 0 auto;
	padding: 3rem 0 4rem;
}

.prose h1 { margin: 0 0 1rem; font-weight: 400; font-size: clamp(2rem, 5vw, 3rem); line-height: 1.1; }

.lede {
	margin: 0 0 2rem;
	font-size: 1.25rem;
	color: var(--muted);
}

.card {
	border: 1.5px solid color-mix(in srgb, var(--muted) 45%, transparent);
	border-radius: 18px;
	padding: 1.25rem 1.5rem 1.25rem;
	background: color-mix(in srgb, var(--bg) 85%, transparent);
	backdrop-filter: blur(6px);
}

.card + .card { margin-top: 1.5rem; }

.card-head {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 1rem;
	margin: 0 0 1.25rem;
}

.card-title { margin: 0; font-size: 1.05rem; color: var(--muted); }

.open { color: var(--accent); text-decoration: none; }
.open:hover { text-decoration: underline; }

.diagram {
	display: block;
	width: 100%;
	max-width: 36rem;
	height: auto;
	margin: 0 auto;
	overflow: visible;
}

.diagram .word { font-family: var(--serif); font-size: 72px; fill: var(--fg); }
.diagram .label { font-family: var(--serif); font-size: 18px; fill: var(--muted); }
.diagram .arrow, .diagram .head { fill: none; stroke: var(--accent); stroke-width: 2.25; stroke-linecap: round; stroke-linejoin: round; }
.diagram .node { fill: none; stroke: var(--rule); stroke-width: 1.5; }
.diagram .glyph { fill: none; stroke: var(--fg); stroke-width: 1.75; stroke-linejoin: round; }
.diagram .dot { fill: var(--fg); }

.cards .flash { fill: var(--bg); stroke: color-mix(in srgb, var(--muted) 60%, transparent); stroke-width: 1.5; }
.cards .flash.front { stroke: var(--accent); stroke-width: 2; }
.cards .corner { font-family: var(--serif); font-size: 16px; fill: var(--muted); }
.cards .keyword { font-family: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, monospace; font-size: 30px; fill: var(--fg); }

.how {
	list-style: none;
	margin: 1.5rem 0 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
	gap: 1.5rem;
}

.how li { display: flex; gap: 0.75rem; }
.n { color: var(--accent); padding-top: 0.15rem; }
.how h2 { margin: 0 0 0.25rem; font-size: 1.15rem; font-weight: 700; }
.how p { margin: 0; color: var(--muted); }

.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/* Terms and contact pages */
.legal { font-size: 1.1rem; }
.legal h2 { margin: 2rem 0 0.5rem; font-size: 1.3rem; font-weight: 700; scroll-margin-top: 1rem; }
.legal h2:first-child, .legal .toc + h2 { margin-top: 0.5rem; }
.legal p { margin: 0 0 0.85rem; }
.legal ul { margin: 0 0 0.85rem; padding-left: 1.25rem; }
.legal li { margin: 0 0 0.4rem; }
.legal a { color: var(--accent); }
.legal .email { margin: 0 0 1rem; font-size: 1.5rem; }

.toc { margin: 0 0 1.75rem; padding: 0 0 1.25rem; border-bottom: 1px solid var(--rule); }
.toc ol { margin: 0; padding-left: 1.5rem; columns: 2 14rem; column-gap: 2rem; }
.toc li { margin: 0 0 0.2rem; }

footer {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	column-gap: 1rem;
	font-size: 0.95rem;
	color: var(--muted);
}

footer p { margin: 0.5rem 0; }
footer a { color: inherit; }
footer .links { display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; }

@media (max-width: 480px) {
	.hero { padding: 2rem 0 4rem; }
	.brand span { font-size: 1.15rem; }
	.nav { gap: 0.35rem; font-size: 1rem; }
}

@media (max-width: 360px) {
	.brand span { display: none; }
}
