@import "@fontsource-variable/newsreader/wght.css";
@import "@fontsource-variable/newsreader/wght-italic.css";
@import "@fontsource-variable/inter/wght.css";
@import "@fontsource-variable/jetbrains-mono/wght.css";

:root {
	--font-serif: "Newsreader Variable", "Iowan Old Style", Georgia, serif;
	--font-sans: "Inter Variable", -apple-system, system-ui, sans-serif;
	--font-mono: "JetBrains Mono Variable", ui-monospace, SFMono-Regular, monospace;

	--reading-width: 64ch;
	--rail-width: 110px;
	--rail-gap: 36px;
}

:root,
:root[data-theme="light"] {
	color-scheme: light;
	--theme-bg: 37deg 47% 93%;
	--theme-text: 28deg 16% 13%;
	--theme-text-muted: 25deg 14% 26%;
	--theme-accent: 17deg 60% 34%;
	--theme-accent-2: 28deg 16% 13%;
	--theme-link: 17deg 60% 34%;
	--theme-quote: 17deg 60% 34%;

	--paper: #fbf6ec;
	--hairline: #d9cfb9;
	--faint: #b8ad9b;
	--accent-soft: rgba(138, 68, 35, 0.1);
	--accent-soft-strong: rgba(138, 68, 35, 0.18);
}

:root[data-theme="dark"] {
	color-scheme: dark;
	--theme-bg: 20deg 9% 7%;
	--theme-text: 42deg 35% 92%;
	--theme-text-muted: 36deg 18% 73%;
	--theme-accent: 30deg 49% 59%;
	--theme-accent-2: 42deg 35% 92%;
	--theme-link: 30deg 49% 59%;
	--theme-quote: 30deg 49% 59%;

	--paper: #1a1715;
	--hairline: #2a2622;
	--faint: #4f4a42;
	--accent-soft: rgba(200, 151, 97, 0.12);
	--accent-soft-strong: rgba(200, 151, 97, 0.22);
}

@media (prefers-reduced-motion: no-preference) {
	.timeline a,
	.work-list a,
	.card,
	.back-link,
	.pag-link,
	.socials a,
	.theme-toggle {
		transition-property: color, background-color, border-color, transform, opacity;
		transition-duration: 0.18s;
		transition-timing-function: ease;
	}
	.timeline a:active,
	.work-list a:active,
	.card:active {
		transform: scale(0.992);
		opacity: 0.85;
	}
	.theme-toggle:active {
		transform: scale(0.96);
	}
}

.section-label {
	font-family: var(--font-sans);
	font-size: 11.5px;
	font-weight: 500;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: hsl(var(--theme-text) / 0.72);
	margin-bottom: 36px;
}

@media (max-width: 420px) {
	.section-label {
		margin-bottom: 26px;
	}
}

.timeline {
	display: grid;
	grid-template-columns: var(--rail-width) 1fr;
	column-gap: var(--rail-gap);
	position: relative;
}
.timeline::before {
	content: "";
	position: absolute;
	left: calc(var(--rail-width) - 0.5px);
	top: 6px;
	bottom: 6px;
	width: 1px;
	background-color: var(--hairline);
	transition: background-color 0.35s ease;
}
.timeline > .post {
	display: contents;
}
.timeline .post-rail {
	position: relative;
	--rail-pad-top: 4px;
	--rail-date-size: 11.5px;
	--rail-date-lh: 1.4;
	padding-top: var(--rail-pad-top);
	padding-right: 18px;
	text-align: right;
}
.timeline .post-date {
	font-family: var(--font-mono);
	font-size: var(--rail-date-size);
	color: hsl(var(--theme-text) / 0.72);
	letter-spacing: -0.01em;
	line-height: var(--rail-date-lh);
	white-space: nowrap;
	font-weight: 500;
	font-variant-numeric: tabular-nums;
	font-feature-settings: "tnum";
	transition: color 0.2s ease;
}
.timeline .post-dot {
	--rail-dot-size: 9px;
	position: absolute;
	right: calc(-0.5 * var(--rail-dot-size));
	top: calc(var(--rail-pad-top) + 0.5lh);
	line-height: var(--rail-date-lh);
	transform: translateY(-50%);
	width: var(--rail-dot-size);
	height: var(--rail-dot-size);
	border-radius: 50%;
	background: hsl(var(--theme-bg));
	border: 1.5px solid var(--faint);
	transition: background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
	z-index: 1;
}
.timeline .post-body {
	padding-bottom: 38px;
}
.timeline .post-title {
	font-family: var(--font-serif);
	font-weight: 500;
	font-size: 18.5px;
	color: hsl(var(--theme-text));
	line-height: 1.3;
	letter-spacing: -0.012em;
	margin: 0 0 6px;
	text-wrap: balance;
	word-wrap: break-word;
	overflow-wrap: anywhere;
	transition: color 0.2s ease;
}
.timeline a:hover .post-title {
	color: hsl(var(--accent, var(--theme-accent)));
}
.timeline a:hover .post-dot {
	border-color: hsl(var(--accent, var(--theme-accent)));
	background: hsl(var(--accent, var(--theme-accent)));
	box-shadow: 0 0 0 3px hsl(var(--theme-bg));
}
.timeline a:hover .post-date {
	color: hsl(var(--theme-text-muted));
}
.timeline .post-preview {
	font-size: 16px;
	line-height: 1.55;
	color: hsl(var(--theme-text) / 0.72);
	margin: 0;
	max-width: 58ch;
	word-wrap: break-word;
	overflow-wrap: anywhere;
	display: -webkit-box;
	-webkit-line-clamp: 1;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.timeline a:focus-visible {
	outline: 2px solid hsl(var(--accent, var(--theme-accent)));
	outline-offset: 4px;
	border-radius: 4px;
}

@media (max-width: 720px) {
	.timeline {
		display: block;
	}
	.timeline::before {
		display: none;
	}
	.timeline > .post {
		display: block;
		padding-bottom: 32px;
	}
	.timeline .post-rail {
		text-align: left;
		padding: 0 0 6px 0;
	}
	.timeline .post-dot {
		display: none;
	}
	.timeline .post-body {
		padding-bottom: 0;
	}
}

@media (max-width: 420px) {
	.timeline .post-title {
		font-size: 17px;
	}
	.timeline .post-preview {
		font-size: 15px;
	}
	.timeline .post-date {
		font-size: 11px;
	}
}

.work-list {
	list-style: none;
	padding: 0;
	margin: 0;
}
.work-list li {
	padding: 22px 0;
	border-top: 1px solid var(--hairline);
	transition: border-color 0.35s ease;
}
.work-list li:last-child {
	border-bottom: 1px solid var(--hairline);
}
.work-list a {
	text-decoration: none;
	color: inherit;
	display: block;
}
.work-list a:focus-visible {
	outline: 2px solid hsl(var(--accent, var(--theme-accent)));
	outline-offset: 4px;
	border-radius: 4px;
}
.work-list .head {
	display: flex;
	align-items: baseline;
	gap: 14px;
	flex-wrap: wrap;
	margin-bottom: 6px;
}
.work-list .name {
	font-family: var(--font-serif);
	font-size: 21px;
	font-weight: 600;
	letter-spacing: -0.012em;
	color: hsl(var(--theme-text));
	transition: color 0.2s ease;
	word-wrap: break-word;
	overflow-wrap: anywhere;
}
.work-list a:hover .name {
	color: hsl(var(--accent, var(--theme-accent)));
}
.work-list .stack {
	font-family: var(--font-mono);
	font-size: 11px;
	color: hsl(var(--theme-text) / 0.72);
	font-variant-numeric: tabular-nums;
	font-feature-settings: "tnum";
}
.work-list .badge {
	font-family: var(--font-mono);
	font-size: 10px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: hsl(var(--accent, var(--theme-accent)));
	background: var(--accent-soft);
	padding: 2px 8px;
	border-radius: 2px;
	margin-left: auto;
}
.work-list p {
	font-size: 16px;
	color: hsl(var(--theme-text-muted));
	margin: 6px 0 0;
	line-height: 1.55;
	word-wrap: break-word;
	overflow-wrap: anywhere;
}

@media (max-width: 420px) {
	.work-list .name {
		font-size: 17.5px;
	}
	.work-list p {
		font-size: 15px;
	}
}

@media (prefers-reduced-motion: no-preference) {
	@keyframes intro-fade-up {
		from { opacity: 0; transform: translateY(6px); }
		to { opacity: 1; transform: none; }
	}
	.timeline > .post .post-rail,
	.timeline > .post .post-body,
	.work-list > li,
	.hero > *,
	.section-label,
	.page-head > * {
		animation: intro-fade-up 380ms cubic-bezier(0.2, 0.6, 0.2, 1) both;
		animation-delay: calc(var(--i, 0) * 55ms);
	}
	.work-list > li:nth-child(1) { --i: 1; }
	.work-list > li:nth-child(2) { --i: 2; }
	.work-list > li:nth-child(3) { --i: 3; }
	.work-list > li:nth-child(4) { --i: 4; }
	.work-list > li:nth-child(5) { --i: 5; }
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after {
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		scroll-behavior: auto !important;
	}
}

.prose {
	max-width: var(--reading-width);
	margin: 0;
	color: hsl(var(--theme-text));
	font-size: 17.5px;
	line-height: 1.75;
}
.prose > p:first-of-type::first-letter {
	font-family: var(--font-serif);
	font-style: italic;
	font-weight: 500;
	color: hsl(var(--accent, var(--theme-accent)));
	float: left;
	font-size: 3.6em;
	line-height: 0.92;
	padding: 4px 10px 0 0;
	margin-top: 4px;
}
.prose h2 {
	font-family: var(--font-serif);
	font-weight: 500;
	font-size: 27px;
	line-height: 1.22;
	letter-spacing: -0.014em;
	margin: 56px 0 20px;
}
.prose h3 {
	font-family: var(--font-serif);
	font-weight: 500;
	font-style: italic;
	font-size: 20px;
	line-height: 1.3;
	margin: 38px 0 14px;
}
.prose p {
	margin: 0 0 24px;
}
.prose a {
	color: hsl(var(--theme-text));
	text-decoration: underline;
	text-decoration-color: hsl(var(--theme-text) / 0.35);
	text-underline-offset: 3px;
	transition: color 0.2s ease, text-decoration-color 0.2s ease;
}
.prose a:hover {
	color: hsl(var(--accent, var(--theme-accent)));
	text-decoration-color: hsl(var(--accent, var(--theme-accent)));
}
.prose :not(pre) > code {
	font-family: var(--font-mono);
	font-size: 14.5px;
	background: var(--paper);
	border: 1px solid var(--hairline);
	padding: 1px 6px;
	border-radius: 3px;
	color: hsl(var(--theme-text-muted));
}
.prose pre {
	background: var(--paper);
	border: 1px solid var(--hairline);
	border-radius: 4px;
	padding: 16px;
	margin: 28px 0;
	overflow-x: auto;
	font-size: 14px;
	line-height: 1.7;
}
.prose pre code {
	background: transparent;
	border: 0;
	padding: 0;
	font-size: inherit;
	color: inherit;
}
.prose ul, .prose ol {
	margin: 0 0 28px;
	padding-left: 22px;
}
.prose li {
	font-size: 17.5px;
	line-height: 1.7;
	margin-bottom: 10px;
}
.prose blockquote {
	margin: 28px 0;
	padding: 4px 0 4px 22px;
	border-left: 2px solid hsl(var(--accent, var(--theme-accent)));
	font-style: italic;
	color: hsl(var(--theme-text-muted));
	font-size: 18px;
	line-height: 1.65;
}
.prose blockquote p { margin: 0 0 12px; }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose hr {
	border: 0;
	height: 1px;
	background: var(--hairline);
	margin: 40px 0;
}
.prose img {
	max-width: 100%;
	height: auto;
	border: 1px solid var(--hairline);
	background: var(--paper);
}

@media (max-width: 720px) {
	.prose { font-size: 17px; }
	.prose h2 { font-size: 23px; margin: 44px 0 16px; }
	.prose h3 { font-size: 18.5px; margin: 30px 0 12px; }
}
@media (max-width: 420px) {
	.prose { font-size: 16px; }
	.prose h2 { font-size: 20px; margin: 36px 0 14px; }
	.prose blockquote { padding-left: 16px; font-size: 16.5px; }
}

.back-link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-family: var(--font-mono);
	font-size: 11px;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: hsl(var(--theme-text) / 0.72);
	margin-bottom: 32px;
}
.back-link:hover { color: hsl(var(--accent, var(--theme-accent))); opacity: 1; }

.page-head { margin-bottom: 40px; }
.page-head__eyebrow {
	font-family: var(--font-mono);
	font-size: 11.5px;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: hsl(var(--theme-text) / 0.55);
	margin-bottom: 22px;
	font-variant-numeric: tabular-nums;
	font-feature-settings: "tnum";
}
.page-head__title {
	font-family: var(--font-serif);
	font-weight: 500;
	font-size: clamp(28px, 5.5vw, 46px);
	letter-spacing: -0.022em;
	line-height: 1.1;
	margin: 0 0 12px;
}
.page-head__sub {
	font-family: var(--font-serif);
	font-style: italic;
	font-size: 16.5px;
	color: hsl(var(--theme-text-muted));
	margin: 0;
	line-height: 1.5;
}

@media (max-width: 420px) {
	.page-head__eyebrow { font-size: 11px; }
	.page-head__title { font-size: 26px; }
	.page-head__sub { font-size: 15.5px; }
}
