/*
Theme Name:   TenVolumes
Theme URI:    https://tenvolumes.com/
Description:  TenVolumes child theme for GeneratePress.
Author:       TenVolumes
Author URI:   https://tenvolumes.com/
Template:     generatepress
Version:      0.4.2
Requires at least: 6.9
Requires PHP: 8.1
License:      GNU General Public License v2 or later
License URI:  https://www.gnu.org/licenses/gpl-2.0.html
Text Domain:  tenvolumes
*/

/* ---------- Fonts (SIL OFL 1.1, subset, see fonts/ and scripts/build_fonts.py) ---------- */
@font-face {
	font-family: "Source Serif 4";
	src: url("fonts/source-serif-4.woff2") format("woff2");
	font-weight: 400 700;
	font-style: normal;
	font-display: swap;
}
@font-face {
	font-family: "Inter";
	src: url("fonts/inter.woff2") format("woff2");
	font-weight: 400 700;
	font-style: normal;
	font-display: swap;
}
/* Metric-matched fallbacks keep layout shift low while the web fonts load. */
@font-face {
	font-family: "Serif Fallback";
	src: local("Georgia");
	size-adjust: 97.89%;
	ascent-override: 105.84%;
	descent-override: 34.22%;
	line-gap-override: 0%;
}
@font-face {
	font-family: "Sans Fallback";
	src: local("Arial");
	size-adjust: 107.3%;
	ascent-override: 90.29%;
	descent-override: 22.48%;
	line-gap-override: 0%;
}

/* ---------- Tokens (plan/DESIGN_BRIEF.md 1 to 3) ---------- */
:root {
	--tv-bg: #FAF7F2;
	--tv-surface: #F2EDE4;
	--tv-white: #FFFFFF;
	--tv-text: #1C1B19;
	--tv-muted: #5E5A53;
	--tv-ad-label: #6B665E;
	--tv-accent: #1F3A5F;
	--tv-accent-hover: #152A47;
	--tv-accent-tint: #E6ECF4;
	--tv-rule: #D9D2C5;
	--tv-control-border: #8C857A;

	--tv-serif: "Source Serif 4", "Serif Fallback", Georgia, serif;
	--tv-sans: "Inter", "Sans Fallback", Arial, system-ui, sans-serif;

	--tv-gutter: 20px;
	--tv-container: 1140px;
	--tv-measure: 720px;
	--tv-radius: 4px;
	--tv-cover-shadow: 0 1px 2px rgba(28, 27, 25, .12), 0 6px 16px rgba(28, 27, 25, .10);

	--tv-fs-body: 18px;
	--tv-lh-body: 1.65;
	--tv-fs-h1: 32px;
	--tv-fs-h2-book: 24px;
	--tv-fs-h2: 22px;
	--tv-fs-h3: 19px;
	--tv-fs-rank: 56px;
	--tv-gap-book: 64px;
	color-scheme: light;
}
@media (min-width: 768px) {
	:root { --tv-gutter: 32px; }
}
@media (min-width: 1024px) {
	:root {
		--tv-fs-body: 19px;
		--tv-lh-body: 1.7;
		--tv-fs-h1: 46px;
		--tv-fs-h2-book: 30px;
		--tv-fs-h2: 26px;
		--tv-fs-h3: 21px;
		--tv-fs-rank: 76px;
		--tv-gap-book: 96px;
	}
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
	margin: 0;
	background: var(--tv-bg);
	color: var(--tv-text);
	font-family: var(--tv-sans);
	font-size: var(--tv-fs-body);
	line-height: var(--tv-lh-body);
	text-rendering: optimizeLegibility;
	-webkit-font-smoothing: antialiased;
	overflow-x: hidden;
}
img, svg { max-width: 100%; height: auto; }
h1, h2, h3, h4 {
	font-family: var(--tv-serif);
	font-weight: 600;
	letter-spacing: -0.01em;
	color: var(--tv-text);
	margin: 0 0 16px;
}
h2 { font-size: var(--tv-fs-h2); line-height: 1.3; }
h3 { font-size: var(--tv-fs-h3); line-height: 1.35; }
p, ul, ol, table, figure { margin: 0 0 24px; }
a {
	color: var(--tv-accent);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
}
a:hover { color: var(--tv-accent-hover); text-decoration-thickness: 2px; }
:focus-visible {
	outline: 2px solid var(--tv-accent);
	outline-offset: 2px;
}
.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;
}
.tv-skip {
	position: absolute;
	left: 8px; top: -100px;
	z-index: 100;
	padding: 12px 16px;
	background: var(--tv-accent);
	color: #fff;
	font-weight: 600;
	border-radius: var(--tv-radius);
}
.tv-skip:focus { top: 8px; color: #fff; }

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---------- Layout ---------- */
.tv-wrap {
	max-width: var(--tv-container);
	margin: 0 auto;
	padding: 0 var(--tv-gutter);
}
.tv-narrow { max-width: calc(var(--tv-measure) + 2 * var(--tv-gutter)); }
.tv-main { padding: 32px 0 64px; }
@media (min-width: 1024px) { .tv-main { padding: 48px 0 96px; } }

/* ---------- Header ---------- */
.tv-header {
	border-bottom: 1px solid var(--tv-rule);
	background: var(--tv-bg);
}
.tv-header__inner {
	max-width: var(--tv-container);
	margin: 0 auto;
	padding: 10px var(--tv-gutter);
	display: flex;
	align-items: center;
	gap: 16px;
	min-height: 64px;
}
.tv-logo { display: inline-flex; align-items: center; min-height: 44px; flex: none; }
.tv-logo img { display: block; height: 32px; width: auto; }
@media (min-width: 1024px) { .tv-logo img { height: 36px; } }
.tv-nav { display: none; flex: 1; }
.tv-nav__list {
	list-style: none;
	margin: 0; padding: 0;
	display: flex;
	flex-wrap: nowrap;
	justify-content: flex-end;
	gap: 0 2px;
}
.tv-nav__list a {
	display: flex;
	align-items: center;
	min-height: 44px;
	padding: 0 10px;
	font-size: 15px;
	font-weight: 500;
	white-space: nowrap;
	color: var(--tv-text);
	text-decoration: none;
}
.tv-nav__list a:hover { color: var(--tv-accent); text-decoration: underline; text-decoration-thickness: 1px; }
.tv-nav__list .current-menu-item > a { color: var(--tv-accent); text-decoration: underline; }
@media (min-width: 1100px) { .tv-nav { display: block; } }
.tv-header__tools { margin-left: auto; display: flex; gap: 8px; }
@media (min-width: 1100px) {
	.tv-header__tools { margin-left: 0; }
	.tv-drawer--menu { display: none; }
}

.tv-drawer > summary { list-style: none; }
.tv-drawer > summary::-webkit-details-marker { display: none; }
.tv-iconbtn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px; height: 44px;
	border-radius: var(--tv-radius);
	color: var(--tv-text);
	cursor: pointer;
}
.tv-iconbtn:hover { background: var(--tv-surface); color: var(--tv-accent); }
.tv-iconbtn__open { display: inline-flex; }
.tv-iconbtn__close { display: none; }
.tv-drawer[open] .tv-iconbtn__open { display: none; }
.tv-drawer[open] .tv-iconbtn__close { display: inline-flex; }
.tv-drawer__panel {
	position: absolute;
	left: 0; right: 0;
	top: 65px;
	z-index: 50;
	background: var(--tv-bg);
	border-bottom: 1px solid var(--tv-rule);
}
.admin-bar .tv-drawer__panel { top: 111px; }
.tv-drawer--menu .tv-drawer__panel { min-height: calc(100vh - 65px); }
.tv-drawer__inner {
	max-width: var(--tv-container);
	margin: 0 auto;
	padding: 24px var(--tv-gutter) 32px;
}
.tv-panel__list { list-style: none; margin: 0; padding: 0; }
.tv-panel__list li { border-bottom: 1px solid var(--tv-rule); }
.tv-panel__list a {
	display: flex;
	align-items: center;
	min-height: 52px;
	font-family: var(--tv-serif);
	font-size: 20px;
	font-weight: 600;
	color: var(--tv-text);
	text-decoration: none;
}
.tv-panel__list a:hover { color: var(--tv-accent); text-decoration: underline; }
.tv-panel__list .tv-panel__page a { font-family: var(--tv-sans); font-size: 16px; font-weight: 500; }

/* ---------- Search form, buttons, inputs ---------- */
.tv-search { margin: 0 0 32px; }
.tv-search label, .tv-form label {
	display: block;
	font-size: 15px;
	font-weight: 600;
	margin-bottom: 8px;
}
.tv-search__row { display: flex; gap: 8px; }
.tv-search__row input { flex: 1; min-width: 0; }
input[type="search"], input[type="text"], input[type="email"], input[type="url"], select, textarea {
	font: inherit;
	font-size: 16px;
	color: var(--tv-text);
	background: var(--tv-white);
	border: 1px solid var(--tv-control-border);
	border-radius: var(--tv-radius);
	min-height: 44px;
	padding: 8px 12px;
	width: 100%;
}
textarea { min-height: 160px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--tv-accent); outline-offset: 2px; border-color: var(--tv-accent); }
.tv-btn, input[type="submit"], button[type="submit"] {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 0 16px;
	font-family: var(--tv-sans);
	font-size: 16px;
	font-weight: 600;
	line-height: 1.2;
	border-radius: var(--tv-radius);
	text-decoration: none;
	cursor: pointer;
}
.tv-btn--solid, input[type="submit"], button[type="submit"] {
	background: var(--tv-accent);
	color: #fff;
	border: 1.5px solid var(--tv-accent);
}
.tv-btn--solid:hover, input[type="submit"]:hover, button[type="submit"]:hover { background: var(--tv-accent-hover); border-color: var(--tv-accent-hover); color: #fff; }
.tv-btn--outline {
	background: transparent;
	color: var(--tv-accent);
	border: 1.5px solid var(--tv-accent);
}
.tv-btn--outline:hover {
	background: var(--tv-accent-tint);
	color: var(--tv-accent-hover);
	border-color: var(--tv-accent-hover);
	text-decoration: none;
}

/* ---------- Shared type pieces ---------- */
.tv-h1 {
	font-size: var(--tv-fs-h1);
	line-height: 1.15;
	margin: 0 0 16px;
	text-wrap: balance;
}
@media (min-width: 1024px) { .tv-h1 { line-height: 1.1; } }
.tv-kicker {
	font-size: 13px;
	font-weight: 600;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: var(--tv-muted);
	margin: 0 0 8px;
}
.tv-lede { font-size: var(--tv-fs-body); }
.tv-section { margin-top: 48px; }
@media (min-width: 1024px) { .tv-section { margin-top: 64px; } }
.tv-section__title { font-size: var(--tv-fs-h2); line-height: 1.25; margin-bottom: 24px; }
.tv-crumbs { font-size: 15px; line-height: 1.5; color: var(--tv-muted); margin-bottom: 16px; }
.tv-crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; }
.tv-crumbs li { display: inline-flex; align-items: center; }
.tv-crumbs li + li::before { content: "/"; padding: 0 8px; color: var(--tv-muted); }
.tv-crumbs a { color: var(--tv-muted); display: inline-flex; align-items: center; min-height: 44px; }
.tv-crumbs a:hover { color: var(--tv-accent); }
.tv-crumbs li:last-child { display: none; }
@media (min-width: 768px) { .tv-crumbs li:last-child { display: inline-flex; } }
.tv-crumbs [aria-current] { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Prose ---------- */
.tv-prose { max-width: var(--tv-measure); }
.tv-prose > * { max-width: 100%; }
/* Go-live test F1: long bare URLs on pages (Privacy) must wrap at 390 px. */
.tv-page .tv-prose { overflow-wrap: break-word; }
.tv-page .tv-prose a { overflow-wrap: anywhere; }
.tv-prose h2 { margin-top: 48px; }
.tv-prose ul, .tv-prose ol { padding-left: 1.3em; }
.tv-prose li { margin-bottom: 8px; }
.tv-prose li::marker { color: var(--tv-muted); }
.tv-prose em, .tv-prose cite { font-style: italic; }

/* ---------- Home ---------- */
.tv-hero { padding-top: 16px; padding-bottom: 8px; }
.tv-hero__title {
	font-size: 28px;
	line-height: 1.2;
	font-weight: 500;
	max-width: 20ch;
	margin-bottom: 12px;
	text-wrap: balance;
}
.tv-hero__sub { color: var(--tv-muted); max-width: 52ch; margin: 0; }
@media (min-width: 1024px) {
	.tv-hero { padding-top: 32px; }
	.tv-hero__title { font-size: 40px; line-height: 1.15; max-width: 24ch; }
}
.tv-band {
	background: var(--tv-surface);
	margin-top: 64px;
	padding: 48px 0;
}
@media (min-width: 1024px) { .tv-band { margin-top: 96px; padding: 64px 0; } }
.tv-home.tv-main { padding-bottom: 0; }
.tv-pillars {
	list-style: none;
	margin: 0 0 24px;
	padding: 0;
	display: grid;
	gap: 24px;
}
@media (min-width: 768px) { .tv-pillars { grid-template-columns: repeat(3, 1fr); gap: 32px; } }
.tv-pillars h3 { font-size: var(--tv-fs-h3); margin-bottom: 8px; }
.tv-pillars p { margin: 0; font-size: 17px; line-height: 1.6; }
.tv-band__more { margin: 0; }
.tv-band__more a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }

/* ---------- Cards ---------- */
.tv-grid {
	display: grid;
	gap: 40px 32px;
	grid-template-columns: 1fr;
}
@media (min-width: 768px) { .tv-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .tv-grid { grid-template-columns: repeat(3, 1fr); } }
.tv-card { position: relative; }
.tv-card__media {
	aspect-ratio: 16 / 9;
	overflow: hidden;
	border-radius: var(--tv-radius);
	background: var(--tv-surface);
	margin-bottom: 16px;
}
.tv-card__img { display: block; width: 100%; height: 100%; object-fit: cover; }
.tv-card__img--empty { display: block; }
.tv-card__title {
	font-size: var(--tv-fs-h3);
	line-height: 1.3;
	margin: 0 0 8px;
}
.tv-card__title a { color: var(--tv-text); text-decoration: none; }
.tv-card__title a::after { content: ""; position: absolute; inset: 0; }
.tv-card:hover .tv-card__title a { color: var(--tv-accent); text-decoration: underline; text-decoration-thickness: 1px; }
.tv-card__title a:focus-visible { outline: none; }
.tv-card:focus-within { outline: 2px solid var(--tv-accent); outline-offset: 4px; border-radius: var(--tv-radius); }
.tv-card__meta { font-size: 15px; color: var(--tv-muted); margin: 0; }
.tv-card__desc { margin: 0 0 12px; }
.tv-card--feature .tv-card__media { aspect-ratio: 1200 / 630; }
@media (min-width: 1024px) {
	.tv-card--feature { display: grid; grid-template-columns: 7fr 5fr; gap: 40px; align-items: center; }
	.tv-card--feature .tv-card__media { margin: 0; }
	.tv-card--feature .tv-card__title { font-size: 34px; line-height: 1.15; }
}
.tv-card--feature .tv-card__title { font-size: 26px; line-height: 1.2; }
.tv-card--compact {
	display: grid;
	grid-template-columns: 112px 1fr;
	gap: 16px;
	align-items: center;
	padding: 16px 0;
	border-bottom: 1px solid var(--tv-rule);
}
.tv-card--compact .tv-card__media { margin: 0; }
.tv-card--compact .tv-card__title { font-size: 18px; margin: 0; }
.tv-results { margin-bottom: 32px; }

/* ---------- Category tiles ---------- */
.tv-tiles {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 12px;
}
@media (min-width: 768px) { .tv-tiles { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .tv-tiles { grid-template-columns: repeat(5, 1fr); gap: 16px; } }
.tv-tile a {
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	gap: 8px;
	height: 100%;
	min-height: 96px;
	padding: 16px;
	background: var(--tv-surface);
	border-radius: var(--tv-radius);
	text-decoration: none;
	color: var(--tv-text);
	border: 1px solid transparent;
}
.tv-tile a:hover { border-color: var(--tv-accent); }
.tv-tile a:hover .tv-tile__name { color: var(--tv-accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.tv-tile__name { font-family: var(--tv-serif); font-weight: 600; font-size: 18px; line-height: 1.25; }
@media (min-width: 1024px) { .tv-tile__name { font-size: 20px; } }
.tv-tile__count { font-size: 14px; color: var(--tv-muted); }

/* ---------- Category archive ---------- */
.tv-archive__head { margin-bottom: 40px; }
/* UX (a): mobile shows the first two sentences above the cards and the rest after them. */
.tv-archive__more { margin: 40px 0 0; }
@media (max-width: 767px) {
	.tv-archive__flow { display: flex; flex-direction: column; }
	.tv-archive__flow > .tv-archive__more { order: 1; }
}
@media (min-width: 768px) {
	.tv-archive__head:has(+ .tv-archive__more) { margin-bottom: 0; }
	.tv-archive__more { margin: 1em 0 40px; }
}
.tv-archive__intro { color: var(--tv-text); }
.tv-archive__intro p:last-child { margin-bottom: 0; }
.tv-empty { color: var(--tv-muted); }
.tv-pagination { margin-top: 48px; }
.tv-pagination .nav-links { display: flex; flex-wrap: wrap; gap: 8px; }
.tv-pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	min-height: 44px;
	padding: 0 12px;
	border: 1px solid var(--tv-control-border);
	border-radius: var(--tv-radius);
	text-decoration: none;
	font-weight: 600;
	font-size: 16px;
}
.tv-pagination .page-numbers.current { background: var(--tv-accent); border-color: var(--tv-accent); color: #fff; }
.tv-pagination .page-numbers.dots { border: 0; }

/* ---------- Single list layout ---------- */
.tv-layout {
	max-width: var(--tv-container);
	margin: 0 auto;
	padding: 0 var(--tv-gutter);
}
.tv-article { max-width: var(--tv-measure); min-width: 0; }
.tv-sidebar { display: none; }
@media (min-width: 1024px) {
	.tv-layout { display: grid; grid-template-columns: minmax(0, 720px) 300px; gap: 48px; justify-content: center; }
	.tv-sidebar { display: block; padding-top: 72px; }
	.tv-sidebar__sticky { position: sticky; top: 24px; }
}
.tv-sidebar__title { font-size: 18px; margin-bottom: 12px; }
.tv-popular { list-style: none; margin: 0 0 32px; padding: 0; }
.tv-popular li { border-bottom: 1px solid var(--tv-rule); }
.tv-popular a { display: flex; align-items: center; min-height: 44px; padding: 8px 0; text-decoration: none; color: var(--tv-text); font-weight: 500; line-height: 1.4; }
.tv-popular a:hover { color: var(--tv-accent); text-decoration: underline; }
.tv-popular--thumbs li { display: grid; grid-template-columns: 72px 1fr; gap: 12px; align-items: center; padding: 8px 0; }
.tv-popular--thumbs .tv-card__img { width: 72px; height: 41px; border-radius: 2px; background: var(--tv-surface); }
.tv-popular--thumbs a { font-size: 15px; padding: 0; }
.tv-links-row { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.tv-links-row a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }

.tv-article__head { margin-bottom: 24px; }
.tv-article__head .tv-kicker { margin-top: 8px; }
.tv-meta {
	font-size: 15px;
	line-height: 1.5;
	color: var(--tv-muted);
	margin: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 4px 20px;
	/* L8: each separator dot sits in the gap to the left of its item. An item that wraps to
	   the start of a line has its dot outside the box, where overflow clips it, so no line
	   ever starts or ends with a lone dot. */
	overflow: hidden;
	padding: 2px 0;
}
.tv-meta > span { position: relative; display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0 4px; white-space: nowrap; }
.tv-meta > span + span::before { content: "\00B7"; position: absolute; left: -20px; width: 20px; text-align: center; color: var(--tv-muted); }
.tv-meta a { color: var(--tv-muted); }
.tv-meta a:hover { color: var(--tv-accent); }
@media (max-width: 767px) {
	.tv-meta { font-size: 14px; }
	.tv-meta > span:first-child { flex-basis: 100%; }
}

/* D25: one quiet affiliate line, directly above book 10. Muted text on the page background
   (#5E5A53 on #FAF7F2, about 6.6:1, passes AA). No link, no box. */
.tv-affiliate-note {
	font-size: 14px;
	line-height: 1.5;
	color: var(--tv-muted);
	margin: 24px 0 8px;
}

/* Quick answer box */
.tv-quick {
	background: var(--tv-surface);
	border-left: 4px solid var(--tv-accent);
	border-radius: 0 var(--tv-radius) var(--tv-radius) 0;
	padding: 20px;
	margin: 0 0 32px;
}
.tv-quick__label {
	font-size: 13px;
	font-weight: 600;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: var(--tv-accent);
	margin: 0 0 8px;
}
.tv-quick p:last-child { margin: 0; }
.tv-quick p { line-height: 1.6; }

.tv-criteria { margin: 0 0 32px; counter-reset: tv-crit; }
.tv-criteria p { margin-bottom: 12px; }
.tv-criteria p:last-child { margin: 20px 0 0; }
/* UX (b): the criteria read as a numbered list (markup stays plain paragraphs; render.py
   wraps the label before the first ": " in <strong>). */
.tv-criteria p:not(:last-child) {
	counter-increment: tv-crit;
	position: relative;
	padding: 12px 0 12px 44px;
	margin: 0;
	border-bottom: 1px solid var(--tv-rule);
}
.tv-criteria p:first-child { border-top: 1px solid var(--tv-rule); }
.tv-criteria p:not(:last-child)::before {
	content: counter(tv-crit);
	position: absolute;
	left: 0;
	top: 12px;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: var(--tv-surface);
	color: var(--tv-accent);
	font-family: var(--tv-serif);
	font-weight: 600;
	font-size: 16px;
	line-height: 28px;
	text-align: center;
}

/* At a glance table */
.tv-glance { margin: 40px 0; position: relative; }
.tv-glance__scroll {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	background:
		linear-gradient(to right, var(--tv-bg) 30%, rgba(250, 247, 242, 0)) left / 32px 100% no-repeat local,
		linear-gradient(to left, var(--tv-bg) 30%, rgba(250, 247, 242, 0)) right / 32px 100% no-repeat local,
		linear-gradient(to right, rgba(28, 27, 25, .14), rgba(28, 27, 25, 0)) left / 12px 100% no-repeat scroll,
		linear-gradient(to left, rgba(28, 27, 25, .14), rgba(28, 27, 25, 0)) right / 12px 100% no-repeat scroll;
}
.tv-glance__scroll:focus-visible { outline: 2px solid var(--tv-accent); outline-offset: 2px; }
.tv-glance table {
	width: 100%;
	min-width: 600px;
	border-collapse: collapse;
	font-size: 15px;
	line-height: 1.45;
	font-variant-numeric: lining-nums tabular-nums;
	margin: 0;
}
@media (min-width: 1024px) { .tv-glance table { font-size: 16px; min-width: 0; } }
.tv-glance caption {
	text-align: left;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: var(--tv-muted);
	padding: 0 0 8px;
}
.tv-glance th, .tv-glance td {
	text-align: left;
	vertical-align: top;
	padding: 10px 12px;
	border-bottom: 1px solid var(--tv-rule);
}
.tv-glance thead th { background: var(--tv-surface); font-weight: 600; border-bottom: 0; white-space: nowrap; }
.tv-glance td:first-child, .tv-glance th:first-child { text-align: center; width: 3.5em; }
.tv-glance tbody th { font-weight: 500; }
.tv-glance .tv-num { white-space: nowrap; }
.tv-glance a { font-weight: 500; }
.tv-glance__hint { font-size: 13px; color: var(--tv-muted); margin: 8px 0 0; }
@media (min-width: 1024px) { .tv-glance__hint { display: none; } }
/* L11: under 480px each row becomes a small card: rank | title / author, year, pages /
   best for. No sideways scrolling. Column order is fixed by render.py. */
@media (max-width: 479px) {
	.tv-glance__scroll { overflow: visible; background: none; }
	.tv-glance table { min-width: 0; font-size: 15px; }
	.tv-glance thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
	.tv-glance tbody { display: block; }
	.tv-glance tr { display: grid; grid-template-columns: 2em minmax(0, 1fr); column-gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--tv-rule); }
	.tv-glance th, .tv-glance td { display: block; padding: 0; border: 0; }
	.tv-glance tr > td:first-child { grid-column: 1; grid-row: 1 / span 3; width: auto; text-align: left; font-family: var(--tv-serif); font-size: 20px; line-height: 1.2; color: var(--tv-accent); }
	.tv-glance tbody th { grid-column: 2; grid-row: 1; font-weight: 600; }
	.tv-glance tr > td:nth-child(3) { grid-column: 2; grid-row: 2; color: var(--tv-muted); font-size: 14px; }
	.tv-glance tr > td:nth-child(4), .tv-glance tr > td:nth-child(5) { display: none; }
	.tv-glance tr > td:nth-child(6) { grid-column: 2; grid-row: 3; font-size: 14px; margin-top: 2px; }
	.tv-glance__hint { display: none; }
}

/* Book section */
.tv-book {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	grid-template-areas: "rank" "title" "best" "cover" "text";
	padding-top: calc(var(--tv-gap-book) / 2);
	margin-top: calc(var(--tv-gap-book) / 2);
	border-top: 1px solid var(--tv-rule);
	scroll-margin-top: 16px;
}
.tv-book__rank {
	grid-area: rank;
	font-family: var(--tv-serif);
	font-weight: 400;
	font-size: var(--tv-fs-rank);
	line-height: 1;
	color: var(--tv-accent);
	font-variant-numeric: lining-nums tabular-nums;
	margin: 0 0 12px;
	display: flex;
	align-items: center;
	gap: 16px;
}
.tv-book__rank::after { content: ""; flex: 1; height: 1px; background: var(--tv-rule); }
.tv-prose .tv-book__title {
	grid-area: title;
	margin-top: 0;
	font-size: var(--tv-fs-h2-book);
	line-height: 1.25;
	margin: 0 0 20px;
	text-wrap: balance;
}
/* Best-for line under the headline (render.py p.tv-book__best): small, muted, not a heading. */
.tv-prose .tv-book__best {
	grid-area: best;
	font-family: var(--tv-sans);
	font-size: 15px;
	line-height: 1.45;
	color: var(--tv-muted);
	margin: -8px 0 20px;
}
.tv-book__cover { grid-area: cover; margin: 0 0 24px; }
.tv-book__cover img {
	display: block;
	width: 160px;
	aspect-ratio: 2 / 3;
	height: auto;
	object-fit: contain;
	background: var(--tv-surface);
	border-radius: 2px;
	box-shadow: var(--tv-cover-shadow);
}
.tv-book__text { grid-area: text; min-width: 0; }
.tv-book__text > p:first-child { margin-top: 0; }
/* The entry text comes as 2 or 3 short paragraphs (render.py); keep them close together. */
.tv-book__text > p:not([class]) { margin-bottom: 16px; }
@media (min-width: 1024px) {
	.tv-book__title { line-height: 1.2; }
}
@media (min-width: 640px) {
	.tv-book {
		grid-template-columns: 200px minmax(0, 1fr);
		grid-template-areas: "cover rank" "cover title" "cover best" "cover text";
		grid-template-rows: auto auto auto 1fr;
		column-gap: 32px;
	}
	.tv-book__cover { margin: 0; }
	.tv-book__cover img { width: 200px; }
}
@media (min-width: 640px) and (max-width: 1023px) {
	.tv-book { grid-template-columns: 160px minmax(0, 1fr); }
	.tv-book__cover img { width: 160px; }
}

/* Details line: segments are template spans, separators are drawn here */
.tv-details {
	font-size: 15px;
	line-height: 1.5;
	color: var(--tv-muted);
	margin: 12px 0 20px;
	display: flex;
	flex-wrap: wrap;
	gap: 4px 0;
	font-variant-numeric: lining-nums;
}
.tv-details > span { display: inline; }
.tv-details > span + span::before {
	content: "";
	display: inline-block;
	width: 1px;
	height: .9em;
	background: var(--tv-control-border);
	margin: 0 10px;
	vertical-align: -0.1em;
}
.tv-buy { margin: 0; }
@media (max-width: 399px) {
	.tv-buy .tv-btn { width: 100%; }
}

/* Related lists, FAQ, sources */
.tv-related { margin-top: calc(var(--tv-gap-book) / 2); padding-top: 48px; border-top: 1px solid var(--tv-rule); }
.tv-prose .tv-related__grid { display: grid; grid-template-columns: 1fr; gap: 0; margin: 0; padding: 0; list-style: none; }
@media (min-width: 640px) { .tv-related__grid { grid-template-columns: 1fr 1fr; column-gap: 32px; } }
.tv-related__grid li { border-bottom: 1px solid var(--tv-rule); margin: 0; }
.tv-related__grid a { display: flex; align-items: center; min-height: 52px; padding: 8px 0; font-family: var(--tv-serif); font-weight: 600; font-size: 18px; text-decoration: none; color: var(--tv-text); line-height: 1.35; }
.tv-related__grid a:hover { color: var(--tv-accent); text-decoration: underline; }
.tv-faq h3 { margin: 32px 0 8px; }
.tv-faq p { margin-bottom: 0; }
.tv-sources ol { font-size: 16px; }
.tv-sources a { overflow-wrap: anywhere; }

/* ---------- Ad slots (DESIGN_BRIEF 7, D27). Hidden while tenvolumes_ads_active is off. ---------- */
.tv-ad { display: none; }
.tv-ads-on .tv-ad {
	display: block;
	margin: 32px 0;
	padding: 12px 0 16px;
	background: var(--tv-surface);
	text-align: center;
	border-radius: var(--tv-radius);
	max-width: 100%;
	overflow: hidden;
}
/* Reserve the tallest size (336x280 / 300x250) so a fill never shifts the layout. */
.tv-ads-on .tv-ad__unit { min-height: 280px; }
.tv-ads-on .tv-ad--empty { display: none; }
.tv-ads-on .tv-grid > .tv-ad { grid-column: 1 / -1; margin: 0; }
/* M6: an ad that follows a book (slot 2 after book 6, slot 3 after book 2) never sits next
   to the Amazon button: 48px space, a divider, then 48px more before the ad box. */
.tv-ads-on .tv-book + .tv-ad { margin-top: 48px; }
.tv-ads-on .tv-book:has(+ .tv-ad) { padding-bottom: 48px; border-bottom: 1px solid var(--tv-rule); }
.tv-ad__label {
	font-size: 11px;
	font-weight: 500;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--tv-ad-label);
	margin: 0 0 8px;
	line-height: 1.2;
}
.tv-ad__unit { display: flex; justify-content: center; align-items: center; max-width: 100%; }
.tv-ad__gpt { max-width: 100%; }
.tv-ad--sidebar { display: none !important; }

/* ---------- Facebook follow card (first party, no Meta SDK) ---------- */
.tv-fb {
	background: var(--tv-white);
	border: 1px solid var(--tv-rule);
	border-radius: 8px;
	padding: 16px;
	font-family: var(--tv-sans);
}
.tv-fb__head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.tv-fb__logo { width: 40px; height: 40px; border-radius: 50%; flex: none; }
.tv-fb__name { margin: 0; font-weight: 600; font-size: 16px; line-height: 1.3; color: var(--tv-text); }
.tv-fb__meta { margin: 0; font-size: 13px; line-height: 1.3; color: var(--tv-muted); }
.tv-fb__text { margin: 0 0 14px; font-size: 15px; line-height: 1.5; color: var(--tv-text); }
.tv-prose .tv-fb__text { font-size: 15px; }
.tv-fb__btn {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 0 16px;
	border-radius: 6px;
	background: #0866FF;
	color: #FFFFFF;
	font-weight: 600;
	font-size: 15px;
	text-decoration: none;
}
.tv-fb__btn:hover, .tv-fb__btn:focus-visible { background: #0654D6; color: #FFFFFF; text-decoration: none; }
.tv-fb__btn:focus-visible { outline: 2px solid var(--tv-accent); outline-offset: 2px; }
.tv-prose .tv-fb__btn, .tv-prose .tv-fb__btn:visited { color: #FFFFFF; text-decoration: none; }
.tv-fb--inline { margin: 40px 0; }
@media (min-width: 1024px) { .tv-fb--inline { display: none; } }

/* ---------- Footer ---------- */
.tv-footer {
	background: var(--tv-surface);
	font-size: 15px;
	line-height: 1.6;
	margin-top: 0;
}
.tv-main + .tv-footer, .tv-footer { border-top: 1px solid var(--tv-rule); }
.tv-footer__inner {
	max-width: var(--tv-container);
	margin: 0 auto;
	padding: 40px var(--tv-gutter) 48px;
}
.tv-footer__brand { font-family: var(--tv-serif); font-weight: 600; font-size: 20px; margin: 0 0 16px; }
.tv-footer__links {
	list-style: none;
	margin: 0 0 24px;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 0 24px;
}
.tv-footer__links a, .tv-footer__pending { display: inline-flex; align-items: center; min-height: 44px; }
.tv-footer__pending { color: var(--tv-muted); }
.tv-footer__disclosure, .tv-footer__copy { margin: 0 0 8px; color: var(--tv-text); }
.tv-footer__copy { color: var(--tv-muted); }

/* ---------- WordPress content defaults ---------- */
.wp-block-image img, .wp-post-image { border-radius: var(--tv-radius); }
.alignwide, .alignfull { max-width: 100%; }
.wpcf7 p { margin-bottom: 20px; }
.wpcf7 .wpcf7-not-valid-tip { color: #8A1C1C; font-size: 15px; }
.wpcf7 form .wpcf7-response-output { margin: 16px 0 0; padding: 12px 16px; border-radius: var(--tv-radius); }

/* ---------- Rendering performance: skip layout of off-screen list sections ---------- */
.tv-book ~ .tv-book ~ .tv-book,
.tv-related, .tv-faq, .tv-sources {
	content-visibility: auto;
	contain-intrinsic-size: auto 900px;
}
.tv-related, .tv-faq, .tv-sources { contain-intrinsic-size: auto 500px; }
