@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:wght@400;500;800&family=Open+Sans:wght@400;500;600&display=swap');

/* --------------------------------------------------------------------------
   Theme variables. The <head> script sets data-theme before first paint.
   Light palette is lifted straight from the resume; dark is a matched variant.
   -------------------------------------------------------------------------- */
:root, :root[data-theme="light"] {
	--bg:            hsl(0, 0%, 100%);
	--surface:       hsl(210, 40%, 99%);
	--text-primary:  hsl(216.8, 88.6%, 13.7%);
	--text-secondary:hsl(204.4, 48.5%, 25.9%);
	--text-tertiary: hsl(204.8, 19%, 52.5%);
	--accent:        hsl(205, 85%, 42%);
	--border:        hsl(210, 22%, 88%);
	--code-bg:       hsl(210, 33%, 96%);
	--tag-bg:        hsl(208, 45%, 94%);
	--shadow:        0 1px 3px hsl(216 40% 20% / 0.08), 0 8px 24px hsl(216 40% 20% / 0.06);
}
:root[data-theme="dark"] {
	--bg:            hsl(217, 33%, 9%);
	--surface:       hsl(217, 28%, 12%);
	--text-primary:  hsl(210, 40%, 96%);
	--text-secondary:hsl(208, 22%, 82%);
	--text-tertiary: hsl(206, 14%, 62%);
	--accent:        hsl(205, 90%, 70%);
	--border:        hsl(215, 20%, 22%);
	--code-bg:       hsl(217, 27%, 14%);
	--tag-bg:        hsl(213, 30%, 18%);
	--shadow:        0 1px 3px hsl(0 0% 0% / 0.4), 0 8px 24px hsl(0 0% 0% / 0.3);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
	margin: 0;
	font-family: "Open Sans", system-ui, sans-serif;
	font-size: 16px;
	line-height: 1.65;
	color: var(--text-secondary);
	background: var(--bg);
	-webkit-font-smoothing: antialiased;
	transition: background-color 0.2s ease, color 0.2s ease;
}

h1, h2, h3, h4 {
	font-family: "EB Garamond", Georgia, serif;
	color: var(--text-primary);
	line-height: 1.2;
}

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

/* --------------------------------------------------------------------------
   Signature section rule: EB Garamond heading with a hairline trailing off
   to the right, echoing the resume's cross-lined section titles.
   -------------------------------------------------------------------------- */
.crossline {
	display: flex;
	align-items: center;
	font-weight: 800;
	font-size: 1.6rem;
	margin: 0 0 1rem;
}
.crossline::before,
.crossline::after {
	content: "";
	height: 1px;
	background: currentColor;
	opacity: 0.85;
}
.crossline::before {   /* short stub cutting through to the left of the text */
	flex: none;
	width: 1.25ch;
	margin-right: 1ch;
}
.crossline::after {    /* rule trailing off to the right edge */
	flex: 1;
	margin-left: 1ch;
}

/* --------------------------------------------------------------------------
   Site chrome: header, nav, footer
   -------------------------------------------------------------------------- */
.site-header, .site-footer {
	max-width: 820px;
	margin: 0 auto;
	padding: 1.25rem 1.5rem;
	display: flex;
	align-items: center;
	justify-content: space-between;
}
.site-title {
	font-family: "EB Garamond", serif;
	font-weight: 800;
	font-size: 1.35rem;
	color: var(--text-primary);
}
.site-header nav { display: flex; align-items: center; gap: 1.25rem; }
.site-header nav a { color: var(--text-tertiary); font-size: 0.95rem; }
.site-header nav a:hover { color: var(--accent); text-decoration: none; }

#theme-toggle {
	font: inherit;
	font-size: 1.1rem;
	line-height: 1;
	width: 2rem; height: 2rem;
	display: grid; place-items: center;
	background: var(--surface);
	color: var(--text-secondary);
	border: 1px solid var(--border);
	border-radius: 999px;
	cursor: pointer;
	transition: border-color 0.15s, color 0.15s;
}
#theme-toggle:hover { color: var(--accent); border-color: var(--accent); }

.site-footer {
	margin-top: 4rem;
	border-top: 1px solid var(--border);
	color: var(--text-tertiary);
	font-size: 0.9rem;
}
.footer-links { display: flex; gap: 1.25rem; }
.footer-links a { color: var(--text-tertiary); }

main { max-width: 820px; margin: 0 auto; padding: 1rem 1.5rem; }

/* --------------------------------------------------------------------------
   Home: about + project listing
   -------------------------------------------------------------------------- */
.home section { margin-bottom: 3rem; }
.about .prose { color: var(--text-secondary); }

.post-list { list-style: none; margin: 0; padding: 0; }
.post-list li { margin-bottom: 0.5rem; }
.post-link {
	display: block;
	padding: 1rem 1.15rem;
	border: 1px solid transparent;
	border-radius: 10px;
	color: inherit;
	transition: background 0.15s, border-color 0.15s;
}
.post-link:hover {
	background: var(--surface);
	border-color: var(--border);
	text-decoration: none;
}
.post-head {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 1rem;
}
.post-head h2 { margin: 0; font-size: 1.3rem; font-weight: 500; }
.post-head time { color: var(--text-tertiary); font-size: 0.85rem; white-space: nowrap; }
.post-summary { margin: 0.4rem 0 0.6rem; color: var(--text-secondary); font-size: 0.95rem; }

.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tag {
	font-size: 0.75rem;
	color: var(--text-tertiary);
	background: var(--tag-bg);
	padding: 0.1rem 0.55rem;
	border-radius: 999px;
}

/* --------------------------------------------------------------------------
   Post / prose typography
   -------------------------------------------------------------------------- */
.post-header { margin-bottom: 2rem; }
.post-header h1 { font-size: 2.4rem; font-weight: 800; margin: 0 0 0.5rem; }
.post-header time { color: var(--text-tertiary); font-size: 0.9rem; }
.post-header .tags { margin-top: 0.75rem; }

.prose { font-size: 1.02rem; }
.prose h1 { font-size: 1.9rem; font-weight: 800; margin: 2.2rem 0 0.8rem; }
.prose h2 { font-size: 1.5rem; font-weight: 800; margin: 2rem 0 0.7rem; }
.prose h3 { font-size: 1.2rem; font-weight: 600; margin: 1.6rem 0 0.5rem; }
.prose p, .prose ul, .prose ol { margin: 0.9rem 0; }
.prose img { max-width: 100%; height: auto; border-radius: 8px; display: block; margin: 1.5rem auto; }
.prose img + em, .prose img + _ { display: block; }
.prose em { color: var(--text-tertiary); }
.prose blockquote {
	margin: 1.2rem 0;
	padding: 0.2rem 1.1rem;
	border-left: 3px solid var(--accent);
	color: var(--text-tertiary);
}
.prose canvas, .prose svg { max-width: 100%; }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

/* inline + block code */
.prose code {
	font-family: ui-monospace, "SF Mono", Menlo, monospace;
	font-size: 0.88em;
	background: var(--code-bg);
	padding: 0.12em 0.4em;
	border-radius: 4px;
}
.prose pre {
	background: var(--code-bg);
	border: 1px solid var(--border);
	border-radius: 8px;
	padding: 1rem 1.15rem;
	overflow-x: auto;
	line-height: 1.5;
}
.prose pre code { background: none; padding: 0; font-size: 0.85rem; }
.codehilite { background: none !important; }

/* footnotes */
.footnote { font-size: 0.9rem; color: var(--text-tertiary); }

.back { margin-top: 3rem; }
.back a { color: var(--text-tertiary); }

/* --------------------------------------------------------------------------
   Resume — ported from the original resume stylesheet, made theme-aware.
   Screen: a centered "sheet". Print: faithful A4 with the original margins.
   -------------------------------------------------------------------------- */
.resume main { max-width: 900px; }
.sheet {
	--page-width: 210mm;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 10px;
	box-shadow: var(--shadow);
	padding: 2.5rem 3rem;
	font-size: 11pt;
}
.sheet h1, .sheet h2 { color: var(--text-primary); }
.sheet section { margin-top: 1.9rem; }
.sheet section:first-of-type { margin-top: 0; }
.sheet .pagebreak + section { margin-top: 1.9rem; }
.sheet .crossline { font-size: 1.3rem; margin-bottom: 0.6rem; }

.resume-header {
	display: grid;
	grid-template-columns: 1fr min-content;
	gap: 1rem;
	margin-bottom: 1.5rem;
}
.resume-header h1 { font-size: 1.9rem; font-weight: 800; margin: 0; }
.resume-header .tagline { color: var(--text-tertiary); }
.contact-info { list-style: none; margin: 0; padding: 0; }
.contact-info li { display: flex; align-items: center; gap: 0.6ch; font-size: 0.8rem; margin-bottom: 0.5ch; }
.contact-info .icon { width: 13px; height: 13px; color: var(--text-tertiary); flex: none; }
.contact-info a { color: var(--text-primary); }

.skills { list-style: none; display: grid; grid-template-columns: 1fr 1fr 1fr; margin: 0; padding: 0; gap: 0.15rem 1rem; }
.skills li.bold { font-weight: 700; color: var(--text-primary); }

.listing ul { list-style: none; padding: 0; margin: 0; }
.listing > ul > li { break-inside: avoid; margin-bottom: 0.6rem; }
.listing h2 { margin: 0; font-size: 1em; font-family: "Open Sans", sans-serif; font-weight: 600; }
.listing .employer { color: var(--text-tertiary); font-size: 10pt; }
.listing .employer::after { content: ','; margin-right: 0.5ch; }
.listing .duration { color: var(--text-tertiary); font-size: 10pt; }
.listing .duration::after { content: "\a"; white-space: pre; }
.listing .points { margin: 0.15rem 0 0 2ch; }
.listing .points li { position: relative; }
.listing .points li::before {
	content: "\2192";           /* → */
	position: absolute;
	left: -1.6ch;
	color: var(--text-tertiary);
}
.pagebreak { break-before: page; }

@media (max-width: 620px) {
	.skills { grid-template-columns: 1fr 1fr; }
	.resume-header { grid-template-columns: 1fr; }
	.sheet { padding: 1.75rem 1.5rem; }
	.post-head { flex-direction: column; gap: 0.15rem; }
}

/* Print: reproduce the original PDF layout. Cmd-P -> Save as PDF. */
@media print {
	@page { size: A4; margin: 0.5in; }
	.site-header, .site-footer, .back { display: none !important; }
	body { background: #fff; color: #000; font-size: 11pt; }
	.resume main, main { max-width: none; margin: 0; padding: 0; }
	.sheet {
		background: #fff; color: #000;
		border: none; border-radius: 0; box-shadow: none; padding: 0;
	}
	.sheet h1, .sheet h2, .contact-info a { color: #000; }
	.sheet .tagline, .listing .employer, .listing .duration, .contact-info .icon,
	.listing .points li::before { color: #333; }
	.crossline::after { opacity: 1; background: #000; }
	.pagebreak { break-before: page; }
	.listing > ul > li { break-inside: avoid; }
	a { color: #000; }
}
