/*
 * Commentary section — long-form prose layout.
 * Inherits the site's terminal-theme infrastructure (header, nav, footer)
 * but switches body typography to a literary serif and uses an amber accent.
 */

:root[data-theme="dark"] body.commentary {
	--primary-color: #eec35e;
	--background-color: #1a170f;
	--font-color: #eceae5;
	}

:root[data-theme="light"] body.commentary {
	--primary-color: #8a6e1c;
	--background-color: #fbf7ee;
	--font-color: #1a170f;
	}

/* Kill the theme's "====" h1 underline pseudo-element */
body.commentary {
	--display-h1-decoration: none;
	}

/* Literary body type — system serif stack, no webfont load.
   Theme's terminal.css explicitly sets font-family on em/strong/headings,
   so we re-override those targets. */
body.commentary .post-content,
body.commentary .post-description,
body.commentary .post-meta,
body.commentary .post-title,
body.commentary .table-of-contents,
body.commentary .table-of-contents h2,
body.commentary .table-of-contents a,
body.commentary .post-content h1,
body.commentary .post-content h2,
body.commentary .post-content h3,
body.commentary .post-content h4,
body.commentary .post-content h5,
body.commentary .post-content h6,
body.commentary.terminal .post-content h1,
body.commentary.terminal .post-content h2,
body.commentary.terminal .post-content h3,
body.commentary.terminal .post-content strong,
body.commentary .post-content em,
body.commentary .post-content strong {
	font-family: Charter, "Iowan Old Style", "Source Serif Pro", "Apple Garamond", Georgia, "Times New Roman", serif;
	}

body.commentary .post-content {
	font-size: 1.05rem;
	line-height: 1.65;
	}

body.commentary .post-content em,
body.commentary .post-content strong,
body.commentary.terminal .post-content strong {
	font-size: inherit;
	}

body.commentary .post-content p {
	margin: 0.9em 0;
	}

/* Centered title + section h2 in accent colour. Override terminal.css which
   pins all headings to body-text size and renders h1 as inline-block. */
body.commentary .post-title,
body.commentary .post-content h1,
body.commentary .post-content h2 {
	text-align: center;
	color: var(--primary-color);
	border-bottom: none;
	display: block;
	width: auto;
	padding: 0;
	font-weight: 600;
	}

body.commentary .post-title,
body.commentary .post-content h1 {
	font-size: 2em;
	line-height: 1.25;
	margin: 30px auto 10px;
	}

body.commentary .post-content h2 {
	font-size: 1.5em;
	line-height: 1.3;
	margin: 1.5em auto 0.5em;
	}

body.commentary .post-content h3 {
	font-size: 1.2em;
	line-height: 1.35;
	padding-top: 0.6em;
	padding-bottom: 0;
	margin-bottom: 0;
	border-bottom: none;
	width: auto;
	}

/* Condensed single-line meta */
body.commentary .post-meta {
	text-align: center;
	font-size: 0.9em;
	color: color-mix(in srgb, var(--font-color) 65%, transparent);
	margin-bottom: 30px;
	}

body.commentary .post-meta time,
body.commentary .post-meta .post-author,
body.commentary .post-meta .post-reading-time {
	color: inherit;
	}

body.commentary .post-description {
	text-align: center;
	font-style: italic;
	max-width: 60ch;
	margin: 0 auto 30px;
	color: color-mix(in srgb, var(--font-color) 80%, transparent);
	}

body.commentary .table-of-contents {
	margin: 30px 0;
	}

/* Link hover — highlighter-style: bright amber + dark text, layout-neutral */
body.commentary a {
	transition: background 0.15s, box-shadow 0.15s, color 0.15s;
	}

body.commentary a:hover,
body.commentary a:hover code {
	background: #eec35e;
	color: #1a170f;
	box-shadow: 0 0 0 3px #eec35e;
	}

/* Banner illustration after each H2 */
body.commentary img.banner {
	display: block;
	width: 100%;
	height: auto;
	margin: 0.5rem 0 1.5rem;
	mask-image: linear-gradient(to bottom, transparent 0%, black 10%);
	-webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 10%);
	}

body.commentary p:has(> img.banner) {
	margin: 0;
	}

/* Genealogy section — 2 columns, $architect forced to right column */
body.commentary .genealogy {
	columns: 2;
	column-gap: 2.5em;
	}

body.commentary .genealogy > * {
	break-inside: avoid;
	}

body.commentary .genealogy h3 {
	break-after: avoid;
	break-after: avoid-column;
	page-break-after: avoid;
	margin-top: 0;
	}

body.commentary .genealogy h3:nth-of-type(4) {
	break-before: column;
	}

/* Footnotes — explicit commentary scope (defensive against cache/cascade) */
body.commentary .footnotes {
	font-size: 0.8em;
	color: color-mix(in srgb, var(--font-color) 60%, transparent);
	margin-top: 10px;
	}

body.commentary .footnotes hr {
	display: none;
	}

body.commentary .footnotes ol {
	columns: 2;
	column-gap: 2.5em;
	margin-top: 0;
	padding-left: 0;
	list-style-position: inside;
	}

body.commentary .footnotes li {
	break-inside: avoid;
	margin-bottom: 0.6em;
	padding-left: 0;
	}

body.commentary .footnotes li > p {
	display: inline;
	margin: 0;
	}

body.commentary .footnotes em,
body.commentary .footnotes strong,
body.commentary.terminal .footnotes strong {
	font-size: 1em !important;
	}

/* Mono code optically reads larger than serif at the same point size, more
   so on iOS — shrink it slightly so it matches the surrounding text */
body.commentary .footnotes code,
body.commentary.terminal .footnotes code {
	font-size: 0.9em !important;
	}

body.commentary {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
	}

body.commentary .footnotes a.footnote-backref {
	text-decoration: none;
	margin-left: 0.25em;
	}

@media only screen and (max-width: 700px) {
	body.commentary .footnotes ol {
		columns: 1;
		}
	}

/* Signature block (closes the essay, before the footnotes) */
body.commentary .signature {
	text-align: right;
	font-style: italic;
	margin-top: 2em;
	}

body.commentary .signature p {
	margin: 0;
	}

/* Highlight a footnote when jumped to via in-text ref */
body.commentary .footnotes li:target {
	background: color-mix(in srgb, var(--primary-color) 12%, transparent);
	padding: 8px 12px;
	margin-left: -0.6rem;
	border-left: 2px solid var(--primary-color);
	}

@media only screen and (max-width: 700px) {
	body.commentary .genealogy {
		columns: 1;
		}
	body.commentary .genealogy h3:nth-of-type(4) {
		break-before: auto;
		}
	}
