/*
Theme Name: Medsplain Blog
Theme URI: https://medsplain.com
Author: Medsplain
Author URI: https://medsplain.com
Description: Editorial blog theme for Medsplain — "The Journal". Instrument Serif + Geist, emerald/paper palette, featured + grid listing, single post with byline, cover, prose, and related reading. Ports the blog.html prototype into WordPress.
Version: 2.4.3
Requires at least: 6.0
Tested up to: 6.5
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: medsplain-blog
Tags: blog, editorial, one-column, custom-menu, featured-images, threaded-comments, translation-ready
*/

/* ===== THEME TOKENS (mirrors src/features/home/home.css) ===== */
:root {
	--paper: #F6F4EF;
	--paper-deep: #E7EFEA;
	--paper-light: #FDFBF7;

	--ink: #0C1318;
	--ink-soft: #2A3239;
	--ink-muted: #5E6770;
	--ink-faint: #9099A0;

	--apothecary: #006B5C;
	--apothecary-deep: #003F36;
	--apothecary-light: #00A48A;
	--apothecary-mist: #C3DDD3;

	--vital: #FF4D2E;
	--vital-deep: #C7311A;

	--gold: #00C2A8;
	--gold-soft: #B6EBE0;
	--blush: #FFD9D0;

	--line: rgba(12, 19, 24, 0.12);
	--line-soft: rgba(12, 19, 24, 0.06);
	--line-gold: rgba(0, 194, 168, 0.4);
}

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

html { scroll-behavior: smooth; overflow-x: hidden; background: var(--paper); }

/* ===== SCROLLBAR ===== */
/* Firefox + Chrome 121+ standard properties. */
html {
	scrollbar-width: thin;
	scrollbar-color: #B4B4AE transparent;
}

/* WebKit / older Chromium. */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
	background: #B4B4AE;
	border-radius: 999px;
	/* Paper border narrows the visible thumb without shrinking the hit area. */
	border: 1px solid var(--paper);
	background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: #98988F; background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }

body {
	background: var(--paper);
	color: var(--ink);
	font-family: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	font-weight: 400;
	line-height: 1.6;
	font-size: 16px;
	overflow-x: hidden;
	position: relative;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	padding-top: 72px;
	background-image:
		radial-gradient(ellipse 800px 600px at 0% 0%, rgba(0, 194, 168, 0.06) 0%, transparent 50%),
		radial-gradient(ellipse 800px 600px at 100% 0%, rgba(0, 194, 168, 0.06) 0%, transparent 50%);
	background-attachment: fixed;
}

/* admin bar offset */
.admin-bar nav { top: 32px; }
@media screen and (max-width: 782px) {
	.admin-bar nav { top: 46px; }
}

body::after {
	content: '';
	position: fixed;
	inset: 0;
	pointer-events: none;
	z-index: 2;
	opacity: 0.25;
	mix-blend-mode: multiply;
	background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.05 0 0 0 0 0.07 0 0 0 0 0.09 0 0 0 0.06 0'/></filter><rect width='200' height='200' filter='url(%23n)'/></svg>");
}

main, nav, footer, section { position: relative; z-index: 3; }

.serif { font-family: 'Instrument Serif', Georgia, serif; font-weight: 400; }
.italic { font-style: italic; }
.mono { font-family: 'Geist Mono', monospace; }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }

.site-content { flex: 1; }

.container {
	max-width: 1760px;
	margin: 0 auto;
	padding: 0 clamp(16px, 2.5vw, 40px);
	width: 100%;
}

.screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px; width: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute !important;
}

/* ===== NAV ===== */
nav.site-nav {
	position: fixed;
	top: 0; left: 0; right: 0;
	z-index: 100;
	background: var(--paper);
	border-bottom: 1px solid var(--line-soft);
}
.nav-inner {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px clamp(16px, 2.5vw, 40px);
	max-width: 1760px;
	margin: 0 auto;
}
.logo {
	font-family: 'Instrument Serif', serif;
	font-size: 28px;
	letter-spacing: -0.02em;
	color: var(--ink);
	display: flex;
	align-items: baseline;
	gap: 10px;
}
.logo-mark { color: var(--apothecary); font-style: italic; }
.logo-icon { width: 30px; height: 30px; flex-shrink: 0; align-self: center; display: inline-flex; }
.logo-icon svg { width: 100%; height: 100%; display: block; }

.nav-links { display: flex; gap: 36px; align-items: center; list-style: none; }
.nav-links a {
	color: var(--ink-soft);
	font-size: 14px;
	font-weight: 400;
	transition: color 0.2s;
}
.nav-links a:hover { color: var(--apothecary); }
.nav-links li.current-menu-item > a,
.nav-links a.active { color: var(--apothecary); }
.nav-links a.nav-cta {
	background: #0C1318;
	color: #FFFFFF;
	padding: 10px 20px;
	border-radius: 999px;
	font-size: 14px;
	font-weight: 500;
	transition: all 0.25s;
}
.nav-links a.nav-cta:hover { background: #000000; }

.nav-toggle {
	display: none;
	flex-direction: column;
	justify-content: center;
	gap: 5px;
	width: 40px; height: 40px;
	padding: 10px 8px;
	background: transparent;
	border: 1px solid var(--line);
	border-radius: 10px;
	cursor: pointer;
}
.nav-toggle span { display: block; height: 2px; width: 100%; background: var(--ink); border-radius: 2px; transition: transform 0.25s, opacity 0.25s; }
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ===== SHARED SECTION HEADING ===== */
.section-tag {
	font-size: 11px;
	letter-spacing: 0.22em;
	text-transform: uppercase;
	color: var(--apothecary);
	font-weight: 500;
	display: inline-flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 22px;
}
.section-tag::before { content: ''; width: 32px; height: 1px; background: var(--apothecary); }
.section-tag.center { display: flex; justify-content: center; }
.section-tag.center::after { content: ''; width: 32px; height: 1px; background: var(--apothecary); }

/* ===== BLOG LISTING ===== */
.blog-hero { padding: 64px 0 24px; }
.blog-hero-inner { text-align: center; max-width: 720px; margin: 0 auto; }
.blog-hero h1 {
	font-family: 'Instrument Serif', serif;
	font-weight: 400;
	font-size: clamp(48px, 7vw, 88px);
	line-height: 1;
	letter-spacing: -0.025em;
	color: var(--ink);
	margin-bottom: 20px;
}
.blog-hero h1 .accent { color: var(--apothecary); font-style: italic; }
.blog-hero p {
	font-size: 18px;
	line-height: 1.55;
	color: var(--ink-soft);
	font-weight: 300;
	max-width: 560px;
	margin: 0 auto;
}

/* Category filter bar */
/* Sections all share z-index 3, so a later sibling — the post list — would paint
   over the open dropdown. Lift the whole bar above them. */
.blog-filter { padding: 8px 0 8px; z-index: 20; }
.blog-filter-inner {
	display: flex;
	flex-direction: row;
	align-items: center;
	justify-content: flex-end;
	flex-wrap: wrap;
	gap: 16px 12px;
	padding-bottom: 40px;
	border-bottom: 1px solid var(--line);
}
.blog-cats {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	flex: 0 0 auto;
}
.cat-select-wrap {
	position: relative;
	display: inline-flex;
	align-items: center;
}
/* Open panel outranks the bar's own bottom rule and anything beside it. */
.cat-select-wrap.is-open { z-index: 21; }
.cat-select {
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	padding: 10px 40px 10px 16px;
	border: 1px solid var(--line);
	border-radius: 999px;
	background: var(--paper-light);
	color: var(--ink-soft);
	font-family: 'Geist Mono', monospace;
	font-size: 12px;
	letter-spacing: 0.03em;
	line-height: 1.2;
	cursor: pointer;
	min-width: 200px;
	transition: border-color 0.2s, color 0.2s;
}
.cat-select:hover { border-color: var(--apothecary); color: var(--apothecary); }
.cat-select:focus { outline: none; border-color: var(--apothecary); }
.cat-select-icon {
	position: absolute;
	right: 16px;
	top: 50%;
	transform: translateY(-50%);
	color: var(--ink-muted);
	display: inline-flex;
	pointer-events: none;
	transition: transform 0.2s, color 0.2s;
}
.cat-select-wrap:hover .cat-select-icon { color: var(--apothecary); }

/* Themed dropdown. Hidden until nav.js confirms JS is running — until then the
   native <select> above is the working control. */
.cat-trigger,
.cat-menu { display: none; }
.cat-select-wrap.is-enhanced .cat-select { display: none; }
.cat-select-wrap.is-enhanced .cat-trigger { display: flex; }
.cat-trigger {
	align-items: center;
	justify-content: flex-start;
	width: 100%;
	text-align: left;
	font: inherit;
	font-family: 'Geist Mono', monospace;
	font-size: 12px;
}
.cat-select-wrap.is-open .cat-trigger { border-color: var(--apothecary); color: var(--apothecary); }
.cat-select-wrap.is-open .cat-select-icon { transform: translateY(-50%) rotate(180deg); color: var(--apothecary); }
.cat-trigger-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-select-wrap.is-enhanced.is-open .cat-menu { display: block; }
.cat-menu {
	position: absolute;
	z-index: 90;
	top: calc(100% + 8px);
	left: 0;
	right: 0;
	min-width: 100%;
	max-height: 320px;
	overflow-y: auto;
	margin: 0;
	padding: 6px;
	list-style: none;
	background: var(--paper-light);
	border: 1px solid var(--line);
	border-radius: 18px;
	box-shadow: 0 20px 40px -20px rgba(12, 19, 24, 0.28);
}
.cat-option {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 10px 14px;
	border-radius: 12px;
	font-family: 'Geist Mono', monospace;
	font-size: 12px;
	letter-spacing: 0.03em;
	line-height: 1.3;
	color: var(--ink-soft);
	cursor: pointer;
	transition: background 0.15s, color 0.15s;
}
/* One highlight style for hover and keyboard, so both read the same. */
.cat-option.is-active { background: rgba(0, 107, 92, 0.08); color: var(--apothecary); }
.cat-option.is-selected { color: var(--apothecary); font-weight: 500; }
/* Flex item, not a float — floated it dropped to a second line once the label
   filled the row. */
.cat-option.is-selected::after {
	content: '✓';
	flex-shrink: 0;
	line-height: 1;
}

.blog-list-section { padding: 40px 0 80px; }

/* Featured card */
.featured-card {
	display: grid;
	grid-template-columns: 1.1fr 1fr;
	gap: 0;
	background: var(--paper-light);
	border: 1px solid var(--line);
	border-radius: 24px;
	overflow: hidden;
	margin-bottom: 48px;
	cursor: pointer;
	transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
	box-shadow: 0 1px 0 rgba(255,255,255,0.4) inset;
}
.featured-card:hover {
	transform: translateY(-4px);
	border-color: var(--apothecary);
	box-shadow: 0 24px 48px -24px rgba(0, 107, 92, 0.25);
}
.featured-banner {
	min-height: 440px;
	background: linear-gradient(165deg, var(--apothecary) 0%, var(--apothecary-deep) 100%);
	background-size: cover;
	background-position: center;
	position: relative;
	display: flex;
	align-items: flex-end;
	padding: 32px;
	overflow: hidden;
}
.featured-banner::before {
	content: '';
	position: absolute;
	top: -30%; right: -10%;
	width: 70%; height: 200%;
	background: radial-gradient(circle, rgba(0, 194, 168, 0.35) 0%, transparent 60%);
}
.featured-banner.has-image::before { display: none; }
.featured-banner .banner-glyph {
	position: absolute;
	top: 8px; right: 24px;
	font-family: 'Instrument Serif', serif;
	font-style: italic;
	font-size: 240px;
	line-height: 1;
	color: rgba(253, 251, 247, 0.10);
	user-select: none;
	pointer-events: none;
}
/* Category pill, sat on the banner artwork. */
.featured-banner .banner-cat {
	position: relative;
	z-index: 2;
	font-family: 'Geist Mono', monospace;
	font-size: 10px;
	letter-spacing: 0.22em;
	text-transform: uppercase;
	color: var(--gold-soft);
	background: rgba(0,0,0,0.2);
	border: 1px solid rgba(182, 235, 224, 0.3);
	padding: 7px 14px;
	border-radius: 999px;
}
.featured-body { padding: 44px 48px; display: flex; flex-direction: column; justify-content: center; }
/* Featured marker sits in the body panel. Borrows the .section-tag idiom — a
   rule and uppercase mono — so it reads as an eyebrow, not a button. */
.featured-body .featured-flag {
	display: inline-flex;
	align-items: center;
	gap: 12px;
	align-self: flex-start;
	font-family: 'Geist Mono', monospace;
	font-size: 10px;
	font-weight: 500;
	letter-spacing: 0.22em;
	text-transform: uppercase;
	color: var(--apothecary);
	margin-bottom: 16px;
}
.featured-body .featured-flag::before {
	content: '';
	width: 28px;
	height: 1px;
	background: var(--apothecary);
	flex-shrink: 0;
}
.featured-body h2 {
	font-family: 'Instrument Serif', serif;
	font-size: clamp(30px, 3.4vw, 44px);
	line-height: 1.05;
	letter-spacing: -0.02em;
	color: var(--ink);
	margin-bottom: 16px;
}
.featured-body h2 a { color: inherit; }
.featured-body p {
	font-size: 16.5px;
	line-height: 1.6;
	color: var(--ink-soft);
	font-weight: 300;
	margin-bottom: 24px;
}

/* Post category chip */
.post-cat {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-family: 'Geist Mono', monospace;
	font-size: 10.5px;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--apothecary);
	font-weight: 500;
}
.post-cat::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Meta row (author + date) */
.post-meta {
	display: flex;
	align-items: center;
	gap: 12px;
	font-size: 13px;
	color: var(--ink-muted);
	flex-wrap: wrap;
}
.post-avatar {
	width: 34px; height: 34px;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--apothecary) 0%, var(--gold) 100%);
	color: var(--paper-light);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-family: 'Instrument Serif', serif;
	font-style: italic;
	font-size: 16px;
	flex-shrink: 0;
}
.post-meta .m-author { color: var(--ink); font-weight: 500; }
.post-meta .m-dot { color: var(--ink-faint); }
.post-meta .m-date, .post-meta .m-read { font-family: 'Geist Mono', monospace; font-size: 11.5px; letter-spacing: 0.03em; }

/* Posts grid */
.posts-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 24px;
}
.post-card {
	background: var(--paper-light);
	border: 1px solid var(--line);
	border-radius: 20px;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	cursor: pointer;
	transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
	box-shadow: 0 1px 0 rgba(255,255,255,0.4) inset;
}
.post-card:hover {
	transform: translateY(-4px);
	border-color: var(--apothecary);
	box-shadow: 0 20px 40px -20px rgba(0, 107, 92, 0.22);
}
/* Fixed height, not aspect-ratio + max-height: Safari resolves the ratio against
   the grid-sized width and then clamps with max-height without re-fitting, which
   cropped the artwork mid-image. A flat height renders identically everywhere. */
.post-banner {
	height: 190px;
	flex-shrink: 0;
	position: relative;
	display: flex;
	align-items: flex-end;
	padding: 18px;
	overflow: hidden;
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
}
.post-banner .banner-glyph {
	position: absolute;
	top: -20px; right: 6px;
	font-family: 'Instrument Serif', serif;
	font-style: italic;
	font-size: 130px;
	line-height: 1;
	color: rgba(253, 251, 247, 0.12);
	user-select: none;
	pointer-events: none;
}
.post-banner .b-tag {
	position: relative; z-index: 2;
	font-family: 'Geist Mono', monospace;
	font-size: 9.5px;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--paper-light);
	background: rgba(0,0,0,0.28);
	padding: 5px 11px;
	border-radius: 999px;
}
.banner-a { background: linear-gradient(135deg, #006B5C 0%, #003F36 100%); }
.banner-b { background: linear-gradient(135deg, #C7311A 0%, #7A1F0F 100%); }
.banner-c { background: linear-gradient(135deg, #00C2A8 0%, #007A6B 100%); }
.banner-d { background: linear-gradient(135deg, #00A48A 0%, #006B5C 100%); }
.banner-e { background: linear-gradient(135deg, #2b6cb0 0%, #1A4971 100%); }
.banner-f { background: linear-gradient(135deg, #805AD5 0%, #4c3191 100%); }

/* Featured image artwork. The inline style on the element supplies --banner-img
   (desktop crop) and --banner-img-mobile (portrait crop, falls back to the same
   file when no mobile image is set), so the gradient class above stays as the
   no-thumbnail fallback and gets painted over here only when a var exists. */
.post-banner[style*="--banner-img"],
.featured-banner[style*="--banner-img"],
.post-cover[style*="--banner-img"] {
	background-image: linear-gradient(rgba(12, 19, 24, 0.15), rgba(12, 19, 24, 0.45)), var(--banner-img);
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
}

.post-card-body { padding: 18px 20px 20px; display: flex; flex-direction: column; flex: 1; }
.post-card-body .post-cat { margin-bottom: 10px; }
.post-card-body h3 {
	font-family: 'Instrument Serif', serif;
	font-size: 21px;
	line-height: 1.12;
	letter-spacing: -0.01em;
	color: var(--ink);
	margin-bottom: 8px;
}
.post-card-body h3 a { color: inherit; }
.post-card-body p {
	font-size: 14.5px;
	line-height: 1.6;
	color: var(--ink-soft);
	font-weight: 300;
	margin-bottom: 0;
	flex: 1;
}

/* Pagination */
.pagination {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin-top: 56px;
	flex-wrap: wrap;
}
.pagination .page-numbers {
	min-width: 42px;
	height: 42px;
	padding: 0 14px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	border: 1px solid var(--line);
	background: var(--paper-light);
	border-radius: 999px;
	color: var(--ink-soft);
	font-family: 'Geist Mono', monospace;
	font-size: 13px;
	cursor: pointer;
	transition: all 0.2s;
}
.pagination a.page-numbers:hover { border-color: var(--apothecary); color: var(--apothecary); }
.pagination .page-numbers.current {
	background: var(--apothecary);
	border-color: var(--apothecary);
	color: var(--paper-light);
}
.pagination .page-numbers.dots { border: none; background: none; }

/* ===== SINGLE POST VIEW ===== */
.post-view { padding: 40px 0 90px; }
.post-container { max-width: 760px; margin: 0 auto; }
/* Back-to-blog link */
.back-link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-bottom: 28px;
	color: var(--apothecary);
	font-size: 14px;
	font-weight: 500;
	transition: color 0.2s;
}
.back-link svg { width: 16px; height: 16px; display: block; flex-shrink: 0; }
.back-link:hover { color: var(--apothecary-deep); }
/* Archive/search views put the arrow above a full-width hero rather than inside
   .post-container, so it carries its own top spacing. The values match
   .post-view's padding-top and .back-link's own margin, so the link lands in the
   same spot whichever template drew it. The hero below already brings its own
   padding, hence the negative trim rather than a second gap. */
.back-link-bar { padding-top: 40px; }
.back-link-bar .back-link { margin-bottom: 0; }
.back-link-bar + .blog-hero { padding-top: 28px; }

.post-header .post-cat { margin-bottom: 18px; }
.post-header h1 {
	font-family: 'Instrument Serif', serif;
	font-weight: 400;
	font-size: clamp(34px, 5vw, 54px);
	line-height: 1.04;
	letter-spacing: -0.02em;
	color: var(--ink);
	margin-bottom: 24px;
}
.post-byline {
	display: flex;
	align-items: center;
	gap: 14px;
	flex-wrap: wrap;
	padding-bottom: 28px;
	margin-bottom: 8px;
	border-bottom: 1px solid var(--line);
}
.post-byline .post-avatar { width: 46px; height: 46px; font-size: 20px; }
/* The author block is the flexible item: it absorbs the slack so the date can
   sit hard right rather than being pushed to a second row. */
.post-byline > div:not(.published-on) { flex: 1 1 auto; min-width: 0; }
.post-byline .by-name { font-size: 15px; font-weight: 500; color: var(--ink); }
.post-byline .by-sub {
	font-family: 'Geist Mono', monospace;
	font-size: 11.5px;
	letter-spacing: 0.04em;
	color: var(--ink-muted);
	margin-top: 2px;
}
.post-byline .published-on {
	margin-left: auto;
	font-family: 'Geist Mono', monospace;
	font-size: 12px;
	letter-spacing: 0.05em;
	color: var(--ink-muted);
	text-align: right;
	/* Without this the date is a shrinkable flex item, wraps to its own row, and
	   margin-left:auto then aligns it inside that row instead of against the
	   author block. Nowrap + no-shrink keeps it on the byline's first line. */
	white-space: nowrap;
	flex-shrink: 0;
}
.post-byline .published-on strong { color: var(--ink); font-weight: 500; }

.post-cover {
	min-height: 300px;
	border-radius: 20px;
	margin: 0 0 36px;
	position: relative;
	overflow: hidden;
	display: flex;
	align-items: flex-end;
	padding: 28px;
	background-size: cover;
	background-position: center;
}
.post-cover .banner-glyph {
	position: absolute;
	top: -30px; right: 24px;
	font-family: 'Instrument Serif', serif;
	font-style: italic;
	font-size: 260px;
	line-height: 1;
	color: rgba(253, 251, 247, 0.10);
	user-select: none; pointer-events: none;
}

/* Article prose (WordPress the_content lives here) */
.prose { font-size: 18px; line-height: 1.75; color: var(--ink-soft); font-weight: 300; }
.prose > *:first-child { margin-top: 0; }

/* Table of contents */
.post-toc {
	position: relative;
	background: var(--paper-light);
	border: 1px solid var(--line);
	border-left: 3px solid var(--apothecary);
	border-radius: 14px;
	padding: 26px 32px 28px;
	margin: 0 0 44px;
}
.post-toc-title {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	font-family: 'Geist Mono', monospace;
	font-size: 13px;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	color: var(--apothecary);
	margin-bottom: 20px;
	padding: 0;
	background: none;
	border: 0;
	cursor: pointer;
	text-align: left;
	outline: none;
	-webkit-tap-highlight-color: transparent;
}
.post-toc-title:focus,
.post-toc-title:focus-visible {
	outline: none;
	box-shadow: none;
}
.post-toc-title::before {
	content: '';
	width: 24px;
	height: 1px;
	background: var(--apothecary);
	flex-shrink: 0;
}
.post-toc-caret {
	display: block;
	flex-shrink: 0;
	margin-left: auto;
	width: 8px;
	height: 8px;
	border-right: 1.5px solid currentColor;
	border-bottom: 1.5px solid currentColor;
	transform: rotate(45deg) translate(-2px, -2px);
	transition: transform 0.2s ease;
}
.post-toc-title[aria-expanded="false"] {
	margin-bottom: 0;
}
.post-toc-title[aria-expanded="false"] .post-toc-caret {
	transform: rotate(-135deg) translate(-2px, -2px);
}
.post-toc-title[aria-expanded="false"] + .post-toc-list {
	display: none;
}
.post-toc-list {
	list-style: none;
	margin: 0;
	padding: 0;
	counter-reset: ms-toc;
}
.post-toc-list li { line-height: 1.5; }
.post-toc-list li.toc-h1 {
	counter-increment: ms-toc;
	position: relative;
	padding-left: 34px;
	margin-bottom: 14px;
}
.post-toc-list li.toc-h1::before {
	content: counter(ms-toc) '.';
	position: absolute;
	left: 0;
	top: 2px;
	font-family: 'Geist Mono', monospace;
	font-size: 12px;
	color: var(--ink-faint);
}
.post-toc-list li.toc-h2 {
	position: relative;
	padding-left: 58px;
	margin-bottom: 14px;
}
.post-toc-list li.toc-h2::before {
	content: '';
	position: absolute;
	left: 34px;
	top: 13px;
	width: 10px;
	height: 1px;
	background: var(--ink-faint);
}
.post-toc-list li:last-child { margin-bottom: 0; }
.post-toc-list a {
	font-size: 17px;
	font-weight: 400;
	color: var(--ink-soft);
	text-decoration: none;
	transition: color 0.2s;
}
.post-toc-list li.toc-h2 a { font-size: 14.5px; }
.post-toc-list a:hover { color: var(--apothecary); }
/* Offset anchor jumps so headings clear the sticky site header. */
.prose h1[id], .prose h2[id] { scroll-margin-top: 96px; }
.prose p { margin-bottom: 24px; }
.prose h1 {
	font-family: 'Instrument Serif', serif;
	font-weight: 600;
	font-size: 32px;
	line-height: 1.25;
	letter-spacing: -0.015em;
	color: var(--ink);
	margin: 48px 0 18px;
}
.prose h2 {
	font-family: 'Instrument Serif', serif;
	font-weight: 600;
	font-size: 26px;
	line-height: 1.3;
	letter-spacing: -0.01em;
	color: var(--ink);
	margin: 44px 0 16px;
}
.prose h3 {
	font-family: 'Instrument Serif', serif;
	font-weight: 600;
	font-size: 21px;
	line-height: 1.35;
	letter-spacing: -0.005em;
	color: var(--ink);
	margin: 32px 0 12px;
}
.prose h4 { font-size: 18px; color: var(--ink); margin: 28px 0 10px; font-weight: 600; }
.prose ul, .prose ol { margin: 0 0 24px 22px; }
.prose li { margin-bottom: 10px; }
.prose strong { color: var(--ink); font-weight: 500; }
.prose img, .prose figure { border-radius: 14px; margin: 28px 0; }
.prose figure img { border-radius: 14px; }
.prose figcaption { font-family: 'Geist Mono', monospace; font-size: 12px; color: var(--ink-muted); text-align: center; margin-top: 10px; }
.prose blockquote {
	font-family: 'Instrument Serif', serif;
	font-style: italic;
	font-size: 24px;
	line-height: 1.35;
	color: var(--apothecary);
	padding-left: 26px;
	border-left: 2px solid var(--apothecary);
	margin: 32px 0;
	font-weight: 400;
}
.prose blockquote p { margin-bottom: 0; }
.prose a { color: var(--apothecary); border-bottom: 1px solid var(--apothecary); }
.prose code { font-family: 'Geist Mono', monospace; font-size: 0.9em; background: var(--paper-deep); padding: 2px 6px; border-radius: 5px; }
.prose pre { background: var(--ink); color: var(--paper-light); padding: 20px; border-radius: 12px; overflow-x: auto; margin: 28px 0; }
.prose pre code { background: none; padding: 0; color: inherit; }
.prose hr { border: none; border-top: 1px solid var(--line); margin: 40px 0; }

/* alignwide / alignfull for block content */
.prose .alignwide { width: min(100%, 920px); margin-left: 50%; transform: translateX(-50%); }
.prose .alignfull { width: 100vw; margin-left: 50%; transform: translateX(-50%); border-radius: 0; }
.prose .alignleft { float: left; margin: 8px 28px 20px 0; max-width: 50%; }
.prose .alignright { float: right; margin: 8px 0 20px 28px; max-width: 50%; }

.disclaimer-banner {
	background: #F3E8FF;
	border-left: 4px solid #805AD5;
	border-radius: 0 10px 10px 0;
	padding: 16px 20px;
	margin: 36px 0;
	font-size: 14px;
	line-height: 1.6;
	color: var(--ink-soft);
	font-weight: 400;
}
.disclaimer-banner strong { color: #805AD5; }

.entry-tags { font-family: 'Geist Mono', monospace; font-size: 12px; color: var(--ink-muted); margin: 36px 0 0; }
.entry-tags + .entry-tags { margin-top: 10px; }
.entry-tags a { color: var(--apothecary); }

/* Post navigation (prev/next) */
.post-navigation { margin-top: 48px; padding-top: 28px; border-top: 1px solid var(--line); }
.post-navigation .nav-links { display: flex; justify-content: space-between; gap: 20px; }
.post-navigation a { color: var(--apothecary); font-weight: 500; font-size: 15px; }

/* Related posts */
.related-section {
	margin-top: 72px;
	padding-top: 56px;
	border-top: 1px solid var(--line);
}
.related-head {
	font-family: 'Instrument Serif', serif;
	font-size: 30px;
	letter-spacing: -0.01em;
	color: var(--ink);
	margin-bottom: 28px;
	text-align: center;
}
.related-head .italic { color: var(--apothecary); }
.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }

/* ===== COMMENTS ===== */
.comments-area { max-width: 760px; margin: 56px auto 0; padding-top: 40px; border-top: 1px solid var(--line); }
.comments-title, .comment-reply-title {
	font-family: 'Instrument Serif', serif;
	font-size: 26px;
	color: var(--ink);
	margin-bottom: 24px;
}
.comment-list { list-style: none; }
.comment-list li.comment { padding: 20px 0; border-top: 1px solid var(--line-soft); }
.comment-list ol.children { list-style: none; margin-left: 28px; }
.comment-author { font-weight: 500; color: var(--ink); }
.comment-author .fn { font-style: normal; }
.comment-metadata { font-family: 'Geist Mono', monospace; font-size: 11.5px; color: var(--ink-muted); }
.comment-content { margin: 10px 0; color: var(--ink-soft); }
.comment-content p { margin-bottom: 12px; }
.reply a { font-size: 13px; color: var(--apothecary); font-weight: 500; }

.comment-form { display: flex; flex-direction: column; gap: 16px; margin-top: 24px; }
.comment-form p { margin: 0; }
.comment-form label { display: block; font-size: 13px; color: var(--ink-muted); margin-bottom: 6px; }
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
	width: 100%;
	padding: 12px 14px;
	border: 1px solid var(--line);
	border-radius: 10px;
	font-size: 15px;
	font-family: inherit;
	background: var(--paper-light);
	color: var(--ink);
}
.comment-form textarea:focus,
.comment-form input:focus { outline: none; border-color: var(--apothecary); }

/* Cookie-consent checkbox row */
.comment-form-cookies-consent {
	display: flex;
	align-items: center;
	gap: 10px;
}
.comment-form-cookies-consent input[type="checkbox"] {
	width: 16px;
	height: 16px;
	margin: 0;
	flex-shrink: 0;
	accent-color: var(--apothecary);
	cursor: pointer;
}
.comment-form-cookies-consent label {
	margin: 0;
	font-size: 13px;
	color: var(--ink-muted);
	line-height: 1.4;
	cursor: pointer;
}

/* ===== BUTTONS ===== */
.btn, .comment-form input[type="submit"], .wp-block-button__link, .search-form input[type="submit"] {
	display: inline-block;
	background: var(--apothecary);
	color: var(--paper-light);
	border: 0;
	padding: 12px 24px;
	border-radius: 999px;
	font-size: 15px;
	font-weight: 500;
	font-family: inherit;
	cursor: pointer;
	transition: background 0.2s;
}
.btn:hover, .comment-form input[type="submit"]:hover { background: var(--apothecary-deep); }
/* Keep button text light even inside .prose (which recolors links). */
.prose a.btn, .prose a.wp-block-button__link { color: var(--paper-light); border-bottom: none; }
.prose a.btn:hover { color: var(--paper-light); background: var(--apothecary-deep); }

.search-form { display: flex; gap: 10px; margin: 20px 0; }
.search-form input[type="search"] { flex: 1; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; font-size: 15px; }

/* ===== FOOTER ===== */
footer.site-footer { background: var(--ink); color: var(--paper-light); padding: 80px 0 32px; position: relative; margin-top: auto; }
.footer-grid { display: grid; grid-template-columns: 1.8fr 1fr 1fr 1fr 1fr; gap: 60px; margin-bottom: 60px; }
footer .logo { color: var(--paper-light); margin-bottom: 18px; }
footer .logo-mark { color: var(--gold); }
.footer-tag { font-size: 14px; color: rgba(241, 232, 210, 0.55); line-height: 1.6; max-width: 300px; }
.footer-col-title { font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold); font-weight: 500; margin-bottom: 18px; }
.footer-col a { display: block; color: rgba(241, 232, 210, 0.7); font-size: 14px; margin-bottom: 10px; transition: color 0.2s; }
.footer-col a:hover { color: var(--gold); }
.footer-col a.footer-contact-link { display: flex; align-items: center; gap: 8px; }
.footer-col a.footer-contact-link svg { flex-shrink: 0; }
.footer-bottom { border-top: 1px solid rgba(241, 232, 210, 0.1); padding-top: 28px; display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: rgba(241, 232, 210, 0.4); }
.footer-bottom .mono { font-family: 'Geist Mono', monospace; letter-spacing: 0.05em; }

.no-posts { text-align: center; padding: 80px 0; color: var(--ink-muted); font-size: 18px; }
.no-posts-actions { display: flex; flex-direction: column; align-items: center; gap: 16px; margin-top: 24px; }
.no-posts-actions .search-form { max-width: 420px; width: 100%; margin: 0; justify-content: center; }
.no-posts-actions .btn { margin: 0; }
.no-posts-title { font-family: 'Instrument Serif', serif; font-weight: 400; font-size: clamp(28px, 4vw, 40px); color: var(--ink); margin-bottom: 12px; }
.hidden { display: none !important; }

/* ===== RESPONSIVE ===== */
@media (max-width: 980px) {
	.nav-toggle { display: inline-flex; }
	.nav-links {
		position: absolute;
		top: 100%; left: 0; right: 0;
		flex-direction: column;
		align-items: stretch;
		gap: 0;
		padding: 12px 24px 20px;
		background: rgba(246, 244, 239, 0.98);
		backdrop-filter: blur(14px) saturate(1.2);
		-webkit-backdrop-filter: blur(14px) saturate(1.2);
		border-bottom: 1px solid var(--line-soft);
		box-shadow: 0 12px 24px -16px rgba(12, 19, 24, 0.15);
		display: none;
	}
	.nav-links.open { display: flex; }
	.nav-links li { width: 100%; }
	/* display:block is load-bearing: these anchors are inline, and vertical
	   padding on an inline box does not grow the line box — the rows collapsed
	   to line-height and the padded CTA overlapped the link above it. */
	.nav-links a { display: block; padding: 14px 4px; font-size: 15px; border-bottom: 1px solid var(--line-soft); }
	.nav-links li:last-child a { border-bottom: none; }
	.nav-links a.nav-cta { display: block; margin-top: 14px; text-align: center; padding: 12px 20px; border-bottom: none; }
	.featured-card { grid-template-columns: 1fr; }
	.featured-banner { min-height: 220px; }
	.posts-grid { grid-template-columns: repeat(2, 1fr); }
	.related-grid { grid-template-columns: 1fr; }
	.footer-grid { grid-template-columns: 1fr 1fr; gap: 40px; }
	.container { padding: 0 24px; }
	.nav-inner { padding: 16px 24px; }
}
@media (max-width: 600px) {
	body { background-attachment: scroll; background-image: none; }
	body::after { display: none; }
	.container { padding: 0 16px; }
	.post-view { padding: 24px 0 60px; }
	.back-link { margin-bottom: 20px; }
	/* Track .post-view's smaller top padding so both templates still agree. */
	.back-link-bar { padding-top: 24px; }
	.back-link-bar + .blog-hero { padding-top: 20px; }
	.posts-grid { grid-template-columns: 1fr; }
	.featured-body { padding: 28px 22px; }
	/* Tighter gap and a slightly smaller date so a long month name still fits on
	   the byline row next to the avatar at phone widths. */
	.post-byline { gap: 10px; }
	.post-byline .published-on { font-size: 11px; letter-spacing: 0.03em; }
	.footer-grid { grid-template-columns: 1fr; gap: 32px; }
	.footer-bottom { flex-direction: column; gap: 10px; align-items: flex-start; }
	.prose { font-size: 17px; }
	.post-navigation .nav-links { flex-direction: column; }
	.blog-filter-inner { flex-direction: column; align-items: stretch; }
	.blog-cats { justify-content: flex-start; width: 100%; }
	.cat-select-wrap { width: 100%; }
	.cat-select { width: 100%; min-width: 0; }

	/* Swap to the portrait crop. Wide banner artwork is mostly cropped away at
	   phone widths, so a separate mobile image (or the desktop one as fallback)
	   is drawn instead, at a shorter height that suits a portrait frame. */
	.post-banner[style*="--banner-img"],
	.featured-banner[style*="--banner-img"],
	.post-cover[style*="--banner-img"] {
		background-image: linear-gradient(rgba(12, 19, 24, 0.15), rgba(12, 19, 24, 0.45)), var(--banner-img-mobile, var(--banner-img));
	}
	.featured-banner { min-height: 260px; }
	.post-cover { min-height: 200px; padding: 20px; }
	.post-banner { height: 210px; }

	/* Adjust Index box for mobile and prevent overlapping */
	.post-toc {
		padding: 20px 24px 24px;
		margin: 0 0 32px;
		overflow: hidden;
		clear: both;
	}
	.prose > p {
		clear: both;
		position: relative;
		z-index: 10;
	}
	.post-toc-list {
		margin-bottom: 0 !important;
	}
	.post-toc-list a {
		font-size: 15.5px;
	}
}
