/* Historyminion v2 - site styles. Light + dark, no framework. */
:root {
  --bg: #ffffff; --surface: #ffffff; --surface-2: #f7f7f5; --ink: #14212f; --muted: #5a6878; --line: #e7e7e2;
  --brand: #032f56; --brand-2: #0a4a82; --link: #0a4a82; --gold: #b8862b; --gold-soft: #e8c46f;
  --shadow: 0 1px 2px rgba(11,42,74,.06), 0 8px 28px rgba(11,42,74,.08);
  --radius: 14px; --wrap: 1180px; --narrow: 760px;
  --font-head: "Playfair Display", "Lora", Georgia, "Times New Roman", serif;
  --font-book: "Lora", Georgia, "Times New Roman", serif;
  --font-hand: "Caveat", "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive;
  --font-body: "Jost", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light only;
}
:root[data-theme="dark"] {
  --bg: #0c1622; --surface: #122033; --surface-2: #16273c; --ink: #e8edf3; --muted: #9fb0c2; --line: #223650;
  --brand: #e8c46f; --brand-2: #f3d78f; --link: #8ec1f2; --gold: #e8c46f; --gold-soft: #e8c46f;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { animation: none !important; transition: none !important; } }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 1.0625rem/1.65 var(--font-body); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--link); text-underline-offset: 3px; }
a:hover { color: var(--brand-2); }
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.2; margin: 0 0 .5em; color: var(--ink); letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 4.6vw, 3.4rem); font-weight: 800; }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); font-weight: 700; }
h3 { font-size: 1.25rem; font-weight: 700; }
p { margin: 0 0 1em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 1rem; top: -4rem; background: var(--brand); color: #fff; padding: .6rem 1rem; border-radius: 8px; z-index: 100; }
.skip-link:focus { top: 1rem; color: #fff; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }
.narrow { width: min(100% - 2.5rem, var(--narrow)); }
.center { text-align: center; }
.muted { color: var(--muted); }
.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.kicker { font: 600 .8rem/1 var(--font-body); letter-spacing: .16em; text-transform: uppercase; color: var(--gold); margin: 0 0 .9rem; }
.kicker-gold { color: var(--gold); }
.lead { font-size: 1.2rem; color: var(--muted); }
.section { padding-block: clamp(2.5rem, 6vw, 4.5rem) 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.section-title { font-size: clamp(1.4rem, 2.6vw, 1.9rem); margin-bottom: 1.2rem; position: relative; padding-bottom: .6rem; }
.section-head .section-title { margin-bottom: 0; }
.section-title::after { content: ""; position: absolute; left: 0; bottom: 0; width: 44px; height: 3px; border-radius: 3px; background: var(--gold); }
.center .section-title::after { left: 50%; transform: translateX(-50%); }
.link-more { font-weight: 500; text-decoration: none; white-space: nowrap; }
.mini-title { font: 600 .8rem/1 var(--font-body); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 1.4rem 0 .4rem; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; font: 500 1rem/1 var(--font-body); padding: .85rem 1.35rem; border-radius: 999px; border: 1.5px solid transparent; cursor: pointer; text-decoration: none; transition: transform .15s, background .2s, color .2s, border-color .2s; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--brand); color: #fff; }
:root[data-theme="dark"] .btn-primary { background: var(--gold-soft); color: #0c1622; }
.btn-primary:hover { background: var(--brand-2); color: #fff; }
:root[data-theme="dark"] .btn-primary:hover { background: #f3d78f; color: #0c1622; }
.btn-ghost { border-color: var(--line); color: var(--ink); background: var(--surface); }
.btn-ghost:hover { border-color: var(--gold); color: var(--ink); }
.btn-gold { background: var(--gold-soft); color: #0b2a4a; }
.btn-gold:hover { background: #f3d78f; color: #0b2a4a; }

/* header */
.site-header { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; gap: 1.5rem; min-height: 70px; }
.brand { display: inline-flex; align-items: center; gap: .65rem; text-decoration: none; color: var(--brand); }
.brand-logo { height: 46px; width: auto; display: block; }
:root[data-theme="dark"] .brand-logo { background: #fff; border-radius: 10px; padding: 4px 8px; }
.main-nav { margin-left: auto; }
.main-nav ul { display: flex; gap: .25rem; list-style: none; margin: 0; padding: 0; }
.main-nav a { display: block; padding: .5rem .8rem; border-radius: 999px; color: var(--ink); text-decoration: none; font-weight: 500; font-size: .98rem; }
.main-nav a:hover { background: var(--surface-2); }
.main-nav a.active { color: var(--brand); background: var(--surface-2); }
:root[data-theme="dark"] .main-nav a.active { color: var(--gold-soft); }
.header-actions { display: flex; gap: .25rem; }
.icon-btn { width: 42px; height: 42px; display: grid; place-items: center; border: 0; background: transparent; color: var(--ink); border-radius: 50%; cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); }
.menu-btn { display: none; }
.i-sun { display: none; }
:root[data-theme="dark"] .i-sun { display: block; }
:root[data-theme="dark"] .i-moon { display: none; }
.search-panel { border-top: 1px solid var(--line); background: var(--surface); padding-block: .9rem; }
.search-panel form { display: flex; gap: .6rem; }
.search-panel[hidden] { display: none; }
input[type=search], input[type=email], input[type=text], textarea, select { font: inherit; color: var(--ink); background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; padding: .8rem 1rem; width: 100%; }
input:focus, textarea:focus, select:focus { border-color: var(--gold); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 25%, transparent); }
.read-progress { position: absolute; left: 0; bottom: -1px; height: 3px; width: 0; background: linear-gradient(90deg, var(--gold), var(--gold-soft)); }

/* hero */
.hero { background: var(--bg); border-bottom: 1px solid var(--line); padding-block: clamp(2.5rem, 6vw, 5rem) clamp(2rem, 4vw, 3rem); }
.hero-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: clamp(2rem, 5vw, 4.5rem); align-items: center; }
.hero h1 em { font-style: italic; color: var(--gold); }
.hero-cta { display: flex; flex-wrap: wrap; gap: .8rem; margin: 1.6rem 0 2rem; }
.stats { display: flex; gap: 2.2rem; margin: 0; flex-wrap: wrap; }
.stats div { display: flex; flex-direction: column; }
.stats dt { font: 800 1.8rem/1.1 var(--font-head); color: var(--brand); }
:root[data-theme="dark"] .stats dt { color: var(--gold-soft); }
.stats dd { margin: 0; color: var(--muted); font-size: .9rem; }
.hero-portrait { margin: 0; justify-self: center; max-width: 380px; width: 100%; }
.portrait-frame { border-radius: 200px 200px 22px 22px; overflow: hidden; border: 6px solid var(--surface); box-shadow: var(--shadow); background: var(--surface-2); }
.portrait-frame img { width: 100%; aspect-ratio: 4/5; object-fit: cover; object-position: 50% 20%; }
.hero-portrait figcaption { text-align: center; margin-top: 1rem; display: grid; gap: .1rem; }
.hero-portrait figcaption span { color: var(--muted); font-size: .92rem; }

/* cards + grids */
.grid { display: grid; gap: 1.5rem; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: transform .2s, box-shadow .2s; }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card-media { display: block; aspect-ratio: 1200/630; background: var(--surface-2); overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.card:hover .card-media img { transform: scale(1.04); }
.card-media-empty { background: linear-gradient(135deg, var(--accent), var(--brand)); opacity: .85; }
.card-body { padding: 1.15rem 1.25rem 1.3rem; display: flex; flex-direction: column; flex: 1; }
.card-title { font-size: 1.22rem; margin: .5rem 0 .4rem; }
.card-title a { color: var(--ink); text-decoration: none; }
.card-title a:hover { color: var(--brand-2); text-decoration: underline; text-decoration-color: var(--gold); }
.card-excerpt { color: var(--muted); font-size: .98rem; margin-bottom: 1rem; }
.meta { margin: auto 0 0; display: flex; gap: .5rem; color: var(--muted); font-size: .86rem; }
.chip { display: inline-block; align-self: flex-start; font: 600 .72rem/1 var(--font-body); letter-spacing: .08em; text-transform: uppercase; text-decoration: none; padding: .38rem .7rem; border-radius: 999px; color: var(--ink); background: color-mix(in srgb, var(--accent, var(--gold)) 22%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent, var(--gold)) 45%, transparent); }
.chip:hover { color: var(--ink); background: color-mix(in srgb, var(--accent, var(--gold)) 38%, var(--surface)); }
.chip-sm { font-size: .66rem; padding: .3rem .55rem; }
.featured { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.5rem; }
.card-lead { grid-row: span 3; }
.card-lead .card-title { font-size: clamp(1.5rem, 2.6vw, 2.1rem); }
.card-lead .card-excerpt { font-size: 1.05rem; }
.card-side { flex-direction: row; }
.card-side .card-media { width: 38%; aspect-ratio: auto; flex: none; }
.card-side .card-excerpt { display: none; }
.card-side .card-title { font-size: 1.05rem; }
.featured:has(.card-lead:only-child) { grid-template-columns: 1fr; }

.topic-card { display: flex; flex-direction: column; gap: .4rem; padding: 1.6rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); border-top: 5px solid var(--accent); text-decoration: none; color: var(--ink); transition: transform .2s, box-shadow .2s; }
.topic-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); color: var(--ink); }
.topic-card h3 { margin: 0; }
.topic-card p { color: var(--muted); font-size: .96rem; margin: 0; }
.topic-count { margin-top: auto; padding-top: .8rem; font-size: .85rem; font-weight: 600; color: var(--brand); }
:root[data-theme="dark"] .topic-count { color: var(--gold-soft); }
.topic-tall { min-height: 220px; }

/* bands */
.book-band { margin-top: clamp(3rem, 6vw, 5rem); background: var(--surface-2); border-block: 1px solid var(--line); color: var(--ink); padding-block: clamp(2.5rem, 5vw, 4rem); }
.book-band h2 em { color: var(--gold); font-style: italic; }
.book-grid { display: grid; grid-template-columns: 1.3fr .7fr; gap: 3rem; align-items: center; }
.book-cover img { border-radius: 12px; box-shadow: 0 20px 50px rgba(0,0,0,.4); transform: rotate(2deg); }
.sub-band { margin-top: clamp(3rem, 6vw, 5rem); background: var(--surface-2); padding-block: clamp(2.5rem, 5vw, 4rem); border-block: 1px solid var(--line); }
.sub-form { display: flex; flex-wrap: wrap; gap: .6rem; max-width: 520px; margin: 1.2rem auto 0; }
.sub-form input[type=email] { flex: 1 1 220px; border-radius: 999px; }
.sub-msg { flex-basis: 100%; margin: 0; min-height: 1.4em; font-size: .95rem; }
.sub-msg.ok { color: #1c7c4a; } .sub-msg.bad { color: #c0392b; }
.sub-box { margin: 1rem 0 2rem; }

/* page heads */
.page-hero { background: linear-gradient(180deg, color-mix(in srgb, var(--accent, var(--gold)) 14%, var(--bg)), var(--bg)); padding-block: clamp(2rem, 5vw, 3.5rem) 1.5rem; }
.page-head { padding-top: 2.5rem; }
.empty-state { padding-block: 4rem; text-align: center; }
.search-inline { display: flex; gap: .6rem; margin: 1.5rem 0; }
.plain-list { list-style: none; padding: 0; margin: 0 0 2rem; display: grid; gap: .5rem; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; padding: 0; margin: 0 0 1.2rem; font-size: .88rem; color: var(--muted); }
.crumbs li + li::before { content: "/"; margin-right: .4rem; opacity: .6; }
.crumbs a { color: var(--muted); }
.pager { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 2.5rem; }
.pager-info { color: var(--muted); }

/* post */
.post-head { padding-top: clamp(1.5rem, 4vw, 2.5rem); text-align: center; }
.post-head .crumbs ol { justify-content: center; }
.post-head h1 { font-size: clamp(1.9rem, 4.2vw, 3rem); margin: .8rem 0; }
.byline { color: var(--muted); font-size: .95rem; display: flex; flex-wrap: wrap; gap: .4rem; justify-content: center; }
.notice { background: #fff4d6; color: #5b4300; border-radius: 10px; padding: .6rem 1rem; font-size: .9rem; }
.post-cover { margin: 1.5rem auto 0; width: min(100% - 2.5rem, 980px); }
.post-cover img, .video { border-radius: var(--radius); box-shadow: var(--shadow); width: 100%; aspect-ratio: 1200/630; object-fit: cover; }
.video { position: relative; overflow: hidden; background: #000; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.article-layout { display: grid; grid-template-columns: 64px minmax(0, 1fr) 64px; gap: 1.5rem; margin-top: 2rem; }
.article-main { grid-column: 2; max-width: var(--narrow); margin-inline: auto; width: 100%; }
.share-rail { grid-column: 1; grid-row: 1; position: sticky; top: 140px; align-self: start; display: flex; flex-direction: column; gap: .5rem; }
.share-rail a, .share-rail button { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; font: 600 .82rem var(--font-body); cursor: pointer; }
.share-rail a:hover, .share-rail button:hover { border-color: var(--gold); }
.prose { font-size: 1.18rem; line-height: 1.85; overflow-wrap: break-word; }
.prose p { margin-bottom: 1.35em; }
.prose h2, .prose h3 { margin-top: 2em; }
.prose img { display: block; border-radius: 10px; margin: 1.5rem auto; max-width: 100%; height: auto; }
.prose blockquote { margin: 1.6rem 0; padding: .4rem 1.4rem; border-left: 4px solid var(--gold); background: var(--surface-2); border-radius: 0 10px 10px 0; font-style: italic; }
.prose ul, .prose ol { padding-left: 1.5rem; margin-bottom: 1.35em; }
.prose li { margin-bottom: .45em; }
.prose table { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; margin: 1.5rem 0; font-size: 1rem; }
.prose th, .prose td { border: 1px solid var(--line); padding: .55rem .75rem; text-align: left; }
.prose th { background: var(--surface-2); }
.prose a { text-decoration-color: var(--gold); text-decoration-thickness: 2px; }
.prose .ql-align-center, .prose [style*="text-align:center"] { text-align: center; }
.prose .ql-align-justify { text-align: justify; }
.prose .ql-align-right { text-align: right; }
.prose.intro { font-size: 1.1rem; line-height: 1.75; color: var(--ink); }
.prose.intro p { color: var(--muted); }
.about-text { text-align: justify; hyphens: auto; }
.about-text h2 { text-align: left; }
.about-grid { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: clamp(2rem, 5vw, 4rem); padding-block: 2rem 0; align-items: start; }
.about-side { position: sticky; top: 100px; }
.facts { list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; gap: .9rem; font-size: .95rem; color: var(--muted); }
.facts strong { display: block; color: var(--ink); font-family: var(--font-head); font-size: 1.02rem; }

/* listen bar */
.tts { position: sticky; top: 78px; z-index: 30; display: flex; align-items: center; gap: .5rem; padding: .6rem .75rem; margin-bottom: 1.8rem; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.tts[hidden] { display: none; }
.tts-main { width: 48px; height: 48px; flex: none; border-radius: 50%; border: 0; background: var(--brand); color: #fff; display: grid; place-items: center; cursor: pointer; }
:root[data-theme="dark"] .tts-main { background: var(--gold-soft); color: #0c1622; }
.tts .i-pause { display: none; }
.tts.is-playing .i-pause { display: block; }
.tts.is-playing .i-play { display: none; }
.tts-info { flex: 1; min-width: 0; display: grid; gap: .2rem; line-height: 1.2; }
.tts-label { font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tts-sub { font-size: .8rem; color: var(--muted); }
.tts-bar { height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.tts-bar span { display: block; height: 100%; width: 0; background: var(--gold); transition: width .3s; }
.tts-btn { min-width: 38px; height: 38px; padding: 0 .5rem; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 10px; cursor: pointer; font: 600 .85rem var(--font-body); }
.tts-btn:hover { border-color: var(--gold); }
.tts-voice { width: auto; max-width: 150px; padding: .4rem .5rem; font-size: .82rem; border-radius: 10px; }
.tts-voice[hidden] { display: none; }

.author-card { display: flex; gap: 1.2rem; align-items: center; padding: 1.3rem; margin: 3rem 0 2rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.author-card img { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; object-position: 50% 20%; flex: none; }
.author-card p { margin: .2rem 0 .4rem; color: var(--muted); font-size: .95rem; }
.comments { margin-top: 2rem; }
.prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 2rem; }
.prevnext a { display: block; padding: 1rem 1.2rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); text-decoration: none; color: var(--ink); font-family: var(--font-head); font-weight: 700; }
.prevnext a span { display: block; font: 500 .8rem var(--font-body); color: var(--muted); margin-bottom: .2rem; }
.prevnext a[rel=next] { text-align: right; }
.prevnext a:hover { border-color: var(--gold); }

/* misc pages */
.archive .year { margin-top: 2rem; border-bottom: 1px solid var(--line); padding-bottom: .4rem; }
.archive-list { list-style: none; padding: 0; margin: 0; }
.archive-list li { display: flex; gap: 1rem; align-items: baseline; padding: .7rem 0; border-bottom: 1px dashed var(--line); flex-wrap: wrap; }
.archive-list time { width: 3.8rem; color: var(--muted); font-size: .9rem; flex: none; }
.archive-list a:not(.chip) { font-weight: 500; text-decoration: none; color: var(--ink); }
.contact-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 3rem; padding-top: 2rem; }
.form-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 2rem; box-shadow: var(--shadow); }
.field { margin-bottom: 1.1rem; } .field label { display: block; font-weight: 500; margin-bottom: .35rem; }
.err { color: #c0392b; } .alert { background: #fdecea; color: #8a1f11; padding: .7rem 1rem; border-radius: 10px; }

/* footer */
.site-footer { margin-top: clamp(3rem, 6vw, 5rem); background: var(--surface-2); border-top: 1px solid var(--line); color: var(--muted); padding-top: 3rem; }
.site-footer a { color: var(--ink); text-decoration: none; }
.site-footer a:hover { color: var(--link); text-decoration: underline; }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 3rem; }
.footer-about p { margin: 1rem 0; max-width: 42ch; }
.footer-col h2 { font: 600 .8rem var(--font-body); letter-spacing: .14em; text-transform: uppercase; color: var(--gold); margin-bottom: 1rem; }
.footer-col ul, .social { list-style: none; padding: 0; margin: 0; display: grid; gap: .55rem; }
.social { display: flex; gap: .6rem; }
.social a { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--surface); border-radius: 50%; }
.footer-base { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 2.5rem; padding-block: 1.4rem; border-top: 1px solid var(--line); font-size: .9rem; }
.footer-base p { margin: 0; }
.to-top { position: fixed; right: 1.2rem; bottom: 1.2rem; width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; display: grid; place-items: center; cursor: pointer; box-shadow: var(--shadow); z-index: 40; }
.to-top[hidden] { display: none; }
:root[data-theme="dark"] .to-top { background: var(--gold-soft); color: #0c1622; }

@media (max-width: 1000px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); } .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .hero-grid, .book-grid, .contact-grid, .about-grid { grid-template-columns: 1fr; }
  .hero-portrait { order: -1; max-width: 280px; } .about-side { position: static; max-width: 340px; }
  .featured { grid-template-columns: 1fr; } .card-lead { grid-row: auto; }
  .article-layout { grid-template-columns: minmax(0, 1fr); } .article-main { grid-column: 1; }
  .share-rail { grid-column: 1; grid-row: 2; position: static; flex-direction: row; justify-content: center; margin-top: 2rem; }
  .menu-btn { display: grid; }
  .main-nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--bg); border-bottom: 1px solid var(--line); padding: .8rem 1.25rem 1.2rem; }
  .main-nav.open { display: block; }
  .main-nav ul { flex-direction: column; }
  .header-inner { gap: .5rem; } .header-actions { margin-left: auto; }
  .footer-grid { grid-template-columns: 1fr 1fr; } .footer-about { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  body { font-size: 1rem; } .prose { font-size: 1.1rem; line-height: 1.8; }
  .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .stats { gap: 1.4rem; } .card-side { flex-direction: column; } .card-side .card-media { width: 100%; aspect-ratio: 1200/630; }
  .prevnext { grid-template-columns: 1fr; } .prevnext a[rel=next] { text-align: left; }
  .tts { top: 70px; flex-wrap: wrap; } .tts-info { flex-basis: calc(100% - 64px); } .tts-voice { max-width: 120px; }
  .search-inline, .search-panel form { flex-direction: column; } .about-text { text-align: left; }
  .author-card { flex-direction: column; text-align: center; } .footer-grid { grid-template-columns: 1fr; }
}
@media print { .site-header, .site-footer, .tts, .share-rail, .sub-band, .comments, .to-top { display: none !important; } body { background: #fff; } }

/* comments */
.comments { margin-top: 3rem; }
.cm-count { display: inline-block; font: 600 .85rem var(--font-body); background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; padding: .15rem .65rem; vertical-align: middle; margin-left: .4rem; }
.cm-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; font-size: .92rem; }
.cm-sort { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; padding: 3px; }
.cm-sort a { padding: .35rem .9rem; border-radius: 99px; text-decoration: none; color: var(--muted); font-weight: 500; }
.cm-sort a.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.cm-list, .cm-one, .cm-replies { list-style: none; margin: 0; padding: 0; }
.cm-thread { padding: 1.2rem 0; border-bottom: 1px solid var(--line); }
.cm { display: flex; gap: .9rem; padding: .3rem 0; scroll-margin-top: 140px; }
.cm:target > .cm-main .cm-body { background: color-mix(in srgb, var(--gold-soft) 30%, transparent); border-radius: 8px; }
.cm-av { flex: none; width: 42px; height: 42px; border-radius: 50%; background: var(--c); color: #fff; display: grid; place-items: center; font: 700 .9rem var(--font-body); }
.cm-main { flex: 1; min-width: 0; }
.cm-head { display: flex; flex-wrap: wrap; gap: .2rem .6rem; align-items: baseline; }
.cm-head time { color: var(--muted); font-size: .84rem; }
.cm-badge { font: 700 .66rem var(--font-body); letter-spacing: .08em; text-transform: uppercase; background: var(--gold-soft); color: #082a4b; border-radius: 99px; padding: .15rem .5rem; }
.cm-to { margin: .1rem 0 0; font-size: .82rem; color: var(--muted); }
.cm-body { margin: .35rem 0; overflow-wrap: anywhere; padding: .1rem .3rem; margin-left: -.3rem; }
.cm-actions a { font-size: .86rem; font-weight: 500; text-decoration: none; color: var(--muted); }
.cm-actions a:hover { color: var(--link); }
.cm-replies { margin: .6rem 0 0 1.3rem; padding-left: 1.1rem; border-left: 2px solid var(--line); }
.cm-is-reply .cm-av { width: 34px; height: 34px; font-size: .78rem; }
.cm-form { margin-top: 1.5rem; padding: 1.4rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.cm-main .cm-form { margin-top: .8rem; background: var(--surface-2); }
.cm-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.cm-replying { background: var(--surface-2); border-radius: 8px; padding: .4rem .8rem; font-size: .9rem; }
.cm-note { padding: .7rem 1rem; border-radius: 10px; margin: 0 0 1rem; }
.cm-note.ok { background: #dcf3e4; color: #14633a; } .cm-note.bad { background: #fdecea; color: #8a1f11; }
:root[data-theme="dark"] .cm-note.ok { background: #123a27; color: #9be3b9; } :root[data-theme="dark"] .cm-note.bad { background: #44201c; color: #f5b5ad; }
.cm-policy { font-size: .85rem; margin: .8rem 0 0; }
@media (max-width: 640px) { .cm-fields { grid-template-columns: 1fr; } .cm-replies { margin-left: .4rem; padding-left: .7rem; } }

.captcha-box { margin: .4rem 0 1rem; min-height: 78px; overflow-x: auto; color: var(--muted); font-size: .9rem; }
.captcha-box:empty::before { content: "Loading verification…"; }

/* ================= book look ================= */
h2.section-title::after, .section-title::after { width: 56px; height: 2px; }
.section-title { font-family: var(--font-head); }
/* cards read like book covers: spine on the left, stacked pages on the edge */
.card { border-left: 6px solid var(--accent, var(--gold)); border-radius: 4px 12px 12px 4px; box-shadow: 3px 3px 0 -1px var(--surface), 3px 3px 0 0 var(--line), 6px 6px 0 -1px var(--surface), 6px 6px 0 0 var(--line); margin: 0 6px 6px 0; }
.card:hover { box-shadow: 3px 3px 0 -1px var(--surface), 3px 3px 0 0 var(--line), 6px 6px 0 -1px var(--surface), 6px 6px 0 0 var(--line), 0 14px 30px rgba(11,42,74,.12); }
.card-side { margin-bottom: 6px; }
.topic-card { border-top: 1px solid var(--line); border-left: 8px solid var(--accent); border-radius: 4px 12px 12px 4px; }
.topic-card h3 { font-family: var(--font-head); }
.card-title { font-family: var(--font-book); font-weight: 600; }
.page-hero { background: var(--bg); border-bottom: 1px solid var(--line); text-align: center; }
.page-hero .crumbs ol { justify-content: center; }
.page-hero h1::after { content: "\2766"; display: block; font-size: 1.1rem; color: var(--gold); margin-top: .5rem; }
.page-hero .prose.intro { text-align: left; font-family: var(--font-book); }

/* the page */
.article-layout { grid-template-columns: 64px minmax(0, 860px) 1fr; justify-content: center; }
.book-page { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 4px 14px 14px 4px; padding: clamp(1.4rem, 5vw, 3.6rem) clamp(1.2rem, 6vw, 4.2rem) clamp(1.4rem, 4vw, 2.6rem) clamp(1.8rem, 6.5vw, 4.8rem);
  box-shadow: 0 1px 0 var(--surface), 0 2px 0 var(--line), 0 4px 0 var(--surface), 0 5px 0 var(--line), 0 7px 0 var(--surface), 0 8px 0 var(--line), 0 28px 50px rgba(11,42,74,.08); }
.book-spine { position: absolute; left: 0; top: 0; bottom: 0; width: clamp(14px, 2.4vw, 26px); border-radius: 4px 0 0 4px; background: linear-gradient(90deg, var(--accent, var(--gold)), color-mix(in srgb, var(--accent, var(--gold)) 70%, #000) 55%, color-mix(in srgb, var(--accent, var(--gold)) 85%, #fff)); box-shadow: inset -3px 0 6px rgba(0,0,0,.18); }
.book-spine::after { content: ""; position: absolute; inset: 14px 0; background: repeating-linear-gradient(0deg, transparent 0 28px, rgba(255,255,255,.35) 28px 30px); opacity: .5; }
.book-page .post-head { padding-top: 0; }
.book-page .post-head h1 { font-family: var(--font-head); font-weight: 800; }
.book-page .post-head .chip { background: transparent; border: 0; padding: 0; letter-spacing: .22em; color: var(--gold); font-size: .78rem; }
.book-page .post-head .chip::before, .book-page .post-head .chip::after { content: "\2014"; margin: 0 .6rem; opacity: .6; }
.book-page .byline { font-family: var(--font-book); font-style: italic; }
.book-page .post-cover { width: 100%; margin: 1.4rem 0 1.8rem; }
.book-page .post-cover img, .book-page .video { box-shadow: 0 6px 18px rgba(0,0,0,.14); border: 6px solid var(--surface); outline: 1px solid var(--line); border-radius: 2px; }
.book-page .tts { top: 82px; margin-inline: 0; }
.book-page .prose { font-family: var(--font-book); font-size: 1.2rem; line-height: 1.9; text-align: justify; hyphens: auto; -webkit-hyphens: auto; text-justify: inter-word; position: relative; }
.book-page .prose > p:first-of-type::first-letter { font-family: var(--font-head); font-weight: 800; float: left; font-size: 4.3em; line-height: .82; padding: .08em .12em 0 0; color: var(--accent, var(--gold)); }
.book-page .prose h2, .book-page .prose h3 { font-family: var(--font-head); text-align: left; }
.book-page .prose h2 { padding-bottom: .3rem; border-bottom: 1px solid var(--line); }
.book-page .prose blockquote { font-family: var(--font-book); border-left: 3px double var(--gold); background: transparent; padding-left: 1.4rem; font-size: 1.1em; }
.book-end { text-align: center; color: var(--gold); font-size: 1.6rem; margin: 2.2rem 0 1rem; letter-spacing: .6em; text-indent: .6em; }
.book-page .author-card { margin: 1rem 0 0; background: var(--surface-2); border-style: dashed; }
.prose img.img-left { float: left; margin: .3rem 1.4rem .8rem 0; }
.prose img.img-right { float: right; margin: .3rem 0 .8rem 1.4rem; }
.prose img.img-center { margin-inline: auto; }
.prose::after { content: ""; display: block; clear: both; }
.prose .video-embed { position: relative; aspect-ratio: 16/9; margin: 1.6rem 0; border-radius: 6px; overflow: hidden; background: #000; clear: both; }
.prose .video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
/* the word being read aloud */
.tts-mark { position: absolute; background: rgba(240, 190, 60, .55); border-radius: 3px; pointer-events: none; z-index: 1; transition: left .08s, top .08s, width .08s; }
:root[data-theme="dark"] .tts-mark { background: rgba(232, 196, 111, .38); }
.prevnext a { font-family: var(--font-book); }
.pager .btn-ghost, .prevnext a span { font-family: var(--font-body); }
.comments { margin-top: 2.5rem; }
@media (max-width: 1000px) { .article-layout { grid-template-columns: minmax(0, 1fr); } .book-page .prose { text-align: left; hyphens: manual; font-size: 1.12rem; } }
@media (max-width: 640px) { .book-page { padding: 1.3rem 1rem 1.3rem 1.5rem; } .book-page .prose > p:first-of-type::first-letter { font-size: 3.6em; } }

/* ================= school-notebook label cards + 3D ================= */
.card.label { position: relative; overflow: visible; border: 2px solid var(--accent); border-radius: 16px; margin: 0; background: var(--surface);
  box-shadow: 0 3px 0 var(--accent), 0 12px 26px rgba(11,42,74,.10);
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .18s ease-out, box-shadow .25s; will-change: transform; }
.card.label:hover { transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(-7px); box-shadow: 0 3px 0 var(--accent), 0 26px 44px rgba(11,42,74,.18); }
.card.label::after { content: ""; position: absolute; inset: 0; border-radius: 14px; pointer-events: none; opacity: 0; transition: opacity .25s;
  background: radial-gradient(circle at var(--gx, 50%) var(--gy, 0%), rgba(255,255,255,.55), transparent 55%); mix-blend-mode: soft-light; }
.card.label:hover::after { opacity: 1; }
.label-head { display: flex; align-items: center; gap: .6rem; background: var(--accent); color: var(--on, #fff); padding: .55rem 1rem .55rem 2.5rem; border-radius: 13px 13px 0 0; position: relative; }
.label-head::before { content: ""; position: absolute; left: .85rem; top: 50%; width: 15px; height: 15px; border-radius: 50%; background: var(--surface); transform: translateY(-50%); box-shadow: inset 0 2px 3px rgba(0,0,0,.35); }
.label-sub { font: 700 .62rem var(--font-body); letter-spacing: .24em; text-transform: uppercase; opacity: .85; }
.label-cat { margin-left: auto; font: 700 1.2rem/1 var(--font-hand); color: var(--on, #fff); text-decoration: none; }
.label-cat:hover { color: var(--on, #fff); text-decoration: underline; }
.tape { position: absolute; top: -11px; right: 24px; width: 78px; height: 22px; z-index: 3; background: rgba(255, 224, 120, .8); box-shadow: 0 1px 3px rgba(0,0,0,.18);
  transform: rotate(4deg); clip-path: polygon(0 0, 5% 50%, 0 100%, 100% 100%, 95% 50%, 100% 0); }
.card.label .card-media { margin: .7rem .7rem 0; border: 2px dashed color-mix(in srgb, var(--accent) 65%, #fff); border-radius: 8px; aspect-ratio: 1200/630; }
.card.label .card-body { padding: .9rem 1.1rem 1.15rem; }
.card.label .card-title { margin: 0 0 .35rem; }
.label-fields { margin: .85rem 0 0; display: grid; gap: .15rem; }
.label-fields div { display: flex; align-items: baseline; gap: .6rem; border-bottom: 1.5px dotted color-mix(in srgb, var(--accent) 60%, #999); padding: .1rem 0; }
.label-fields dt { font: 600 .64rem var(--font-body); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); width: 3rem; flex: none; }
.label-fields dd { margin: 0; font: 700 1.2rem/1.15 var(--font-hand); color: #1b3a8f; }
:root[data-theme="dark"] .label-fields dd { color: #9db8ff; }
.card-side.label { display: grid; grid-template-columns: 38% 1fr; }
.card-side.label .label-head { grid-column: 1 / -1; }
.card-side.label .card-media { margin: .6rem 0 .6rem .6rem; aspect-ratio: auto; min-height: 120px; width: auto; }
.card-side.label .label-fields { display: none; }
.card-lead.label .card-title { font-size: clamp(1.4rem, 2.4vw, 1.9rem); }
@media (max-width: 640px) { .card-side.label { grid-template-columns: 1fr; } .card-side.label .card-media { margin: .7rem .7rem 0; aspect-ratio: 1200/630; } .card-side.label .label-fields { display: grid; } }

/* category tiles become little 3D books */
.topic-tall { color: var(--on, #fff); border: 0; border-radius: 3px 14px 14px 3px; padding: 2rem 1.5rem 1.5rem 2.4rem; min-height: 240px; margin-right: 12px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 82%, #fff), var(--accent) 60%, color-mix(in srgb, var(--accent) 80%, #000));
  transform: perspective(1100px) rotateY(var(--ry, -12deg)) rotateX(var(--rx, 0deg)); transform-origin: left center; transition: transform .3s ease-out, box-shadow .3s;
  box-shadow: 1px 0 0 #fff, 2px 0 0 #d7d7d0, 3px 0 0 #fff, 4px 0 0 #d7d7d0, 5px 0 0 #fff, 6px 0 0 #d7d7d0, 18px 20px 30px rgba(0,0,0,.22); }
.topic-tall:hover { color: var(--on, #fff); transform: perspective(1100px) rotateY(var(--ry, -4deg)) rotateX(var(--rx, 0deg)) translateY(-8px); box-shadow: 1px 0 0 #fff, 2px 0 0 #d7d7d0, 3px 0 0 #fff, 4px 0 0 #d7d7d0, 5px 0 0 #fff, 6px 0 0 #d7d7d0, 24px 30px 40px rgba(0,0,0,.26); }
.topic-tall::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 18px; border-radius: 3px 0 0 3px; background: linear-gradient(90deg, rgba(0,0,0,.38), rgba(255,255,255,.2) 65%, transparent); }
.topic-tall::after { content: ""; position: absolute; left: 30px; right: 18px; top: 16px; height: 6px; border-top: 2px solid color-mix(in srgb, var(--on, #fff) 70%, transparent); border-bottom: 1px solid color-mix(in srgb, var(--on, #fff) 55%, transparent); }
.topic-tall h3 { color: var(--on, #fff); font-size: 1.55rem; margin-top: .6rem; }
.topic-tall p { color: color-mix(in srgb, var(--on, #fff) 92%, transparent); }
.topic-tall .topic-count { color: var(--on, #fff); background: color-mix(in srgb, var(--on, #fff) 18%, transparent); border-radius: 99px; padding: .25rem .8rem; align-self: flex-start; }
[data-tilt]:not(.card):not(.topic-tall) { transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .18s ease-out; will-change: transform; }
@media (hover: none), (prefers-reduced-motion: reduce) { .card.label, .card.label:hover, .topic-tall, .topic-tall:hover, [data-tilt] { transform: none; } .card.label:hover { transform: translateY(-3px); } }
