/* ===== Tokens ===== */
:root {
  --bg: #f7f3ea;
  --surface: #fffdf8;
  --ink: #1d2939;
  --muted: #5f6b7a;
  --line: #e4ddcf;
  --accent: #7d3c98;
  --accent-soft: #f1e7f5;
  --seal: #b03a2e;
  --shadow: 0 1px 2px rgba(29, 41, 57, .05), 0 8px 24px rgba(29, 41, 57, .07);

  --toan: #2f6690;   --toan-soft: #e6eef6;
  --tho: #7a5230;    --tho-soft: #f3ebe1;
  --lan: #8e44ad;    --lan-soft: #f3e8f7;
  --pha: #b03a2e;    --pha-soft: #f8e6e3;
  --ghi: #3d6b5e;    --ghi-soft: #e6f0ec;

  --tint: var(--accent);
  --tint-soft: var(--accent-soft);

  --serif: "Lora", "Noto Serif", Georgia, serif;
  --han: "Noto Serif SC", "Noto Serif CJK SC", "SimSun", serif;
  --sans: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 12px;
  --wrap: 1160px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12161d; --surface: #1a2029; --ink: #e8e4da; --muted: #9aa3ad; --line: #2a313c;
    --accent: #c79ad9; --accent-soft: #2b2233; --seal: #d9675b;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.3);
    --toan: #7fb0d9; --toan-soft: #1b2633; --tho: #d0a77f; --tho-soft: #2a221b;
    --lan: #cf9ae3; --lan-soft: #2a1f31; --pha: #e8877c; --pha-soft: #321e1c;
    --ghi: #86c2ae; --ghi-soft: #1a2a25;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12161d; --surface: #1a2029; --ink: #e8e4da; --muted: #9aa3ad; --line: #2a313c;
  --accent: #c79ad9; --accent-soft: #2b2233; --seal: #d9675b;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.3);
  --toan: #7fb0d9; --toan-soft: #1b2633; --tho: #d0a77f; --tho-soft: #2a221b;
  --lan: #cf9ae3; --lan-soft: #2a1f31; --pha: #e8877c; --pha-soft: #321e1c;
  --ghi: #86c2ae; --ghi-soft: #1a2a25;
  color-scheme: dark;
}
[data-section="toan-hoc"] { --tint: var(--toan); --tint-soft: var(--toan-soft); }
[data-section="van-tho"]  { --tint: var(--tho);  --tint-soft: var(--tho-soft); }
[data-section="hoa-lan"]  { --tint: var(--lan);  --tint-soft: var(--lan-soft); }
[data-section="gia-pha"]  { --tint: var(--pha);  --tint-soft: var(--pha-soft); }
[data-section="ghi-chep"] { --tint: var(--ghi);  --tint-soft: var(--ghi-soft); }

/* Reader-controlled text size (A− / A+) */
html { font-size: 100%; -webkit-text-size-adjust: 100%; }
html[data-fs="1"] { font-size: 112.5%; }
html[data-fs="2"] { font-size: 125%; }
html[data-fs="3"] { font-size: 137.5%; }

/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 1.0625rem; line-height: 1.65;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
a { color: inherit; }
img { max-width: 100%; height: auto; }
h1, h2, h3 { text-wrap: balance; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 28px; } }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 12px; z-index: 20; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ===== Header ===== */
.masthead { background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.masthead__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 68px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; min-width: 0; }
.seal {
  flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: 6px; background: var(--seal); color: #fff8f0;
  font-family: var(--serif); font-weight: 700; font-size: .66rem; line-height: 1.05; letter-spacing: .02em;
  box-shadow: inset 0 0 0 2px var(--seal), inset 0 0 0 3.5px rgba(255,248,240,.75);
}
.brand__text { display: flex; flex-direction: column; min-width: 0; }
.brand__name { font-family: var(--serif); font-weight: 700; font-size: 1.3rem; letter-spacing: -.01em; line-height: 1.2; }
.brand__tag { font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 520px) { .brand__tag { display: none; } }
.tools-bar { display: flex; gap: 6px; flex: none; }
.icon-btn {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--line); background: transparent; color: var(--ink); cursor: pointer;
  font: 600 .9rem var(--sans); text-decoration: none; padding: 0;
}
.icon-btn sup { font-size: .65em; }
.icon-btn:hover { border-color: var(--muted); }
@media (max-width: 400px) { .fs-btn { display: none; } }
.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: none; }
  :root:not([data-theme="light"]) .i-moon { display: block; }
}
.nav { border-top: 1px solid var(--line); }
.nav__inner { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.nav__inner::-webkit-scrollbar { display: none; }
.nav a {
  flex: none; padding: 11px 13px; font-size: .92rem; font-weight: 500; color: var(--muted);
  text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--tint); }

/* ===== Shared bits ===== */
.eyebrow { margin: 0 0 8px; font-size: .78rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--tint); }
.meta { font-size: .86rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.tag {
  display: inline-block; font-size: .76rem; font-weight: 600; text-decoration: none; color: var(--tint);
  background: var(--tint-soft); padding: 2px 10px; border-radius: 999px; line-height: 1.6;
}
.tag--solid { background: var(--tint); color: var(--surface); }
.tag--plain { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.btn {
  display: inline-flex; align-items: center; gap: 8px; font: 600 .92rem var(--sans); padding: 9px 16px;
  border-radius: 999px; border: 1px solid var(--accent); background: var(--accent); color: var(--surface);
  text-decoration: none; cursor: pointer;
}
.btn--ghost { background: transparent; color: var(--accent); }
.btn:hover { filter: brightness(1.08); }
.section { padding: 36px 0; }
.section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 20px; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.section__title { font-family: var(--serif); font-size: 1.5rem; margin: 0; }
.link-more { font-size: .9rem; font-weight: 500; color: var(--accent); text-decoration: none; white-space: nowrap; }
.link-more:hover { text-decoration: underline; }
.notice {
  border: 1px dashed color-mix(in srgb, var(--tint) 55%, var(--line)); background: var(--tint-soft);
  border-radius: var(--radius); padding: 14px 18px; font-size: .92rem; color: var(--ink); margin: 0 0 24px;
}
.notice b { color: var(--tint); }
.empty { color: var(--muted); padding: 18px 0; font-style: italic; }

/* ===== Page heads ===== */
.page { padding: 40px 16px 56px; }
.listing { padding: 40px 16px 56px; }
@media (min-width: 720px) { .page, .listing { padding-left: 28px; padding-right: 28px; } }
.page__head { max-width: 760px; margin: 0 auto 28px; }
.listing .page__head { max-width: none; margin: 0 0 28px; }
.page__title { font-family: var(--serif); font-size: clamp(1.75rem, 4.4vw, 2.6rem); line-height: 1.2; margin: 0 0 12px; letter-spacing: -.01em; }
.page__lead { color: var(--muted); font-size: 1.05rem; margin: 0; max-width: 68ch; }
.section-hero { border-bottom: 1px solid var(--line); background: linear-gradient(180deg, var(--tint-soft), transparent); }
.section-hero .listing { padding-bottom: 28px; }
.subnav { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.subnav a { text-decoration: none; font-size: .88rem; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); }
.subnav a:hover, .subnav a[aria-current="page"] { border-color: var(--tint); color: var(--tint); }

/* ===== Home ===== */
.hero { display: grid; gap: 24px; align-items: center; padding: 44px 0 20px; }
@media (min-width: 760px) { .hero { grid-template-columns: auto 1fr; gap: 36px; } }
.portrait {
  width: 148px; height: 148px; border-radius: 50%; overflow: hidden; display: grid; place-items: center;
  background: radial-gradient(circle at 30% 25%, var(--surface), var(--accent-soft)); border: 1px solid var(--line);
}
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.portrait .seal { width: 84px; height: 84px; font-size: 1.25rem; border-radius: 10px; }
.hero h1 { font-family: var(--serif); font-size: clamp(2rem, 5vw, 3rem); line-height: 1.12; margin: 0 0 6px; letter-spacing: -.015em; }
.hero__tag { font-family: var(--serif); font-style: italic; font-size: 1.2rem; color: var(--accent); margin: 0 0 10px; }
.hero__intro { margin: 0; max-width: 62ch; color: var(--muted); }

.pillars { display: grid; gap: 14px; grid-template-columns: 1fr; padding: 12px 0 8px; }
@media (min-width: 600px) { .pillars { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .pillars { grid-template-columns: repeat(4, 1fr); } }
.pillar {
  position: relative; display: flex; flex-direction: column; gap: 8px; padding: 22px 20px 20px; min-height: 190px;
  background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--tint);
  border-radius: var(--radius); text-decoration: none; transition: box-shadow .2s, transform .2s;
}
.pillar:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.pillar__icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--tint-soft); color: var(--tint); }
.pillar h2 { font-family: var(--serif); font-size: 1.35rem; margin: 6px 0 0; }
.pillar p { margin: 0; font-size: .92rem; color: var(--muted); flex: 1; }
.pillar__more { font-size: .85rem; font-weight: 600; color: var(--tint); }

.trio { display: grid; gap: 18px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .trio { grid-template-columns: 1.1fr 1fr 1fr; } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; }
.panel h3 { font-family: var(--serif); font-size: 1.25rem; margin: 0 0 10px; }
.panel h3 a { text-decoration: none; }
.panel h3 a:hover { color: var(--tint); }
.panel .stanza { font-family: var(--serif); font-size: 1.05rem; line-height: 1.8; margin: 4px 0 14px; white-space: pre-line; }
.panel .link-more { margin-top: auto; color: var(--tint); }
.bloom-list { list-style: none; margin: 4px 0 14px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }

.rows { list-style: none; margin: 0; padding: 0; }
.row { border-bottom: 1px solid var(--line); }
.row a { display: flex; gap: 16px; align-items: baseline; padding: 12px 0; text-decoration: none; }
.row time { flex: none; width: 96px; font-size: .86rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.row b { font-family: var(--serif); font-weight: 500; font-size: 1.08rem; flex: 1; }
.row a:hover b { color: var(--accent); }
.row .tag { flex: none; }
@media (max-width: 560px) {
  .row a { flex-wrap: wrap; gap: 4px 10px; }
  .row time { width: auto; }
  .row b { flex-basis: 100%; order: 3; }
}

/* ===== Cards ===== */
.grid { display: grid; gap: 28px 24px; grid-template-columns: 1fr; }
@media (min-width: 620px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.card { display: flex; flex-direction: column; text-decoration: none; }
.card .thumb { aspect-ratio: 16 / 10; margin-bottom: 14px; }
.card__title { font-family: var(--serif); font-size: 1.2rem; line-height: 1.3; margin: 8px 0; }
.card:hover .card__title { color: var(--accent); }
.card__excerpt { margin: 0 0 10px; color: var(--muted); font-size: .92rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.thumb { border-radius: var(--radius); overflow: hidden; background: var(--tint-soft); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s ease; }
.card:hover .thumb img { transform: scale(1.03); }
.thumb--empty { display: grid; place-items: center; padding: 16px; text-align: center; }
.thumb--empty span { font-family: var(--serif); font-style: italic; font-size: 1.35rem; color: var(--tint); opacity: .85; }

.tiles { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 620px) { .tiles { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .tiles { grid-template-columns: repeat(3, 1fr); } }
.tile {
  display: block; padding: 20px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); text-decoration: none; transition: border-color .2s, box-shadow .2s;
}
a.tile:hover { border-color: var(--tint); box-shadow: var(--shadow); }
.tile h3 { font-family: var(--serif); font-size: 1.22rem; margin: 0 0 4px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.tile h3 small { font-family: var(--sans); font-size: .8rem; font-weight: 500; color: var(--muted); white-space: nowrap; }
.tile p { margin: 0; font-size: .92rem; color: var(--muted); }
.tile--soon { border-style: dashed; }

/* ===== Article ===== */
.post__cover { max-width: 900px; margin: 0 auto 32px; }
.prose { max-width: 720px; margin: 0 auto; font-family: var(--serif); font-size: 1.18rem; line-height: 1.8; overflow-wrap: break-word; }
.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose table, .prose dl { margin: 0 0 1.05em; }
.prose div:not(:has(div, p, ul, ol, table, h1, h2, h3, h4, blockquote)) { margin: 0 0 1.05em; }
.prose h1, .prose h2, .prose h3, .prose h4 { font-family: var(--serif); line-height: 1.3; margin: 1.6em 0 .6em; }
.prose h1, .prose h2 { font-size: 1.42em; }
.prose h3 { font-size: 1.2em; }
.prose h4 { font-size: 1.06em; }
.prose a { color: var(--accent); text-underline-offset: 3px; }
.prose img { display: block; margin: 1.4em auto; border-radius: 8px; }
.prose a:has(img) { display: block; }
.prose blockquote { border-left: 3px solid var(--tint); padding: .2em 0 .2em 1.1em; color: var(--muted); font-style: italic; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin: .3em 0; }
.prose table { border-collapse: collapse; width: 100%; font-family: var(--sans); font-size: .92rem; display: block; overflow-x: auto; }
.prose td, .prose th { border: 1px solid var(--line); padding: 8px 10px; vertical-align: top; }
.prose iframe { max-width: 100%; border: 0; border-radius: 8px; display: block; margin: 1.4em auto; }
.prose iframe.yt { width: 100%; height: auto; aspect-ratio: 16 / 9; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.prose svg { max-width: 100%; height: auto; }

/* Poems: serif, larger, centred stanzas, line breaks kept */
.prose--poem { text-align: center; font-size: 1.28rem; line-height: 1.9; }
.prose--poem p, .prose--poem div { margin-bottom: 1.3em; }
.prose--poem img { margin-left: auto; margin-right: auto; }
.poem-byline { text-align: center; margin: 0 auto 30px; max-width: 720px; }
.poem-byline .author { font-family: var(--serif); font-style: italic; font-size: 1.1rem; }
.poem-byline .meta { justify-content: center; margin-top: 8px; }
.poem-sign { max-width: 720px; margin: 8px auto 0; text-align: center; color: var(--muted); font-size: .92rem; }
.han-grid { display: grid; gap: 22px; grid-template-columns: 1fr; max-width: 1040px; margin: 0 auto 32px; }
@media (min-width: 860px) { .han-grid { grid-template-columns: repeat(3, 1fr); } }
.han-grid section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.han-grid h3 { font-family: var(--sans); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--tint); margin: 0 0 10px; }
.han-grid .han { font-family: var(--han); font-size: 1.4rem; line-height: 1.9; }
.han-grid p { font-family: var(--serif); white-space: pre-line; margin: 0; line-height: 1.85; }

.post__foot { max-width: 720px; margin: 40px auto 0; padding-top: 22px; border-top: 1px solid var(--line); }
.share { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.pager { display: grid; gap: 14px; grid-template-columns: 1fr; margin-top: 8px; }
@media (min-width: 620px) { .pager { grid-template-columns: 1fr 1fr; } }
.pager a { display: block; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; background: var(--surface); }
.pager a:hover { border-color: var(--tint); }
.pager small { display: block; font-size: .8rem; color: var(--muted); margin-bottom: 4px; }
.pager span { font-family: var(--serif); font-weight: 600; line-height: 1.35; }
.pager .next { text-align: right; }
.related { background: var(--surface); border-top: 1px solid var(--line); margin-top: 56px; }

/* ===== Math lessons ===== */
.lesson { display: grid; gap: 32px; padding: 36px 16px 56px; max-width: var(--wrap); margin: 0 auto; }
@media (min-width: 720px) { .lesson { padding-left: 28px; padding-right: 28px; } }
@media (min-width: 1000px) { .lesson { grid-template-columns: 260px minmax(0, 1fr); } }
.toc { font-size: .9rem; }
.toc details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.toc summary { font-weight: 600; cursor: pointer; }
.toc ol { list-style: none; margin: 10px 0 0; padding: 0; }
.toc li { margin: 0; }
.toc .ch { font-weight: 600; color: var(--muted); margin: 12px 0 4px; font-size: .82rem; }
.toc a { display: block; padding: 4px 8px; border-radius: 6px; text-decoration: none; }
.toc a:hover { background: var(--tint-soft); }
.toc a[aria-current="page"] { background: var(--tint-soft); color: var(--tint); font-weight: 600; }
.toc .soon { padding: 4px 8px; color: var(--muted); font-style: italic; }
@media (min-width: 1000px) { .toc { position: sticky; top: 130px; align-self: start; max-height: calc(100vh - 150px); overflow: auto; } }
.lesson__main { min-width: 0; }
.lesson__main .page__head { margin: 0 0 24px; max-width: none; }
.lesson .prose { max-width: 760px; margin: 0; font-size: 1.1rem; line-height: 1.75; }
.lesson-box { border-radius: var(--radius); padding: 16px 20px; margin: 0 0 1.4em; background: var(--tint-soft); }
.lesson-box h2 { font-size: 1.05em; margin: 0 0 .4em; }
.lesson-box ul { margin-bottom: .6em; }
.lesson-box p { margin: 0; }
.math-block { border: 1px solid var(--line); border-left: 4px solid var(--tint); border-radius: 8px; padding: 14px 18px; margin: 0 0 1.3em; background: var(--surface); }
.math-block--thm { border-left-color: var(--accent); }
.math-block--ex { border-left-color: var(--tho); }
.math-block__label { font-family: var(--sans); font-weight: 700; font-size: .82rem; letter-spacing: .06em; text-transform: uppercase; color: var(--tint); margin: 0 0 .4em !important; }
.math-block--thm .math-block__label { color: var(--accent); }
.math-block--ex .math-block__label { color: var(--tho); }
.exercise { border-bottom: 1px dashed var(--line); padding: 4px 0 12px; margin-bottom: 14px; }
details.solution, details.proof { margin: 8px 0 0; }
details.solution summary, details.proof summary {
  display: inline-block; cursor: pointer; font: 600 .86rem var(--sans); color: var(--tint);
  border: 1px solid var(--tint); border-radius: 999px; padding: 4px 14px; list-style: none;
}
details.solution summary::-webkit-details-marker, details.proof summary::-webkit-details-marker { display: none; }
details[open].solution summary, details[open].proof summary { background: var(--tint); color: var(--surface); }
details.solution > :not(summary), details.proof > :not(summary) { margin-top: 12px; }
.katex-display { overflow-x: auto; overflow-y: hidden; padding: 4px 0; }
.katex { font-size: 1.08em; }
.lesson-tools { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

/* ===== Archive / search ===== */
.tools { display: flex; flex-direction: column; gap: 14px; margin-bottom: 28px; }
.search {
  width: 100%; max-width: 560px; font: inherit; font-size: 1rem; padding: 12px 16px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: inherit; font-size: .88rem; padding: 6px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.year { margin: 0 0 32px; }
.year h2 { font-family: var(--serif); font-size: 1.4rem; margin: 0 0 6px; color: var(--tint); }
.results .row small { display: block; color: var(--muted); font-size: .85rem; font-family: var(--sans); margin-top: 2px; }

/* ===== Orchids ===== */
.months { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .months { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .months { grid-template-columns: repeat(3, 1fr); } }
.month { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.month.is-now { border-color: var(--lan); box-shadow: 0 0 0 2px var(--lan-soft); }
.month h3 { font-family: var(--serif); font-size: 1.25rem; margin: 0 0 8px; display: flex; align-items: center; gap: 10px; }
.month ul { margin: 0 0 12px; padding-left: 1.2em; font-size: .94rem; }
.month li { margin: 3px 0; }
.plant-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.plant { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.plant button { all: unset; cursor: zoom-in; display: block; width: 100%; aspect-ratio: 4 / 3; background: var(--lan-soft); }
.plant img { width: 100%; height: 100%; object-fit: cover; display: block; }
.plant__body { padding: 12px 14px; }
.plant__body h3 { font-family: var(--serif); font-size: 1.1rem; margin: 0; }
.plant__body i { color: var(--muted); font-size: .9rem; }
.lightbox { border: 0; padding: 0; background: transparent; max-width: min(92vw, 1100px); }
.lightbox::backdrop { background: rgba(10, 12, 16, .85); }
.lightbox img { max-height: 84vh; border-radius: 8px; display: block; }
.lightbox p { color: #f2efe8; text-align: center; margin: 10px 0 0; }

/* ===== Family tree teaser ===== */
.tree { display: flex; flex-direction: column; align-items: center; gap: 0; padding: 12px 0 4px; }
.tree__gen { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; position: relative; padding: 14px 0; }
.tree__gen + .tree__gen::before { content: ""; position: absolute; top: 0; left: 50%; height: 14px; border-left: 1.5px solid var(--line); }
.person { background: var(--surface); border: 1.5px solid var(--pha); border-radius: 10px; padding: 8px 14px; text-align: center; font-size: .86rem; min-width: 120px; }
.person b { display: block; font-family: var(--serif); font-size: .98rem; }
.person--dead { border-style: dashed; }
.person--root { background: var(--pha-soft); }
.person--inlaw { border-color: var(--muted); }

/* ===== About ===== */
.timeline { list-style: none; margin: 0; padding: 0 0 0 22px; border-left: 2px solid var(--line); }
.timeline li { position: relative; margin: 0 0 22px; }
.timeline li::before { content: ""; position: absolute; left: -29px; top: .45em; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--bg); }
.timeline b { font-family: var(--serif); font-size: 1.12rem; }
.timeline span { display: block; color: var(--muted); font-size: .92rem; }
.todo { color: var(--muted); font-style: italic; }

/* ===== Footer ===== */
.footer { border-top: 1px solid var(--line); margin-top: 24px; padding: 32px 0 24px; font-size: .9rem; color: var(--muted); }
.footer__inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 20px; }
.footer__brand { font-family: var(--serif); font-weight: 700; font-size: 1.15rem; color: var(--ink); margin: 0 0 4px; }
.footer__about p { margin: 0; }
.footer__links { display: flex; flex-wrap: wrap; gap: 8px 18px; align-content: flex-start; }
.footer__links a { text-decoration: none; }
.footer__links a:hover { color: var(--ink); }
.footer__copy { margin-top: 22px; font-size: .82rem; }

/* ===== Print (lesson PDF) ===== */
@media print {
  .masthead, .footer, .toc, .lesson-tools, .share, .pager, .related, .skip { display: none !important; }
  body { background: #fff; color: #000; }
  .lesson { display: block; padding: 0; }
  details > summary { display: none; }
  .math-block, .lesson-box { break-inside: avoid; }
}
