/*
Theme Name: Noferv Larder
Theme URI: https://noferv.com/
Author: noferv.com
Description: A custom recipe-packet theme for Noferv: warm oat paper, ink outlines, seed-packet cards and a randomised Popular Topics shelf. Includes a Header widget area printed right after the site header for analytics and ad code.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.8
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: noferv
Tags: blog, food-and-drink, custom-logo, custom-menu, featured-images, translation-ready, two-columns
*/

/* ---------- Fonts (self-hosted) ---------- */
@font-face {
	font-family: "Fraunces";
	src: url("assets/fonts/fraunces.woff2") format("woff2");
	font-weight: 300 900;
	font-style: normal;
	font-display: swap;
}
@font-face {
	font-family: "Fraunces";
	src: url("assets/fonts/fraunces-italic.woff2") format("woff2");
	font-weight: 300 900;
	font-style: italic;
	font-display: swap;
}
@font-face {
	font-family: "Karla";
	src: url("assets/fonts/karla.woff2") format("woff2");
	font-weight: 300 800;
	font-style: normal;
	font-display: swap;
}
@font-face {
	font-family: "Space Mono";
	src: url("assets/fonts/spacemono-400.woff2") format("woff2");
	font-weight: 400;
	font-display: swap;
}
@font-face {
	font-family: "Space Mono";
	src: url("assets/fonts/spacemono-700.woff2") format("woff2");
	font-weight: 700;
	font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
	--paper: #f3ecdd;
	--paper-2: #e9dfc9;
	--paper-3: #fbf7ee;
	--ink: #1b1a15;
	--ink-soft: #4a463b;
	--kale: #24513a;
	--kale-deep: #193a2a;
	--sprout: #9cc56f;
	--tomato: #d5451b;
	--tomato-ink: #a8340f;
	--turmeric: #eba92e;
	--beet: #8c2b55;
	--sky: #8fb8c9;

	--font-display: "Fraunces", Georgia, "Times New Roman", serif;
	--font-body: "Karla", system-ui, -apple-system, "Segoe UI", sans-serif;
	--font-mono: "Space Mono", ui-monospace, Menlo, monospace;

	--line: 2px solid var(--ink);
	--radius: 14px;
	--radius-sm: 8px;
	--shadow: 5px 5px 0 var(--ink);
	--shadow-lg: 8px 8px 0 var(--ink);
	--wrap: 1240px;
	--gutter: clamp(16px, 4vw, 40px);
	--ease: cubic-bezier(.2, .8, .2, 1);
}

/* ---------- Base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 96px; }

body {
	margin: 0;
	background-color: var(--paper);
	background-image:
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .1 0 0 0 0 .09 0 0 0 0 .05 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
	color: var(--ink);
	font-family: var(--font-body);
	font-size: 1.0625rem;
	line-height: 1.65;
	text-rendering: optimizeLegibility;
	-webkit-font-smoothing: antialiased;
}

img, svg, video { max-width: 100%; height: auto; display: block; }

a { color: inherit; text-decoration-thickness: 2px; text-underline-offset: 3px; }

:focus-visible {
	outline: 3px solid var(--tomato);
	outline-offset: 3px;
	border-radius: 4px;
}

h1, h2, h3, h4 {
	font-family: var(--font-display);
	font-variation-settings: "opsz" 144, "SOFT" 50;
	font-weight: 750;
	line-height: 1.08;
	letter-spacing: -0.02em;
	margin: 0 0 .5em;
	text-wrap: balance;
}

p { margin: 0 0 1.1em; text-wrap: pretty; }

.wrap {
	width: 100%;
	max-width: var(--wrap);
	margin-inline: auto;
	padding-inline: var(--gutter);
}

.screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}
.skip-link:focus {
	position: fixed !important;
	top: 12px; left: 12px;
	z-index: 1000;
	width: auto; height: auto;
	clip: auto;
	padding: 10px 16px;
	background: var(--ink);
	color: var(--paper);
	border-radius: var(--radius-sm);
	text-decoration: none;
}

.icon { flex: none; }

.eyebrow {
	display: inline-flex;
	align-items: center;
	gap: .5em;
	margin: 0 0 1rem;
	font-family: var(--font-mono);
	font-size: .78rem;
	font-weight: 700;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--kale);
}

.stamp {
	display: inline-block;
	font-family: var(--font-mono);
	font-size: .72rem;
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
	padding: 3px 8px;
	border: 1.5px solid var(--ink);
	border-radius: 4px;
	background: var(--paper-3);
	line-height: 1.3;
}

.chip {
	display: inline-block;
	font-family: var(--font-mono);
	font-size: .72rem;
	font-weight: 700;
	letter-spacing: .06em;
	text-transform: uppercase;
	text-decoration: none;
	padding: 3px 10px;
	border-radius: 999px;
	background: var(--ink);
	color: var(--paper);
	line-height: 1.3;
	transition: background-color .2s var(--ease);
}
.chip:hover { background: var(--tomato-ink); }

/* ---------- Header ---------- */
.site-header {
	position: sticky;
	top: 0;
	z-index: 50;
	background: color-mix(in srgb, var(--paper) 92%, transparent);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
	border-bottom: var(--line);
}
.admin-bar .site-header { top: 32px; }
@media (max-width: 782px) { .admin-bar .site-header { top: 0; position: relative; } }

.header-row {
	display: flex;
	align-items: center;
	gap: 20px;
	min-height: 76px;
}

.brand {
	display: inline-flex;
	align-items: center;
	text-decoration: none;
	margin-right: auto;
	flex: none;
}
.brand .logo { width: 172px; height: auto; overflow: visible; }
.brand-img { max-height: 52px; width: auto; }

.main-nav { display: flex; align-items: center; gap: 6px; }
.nav-list {
	display: flex;
	gap: 6px;
	list-style: none;
	margin: 0;
	padding: 0;
}
.nav-link,
.nav-extra a {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding: 0 16px;
	border-radius: 999px;
	border: 2px solid transparent;
	font-weight: 700;
	font-size: .98rem;
	text-decoration: none;
	transition: border-color .2s var(--ease), background-color .2s var(--ease);
}
.nav-link:hover,
.nav-extra a:hover { border-color: var(--ink); }
.nav-link.is-current { background: var(--ink); color: var(--paper); }

.search-toggle {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 44px;
	padding: 0 16px;
	font: 700 .98rem var(--font-body);
	color: var(--ink);
	background: var(--turmeric);
	border: var(--line);
	border-radius: 999px;
	box-shadow: 3px 3px 0 var(--ink);
	cursor: pointer;
	transition: transform .15s var(--ease), box-shadow .15s var(--ease);
}
.search-toggle:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.search-toggle:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.search-toggle[aria-expanded="true"] { background: var(--ink); color: var(--paper); }

.search-panel {
	border-top: var(--line);
	background: var(--paper-2);
	padding: 18px 0;
}
.search-panel[hidden] { display: none; }

@media (max-width: 640px) {
	.header-row { gap: 8px; min-height: 64px; }
	.brand .logo { width: 128px; }
	.nav-link, .nav-extra a { padding: 0 10px; font-size: .92rem; }
	.nav-extra { display: none; }
	.search-toggle { padding: 0 12px; }
	.search-toggle-label { display: none; }
}
@media (max-width: 380px) {
	.nav-list li:first-child { display: none; }
}

/* ---------- Search form ---------- */
.search-form {
	display: flex;
	align-items: stretch;
	max-width: 640px;
	background: var(--paper-3);
	border: var(--line);
	border-radius: 999px;
	box-shadow: var(--shadow);
	overflow: hidden;
}
.search-field {
	flex: 1;
	min-width: 0;
	padding: 14px 22px;
	font: 500 1.05rem var(--font-body);
	color: var(--ink);
	background: transparent;
	border: 0;
}
.search-field::placeholder { color: #7a7465; }
.search-field:focus { outline: none; }
.search-form:focus-within { outline: 3px solid var(--tomato); outline-offset: 3px; }
.search-submit {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 0 22px;
	font: 700 1rem var(--font-body);
	color: var(--paper);
	background: var(--kale);
	border: 0;
	border-left: var(--line);
	cursor: pointer;
	transition: background-color .2s var(--ease);
}
.search-submit:hover { background: var(--kale-deep); }
@media (max-width: 480px) { .search-submit span { display: none; } }

/* ---------- Hero ---------- */
.hero { padding: clamp(40px, 7vw, 96px) 0 clamp(24px, 4vw, 48px); overflow: hidden; }
.hero-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: center;
	gap: clamp(24px, 5vw, 72px);
}
.hero-title {
	font-size: clamp(2.6rem, 7.4vw, 6.4rem);
	font-weight: 800;
	line-height: .98;
	letter-spacing: -0.035em;
	font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1;
	margin-bottom: .35em;
	max-width: 13ch;
}
.hero-title em {
	font-style: italic;
	font-weight: 600;
	color: var(--tomato);
	position: relative;
	white-space: nowrap;
}
.hero-title em::after {
	content: "";
	position: absolute;
	left: 2%;
	right: 2%;
	bottom: .02em;
	height: .14em;
	background: var(--turmeric);
	border-radius: 999px;
	z-index: -1;
	transform: rotate(-1.5deg);
}
.hero-text { font-size: clamp(1.05rem, 1.6vw, 1.25rem); max-width: 46ch; color: var(--ink-soft); }
.hero-search { margin-top: 28px; }

.hero-badge {
	position: relative;
	width: clamp(150px, 20vw, 240px);
	aspect-ratio: 1;
}
.spin-badge { width: 100%; height: 100%; animation: noferv-spin 28s linear infinite; }
.badge-core {
	position: absolute;
	inset: 28%;
	display: grid;
	place-items: center;
	background: var(--kale);
	color: var(--paper);
	border: var(--line);
	border-radius: 50%;
}
.badge-core .icon { width: 46%; height: 46%; }
@keyframes noferv-spin { to { transform: rotate(360deg); } }

@media (max-width: 760px) {
	.hero-grid { grid-template-columns: 1fr; }
	.hero-badge { display: none; }
	.hero-title { max-width: 11ch; }
}

/* ---------- Page head ---------- */
.page-head { padding: clamp(36px, 6vw, 72px) 0 clamp(20px, 3vw, 32px); }
.page-title { font-size: clamp(2.2rem, 5.5vw, 4.4rem); font-weight: 800; letter-spacing: -0.03em; }
.page-desc { max-width: 60ch; color: var(--ink-soft); }
.page-head-search { margin-top: 24px; }

/* ---------- Section title ---------- */
.section-title {
	display: flex;
	align-items: center;
	gap: 18px;
	font-size: clamp(1.5rem, 3vw, 2.2rem);
	font-style: italic;
	font-weight: 600;
	margin: 0 0 28px;
}
.section-title::after {
	content: "";
	flex: 1;
	height: 2px;
	background: repeating-linear-gradient(90deg, var(--ink) 0 10px, transparent 10px 18px);
}

/* ---------- Packets (post cards) ---------- */
.feed { padding: 16px 0 clamp(48px, 7vw, 96px); }

.packet-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: clamp(20px, 2.6vw, 34px);
}
@media (max-width: 1024px) { .packet-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) {
	.packet-grid { grid-template-columns: 1fr; }
	.packet-media { aspect-ratio: 16 / 10; }
}

.packet {
	--band: var(--kale);
	position: relative;
	display: flex;
	flex-direction: column;
	background: var(--paper-3);
	border: var(--line);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	overflow: hidden;
	transition: transform .22s var(--ease), box-shadow .22s var(--ease);
}
.packet:hover { transform: translate(-3px, -3px); box-shadow: var(--shadow-lg); }

.tone-kale { --band: var(--kale); --band-ink: var(--paper); }
.tone-tomato { --band: var(--tomato); --band-ink: var(--ink); }
.tone-turmeric { --band: var(--turmeric); --band-ink: var(--ink); }
.tone-beet { --band: var(--beet); --band-ink: var(--paper); }
.tone-sky { --band: var(--sky); --band-ink: var(--ink); }

.packet-media {
	position: relative;
	aspect-ratio: 4 / 3;
	background: var(--band);
	border-bottom: var(--line);
	overflow: hidden;
}
.packet-img { display: block; height: 100%; text-decoration: none; }
.packet-media img,
.packet-media .thumb-fallback {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform .5s var(--ease);
}
.packet:hover .packet-media img { transform: scale(1.04); }

.packet-body {
	display: flex;
	flex-direction: column;
	flex: 1;
	padding: 18px 20px 20px;
	border-top: 10px solid var(--band);
	margin-top: -2px;
}
.packet-label { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.packet-title { font-size: clamp(1.25rem, 1.8vw, 1.5rem); font-weight: 700; margin-bottom: .45em; }
.packet-title a { text-decoration: none; background-image: linear-gradient(var(--turmeric), var(--turmeric)); background-size: 0 .3em; background-position: 0 92%; background-repeat: no-repeat; transition: background-size .3s var(--ease); }
.packet-title a:hover { background-size: 100% .3em; }
.packet-excerpt { color: var(--ink-soft); font-size: .98rem; margin-bottom: 18px; }
.packet-more {
	margin-top: auto;
	align-self: flex-start;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 44px;
	padding: 0 16px;
	font-weight: 800;
	font-size: .95rem;
	text-decoration: none;
	border: var(--line);
	border-radius: 999px;
	background: var(--paper);
	transition: background-color .2s var(--ease), color .2s var(--ease);
}
.packet-more:hover { background: var(--ink); color: var(--paper); }
.packet-more .icon { transition: transform .2s var(--ease); }
.packet-more:hover .icon { transform: translateX(3px); }

/* Feature packet */
.packet--feature {
	grid-column: 1 / -1;
	display: grid;
	grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
}
.packet--feature .packet-media { aspect-ratio: auto; min-height: 380px; border-bottom: 0; border-right: var(--line); }
.packet--feature .packet-body {
	border-top: 0;
	border-left: 14px solid var(--band);
	margin: 0;
	padding: clamp(24px, 3.4vw, 48px);
	justify-content: center;
}
.packet--feature .packet-title { font-size: clamp(1.9rem, 3.6vw, 3rem); font-weight: 800; }
.packet--feature .packet-excerpt { font-size: 1.1rem; }
.packet--feature .packet-more { background: var(--tomato); color: var(--ink); box-shadow: 3px 3px 0 var(--ink); }
.packet--feature .packet-more:hover { background: var(--ink); color: var(--paper); }
@media (max-width: 820px) {
	.packet--feature { grid-template-columns: 1fr; }
	.packet--feature .packet-media { min-height: 0; aspect-ratio: 4 / 3; border-right: 0; border-bottom: var(--line); }
	.packet--feature .packet-body { border-left: 0; border-top: 12px solid var(--band); }
}

/* Placeholder art when a post has no image */
.thumb-fallback {
	display: grid;
	place-items: center;
	width: 100%;
	height: 100%;
	background:
		radial-gradient(circle at 20% 30%, rgba(255, 255, 255, .18) 0 18%, transparent 19%),
		radial-gradient(circle at 78% 72%, rgba(0, 0, 0, .12) 0 22%, transparent 23%),
		var(--fb, var(--kale));
}
.thumb-fallback span {
	font-family: var(--font-display);
	font-size: clamp(3rem, 8vw, 6rem);
	font-style: italic;
	font-weight: 800;
	color: var(--paper);
	text-shadow: 3px 3px 0 var(--ink);
}
.thumb-fallback.tone-0 { --fb: var(--kale); }
.thumb-fallback.tone-1 { --fb: var(--tomato); }
.thumb-fallback.tone-2 { --fb: var(--turmeric); }
.thumb-fallback.tone-3 { --fb: var(--beet); }
.thumb-fallback.tone-4 { --fb: var(--sky); }

/* ---------- Pagination ---------- */
.pager { margin-top: clamp(40px, 5vw, 64px); }
.pager ul {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 10px;
	list-style: none;
	margin: 0;
	padding: 0;
}
.pager .page-numbers {
	display: inline-grid;
	place-items: center;
	min-width: 46px;
	min-height: 46px;
	padding: 0 14px;
	font-family: var(--font-mono);
	font-weight: 700;
	text-decoration: none;
	border: var(--line);
	border-radius: 12px;
	background: var(--paper-3);
	transition: transform .15s var(--ease), box-shadow .15s var(--ease);
}
.pager a.page-numbers:hover { transform: translate(-2px, -2px); box-shadow: 3px 3px 0 var(--ink); }
.pager .current { background: var(--ink); color: var(--paper); }
.pager .dots { border-style: dashed; background: transparent; }

/* ---------- Popular Topics ---------- */
.popular {
	position: relative;
	padding: clamp(56px, 8vw, 104px) 0;
	background: var(--kale-deep);
	color: var(--paper);
	border-top: var(--line);
	border-bottom: var(--line);
	overflow: hidden;
}
.popular::before {
	content: "";
	position: absolute;
	inset: 0;
	background-image: radial-gradient(rgba(243, 236, 221, .09) 1.2px, transparent 1.3px);
	background-size: 18px 18px;
	pointer-events: none;
}
.popular .wrap { position: relative; }
.popular .tone-kale { --band: var(--sprout); --band-ink: var(--ink); }
.popular-head {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 8px 32px;
	margin-bottom: clamp(28px, 4vw, 48px);
}
.popular-title {
	font-size: clamp(2.4rem, 6vw, 4.8rem);
	font-style: italic;
	font-weight: 800;
	margin: 0;
	color: var(--paper);
}
.popular-sub {
	margin: 0;
	max-width: 32ch;
	font-family: var(--font-mono);
	font-size: .82rem;
	letter-spacing: .04em;
	color: #cfd9c4;
}

/* Rows always fill completely: 12 cards = 4x3 / 3x4 / 2x6, and any leftover cards stretch. */
.ticket-grid {
	display: flex;
	flex-wrap: wrap;
	gap: clamp(16px, 2vw, 24px);
	list-style: none;
	margin: 0;
	padding: 0;
}
.ticket {
	--cols: 4;
	flex: 1 1 calc((100% - (var(--cols) - 1) * clamp(16px, 2vw, 24px)) / var(--cols));
	min-width: 0;
	display: flex;
}
@media (max-width: 1024px) { .ticket { --cols: 3; } }
@media (max-width: 760px) { .ticket { --cols: 2; } }

.ticket-link {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	color: var(--ink);
	text-decoration: none;
	background: var(--paper-3);
	border: var(--line);
	border-radius: var(--radius);
	box-shadow: 5px 5px 0 var(--band);
	transition: transform .22s var(--ease), box-shadow .22s var(--ease);
}
.ticket-link:hover { transform: translate(-3px, -3px) rotate(-.6deg); box-shadow: 8px 8px 0 var(--band); }
.ticket-media {
	display: block;
	aspect-ratio: 16 / 11;
	overflow: hidden;
	border-radius: calc(var(--radius) - 2px) calc(var(--radius) - 2px) 0 0;
	background: var(--band);
}
.ticket-media img,
.ticket-media .thumb-fallback { width: 100%; height: 100%; object-fit: cover; }
.ticket-body {
	position: relative;
	display: flex;
	gap: 12px;
	align-items: flex-start;
	flex: 1;
	padding: 18px 16px 18px;
	border-top: 2px dashed var(--ink);
}
/* Perforation notches */
.ticket-body::before,
.ticket-body::after {
	content: "";
	position: absolute;
	top: -11px;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: var(--kale-deep);
	border: var(--line);
}
.ticket-body::before { left: -11px; clip-path: inset(0 0 0 50%); }
.ticket-body::after { right: -11px; clip-path: inset(0 50% 0 0); }
.ticket-num {
	flex: none;
	display: grid;
	place-items: center;
	width: 38px;
	height: 38px;
	font-family: var(--font-mono);
	font-size: .82rem;
	font-weight: 700;
	color: var(--band-ink, var(--ink));
	background: var(--band);
	border: var(--line);
	border-radius: 50%;
}
.ticket-title {
	font-family: var(--font-display);
	font-size: 1.08rem;
	font-weight: 700;
	line-height: 1.22;
	letter-spacing: -0.01em;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
@media (max-width: 480px) {
	.ticket-body { flex-direction: column; gap: 8px; padding: 16px 12px; }
	.ticket-num { width: 32px; height: 32px; font-size: .74rem; }
	.ticket-title { font-size: .98rem; }
}

/* ---------- Single entry ---------- */
.entry-head { padding: clamp(36px, 6vw, 80px) 0 clamp(24px, 3vw, 36px); }
.entry-head .wrap,
.entry-layout,
.post-nav { max-width: calc(1132px + 2 * var(--gutter)); }
.entry-label { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 18px; }
.entry-title {
	font-size: clamp(2.3rem, 5.6vw, 4.6rem);
	font-weight: 800;
	letter-spacing: -0.035em;
	line-height: 1.02;
	font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1;
	margin-bottom: .4em;
}
.entry-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 10px;
	font-family: var(--font-mono);
	font-size: .82rem;
	color: var(--ink-soft);
	margin: 0;
}

.entry-hero { margin: 0 auto clamp(32px, 5vw, 56px); max-width: calc(1132px + 2 * var(--gutter)); }
.entry-hero img {
	width: 100%;
	max-height: 680px;
	object-fit: cover;
	border: var(--line);
	border-radius: calc(var(--radius) + 6px);
	box-shadow: var(--shadow-lg);
}

.entry-layout {
	display: grid;
	grid-template-columns: minmax(0, 760px) minmax(240px, 300px);
	justify-content: center;
	gap: clamp(32px, 5vw, 72px);
	padding-bottom: clamp(48px, 6vw, 80px);
}
.entry-layout--single { grid-template-columns: minmax(0, 760px); }
.entry--page .entry-head .wrap, .entry--page .entry-layout { max-width: calc(760px + 2 * var(--gutter)); }
@media (max-width: 1060px) {
	.entry-layout { grid-template-columns: minmax(0, 760px); }
	.entry-rail { order: -1; }
	.entry-head .wrap, .entry-layout, .post-nav, .entry-hero { max-width: calc(760px + 2 * var(--gutter)); }
}

.entry-rail { position: relative; }
.toc {
	position: sticky;
	top: 104px;
	padding: 20px 20px 16px;
	background: var(--paper-3);
	border: var(--line);
	border-radius: var(--radius);
	box-shadow: 5px 5px 0 var(--turmeric), 5px 5px 0 2px var(--ink);
}
.toc-title {
	font-family: var(--font-mono);
	font-size: .76rem;
	font-weight: 700;
	letter-spacing: .14em;
	text-transform: uppercase;
	margin: 0 0 10px;
}
.toc ol { list-style: none; counter-reset: toc; margin: 0; padding: 0; }
.toc li { counter-increment: toc; border-top: 1.5px dashed rgba(27, 26, 21, .3); }
.toc li:first-child { border-top: 0; }
.toc-link {
	display: flex;
	gap: 10px;
	padding: 9px 0;
	font-weight: 600;
	font-size: .96rem;
	line-height: 1.35;
	text-decoration: none;
}
.toc-link::before {
	content: counter(toc, decimal-leading-zero);
	font-family: var(--font-mono);
	font-size: .76rem;
	padding-top: 2px;
	color: var(--tomato-ink);
}
.toc-link:hover,
.toc-link.is-active { color: var(--kale); text-decoration: underline; }
@media (max-width: 1060px) { .toc { position: static; } }

.rail-widgets { margin-top: 28px; }

/* Content typography */
.entry-content { font-size: 1.12rem; line-height: 1.75; min-width: 0; }
.entry-content > * { margin-block: 0 1.2em; }
.entry-content a { color: var(--tomato-ink); font-weight: 600; }
.entry-content a:hover { color: var(--ink); }
.entry-content { counter-reset: h2; }
.entry-content h2 {
	counter-increment: h2;
	position: relative;
	font-size: clamp(1.7rem, 3vw, 2.3rem);
	margin: 2em 0 .7em;
	padding-top: .9em;
	border-top: var(--line);
}
.entry-content h2::before {
	content: counter(h2, decimal-leading-zero);
	position: absolute;
	top: -.85em;
	left: 0;
	padding: 2px 10px;
	font-family: var(--font-mono);
	font-size: .8rem;
	font-weight: 700;
	letter-spacing: .06em;
	color: var(--paper);
	background: var(--ink);
	border-radius: 999px;
}
.entry-content h3 { font-size: clamp(1.3rem, 2.2vw, 1.6rem); margin: 1.6em 0 .6em; }
.entry-content ul { list-style: none; padding-left: 0; }
.entry-content ul > li {
	position: relative;
	padding-left: 30px;
	margin-bottom: .55em;
}
.entry-content ul > li::before {
	content: "";
	position: absolute;
	left: 4px;
	top: .55em;
	width: 12px;
	height: 12px;
	border-radius: 2px 10px;
	background: var(--sprout);
	border: 1.5px solid var(--ink);
	transform: rotate(-12deg);
}
.entry-content ol { list-style: none; padding-left: 0; counter-reset: step; }
.entry-content ol > li {
	counter-increment: step;
	position: relative;
	padding: 2px 0 0 52px;
	margin-bottom: 1em;
	min-height: 36px;
}
.entry-content ol > li::before {
	content: counter(step);
	position: absolute;
	left: 0;
	top: 0;
	display: grid;
	place-items: center;
	width: 36px;
	height: 36px;
	font-family: var(--font-mono);
	font-size: .9rem;
	font-weight: 700;
	background: var(--turmeric);
	border: var(--line);
	border-radius: 50%;
}
.entry-content img { border-radius: var(--radius); border: var(--line); }
.entry-content figure { margin-inline: 0; }
.entry-content figcaption { font-family: var(--font-mono); font-size: .8rem; color: var(--ink-soft); margin-top: 8px; }
.entry-content blockquote {
	margin-inline: 0;
	padding: 22px 26px;
	font-family: var(--font-display);
	font-size: 1.35rem;
	font-style: italic;
	line-height: 1.4;
	background: var(--paper-3);
	border: var(--line);
	border-left: 12px solid var(--tomato);
	border-radius: var(--radius);
}
.entry-content blockquote > :last-child { margin-bottom: 0; }
.entry-content table { width: 100%; border-collapse: collapse; font-size: 1rem; background: var(--paper-3); border: var(--line); }
.entry-content th, .entry-content td { padding: 10px 14px; border: 1px solid var(--ink); text-align: left; }
.entry-content th { background: var(--paper-2); }
.entry-content hr { border: 0; height: 2px; background: repeating-linear-gradient(90deg, var(--ink) 0 10px, transparent 10px 18px); }
.entry-content code { font-family: var(--font-mono); font-size: .9em; background: var(--paper-2); padding: 2px 6px; border-radius: 4px; }
.entry-content .alignwide { margin-inline: calc(-1 * clamp(0px, 6vw, 80px)); max-width: none; }
.entry-content .aligncenter { margin-inline: auto; }
.entry-content .alignleft { float: left; margin: .3em 1.5em 1em 0; }
.entry-content .alignright { float: right; margin: .3em 0 1em 1.5em; }
.wp-caption-text { font-family: var(--font-mono); font-size: .8rem; }

.page-links { font-family: var(--font-mono); margin-top: 2em; }

/* Prev / next */
.post-nav {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 20px;
	padding-bottom: clamp(48px, 6vw, 80px);
}
.post-nav-link {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 20px 24px;
	text-decoration: none;
	background: var(--paper-3);
	border: var(--line);
	border-radius: var(--radius);
	transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.post-nav-link:hover { transform: translate(-3px, -3px); box-shadow: var(--shadow); }
.post-nav-link.next { grid-column: 2; text-align: right; }
.post-nav-dir { font-family: var(--font-mono); font-size: .76rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--tomato-ink); }
.post-nav-title { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; line-height: 1.25; }
@media (max-width: 620px) {
	.post-nav { grid-template-columns: 1fr; }
	.post-nav-link.next { grid-column: auto; }
}

/* ---------- Widgets ---------- */
.widget { margin-bottom: 28px; }
.widget-title {
	font-family: var(--font-mono);
	font-size: .78rem;
	font-weight: 700;
	letter-spacing: .14em;
	text-transform: uppercase;
	margin-bottom: 12px;
}
.widget ul { list-style: none; margin: 0; padding: 0; }
.widget li { padding: 8px 0; border-top: 1.5px dashed rgba(27, 26, 21, .25); }
.widget li:first-child { border-top: 0; }
.widget a { text-decoration: none; font-weight: 600; }
.widget a:hover { text-decoration: underline; }
.widget .search-form { box-shadow: 3px 3px 0 var(--ink); }

/* ---------- Empty / 404 ---------- */
.empty-note {
	padding: clamp(28px, 5vw, 56px);
	background: var(--paper-3);
	border: var(--line);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
}
.page-head--404 .page-title { font-size: clamp(2.8rem, 8vw, 6rem); }

/* ---------- Footer ---------- */
.site-footer {
	background: var(--ink);
	color: var(--paper);
	padding-top: clamp(48px, 7vw, 88px);
	overflow: hidden;
}
.site-footer .brand .logo { width: 200px; }
.site-footer .logo text { fill: var(--paper); }
.site-footer .logo rect:first-of-type { fill: var(--paper); }
.foot-grid {
	display: grid;
	grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
	gap: 32px 56px;
	align-items: start;
}
.foot-text { margin-top: 18px; max-width: 42ch; color: #cdc6b5; }
.foot-links {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 8px 10px;
	list-style: none;
	margin: 0;
	padding: 0;
}
.foot-links a {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding: 0 16px;
	font-weight: 600;
	font-size: .95rem;
	text-decoration: none;
	color: var(--paper);
	border: 1.5px solid rgba(243, 236, 221, .35);
	border-radius: 999px;
	transition: background-color .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease);
}
.foot-links a:hover { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.foot-widgets { grid-column: 1 / -1; }
.foot-word {
	font-family: var(--font-display);
	font-size: clamp(5rem, 24vw, 22rem);
	font-weight: 900;
	font-style: italic;
	line-height: .8;
	letter-spacing: -0.06em;
	text-align: center;
	color: transparent;
	-webkit-text-stroke: 2px rgba(243, 236, 221, .28);
	margin: clamp(32px, 5vw, 64px) 0 0;
	height: .74em;
	overflow: hidden;
	user-select: none;
	white-space: nowrap;
	font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1;
}
.foot-bottom {
	position: relative;
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	padding-top: 20px;
	padding-bottom: 24px;
	border-top: 1.5px solid rgba(243, 236, 221, .25);
	font-family: var(--font-mono);
	font-size: .8rem;
	color: #cdc6b5;
}
.foot-bottom p { margin: 0; }
.to-top { text-decoration: none; color: var(--turmeric); font-weight: 700; }
.to-top:hover { text-decoration: underline; }
@media (max-width: 760px) {
	.foot-grid { grid-template-columns: 1fr; }
	.foot-links { justify-content: flex-start; }
}

/* ---------- Reveal on scroll (progressive) ---------- */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .5s var(--ease), transform .5s var(--ease); }
.js .reveal.is-in { opacity: 1; transform: none; }

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	*, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
	.js .reveal { opacity: 1; transform: none; }
}

/* ---------- Print ---------- */
@media print {
	.site-header, .site-footer, .popular, .entry-rail, .post-nav, .hero-badge { display: none !important; }
	body { background: #fff; }
	.entry-layout { display: block; }
}
