/* =========================================================
   Knight Logs — design tokens
   ========================================================= */
:root {
	--color-bg: #0a0a0c;
	--color-surface: #141417;
	--color-surface-alt: #1b1b1f;
	--color-surface-deep: #0d0d10;
	--color-border: #2a2a2e;
	--color-text: #f2f1ee;
	--color-text-muted: #a3a1a0;
	--color-gold: #d4af37;
	--color-gold-strong: #e8c452;
	--color-focus: #f2c94c;

	/* Arkade-inspired ambient background system: an extremely faint
	   square grid ("block" texture) plus a soft vignette. Kept as tokens
	   so every section reuses the exact same texture, just at different
	   sizes/opacities, rather than each section inventing its own. */
	--texture-grid: linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
		linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
	--texture-grid-size: 48px 48px;

	--font-body: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	--font-heading: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

	--container-max: 1320px;
	--container-pad: 20px;
	--radius: 10px;
	--radius-sm: 6px;
}

@media (min-width: 768px) {
	:root { --container-pad: 32px; }
}
@media (min-width: 1024px) {
	:root { --container-pad: 40px; }
}

/* =========================================================
   Reset
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; -webkit-text-size-adjust: 100%; }
body {
	margin: 0;
	background-color: var(--color-bg);
	/* Sitewide ambient texture: a barely-visible grid plus a soft gold
	   vignette near the top of the document. Deliberately faint (1.5%
	   grid lines, 4% vignette) so it reads as "premium and layered" at
	   a glance and is invisible the moment you're actually reading —
	   including on article pages, where this is the only background
	   treatment applied (see .single-post__content, which adds none of
	   its own). */
	background-image:
		radial-gradient(ellipse 1100px 560px at 50% 0%, rgba(212,175,55,0.05), transparent 65%),
		linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
		linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
	background-size: 100% 100%, 56px 56px, 56px 56px;
	color: var(--color-text);
	font-family: var(--font-body);
	font-size: 16px;
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, h5, h6 { margin: 0; font-family: var(--font-heading); font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; }
p { margin: 0 0 1em; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input { font: inherit; color: inherit; }

.screen-reader-text {
	position: absolute;
	width: 1px; height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}
.skip-link {
	left: -9999px;
	position: absolute;
	top: 0;
	z-index: 1000;
	background: var(--color-gold);
	color: #0a0a0c;
	padding: 10px 16px;
	border-radius: 0 0 var(--radius-sm) 0;
	font-weight: 700;
}
.skip-link:focus {
	left: 0;
	width: auto;
	height: auto;
	clip: auto;
}

:focus-visible {
	outline: 2px solid var(--color-focus);
	outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* =========================================================
   Layout helpers
   ========================================================= */
.site-main { display: block; width: 100%; }
.homepage, .archive-page, .single-post, .error-404-page, .policy-page {
	max-width: var(--container-max);
	margin: 0 auto;
	padding: 0 var(--container-pad) 64px;
}
.section-header {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 28px;
}
.section-header .view-all { margin-bottom: 6px; }
.section-heading {
	font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.6rem);
	color: var(--color-text);
}
.section-heading--compact { font-size: 1.05rem; }

/* =========================================================
   Section kicker — the one reusable Knight Logs section-heading
   component (eyebrow + heading + short accent rule). Used for every
   major editorial section so they read as one consistent system
   instead of each section styling its own heading.
   ========================================================= */
.section-kicker { margin-bottom: 0; }
.section-kicker__eyebrow {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--color-gold);
	margin-bottom: 8px;
}
.section-kicker__marker {
	display: inline-block;
	width: 6px;
	height: 6px;
	flex-shrink: 0;
	background: var(--color-gold);
	transform: rotate(45deg);
}
.section-kicker .section-heading { margin-bottom: 10px; }
.section-kicker__rule {
	display: block;
	width: 42px;
	height: 3px;
	border-radius: 2px;
	background: var(--color-gold);
}
.view-all {
	color: var(--color-gold);
	font-weight: 600;
	font-size: 0.9rem;
	white-space: nowrap;
}
.view-all:hover { color: var(--color-gold-strong); }
.empty-state { color: var(--color-text-muted); padding: 32px 0; }

.badge {
	display: inline-block;
	font-size: 0.7rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	padding: 4px 10px;
	border-radius: 4px;
	background: var(--color-gold);
	color: #14120a;
	margin-bottom: 10px;
}

.button {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 12px 22px;
	border-radius: var(--radius-sm);
	font-weight: 700;
	font-size: 0.9rem;
}
.button--gold { background: var(--color-gold); color: #14120a; }
.button--gold:hover { background: var(--color-gold-strong); }

/* =========================================================
   Header
   ========================================================= */
.site-header {
	position: sticky;
	top: 0;
	z-index: 100;
	background: var(--color-bg);
	border-bottom: 1px solid var(--color-border);
}
.site-header__bar {
	max-width: var(--container-max);
	margin: 0 auto;
	padding: 12px var(--container-pad);
	display: flex;
	align-items: center;
	gap: 16px;
}
.site-branding {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-right: auto;
}
.site-branding__mark {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: linear-gradient(155deg, var(--color-gold-strong), var(--color-gold));
	color: #14120a;
	font-weight: 800;
	font-size: 0.85rem;
	flex-shrink: 0;
}
.site-branding__text { display: flex; flex-direction: column; line-height: 1.15; }
.site-branding__brand { font-size: 0.95rem; font-weight: 800; letter-spacing: 0.02em; }
.site-branding__pub { font-size: 0.65rem; font-weight: 700; letter-spacing: 0.12em; color: var(--color-gold); }

.nav-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	order: -1;
}
.nav-toggle__box { display: flex; flex-direction: column; gap: 4px; width: 20px; }
.nav-toggle__box span { display: block; height: 2px; background: var(--color-text); border-radius: 1px; transition: transform 0.2s ease, opacity 0.2s ease; }
body.nav-is-open .nav-toggle__box span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
body.nav-is-open .nav-toggle__box span:nth-child(2) { opacity: 0; }
body.nav-is-open .nav-toggle__box span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.primary-nav__list { display: flex; align-items: center; gap: 22px; }
.primary-nav__list a {
	font-size: 0.88rem;
	font-weight: 600;
	color: var(--color-text-muted);
	white-space: nowrap;
}
.primary-nav__list a:hover,
.primary-nav__list .current-menu-item > a { color: var(--color-gold); }

.site-header__utility { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.search-toggle svg { width: 20px; height: 20px; }
.search-toggle:hover { color: var(--color-gold); }

.social-icons { display: flex; align-items: center; gap: 10px; }
.social-icons a { display: inline-flex; color: var(--color-text-muted); }
.social-icons svg { width: 17px; height: 17px; }
.social-icons a:hover { color: var(--color-gold); }

.header-search[hidden] { display: none; }
.header-search {
	border-top: 1px solid var(--color-border);
	padding: 14px var(--container-pad);
}
.header-search__form {
	max-width: var(--container-max);
	margin: 0 auto;
	display: flex;
	gap: 10px;
}
.header-search__input {
	flex: 1;
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	padding: 10px 14px;
	color: var(--color-text);
}
.header-search__input::placeholder { color: var(--color-text-muted); }
.header-search__submit {
	background: var(--color-gold);
	color: #14120a;
	padding: 10px 18px;
	border-radius: var(--radius-sm);
	font-weight: 700;
}

/* Mobile nav drawer */
@media (max-width: 1023px) {
	.primary-nav {
		position: fixed;
		inset: 0 0 0 auto;
		width: min(320px, 84vw);
		height: 100vh;
		background: var(--color-surface);
		border-left: 1px solid var(--color-border);
		padding: 90px 24px 24px;
		transform: translateX(100%);
		transition: transform 0.25s ease;
		overflow-y: auto;
	}
	body.nav-is-open .primary-nav { transform: translateX(0); }
	.primary-nav__list { flex-direction: column; align-items: flex-start; gap: 4px; }
	.primary-nav__list a { display: block; padding: 12px 4px; font-size: 1rem; width: 100%; border-bottom: 1px solid var(--color-border); }
	.social-icons { display: none; }
}
@media (min-width: 1024px) {
	.nav-toggle { display: none; }
}

/* =========================================================
   Featured block
   ========================================================= */
.featured-block {
	display: grid;
	grid-template-columns: 1fr;
	gap: 18px;
	padding: 20px 0 24px;
	/* Localized vignette: a soft gold glow behind the hero only (visible
	   in the grid gap and around the card edges), reinforcing the
	   cinematic feel without a sitewide effect competing with content. */
	background-image: radial-gradient(ellipse 70% 65% at 28% 15%, rgba(212,175,55,0.07), transparent 70%);
	background-repeat: no-repeat;
}
@media (min-width: 1024px) {
	.featured-block { grid-template-columns: 1.6fr 1fr; gap: 28px; padding: 28px 0 32px; align-items: start; }
}
/* min-width: 0 overrides the grid item's default `min-width: auto` —
   without it, this item's min-content size (which the aspect-ratio +
   min-height child below computes as ~569px, see .featured-block__media)
   gets propagated up and forces the *grid track itself* to widen to
   fit, so `width: 100%` on the child alone can't fix it — the track it
   would be 100% of has already grown. Same class of bug, same fix
   already used for `.single-post__main` elsewhere in this file. */
.featured-block__primary { position: relative; min-width: 0; }

/* Cinematic overlay composition: the card's total height is just the
   16:9 image — badge/category/title/excerpt/meta/CTA sit on a gradient
   over the image rather than extending the card with a separate content
   block below it (that mismatch was what created the dead space under
   the hero at desktop widths). */
.featured-block__media {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: 16 / 9;
	/* Below ~640px the overlay text needs more room than a strict 16:9
	   crop gives a narrow column — min-height wins over aspect-ratio
	   there (object-fit: cover just crops the image a little tighter,
	   never distorts it), so the overlay never gets clipped. At 640px+
	   16:9 already comfortably fits the overlay, so this is a no-op.
	   `width: 100%` above is what actually pins the box to its
	   container — without it, a block element with only aspect-ratio +
	   min-height (no width) lets the browser derive width *from* the
	   height floor via the ratio (320 × 16/9 ≈ 569px) instead of filling
	   the container, which is what caused the real horizontal overflow
	   below ~569px viewports. */
	min-height: 320px;
	border-radius: var(--radius);
	overflow: hidden;
	background: var(--color-surface);
}
@media (min-width: 640px) {
	.featured-block__media { min-height: 0; }
}
.featured-block__image-link { position: absolute; inset: 0; display: block; }
.featured-block__image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.featured-block__image--placeholder { position: absolute; inset: 0; display: block; width: 100%; height: 100%; background: linear-gradient(160deg, var(--color-surface-alt), var(--color-surface)); }
.featured-block__gradient {
	position: absolute;
	inset: 0;
	background: linear-gradient(to top, rgba(10,10,12,0.95) 0%, rgba(10,10,12,0.78) 34%, rgba(10,10,12,0.25) 62%, transparent 85%);
	pointer-events: none;
}
.featured-block__overlay {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 2;
	padding: 18px 20px 20px;
}
@media (min-width: 640px) {
	.featured-block__overlay { padding: 26px 30px 28px; }
}
.featured-block__eyebrow { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.featured-block__overlay .badge { position: static; margin-bottom: 0; }
.featured-block__category {
	display: inline-block;
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--color-gold-strong);
}
.featured-block__title {
	font-size: clamp(1.25rem, 1.05rem + 1.4vw, 1.9rem);
	margin-bottom: 8px;
	text-shadow: 0 2px 10px rgba(0,0,0,0.4);
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.featured-block__title a:hover { color: var(--color-gold-strong); }
.featured-block__excerpt {
	color: #d8d6d3;
	max-width: 58ch;
	margin-bottom: 12px;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.featured-block__meta { color: var(--color-text-muted); font-size: 0.85rem; margin-bottom: 16px; }
.featured-block__dot { margin: 0 6px; }
.featured-block__cta { font-size: 0.85rem; padding: 10px 18px; }

/* Extra headroom on the smallest phones: drop the excerpt from the
   overlay rather than risk crowding a long title + meta + CTA into the
   available height. */
@media (max-width: 479px) {
	.featured-block__excerpt { display: none; }
}

.featured-block__secondary { display: none; flex-direction: column; gap: 10px; }
@media (min-width: 1024px) {
	.featured-block__secondary { display: flex; }
}
.article-card.article-card--compact {
	display: flex;
	flex-direction: row;
	align-items: flex-start;
	gap: 12px;
}
.article-card--compact .article-card__media-wrap { flex: 0 0 112px; width: 112px; }
.article-card--compact .article-card__image,
.article-card--compact .article-card__image--placeholder { width: 100%; height: auto; aspect-ratio: 16 / 9; border-radius: var(--radius-sm); }
.article-card--compact .article-card__body { padding: 0; min-width: 0; flex: 1 1 auto; }
.article-card--compact .article-card__title { font-size: 0.86rem; margin-bottom: 4px; line-height: 1.3; }
.article-card--compact .article-card__title a {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.article-card--compact .article-card__category { font-size: 0.63rem; margin-bottom: 3px; }
.article-card--compact .article-card__excerpt { display: none; }
.article-card--compact .article-card__meta { font-size: 0.7rem; }
.article-card--compact .badge { font-size: 0.56rem; padding: 2px 6px; top: 5px; left: 5px; }

/* =========================================================
   Article cards + grid
   ========================================================= */
/* Section-band: lets a section's background bleed to the edge of the
   page's own max-width container (cancelling .homepage's padding for
   just this section) without ever exceeding that container — safe by
   construction, unlike a 100vw bleed, so it can't introduce horizontal
   scroll. Latest Articles reads as a "lifted" surface; Explore by Topic
   layers in the block-grid texture at higher visibility for a subtly
   textured band — the two adjacent sections get a visibly different
   surface treatment even though the change is a single background swap. */
.latest-articles {
	margin-left: calc(-1 * var(--container-pad));
	margin-right: calc(-1 * var(--container-pad));
	padding: 32px var(--container-pad) 40px;
	background-color: var(--color-surface);
}

.article-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 18px 20px;
}
@media (min-width: 640px) {
	.article-grid { grid-template-columns: repeat(2, 1fr); gap: 24px; }
}
@media (min-width: 1024px) {
	.article-grid { grid-template-columns: repeat(4, 1fr); }
}
.article-grid--three { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 768px) {
	.article-grid--three { grid-template-columns: repeat(3, 1fr); }
}

/* Mobile-only Latest Articles: one compact editorial row per article
   ([thumbnail][content], thumbnail ~38%) instead of the 2-column grid,
   which squeezed thumbnails and headlines too narrow on a phone. Scoped
   specifically to Latest Articles' own grid (not the generic
   .article-grid used on archive/search/blog pages) via a three-class
   selector so it can't lose the cascade to the base `.article-card`
   rule regardless of source order — the exact bug that bit the
   secondary-stack compact cards earlier. Desktop/tablet (640px+)
   layout is untouched. */
@media (max-width: 639px) {
	.latest-articles .article-grid {
		grid-template-columns: 1fr;
		gap: 0;
	}
	.latest-articles .article-grid .article-card {
		flex-direction: row;
		align-items: flex-start;
		gap: 14px;
		padding: 16px 0;
		border-bottom: 1px solid var(--color-border);
	}
	.latest-articles .article-grid .article-card:first-child { padding-top: 4px; }
	.latest-articles .article-grid .article-card:last-child { border-bottom: 0; padding-bottom: 4px; }
	.latest-articles .article-grid .article-card .article-card__media-wrap {
		flex: 0 0 38%;
		width: 38%;
	}
	.latest-articles .article-grid .article-card .article-card__body {
		flex: 1 1 auto;
		min-width: 0;
		padding-top: 0;
	}
}

.article-card { display: flex; flex-direction: column; }
.article-card__media-wrap { position: relative; }
.article-card__media { display: block; border-radius: var(--radius-sm); overflow: hidden; background: var(--color-surface); }
.article-card__image { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; transition: transform 0.35s ease; }
.article-card__image--placeholder { display: block; width: 100%; aspect-ratio: 16 / 9; background: linear-gradient(160deg, var(--color-surface-alt), var(--color-surface)); }
.article-card:hover .article-card__image,
.article-card:focus-within .article-card__image { transform: scale(1.025); }
.article-card__body { padding-top: 10px; }
.article-card__category {
	display: inline-block;
	font-size: 0.66rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--color-gold);
	margin-bottom: 6px;
}
.article-card__title { font-size: 0.96rem; margin-bottom: 5px; line-height: 1.35; }
.article-card__title a:hover { color: var(--color-gold-strong); }
.article-card__title a { transition: color 0.15s ease; }
.article-card__excerpt { display: none; color: var(--color-text-muted); font-size: 0.86rem; }
@media (min-width: 1024px) { .article-card__excerpt { display: block; } }
.article-card__meta { color: var(--color-text-muted); font-size: 0.76rem; }
.article-card__dot { margin: 0 5px; }

/* Status badges (Featured / Fresh / Rising / Hot) */
.badge {
	position: absolute;
	top: 10px;
	left: 10px;
	z-index: 1;
}
.featured-block__content .badge { position: static; margin-bottom: 10px; }
.badge--featured { background: var(--color-gold); color: #14120a; }
.badge--fresh { background: var(--color-surface); color: var(--color-text); border: 1px solid var(--color-border); }
.badge--rising { background: var(--color-surface-alt); color: var(--color-gold-strong); border: 1px solid rgba(212,175,55,0.4); }
.badge--hot { background: var(--color-gold-strong); color: #14120a; }

/* =========================================================
   Popular Now + AD2 row
   ========================================================= */
.popular-ad-row {
	display: flex;
	flex-direction: column;
	gap: 20px;
	padding: 32px 0;
	border-top: 1px solid var(--color-border);
	margin-top: 8px;
}
@media (min-width: 1024px) {
	.popular-ad-row { flex-direction: row; align-items: flex-start; }
	.popular-ad-row .popular-now { order: 1; flex: 1 1 auto; }
	.popular-ad-row .ad-slot { order: 2; flex: 0 0 300px; }
}
.popular-now__list { display: flex; flex-direction: column; }
.popular-now__item { display: flex; align-items: center; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--color-border); }
.popular-now__item:last-child { border-bottom: 0; }
.popular-now__rank { font-size: 1.4rem; font-weight: 800; color: var(--color-gold); width: 24px; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.popular-now__media { flex: 0 0 64px; border-radius: var(--radius-sm); overflow: hidden; background: var(--color-surface); }
.popular-now__media img { aspect-ratio: 16 / 9; object-fit: cover; width: 100%; height: auto; }
.popular-now__link { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.popular-now__category { font-size: 0.64rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-gold); }
.popular-now__title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.popular-now__link:hover .popular-now__title { color: var(--color-gold-strong); }
.popular-now__date { font-size: 0.76rem; color: var(--color-text-muted); }

/* =========================================================
   Explore by Topic
   ========================================================= */
.topic-grid {
	margin-left: calc(-1 * var(--container-pad));
	margin-right: calc(-1 * var(--container-pad));
	padding: 40px var(--container-pad) 44px;
	background-color: var(--color-surface);
	background-image:
		linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px),
		linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px);
	background-size: 44px 44px;
}
.topic-grid__list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 640px) { .topic-grid__list { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .topic-grid__list { grid-template-columns: repeat(6, 1fr); } }
.topic-grid__item {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	text-align: center;
	padding: 18px 10px;
	border: 1px solid var(--color-border);
	border-radius: var(--radius);
	background: var(--color-surface);
	transition: border-color 0.15s ease, background 0.15s ease;
}
.topic-grid__item:hover,
.topic-grid__item:focus-visible { border-color: var(--color-gold); background: var(--color-surface-alt); }
.topic-grid__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	color: var(--color-gold);
}
.topic-grid__icon svg { width: 22px; height: 22px; }
.topic-grid__name { font-weight: 600; font-size: 0.86rem; color: var(--color-text); }
.topic-grid__item:hover .topic-grid__name { color: var(--color-gold-strong); }

/* =========================================================
   Ad slots
   ========================================================= */
.ad-slot { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 28px 0; }
.ad-slot__label { font-size: 0.65rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-text-muted); }
.ad-slot__link { display: block; border-radius: var(--radius-sm); overflow: hidden; }
.ad-slot__image { width: 100%; height: auto; border-radius: var(--radius-sm); }
.ad-slot--ad-1 .ad-slot__image,
.ad-slot--ad-3 .ad-slot__image,
.ad-slot--ad-5 .ad-slot__image { max-width: 728px; }
.ad-slot--ad-2 .ad-slot__image { max-width: 300px; }
.ad-slot--ad-3 { width: 100%; }
.ad-slot--ad-3 .ad-slot__image { max-width: 970px; margin: 0 auto; }
.ad-slot--ad-4 .ad-slot__image { max-width: 300px; }

/* AD4 is a desktop sidebar creative (300×600), not a mobile in-flow
   placement. Until an approved compact/mobile creative is supplied,
   suppress the entire slot below the tablet breakpoint. `display: none`
   removes its label, image, margins, and flex gap together, so a disabled
   or unavailable ad can never reserve a blank 300×600-sized region. */
@media (max-width: 767px) {
	.single-post__aside .ad-slot--ad-4 { display: none; }
}

/* Mobile section rhythm: the vertical padding tuned for desktop reads
   as excessive dead air stacked on a phone (Latest Articles' band,
   Popular Now/AD2, Explore by Topic's band, and the ad slots' own
   margins all compound). Trims padding/margins only — no section,
   grid, ad position, or structural element is removed. Explore by
   Topic's 2×3 grid and Popular Now's row structure are untouched. */
@media (max-width: 639px) {
	.latest-articles { padding-top: 24px; padding-bottom: 8px; }
	.topic-grid { padding-top: 28px; padding-bottom: 32px; }
	.popular-ad-row { padding: 24px 0; gap: 16px; margin-top: 4px; }
	.ad-slot { margin: 20px 0; }
}

/* =========================================================
   Breadcrumbs
   ========================================================= */
.breadcrumbs { max-width: var(--container-max); margin: 0 auto; padding: 16px var(--container-pad) 0; }
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 6px; font-size: 0.78rem; color: var(--color-text-muted); }
.breadcrumbs li:not(:last-child)::after { content: '/'; margin-left: 6px; color: var(--color-border); }
.breadcrumbs a:hover { color: var(--color-gold); }
.breadcrumbs [aria-current="page"] { color: var(--color-text); }

/* =========================================================
   Single post
   ========================================================= */
.single-post__grid { display: grid; grid-template-columns: 1fr; gap: 40px; padding-top: 20px; }
@media (min-width: 1024px) {
	.single-post__grid { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
}
.single-post__main { min-width: 0; }

/* Desktop-only sticky sidebar: on a long article, the useful sidebar
   modules (AD4, Popular Topics, Related Reads, Follow) stay in view
   alongside the body instead of scrolling out and leaving a large empty
   column. `align-items: start` above is required for this — without it
   the grid stretches the aside to the row's full height and there's no
   room left for "sticky" to ever move. Scoped to 1024px+ only, the same
   breakpoint the two-column layout itself starts at; below that the
   aside is normal static flow. */
@media (min-width: 1024px) {
	.single-post__aside {
		position: sticky;
		top: 88px;
	}
}

.single-post__category {
	display: inline-block;
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--color-gold);
	margin-bottom: 10px;
}
.single-post__title { font-size: clamp(1.5rem, 1.1rem + 1.8vw, 2.3rem); margin-bottom: 12px; }
.single-post__deck { font-size: 1.05rem; color: var(--color-text-muted); max-width: 62ch; margin-bottom: 16px; }
.single-post__meta { color: var(--color-text-muted); font-size: 0.85rem; margin-bottom: 16px; }
.single-post__dot { margin: 0 6px; }
.single-post__share { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; }
.single-post__share-label { font-size: 0.78rem; color: var(--color-text-muted); margin-right: 4px; }
.single-post__share-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	font-size: 0.8rem;
	font-weight: 700;
}
.single-post__share-btn:hover { border-color: var(--color-gold); color: var(--color-gold); }

.single-post__featured-image { margin: 0 0 24px; }
.single-post__image { width: 100%; height: auto; border-radius: var(--radius); aspect-ratio: 16/9; object-fit: cover; }
.single-post__featured-image figcaption { font-size: 0.8rem; color: var(--color-text-muted); margin-top: 8px; }

/* Table of contents */
.toc {
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius);
	padding: 8px 20px;
	margin: 0 0 28px;
}
.toc__toggle {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 0;
	font-weight: 700;
}
.toc__chevron { width: 18px; height: 18px; transition: transform 0.2s ease; }
.toc__toggle[aria-expanded="true"] .toc__chevron { transform: rotate(180deg); }
.toc__list { padding: 4px 0 16px; display: flex; flex-direction: column; gap: 8px; counter-reset: toc-counter; }
.toc__item { counter-increment: toc-counter; font-size: 0.9rem; }
.toc__item::before { content: counter(toc-counter) '.'; color: var(--color-gold); font-weight: 700; margin-right: 8px; }
.toc__item--level-3 { padding-left: 20px; font-size: 0.85rem; }
.toc__item a:hover { color: var(--color-gold-strong); }
.toc--collapsed .toc__list { display: none; }

/* Article body typography */
.single-post__content {
	/* Keeps long-form copy inside the 800px desktop main column while
	   restoring a comfortably generous editorial measure (736px) rather
	   than the previous ~587px cap. The width remains fluid below this
	   cap, so tables, inline ads, and mobile reflow retain their existing
	   behavior. */
	max-width: min(100%, 46rem);
	/* The sitewide ambient texture is already extremely faint, but the
	   long-form reading column gets an explicit solid backdrop anyway —
	   belt-and-suspenders so nothing ever sits behind body text. */
	background-color: var(--color-bg);
}
.single-post__content > * + * { margin-top: 1.1em; }
.single-post__content h2 { font-size: 1.5rem; margin-top: 1.8em; }
.single-post__content h3 { font-size: 1.2rem; margin-top: 1.6em; }
.single-post__content p { color: #d8d6d3; }
.single-post__content ul, .single-post__content ol { padding-left: 1.4em; color: #d8d6d3; }
.single-post__content ul { list-style: disc; }
.single-post__content ol { list-style: decimal; }
.single-post__content li + li { margin-top: 0.4em; }
.single-post__content blockquote {
	border-left: 3px solid var(--color-gold);
	padding: 4px 0 4px 20px;
	color: var(--color-text-muted);
	font-style: italic;
}
.single-post__content img { border-radius: var(--radius-sm); }
.single-post__content figcaption { font-size: 0.82rem; color: var(--color-text-muted); margin-top: 6px; }
.single-post__content table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.single-post__content th, .single-post__content td { border: 1px solid var(--color-border); padding: 8px 12px; text-align: left; }
.single-post__content th { background: var(--color-surface); }
.single-post__content pre {
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	padding: 16px;
	overflow-x: auto;
	font-size: 0.85rem;
}
.single-post__content code { background: var(--color-surface); padding: 2px 5px; border-radius: 4px; font-size: 0.88em; }
.single-post__content a { color: var(--color-gold); text-decoration: underline; text-decoration-color: rgba(212,175,55,0.4); }

/* Sidebar */
.single-post__aside { display: flex; flex-direction: column; gap: 28px; }

/* On the one-column tablet/mobile layout, the sidebar modules should
   read as the supporting layer that follows the article—not as a hard
   continuation of its final paragraph. A hairline and compact inset
   create that hand-off without introducing another surface or box. */
@media (max-width: 1023px) {
	.single-post__aside {
		border-top: 1px solid var(--color-border);
		padding-top: 28px;
	}
}

/* Phone-only article-header polish. The title remains emphatic, while
   its slightly more deliberate leading, clearer metadata, and larger
   share controls make the opening easier to scan and tap at 390px. */
@media (max-width: 639px) {
	.single-post__category { margin-bottom: 12px; }
	.single-post__title {
		font-size: clamp(1.58rem, 6.4vw, 1.8rem);
		line-height: 1.18;
		margin-bottom: 14px;
	}
	.single-post__deck { margin-bottom: 18px; }
	.single-post__meta {
		font-size: 0.875rem;
		line-height: 1.5;
		margin-bottom: 18px;
	}
	.single-post__share { gap: 12px; margin-bottom: 28px; }
	.single-post__share-btn { width: 36px; height: 36px; }
}

.popular-topics__list { display: flex; flex-wrap: wrap; gap: 8px; }
.popular-topics__list a {
	display: inline-block;
	padding: 6px 12px;
	border: 1px solid var(--color-border);
	border-radius: 999px;
	font-size: 0.8rem;
	color: var(--color-text-muted);
}
.popular-topics__list a:hover { border-color: var(--color-gold); color: var(--color-gold); }

.related-reads-compact__list { display: flex; flex-direction: column; gap: 14px; }
.related-reads-compact__item { display: flex; gap: 12px; align-items: flex-start; }
.related-reads-compact__media,
.related-reads-compact__media--placeholder { flex: 0 0 88px; width: 88px; aspect-ratio: 16 / 9; border-radius: var(--radius-sm); overflow: hidden; background: var(--color-surface); display: block; }
.related-reads-compact__media img { width: 100%; height: 100%; object-fit: cover; }
.related-reads-compact__title { display: block; font-size: 0.86rem; font-weight: 600; line-height: 1.35; margin-bottom: 4px; }
.related-reads-compact__title:hover { color: var(--color-gold-strong); }
.related-reads-compact__date { font-size: 0.74rem; color: var(--color-text-muted); }

.follow-module__list { display: flex; flex-direction: column; gap: 4px; }
.follow-module__list a {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 9px 4px;
	color: var(--color-text-muted);
	font-size: 0.86rem;
	font-weight: 600;
	border-bottom: 1px solid var(--color-border);
}
.follow-module__list li:last-child a { border-bottom: 0; }
.follow-module__list a:hover { color: var(--color-gold); }
.follow-module__icon { display: inline-flex; color: var(--color-gold); flex-shrink: 0; }
.follow-module__icon svg { width: 18px; height: 18px; }

/* Post-end "Related Reads" editorial module */
.related-reads-section { margin-top: 56px; padding-top: 32px; border-top: 1px solid var(--color-border); }
.related-reads-section__cta { text-align: center; margin-top: 28px; }
.button--outline {
	background: transparent;
	color: var(--color-gold);
	border: 1px solid var(--color-border);
}
.button--outline:hover { border-color: var(--color-gold); color: var(--color-gold-strong); }

/* =========================================================
   Generic archive header / pagination / all-topics
   ========================================================= */
.archive-header { padding: 28px 0 24px; }
.archive-header__title { font-size: clamp(1.4rem, 1.1rem + 1.4vw, 2rem); }
.archive-header__description { color: var(--color-text-muted); margin-top: 8px; }

.pagination { display: flex; justify-content: center; gap: 8px; margin-top: 40px; }
.pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 36px;
	height: 36px;
	padding: 0 10px;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	color: var(--color-text-muted);
}
.pagination .page-numbers.current { background: var(--color-gold); color: #14120a; border-color: var(--color-gold); }
.pagination a.page-numbers:hover { border-color: var(--color-gold); color: var(--color-gold); }

.all-topics__list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 768px) { .all-topics__list { grid-template-columns: repeat(3, 1fr); } }
.all-topics__item {
	display: flex;
	justify-content: space-between;
	padding: 14px 16px;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	background: var(--color-surface);
	font-weight: 600;
}
.all-topics__item:hover { border-color: var(--color-gold); }
.all-topics__count { color: var(--color-text-muted); font-weight: 400; }

/* =========================================================
   404
   ========================================================= */
.error-404 { text-align: center; padding: 80px 0 40px; max-width: 520px; margin: 0 auto; }
.error-404__code { font-size: 4rem; font-weight: 800; color: var(--color-gold); display: block; }
.error-404__title { font-size: 1.5rem; margin: 8px 0 12px; }
.error-404__text { color: var(--color-text-muted); margin-bottom: 24px; }
.error-404 .header-search__form { margin-bottom: 24px; }

/* =========================================================
   Footer
   ========================================================= */
.site-footer {
	border-top: 1px solid var(--color-border);
	background-color: var(--color-surface-deep);
	background-image: linear-gradient(180deg, var(--color-surface) 0%, var(--color-surface-deep) 100%), var(--texture-grid);
	background-size: 100% 100%, 56px 56px;
	margin-top: 40px;
}
.site-footer__inner {
	max-width: var(--container-max);
	margin: 0 auto;
	padding: 44px var(--container-pad) 32px;
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 32px 24px;
}
@media (min-width: 768px) {
	.site-footer__inner { grid-template-columns: 1.4fr 1fr 1fr; gap: 24px; }
	.site-footer__inner--4col { grid-template-columns: 1.4fr 1fr 1fr 1fr; }
}
.site-footer__col--brand { grid-column: 1 / -1; }
@media (min-width: 768px) {
	.site-footer__col--brand { grid-column: 1; }
}
.site-footer__tagline { color: var(--color-text-muted); font-size: 0.86rem; margin: 12px 0 16px; max-width: 32ch; }
.site-footer__col-title {
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--color-text-muted);
	margin-bottom: 14px;
}
.site-footer__list { display: flex; flex-direction: column; gap: 10px; }
.site-footer__list a { color: var(--color-text); font-size: 0.86rem; }
.site-footer__list a:hover { color: var(--color-gold); }
.site-footer__legal {
	max-width: var(--container-max);
	margin: 0 auto;
	padding: 20px var(--container-pad) 32px;
	border-top: 1px solid var(--color-border);
	color: var(--color-text-muted);
	font-size: 0.78rem;
}

/* =========================================================
   Article sources (references) — inc/trust.php
   ========================================================= */
.article-sources {
	max-width: min(100%, 46rem);
	margin-top: 40px;
	padding-top: 22px;
	border-top: 1px solid var(--color-border);
}
.article-sources__heading {
	font-size: 0.78rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--color-gold);
	margin-bottom: 12px;
}
.article-sources__list {
	list-style: decimal;
	padding-left: 1.4em;
	font-size: 0.92rem;
	color: var(--color-text-muted);
}
.article-sources__item + .article-sources__item { margin-top: 0.5em; }
.article-sources__link {
	color: var(--color-text);
	text-decoration: underline;
	text-decoration-color: var(--color-border);
	text-underline-offset: 3px;
	overflow-wrap: anywhere;
}
.article-sources__link:hover { color: var(--color-gold-strong); text-decoration-color: currentColor; }

/* =========================================================
   Correction / update note, commercial disclosure, policy pages
   (inc/trust.php, page-templates/how-knight-logs-works.php, privacy-policy.php)
   ========================================================= */
.update-note,
.disclosure-note {
	max-width: min(100%, 46rem);
	margin: 0 0 20px;
	padding: 12px 16px;
	border: 1px solid var(--color-border);
	border-left: 3px solid var(--color-gold);
	border-radius: var(--radius-sm);
	background: var(--color-surface);
	color: var(--color-text-muted);
	font-size: 0.9rem;
}
.update-note p,
.disclosure-note p { margin: 0; }
.update-note__line + .update-note__text { margin-top: 6px; }
.update-note__label,
.disclosure-note__label {
	font-size: 0.72rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--color-gold);
	margin-right: 6px;
}
.update-note__date { color: var(--color-text-muted); }
.update-note__text { color: #d8d6d3; }
.policy-page__body { max-width: min(100%, 46rem); padding-bottom: 48px; }
.policy-page__body > * + * { margin-top: 1em; }
.policy-page__body h2 { font-size: 1.25rem; margin-top: 1.8em; }
.policy-page__body p { color: #d8d6d3; }
.policy-page__body a { color: var(--color-gold-strong); text-decoration: underline; text-underline-offset: 3px; }
