/*
 * How a post looks. Shared, byte for byte, by the public pages and the editor —
 * change it here and the draft you're writing changes with it.
 * Palette matches cpv.sh.
 */

:root {
	color-scheme: light dark;
	--bg: #fbfbfa;
	--fg: #16150f;
	--muted: #79766d;
	--line: #e4e2dc;
	--accent: #c96442;
	--code-bg: #f1f0ec;
	--sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--serif: ui-serif, "Iowan Old Style", "Charter", Georgia, serif;
	--mono: ui-monospace, SFMono-Regular, Menlo, monospace;
	/* Categorical colours for live blocks (kit.series). */
	--s1: #c96442;
	--s2: #2a8c82;
	--s3: #3b6fc4;
	--s4: #b8892b;
	--s5: #8a5cc2;
	--s6: #5c9a3a;
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #141413;
		--fg: #f5f4ef;
		--muted: #8a877d;
		--line: #2b2a27;
		--accent: #e08a6b;
		--code-bg: #1d1d1b;
		--s1: #e08a6b;
		--s2: #4fb8ac;
		--s3: #7aa2ea;
		--s4: #d9ad52;
		--s5: #b08ae0;
		--s6: #86c064;
	}
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--fg);
	font: 16px/1.5 var(--sans);
	-webkit-font-smoothing: antialiased;
}

.post {
	max-width: 680px;
	margin: 0 auto;
	padding: 48px 24px 120px;
}

.post-nav {
	margin-bottom: 12dvh;
	font-size: 15px;
}

.post-nav a {
	color: var(--muted);
	text-decoration: none;
}

.post-nav a:hover {
	color: var(--fg);
}

.post-head {
	margin-bottom: 40px;
}

.post-title {
	margin: 0;
	font-size: clamp(30px, 5vw, 40px);
	line-height: 1.15;
	letter-spacing: -0.025em;
	text-wrap: balance;
}

.post-meta {
	margin: 12px 0 0;
	color: var(--muted);
	font-size: 14px;
	font-variant-numeric: tabular-nums;
}

/* --- Body --------------------------------------------------------------- */

.prose {
	font: 19px/1.7 var(--serif);
	overflow-wrap: break-word;
}

.prose > * {
	margin: 0 0 1.2em;
}

.prose h2,
.prose h3 {
	font-family: var(--sans);
	letter-spacing: -0.015em;
	line-height: 1.3;
	text-wrap: balance;
}

.prose h2 {
	margin-top: 2.2em;
	font-size: 26px;
}

.prose h3 {
	margin-top: 1.8em;
	font-size: 20px;
}

.prose a {
	color: var(--accent);
	text-underline-offset: 3px;
	text-decoration-thickness: 1px;
}

.prose strong,
.prose b {
	font-weight: 650;
}

.prose ul,
.prose ol {
	padding-left: 1.4em;
}

.prose li + li {
	margin-top: 0.35em;
}

.prose blockquote {
	padding-left: 20px;
	border-left: 3px solid var(--accent);
	color: var(--muted);
	font-style: italic;
}

.prose hr {
	border: 0;
	height: 1px;
	margin: 3em 0;
	background: var(--line);
}

.prose code {
	padding: 0.1em 0.35em;
	border-radius: 5px;
	background: var(--code-bg);
	font: 0.82em/1.5 var(--mono);
}

.prose pre {
	margin-left: -20px;
	margin-right: -20px;
	padding: 18px 20px;
	border-radius: 10px;
	background: var(--code-bg);
	font: 14.5px/1.6 var(--mono);
	overflow-x: auto;
	white-space: pre;
	tab-size: 4;
}

.prose pre code {
	padding: 0;
	background: none;
	font: inherit;
}

.prose img {
	display: block;
	max-width: 100%;
	height: auto;
	border-radius: 8px;
}

/* Live blocks: code stored in the post, run in a sandboxed frame by /live/live.js. */
.prose .live {
	margin-top: 2em;
	margin-bottom: 2em;
}

.prose .live-src,
.prose .live[data-name] {
	display: none;
}

.live-frame {
	display: block;
	width: 100%;
	border: 0;
}

@media (max-width: 720px) {
	.prose {
		font-size: 18px;
	}

	.prose pre {
		margin-left: -24px;
		margin-right: -24px;
		border-radius: 0;
	}
}

/* --- Index -------------------------------------------------------------- */

.post-list {
	margin: 40px 0 0;
	padding: 0;
	list-style: none;
}

.post-list a {
	display: flex;
	justify-content: space-between;
	gap: 16px;
	padding: 12px 14px;
	margin: 0 -14px;
	border-radius: 10px;
	color: inherit;
	text-decoration: none;
}

.post-list a:hover {
	background: color-mix(in srgb, var(--accent) 12%, var(--bg));
}

.post-list time {
	color: var(--muted);
	font-size: 14px;
	white-space: nowrap;
}
