/* ==========================================================================
   chenyangsu.github.io — blog stylesheet
   Loaded after main.css on /blog/ pages only. It reuses every design token
   from main.css (--accent, --ink, --rule, --panel-bg, ...), so light mode,
   dark mode and the theme toggle all work here with no extra colour work.

   Two page shapes:
     .page-blog   the post index   (980px, matches the rest of the site)
     .page-post   a single post    (720px, a comfortable measure for prose)
   ========================================================================== */

/* ---------- Page shells ---------- */

.page-post { max-width: 720px; }

/* The post index and a post both open with a plain header, not a hero. */
.blog-head { margin-top: 10px; }

.blog-head h1 {
	font-size: 34px;
	font-weight: 900;
	color: var(--accent-dark);
	letter-spacing: -0.3px;
	margin: 0 0 10px;
}

.blog-lede {
	font-size: 18px;
	line-height: 1.55;
	color: var(--ink-light);
	max-width: 62ch;
	margin: 0 0 6px;
}

/* Small "Home / Blog" crumb above the title on post pages. */
.crumbs {
	font-size: 14px;
	font-weight: 700;
	color: var(--ink-light);
	margin: 0 0 14px;
	display: flex;
	align-items: center;
	gap: 8px;
}

.crumbs a { color: var(--ink-light); }
.crumbs a:hover { color: var(--accent); text-decoration: none; }
.crumbs .sep { color: var(--rule); }

/* ---------- Post index ---------- */

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

.post-list > li {
	border-top: 1px solid var(--rule);
	padding: 24px 0;
}

.post-list > li:last-child { border-bottom: 1px solid var(--rule); }

.post-meta {
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.8px;
	text-transform: uppercase;
	color: var(--ink-light);
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
}

.post-meta .dot { color: var(--rule); }

/* h2 on the blog index, h3 in the Blog section of the home page, where the
   section itself already owns the h2. Same look either way. */
.post-list h2, .post-list h3 {
	font-size: 22px;
	font-weight: 900;
	line-height: 1.3;
	color: var(--accent-dark);
	border: 0;                 /* main.css puts a rule under every h2 */
	padding: 0;
	margin: 7px 0 8px;
}

.post-list h2 a, .post-list h3 a { color: inherit; }
.post-list h2 a:hover, .post-list h3 a:hover { color: var(--accent); text-decoration: none; }

/* "All posts →" under the list on the home page. */
.post-list-more { margin: 16px 0 0; font-size: 15.5px; font-weight: 700; }

.post-excerpt {
	margin: 0;
	color: var(--ink-light);
	font-size: 16px;
	line-height: 1.6;
	max-width: 70ch;
}

/* ---------- Tags ---------- */

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }

.tag {
	font-size: 12.5px;
	font-weight: 700;
	letter-spacing: 0.2px;
	color: var(--accent);
	background: var(--tag-bg);
	border: 1px solid var(--tag-border);
	border-radius: 999px;
	padding: 2px 10px;
	white-space: nowrap;
}

/* ---------- Empty state (no posts yet) ---------- */

.blog-empty {
	margin-top: 30px;
	padding: 26px 24px;
	background: var(--panel-bg);
	border: 1px solid var(--rule);
	border-left: 4px solid var(--accent);
	border-radius: 8px;
	color: var(--ink-light);
}

.blog-empty p { margin: 0 0 8px; }
.blog-empty p:last-child { margin-bottom: 0; }

/* ---------- Single post: title block ---------- */

.post-kicker {
	font-size: 12.5px;
	font-weight: 900;
	letter-spacing: 1.6px;
	text-transform: uppercase;
	color: var(--accent);
	margin: 0 0 10px;
}

.post-title {
	font-size: 36px;
	font-weight: 900;
	line-height: 1.18;
	letter-spacing: -0.5px;
	color: var(--accent-dark);
	margin: 0 0 14px;
}

.post-standfirst {
	font-family: 'Source Serif 4', Georgia, serif;
	font-size: 20px;
	line-height: 1.5;
	color: var(--ink-light);
	margin: 0 0 20px;
}

.post-byline {
	font-size: 14px;
	color: var(--ink-light);
	border-top: 1px solid var(--rule);
	border-bottom: 1px solid var(--rule);
	padding: 12px 0;
	margin-bottom: 30px;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 10px;
}

.post-byline .dot { color: var(--rule); }
.post-byline b { color: var(--ink); font-weight: 700; }

/* ---------- Single post: body prose ----------
   Serif at 18px/1.72 for long-form reading. Headings stay in Lato so the
   article still reads as part of this site.
   -------------------------------------------------------------------------- */

.prose {
	font-family: 'Source Serif 4', Georgia, serif;
	font-size: 18px;
	line-height: 1.72;
	color: var(--ink);
}

.prose p { margin: 0 0 20px; }

.prose h2 {
	font-family: 'Lato', 'Helvetica Neue', Arial, sans-serif;
	font-size: 24px;
	font-weight: 900;
	line-height: 1.3;
	color: var(--accent-dark);
	border: 0;
	padding: 0;
	margin: 40px 0 14px;
}

.prose h3 {
	font-family: 'Lato', 'Helvetica Neue', Arial, sans-serif;
	font-size: 19px;
	font-weight: 700;
	color: var(--accent-dark);
	margin: 30px 0 10px;
}

.prose ul, .prose ol { margin: 0 0 20px; padding-left: 24px; }
.prose li { margin: 0 0 8px; }
.prose li > ul, .prose li > ol { margin: 8px 0 0; }

.prose strong { font-weight: 600; color: var(--ink); }

.prose hr {
	border: 0;
	border-top: 1px solid var(--rule);
	margin: 36px 0;
}

/* Pull quote / block quote */
.prose blockquote {
	margin: 26px 0;
	padding: 4px 0 4px 20px;
	border-left: 3px solid var(--accent);
	color: var(--serif-ink);
	font-style: italic;
}

.prose blockquote p:last-child { margin-bottom: 0; }

/* Figures */
.prose figure { margin: 30px 0; }

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

.prose figure img { border: 1px solid var(--rule); background: var(--panel-bg); }

.prose figcaption {
	font-family: 'Lato', 'Helvetica Neue', Arial, sans-serif;
	font-size: 14px;
	line-height: 1.5;
	color: var(--caption-ink);
	margin-top: 10px;
}

.prose figcaption b { color: var(--ink-light); font-weight: 700; }

/* Code */
.prose code {
	font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
	font-size: 0.87em;
	background: var(--chip-bg);
	border: 1px solid var(--rule);
	border-radius: 4px;
	padding: 1px 5px;
}

.prose pre {
	font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
	font-size: 14px;
	line-height: 1.6;
	background: var(--panel-bg);
	border: 1px solid var(--rule);
	border-radius: 8px;
	padding: 14px 16px;
	margin: 24px 0;
	overflow-x: auto;          /* long lines scroll, the page never does */
}

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

/* Tables */
.prose .table-wrap { overflow-x: auto; margin: 26px 0; }

.prose table {
	font-family: 'Lato', 'Helvetica Neue', Arial, sans-serif;
	font-size: 15px;
	border-collapse: collapse;
	width: 100%;
	min-width: 460px;
}

.prose th, .prose td {
	border: 1px solid var(--rule);
	padding: 8px 12px;
	text-align: left;
	vertical-align: top;
}

.prose th { background: var(--chip-bg); font-weight: 700; color: var(--accent-dark); }

/* ---------- Boxes ----------
   Two shapes. .takeaways is the summary panel that sits above the body; a
   post has at most one. .callout is an inline box for a definition, a caveat
   or a rule, in four colours. Colours carry meaning, so keep them consistent
   across posts: blue states, gold defines, red warns, green prescribes.

   The four hues main.css does not already define are declared here, on both
   dark-mode routes, so they follow the theme like every other token.
   -------------------------------------------------------------------------- */

:root {
	--warn-bg: #fdf2f0;
	--warn-border: #f3d5cf;
	--good: #1a7a4e;
	--good-bg: #eef7f1;
	--good-border: #cfe6d9;
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--warn-bg: #2a1613;
		--warn-border: #4a2a24;
		--good: #5fbf8a;
		--good-bg: #10241a;
		--good-border: #234a35;
	}
}

:root[data-theme="dark"] {
	--warn-bg: #2a1613;
	--warn-border: #4a2a24;
	--good: #5fbf8a;
	--good-bg: #10241a;
	--good-border: #234a35;
}

/* Summary panel, directly under the byline. */
.takeaways {
	font-family: 'Lato', 'Helvetica Neue', Arial, sans-serif;
	background: var(--tag-bg);
	border: 1px solid var(--accent);
	border-radius: 10px;
	padding: 18px 22px;
	margin: 0 0 32px;
}

.takeaways-label {
	display: block;
	font-size: 12.5px;
	font-weight: 900;
	letter-spacing: 1.4px;
	text-transform: uppercase;
	color: var(--accent-dark);
	margin-bottom: 10px;
}

.takeaways ul { margin: 0; padding-left: 20px; }
.takeaways li { margin: 0 0 9px; font-size: 16px; line-height: 1.58; }
.takeaways li:last-child { margin-bottom: 0; }
.takeaways strong { font-weight: 700; color: var(--ink); }

/* Inline box. Blue by default; add a modifier for the other three. */
.callout {
	font-family: 'Lato', 'Helvetica Neue', Arial, sans-serif;
	font-size: 15.5px;
	line-height: 1.6;
	background: var(--tag-bg);
	border: 1px solid var(--tag-border);
	border-left: 4px solid var(--accent);
	border-radius: 10px;
	padding: 16px 18px;
	margin: 28px 0;
}

.callout p { margin: 0 0 10px; }
.callout p:last-child { margin-bottom: 0; }
.callout ul { margin: 0; padding-left: 20px; }
.callout li { margin: 0 0 7px; }
.callout li:last-child { margin-bottom: 0; }

.callout-label {
	display: block;
	font-size: 12.5px;
	font-weight: 900;
	letter-spacing: 1.2px;
	text-transform: uppercase;
	color: var(--accent);
	margin-bottom: 7px;
}

/* Gold — defines a term or names a principle. */
.callout-note { background: var(--flag-bg); border-color: var(--flag-border); border-left-color: var(--gold-hl-ink); }
.callout-note .callout-label { color: var(--gold-hl-ink); }

/* Red — a caveat, a limit, or a correction to a published post. */
.callout-warn { background: var(--warn-bg); border-color: var(--warn-border); border-left-color: var(--award); }
.callout-warn .callout-label { color: var(--award); }

/* Green — the rule to take away, or the thing to actually do. */
.callout-good { background: var(--good-bg); border-color: var(--good-border); border-left-color: var(--good); }
.callout-good .callout-label { color: var(--good); }
.callout-good strong { color: var(--ink); }

/* Footnotes / references */
.prose .footnotes {
	font-family: 'Lato', 'Helvetica Neue', Arial, sans-serif;
	font-size: 14.5px;
	line-height: 1.6;
	color: var(--ink-light);
	border-top: 1px solid var(--rule);
	margin-top: 40px;
	padding-top: 18px;
}

.prose .footnotes ol { padding-left: 20px; }
.prose sup a { font-weight: 700; text-decoration: none; }

/* ---------- Single post: foot ---------- */

.post-foot {
	margin-top: 44px;
	padding-top: 22px;
	border-top: 1px solid var(--rule);
}

.post-foot .tags { margin: 0 0 18px; }

.post-nav {
	display: flex;
	flex-wrap: wrap;
	gap: 10px 20px;
	font-size: 15px;
	font-weight: 700;
}

/* ---------- Small screens ---------- */

@media (max-width: 720px) {
	.blog-head h1 { font-size: 28px; }
	.blog-lede { font-size: 16.5px; }
	.post-title { font-size: 28px; }
	.post-standfirst { font-size: 18px; }
	.prose { font-size: 17px; }
	.prose h2 { font-size: 21px; }
}
