:root {
	--bg: #fff;
	--text: #000;
	--accent: #9a6e1a;
	--link: #b07818;

	--col-text: 420px;
	--col-gap: 3rem;

	--ratio: 1.25;
	--scale-min: 1.0625rem;
	--scale-h4: calc(var(--scale-min) * var(--ratio));
	--scale-h3: calc(var(--scale-h4) * var(--ratio));
	--scale-h2: calc(var(--scale-h3) * var(--ratio));
	--scale-h1: calc(var(--scale-h2) * var(--ratio));
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
	scroll-behavior: smooth;
	background-color: #f8f8f8;
	background-image: url("grid.svg");
	background-size: 80px 80px;
	animation: grid-drift 20s linear infinite;
}

@keyframes grid-drift {
	from { background-position: 0 0; }
	to   { background-position: 0 80px; }
}

body {
	max-width: 1100px;
	margin: 0 auto;
	padding: 0 2rem;
	line-height: 1.7;

	font-size: var(--scale-min);
	font-family: 'Inter', system-ui, sans-serif;
	color: var(--text);
}

a {
	color: var(--link);
	text-decoration: none;
	transition: color 0.2s ease;
}
a:hover { color: var(--accent); }

nav a { color: var(--text); }

h1, h2, h3 {
	font-family: 'Source Serif 4', Georgia, serif;
	font-optical-sizing: auto;
}
h1 {
	font-size: clamp(2.5rem, 6vw, 5.5rem);
	font-weight: 700;
	line-height: 1.0;
	margin-bottom: 0;
}
h2 {
	font-size: var(--scale-h2);
	font-weight: 600;
	line-height: 1.15;
	margin-bottom: 0.65rem;
}
h3 {
	font-size: var(--scale-h3);
	font-weight: 600;
	line-height: 1.2;
	margin-bottom: 0.5rem;
}

.logo {
	font-size: var(--scale-h3);
	font-family: 'Source Serif 4', Georgia, serif;
	font-weight: 600;
	color: var(--text);
}
.logo:hover { color: var(--text); }

header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 2rem 0;
}

footer {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 2rem 0;
}

#nav-toggle { display: none; }
.burger { display: none; }

nav ul {
	display: flex;
	gap: 1.5rem;
	list-style: none;
}

main {
	display: grid;
	grid-template-columns: var(--col-text) 1fr;
	gap: 0 var(--col-gap);
}

.headline {
	grid-column: 1 / -1;
	padding: 3rem 0 5rem;
}

.section-row {
	grid-column: 1 / -1;
	display: grid;
	grid-template-columns: var(--col-text) 1fr;
	grid-template-areas: "body label";
	gap: 0 var(--col-gap);
	padding: 1rem 0 3rem;
}

.section-label-row + .section-row {
	padding-top: 0.5rem;
}

.section-label {
	grid-area: label;
	text-transform: uppercase;
	color: #aaa;
	font-size: var(--scale-h4);
}

.section-label-row {
	grid-column: 1 / -1;
	display: grid;
	grid-template-columns: var(--col-text) 1fr;
	grid-template-areas: ". label";
	gap: 0 var(--col-gap);
	padding-top: 3rem;
	padding-bottom: 1.5rem;
}

.section-body {
	grid-area: body;
}

.section-video {
	grid-area: label;
	align-self: center;
}

.section-video iframe {
	width: 100%;
	height: 280px;
	border: none;
}

article + article {
	margin-top: 2rem;
}

.article .prose-meta,
.article article {
	grid-column: 1 / -1;
	min-width: 0;
}

.article article {
	max-width: 50ch;
}

.article .headline {
	padding-bottom: 1rem;
}

.article .prose-meta time {
	color: #aaa;
	font-size: var(--scale-h4);
	font-weight: 300;
}

.article article {
	margin-top: 2.5rem;
}

.prose-body p + p {
	margin-top: 1.2rem;
}

.prose-body h2,
.prose-body h3 {
	margin-top: 2rem;
}

.prose-body blockquote {
	border-left: 3px solid var(--accent);
	padding: 0.5rem 1.25rem;
	margin: 1.5rem 0;
	color: #aaa;
}

.prose-body .footnotes {
	margin-top: 3rem;
}

.prose-body .footnotes ol {
	margin-top: 1rem;
}

.prose-body code {
	background: #f0f0f0;
	padding: 0.1em 0.35em;
	border-radius: 3px;
	font-size: 0.9em;
}

.prose-body pre {
	background: rgba(255, 255, 255, 0.5);
	padding: 0.65rem 1.25rem;
	border-radius: 4px;
	overflow-x: auto;
	font-size: 0.9em;
	width: calc(80ch + 2.6rem);
	margin: 1.2rem 0;
}

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

.writing-index article + article {
	margin-top: 2.5rem;
}

.writing-index article a {
	display: block;
	color: var(--text);
	font-size: var(--scale-h2);
	line-height: 1.2;
}

.writing-index article a:hover {
	color: var(--accent);
}

.writing-index article a:hover time {
	color: #aaa;
}

.writing-index .article-meta {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	margin-top: 0.35rem;
}

.writing-index article time {
	color: #aaa;
	font-size: var(--scale-h4);
	font-weight: 300;
}

.writing-index .section-tag {
	font-size: 0.75rem;
	font-weight: 400;
	color: #aaa;
	background: #f5f5f5;
	padding: 0.1rem 0.45rem;
	border-radius: 3px;
}

p {
	color: #444;
}

p + p {
	margin-top: 0.6rem;
}

.social-links {
	display: flex;
	gap: 1.25rem;
}

.section-body .social-links {
	margin-top: 1rem;
}

.social-links a {
	display: flex;
}

.social-icon {
	width: 1.5rem;
	height: 1.5rem;
	opacity: 0.75;
	transition: opacity 0.2s ease;
}

.social-links a:hover .social-icon {
	opacity: 1;
}

.conclusion {
	margin-top: 1.0rem;
	font-size: var(--scale-h4);
	font-weight: 500;
	font-style: italic;
	color: var(--text);
}

@media (max-width: 720px) {
	header { flex-wrap: wrap; }

	.logo { flex: 1; }

	.burger {
		display: flex;
		flex-direction: column;
		gap: 5px;
		cursor: pointer;
	}
	.burger span {
		display: block;
		width: 22px;
		height: 2px;
		background: var(--text);
		transition: transform 0.2s ease, opacity 0.2s ease;
	}
	#nav-toggle:checked ~ .burger {
		& span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
		& span:nth-child(2) { opacity: 0; }
		& span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
	}

	header nav {
		display: none;
		width: 100%;
		border-top: 1px solid #ccc;
		border-bottom: 1px solid #ccc;
		padding: 1rem 0;
		margin-top: 1rem;
	}

	#nav-toggle:checked ~ nav { display: block; }
	#nav-toggle:checked ~ nav ul {
		flex-direction: column;
		gap: 0.75rem;
	}

	main {
		grid-template-columns: 1fr;
	}

	.section-label-row {
		grid-template-columns: 1fr;
		grid-template-areas: "label";
	}

	.section-row {
		grid-template-columns: 1fr;
		grid-template-areas: "body" "label";
		gap: 0.75rem 0;
	}

	.prose-body pre {
		width: auto;
	}
}
