:root {
  --bg: #fbf9f5; --fg: #1d1b18; --muted: #6f6a62; --faint: #a39d93; --rule: #e6e1d8;
  --hi: #f3eee4; --accent: #8a4b2a; --orig: #3a3631;
  --fs: 19px; --measure: 38rem;
  --serif: "Source Serif 4", Georgia, serif;
  --greek: "Gentium Book Plus", "Gentium Plus", "Noto Serif", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161514; --fg: #e8e4dc; --muted: #9c968c; --faint: #6b665e; --rule: #2c2a27;
    --hi: #211f1c; --accent: #d49a72; --orig: #cfc9bf;
  }
}
:root[data-theme="dark"] {
  --bg: #161514; --fg: #e8e4dc; --muted: #9c968c; --faint: #6b665e; --rule: #2c2a27;
  --hi: #211f1c; --accent: #d49a72; --orig: #cfc9bf;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--serif);
  font-size: var(--fs); line-height: 1.62; font-optical-sizing: auto;
  text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; }
a { color: inherit; }

/* Top bar: identical on every page */
.bar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10; background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--rule);
  font-family: var(--sans); font-size: 14px; }
.bar-inner { max-width: 76rem; margin: 0 auto; padding: 0 16px; height: 3.25rem; display: flex; align-items: center; gap: .9rem; }
.brand { display: inline-flex; align-items: center; gap: .5rem; text-decoration: none; flex: none; }
.brand img { width: 26px; height: 26px; display: block; }
.brand span { font-family: var(--serif); font-weight: 600; font-size: 19px; letter-spacing: .005em; color: var(--fg); position: relative; top: 1px; }
.brand:hover span { color: var(--accent); }
.crumb { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
  padding-left: .9rem; border-left: 1px solid var(--rule); line-height: 1.2; }
.crumb a { color: inherit; text-decoration: none; } .crumb a:hover { color: var(--fg); }
.spacer { flex: 1; }
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; flex: none; background: var(--bg); }
.seg button, .icon { font: inherit; font-size: 13px; background: none; border: 0; color: var(--muted);
  padding: .35rem .7rem; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }
.icon { border: 1px solid var(--rule); border-radius: 8px; min-width: 2.2rem; height: 2rem; flex: none; background: var(--bg); }
.icon:hover, .seg button:hover:not([aria-pressed="true"]) { color: var(--fg); }
.progress { position: absolute; left: 0; bottom: -1px; height: 2px; background: var(--accent); width: 0; }

/* Title block */
.head { max-width: 76rem; margin: 0 auto; padding: 4rem 16px 1rem; }
.head .author { font-family: var(--sans); font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.head h1 { font-size: clamp(2.2rem, 6vw, 3.4rem); line-height: 1.1; margin: .4rem 0 .3rem; font-weight: 600; letter-spacing: -.01em; }
.head .orig-title { font-family: var(--greek); font-size: 1.3rem; color: var(--muted); }
.intro { max-width: var(--measure); margin: 2rem 0 0; color: var(--fg); }
.intro p { margin: 0 0 1em; }
.meta { font-family: var(--sans); font-size: 13px; color: var(--muted); margin-top: 1.5rem; line-height: 1.55; max-width: var(--measure); text-wrap: pretty; }
.toc { max-width: 76rem; margin: 0 auto; padding: 0 16px 2rem; font-family: var(--sans); font-size: 14px; }
.toc-in { border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding-block: 1rem; }
.toc h2 { font-family: var(--sans); font-size: 12px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0 0 .5rem; }
.toc ul { list-style: none; margin: 0; padding: 0; columns: 2 16rem; column-gap: 2.5rem; }
.toc li.grp { break-inside: avoid; margin: 0 0 .7rem; }
.toc li.grp > a { font-weight: 600; }
.toc li.grp ul { columns: auto; margin: .15rem 0 0; padding-left: .9rem; }
.toc li.grp ul li { margin: .15rem 0; }
.toc a { text-decoration: none; } .toc a:hover { color: var(--accent); }
.toc .n { color: var(--faint); font-variant-numeric: tabular-nums; margin-left: .35rem; font-size: 12px; }

/* Text */
.text { max-width: 76rem; margin: 0 auto; padding: 0 16px 6rem; }
.colheads, .row { display: grid; grid-template-columns: 3rem minmax(0, 1fr) minmax(0, 1.12fr); column-gap: 2.75rem; }
.colheads { position: sticky; top: 2.9rem; z-index: 5; background: var(--bg); font-family: var(--sans);
  font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); padding: .6rem 0; border-bottom: 1px solid var(--rule); margin-bottom: 1rem; }
.colheads span:first-child { grid-column: 2; } 
h2.speech { font-size: 1.55rem; font-weight: 600; margin: 3.5rem 0 .2rem; grid-column: 1 / -1; }
.speech-sub { font-family: var(--sans); font-size: 14px; color: var(--muted); margin: 0 0 1.5rem; max-width: var(--measure); }
h3.part { font-family: var(--sans); font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent);
  font-weight: 600; margin: 2.8rem 0 1rem; }
/* Off-screen rows skip layout and paint until scrolled near: long books render instantly. */
.row { content-visibility: auto; contain-intrinsic-size: auto 12rem; }
.row { position: relative; border-radius: 6px; margin: 0 -.75rem; padding: .35rem .75rem; }
.row.para { margin-top: .9rem; }
.row:hover, .row.active { background: var(--hi); }
.gut { font-family: var(--sans); font-size: 12px; color: var(--faint); padding-top: .42em; font-variant-numeric: tabular-nums; }
.gut a { text-decoration: none; } .gut a:hover { color: var(--accent); }
.orig { font-family: var(--greek); color: var(--orig); font-size: .96em; line-height: 1.66; }
.en p, .orig p { margin: 0; }
.st { font-family: var(--sans); font-size: 10.5px; color: var(--faint); vertical-align: .45em; padding: 0 .12em; user-select: none; cursor: help; letter-spacing: .02em; }
.spk { font-family: var(--sans); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); font-weight: 600; margin-right: .5em; }
.orig .spk { color: var(--faint); }
.nref { font-family: var(--sans); font-size: 11px; color: var(--accent); background: none; border: 0; padding: 0 .15em; cursor: pointer; vertical-align: .4em; line-height: 1; }
.note { display: none; font-family: var(--sans); font-size: 14px; line-height: 1.5; color: var(--muted);
  border-left: 2px solid var(--accent); padding: .2rem 0 .2rem .75rem; margin: .6rem 0 .2rem; }
.row.show-note .note { display: block; }

/* Modes */
body.mode-en .orig, body.mode-en .colheads span:first-child { display: none; }
body.mode-orig .en, body.mode-orig .colheads span:last-child { display: none; }
body.mode-en .row, body.mode-en .colheads, body.mode-orig .row, body.mode-orig .colheads { grid-template-columns: 3rem minmax(0, var(--measure)); }
body.mode-en .colheads, body.mode-orig .colheads { display: none; }

/* Mobile */
@media (max-width: 820px) {
  :root { --fs: 18px; }
  .head { padding-top: 2.5rem; }
  .colheads { display: none !important; }
  .row, body.mode-en .row, body.mode-orig .row { grid-template-columns: minmax(0, 1fr); margin: 0 -.5rem; padding: .3rem .5rem; }
  .gut { display: none; }
  .row .orig { order: 2; }
  body.mode-both .orig, .row.show-orig .orig { display: block; font-size: .9em; margin: .5rem 0 .4rem; padding-left: .75rem; border-left: 2px solid var(--rule); }
  body.mode-en .row { cursor: pointer; }
  .row:hover { background: none; } .row.active, .row.show-orig { background: var(--hi); }
  .crumb { display: none; } .brand span { font-size: 18px; }
  .row.para { margin-top: .75rem; }
}
@media (max-width: 420px) { .bar-inner { gap: .5rem; } .bar .seg button { padding: .35rem .55rem; } }

/* Library */
.lib { max-width: 76rem; margin: 0 auto; padding: 4.5rem 16px 6rem; }
.lib-head { margin-bottom: 3.5rem; }
.lib h1 { font-size: clamp(2.3rem, 6vw, 3.4rem); line-height: 1.05; margin: 0 0 1rem; font-weight: 600; letter-spacing: -.015em; text-wrap: balance; }
.lib .lede { font-size: 1.2rem; line-height: 1.5; color: var(--muted); max-width: none; margin: 0; text-wrap: pretty; }
.author-block { display: grid; grid-template-columns: 14rem minmax(0, 1fr); column-gap: 2.5rem; border-top: 1px solid var(--rule); padding: 2rem 0 2.2rem; }
.author-block h2 { font-size: 1.45rem; font-weight: 600; margin: .1rem 0 0; line-height: 1.3; }
.author-block .dates { display: block; font-family: var(--sans); font-size: 12.5px; font-weight: 400; color: var(--muted); margin-top: .25rem; font-variant-numeric: tabular-nums; }
.author-block ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: 1.6rem 2.5rem; }
.work { display: grid; gap: .15rem; text-decoration: none; color: inherit; }
.work .t { font-size: 1.2rem; font-weight: 600; line-height: 1.25; }
.work .o { font-family: var(--greek); font-size: .95rem; color: var(--faint); }
.work .d { font-size: .98rem; color: var(--muted); line-height: 1.45; margin-top: .15rem; }
a.work:hover .t { color: var(--accent); }
.work.soon .t { color: var(--muted); }
.soon-tag { font-family: var(--sans); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); margin-top: .2rem; }
.lib .foot { border-top: 1px solid var(--rule); padding-top: 1.5rem; margin-top: 1rem; font-family: var(--sans); font-size: 13px; color: var(--muted); line-height: 1.6; max-width: 40rem; }
@media (max-width: 700px) {
  .lib { padding-top: 3rem; }
  .author-block { grid-template-columns: 1fr; row-gap: 1.1rem; padding: 2.2rem 0 2.4rem; }
  /* One column: make philosopher vs. book obvious — bigger name, smaller titles, books hung under a rule */
  .author-block h2 { font-size: 1.85rem; line-height: 1.15; letter-spacing: -.01em; }
  .author-block .dates { font-size: 13px; margin-top: .35rem; }
  .author-block ul { border-left: 2px solid color-mix(in srgb, var(--accent) 45%, var(--rule)); padding-left: 1rem; gap: 1.25rem; }
  .work .t { font-size: 1.05rem; }
  .work .o { font-size: .88rem; }
  .work .d { font-size: .93rem; }
}

/* Author's own footnotes (e.g. Hume) */
.row.fn { font-size: .86em; color: var(--muted); }
.row.fn .orig, .row.fn .en { padding-left: 1rem; border-left: 1px solid var(--rule); }

/* Editorial substitution for an offensive term in an original text */
.ed { font-style: italic; color: var(--muted); cursor: help; }

/* Famous passages */
:root { --fam-bg: color-mix(in srgb, var(--accent) 7%, var(--bg)); }
.famous-list { max-width: 76rem; margin: 0 auto; padding: 0 16px 1.5rem; font-family: var(--sans); font-size: 14px; }
.famous-list h2 { font-family: var(--sans); font-size: 12px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin: 0 0 .5rem; }
.famous-list ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.famous-list li a { display: inline-block; text-decoration: none; border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--rule)); color: var(--fg);
  border-radius: 999px; padding: .25rem .7rem; background: var(--fam-bg); }
.famous-list li a:hover { border-color: var(--accent); color: var(--accent); }
.fam { margin: 2rem 0 .1rem; padding-left: calc(3rem + 2.75rem); font-family: var(--sans); font-size: 13.5px; line-height: 1.45; display: grid; gap: .1rem; scroll-margin-top: 5rem; }
.fam-tag { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.fam-t { font-family: var(--serif); font-size: 1.1rem; font-weight: 600; color: var(--fg); }
.fam-why { color: var(--muted); max-width: 44rem; }
.row.famous { background: var(--fam-bg); box-shadow: inset 3px 0 0 var(--accent); }
.row.famous:hover, .row.famous.active { background: color-mix(in srgb, var(--accent) 11%, var(--bg)); }
body.mode-en .fam, body.mode-orig .fam { padding-left: calc(3rem + 2.75rem); }
@media (max-width: 820px) { .fam { padding-left: 0; } body.mode-en .fam, body.mode-orig .fam { padding-left: 0; } .row.famous { background: var(--fam-bg); } }

/* Keeping your place: resume / back pill and contents button */
.float-ui { position: fixed; left: 0; right: 0; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 20;
  display: flex; justify-content: center; align-items: center; gap: .5rem; pointer-events: none; padding-inline: 16px; }
.pill, .fab { pointer-events: auto; font-family: var(--sans); font-size: 14px; box-shadow: 0 6px 24px rgba(0,0,0,.18); }
.pill { display: inline-flex; align-items: stretch; background: var(--fg); color: var(--bg); border-radius: 999px; overflow: hidden; max-width: 100%; }
.pill[hidden], .fab[hidden] { display: none; }
.pill button { font: inherit; color: inherit; background: none; border: 0; padding: .6rem 1rem; cursor: pointer; white-space: nowrap; }
.pill button[data-act="close"] { padding: .6rem .85rem; opacity: .7; border-left: 1px solid color-mix(in srgb, var(--bg) 25%, transparent); }
.pill button:hover { background: color-mix(in srgb, var(--bg) 12%, transparent); }
.fab { position: absolute; right: 16px; bottom: 0; background: var(--bg); color: var(--fg); border: 1px solid var(--rule); border-radius: 999px; padding: .5rem .9rem; cursor: pointer; }
.fab:hover { border-color: var(--muted); }
@media (max-width: 820px) { .fab { right: 12px; } .pill { font-size: 13.5px; } }
@media (max-width: 520px) { .float-ui { justify-content: flex-start; } }

/* Paragraph breaks inside a chunk; long works split into one page per book */
.orig p + p, .en p + p { margin-top: .45em; }
.head-part { padding-top: 3rem; padding-bottom: 1.5rem; }
.head-part .author a { color: inherit; text-decoration: none; border-bottom: 1px solid var(--rule); }
.head-part .author a:hover { color: var(--accent); }
.head-part h1 { margin-bottom: .2rem; }
.part-sub { font-size: 1.15rem; color: var(--muted); margin: 0; max-width: var(--measure); }
.partnav { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; font-family: var(--sans); font-size: 14px; margin: 1.75rem 0 0; max-width: var(--measure); }
.partnav > :last-child { text-align: right; }
.partnav a { text-decoration: none; color: var(--muted); } .partnav a:hover { color: var(--accent); }
.text > .partnav { border-top: 1px solid var(--rule); padding-top: 1.25rem; margin-top: 3rem; }
.pill .pill-link { color: inherit; text-decoration: none; padding: .6rem 1rem; white-space: nowrap; }

/* Book opening: intro on the left, famous passages + contents on the right */
.head { padding-bottom: 2.5rem; }
.front { display: grid; grid-template-columns: minmax(0, var(--measure)) minmax(0, 1fr); column-gap: 4rem; align-items: start; margin-top: 2rem; }
.front .intro { margin-top: 0; }
.front-side { display: grid; gap: 1.75rem; font-family: var(--sans); font-size: 14px; }
.front-side .famous-list, .front-side .toc { max-width: none; margin: 0; padding: 0; }
.front-side .toc-in { border: 0; padding: 0; }
.front-side h2 { margin-bottom: .6rem; }
.front-side .toc ul { columns: 1; }
.front-side .toc li.grp { margin-bottom: .55rem; }
@media (max-width: 980px) {
  .front { grid-template-columns: minmax(0, 1fr); row-gap: 2rem; }
  .front-side { border-top: 1px solid var(--rule); padding-top: 1.5rem; }
  .front-side .toc ul { columns: 2 15rem; }
}

/* Contents beside the intro; famous passages as a full-width band beneath */
.head .famous-list { max-width: none; margin: 2.5rem 0 0; padding: 1.5rem 0 0; border-top: 1px solid var(--rule); }
.head .famous-list .toc-in { border: 0; padding: 0; }
.toc-sub { display: block; font-size: 12.5px; color: var(--muted); margin: .1rem 0 .15rem; line-height: 1.4; }
.front-side .toc li.grp > .n { margin-left: .35rem; }

/* In-page contents on a book-part page */
.head-part .part-toc { max-width: none; margin: 2rem 0 0; padding: 0; }
.head-part .part-toc .toc-in { border-top: 1px solid var(--rule); border-bottom: 0; padding-top: 1.25rem; }
.head-part .part-toc ul { list-style: none; padding: 0; columns: 3 14rem; column-gap: 2.5rem; }
.head-part .part-toc li { margin: .2rem 0; break-inside: avoid; }
.head-part .famous-list { max-width: none; margin: 1.25rem 0 0; padding: 0; }
.head-part .famous-list .toc-in { border: 0; padding: 0; }

/* Classical Chinese originals: system serif CJK faces (no web font download) */
.orig[lang="ar"], [lang="ar"].o, .orig-title[lang="ar"] {
  font-family: "Noto Naskh Arabic", "Amiri", "Geeza Pro", serif; direction: rtl; text-align: right; unicode-bidi: isolate;
  font-size: 1.12em; line-height: 1.95; letter-spacing: 0; font-style: normal;
}
.orig[lang="ar"] .ed, .orig[lang="ar"] .st { unicode-bidi: isolate; }
.orig[lang="sa"], [lang="sa"].o, .orig-title[lang="sa"] {
  font-family: "Noto Serif Devanagari", "Kohinoor Devanagari", "Devanagari Sangam MN", "Nirmala UI", serif;
  line-height: 1.9;
}
.orig[lang="lzh"], [lang="lzh"].o, .orig-title[lang="lzh"] {
  font-family: "Songti TC", "STSong", "Noto Serif CJK TC", "Noto Serif TC", "Source Han Serif TC", "PMingLiU", "MingLiU", serif;
  letter-spacing: .04em; line-height: 1.9;
}

/* Room after the last passage so a jump to it can bring it to the top */
.text { padding-bottom: max(6rem, 45vh); }

/* Display-settings menu (Aa) */
.menu { position: relative; flex: none; }
.panel { position: absolute; right: 0; top: calc(100% + .5rem); z-index: 30; background: var(--bg); border: 1px solid var(--rule);
  border-radius: 10px; padding: .75rem .85rem; box-shadow: 0 10px 30px rgba(0,0,0,.14); min-width: 15.5rem; display: grid; gap: .65rem; }
.panel[hidden] { display: none; }
.row2 { display: flex; align-items: center; justify-content: space-between; gap: 1rem; color: var(--muted); font-size: 13.5px; }
.icon:focus-visible, .seg button:focus-visible, .pill button:focus-visible, .fab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon:focus:not(:focus-visible) { outline: none; }

/* One-line description under a section heading */
h3.part + .part-desc { font-family: var(--sans); font-size: 14px; line-height: 1.5; color: var(--muted); margin: -.6rem 0 1.1rem; max-width: var(--measure); }

/* Key terms */
.term { text-decoration: underline dotted color-mix(in srgb, var(--accent) 70%, transparent); text-underline-offset: .22em; text-decoration-thickness: 1.5px; cursor: help; }
.term:hover, .term:focus-visible { color: var(--accent); outline: none; }
.term-pop { position: absolute; z-index: 40; background: var(--bg); color: var(--fg); border: 1px solid var(--rule); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.16); padding: .75rem .9rem; font-family: var(--sans); font-size: 14px; line-height: 1.5; }
.term-pop[hidden] { display: none; }
.term-pop .tp-head strong { font-family: var(--serif); font-size: 1.05rem; }
.term-pop .tp-orig { font-family: var(--greek); color: var(--accent); }
.term-pop .tp-tr { color: var(--muted); font-style: italic; }
.term-pop p { margin: .35rem 0 0; color: var(--fg); }
/* Reader's guide: about the author, who's who, key terms */
.guide { display: grid; gap: 2rem; margin-top: 2.5rem;
  padding-top: 1.5rem; border-top: 1px solid var(--rule); font-family: var(--sans); font-size: 14px; line-height: 1.5; }
.guide h2 { font-size: 12px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0 0 .6rem; }
.guide p { margin: 0; color: var(--fg); }
.guide dl { margin: 0; columns: 3 15rem; column-gap: 2.5rem; }
.guide dl > div { break-inside: avoid; margin-bottom: .7rem; }
.guide .g-col > p { max-width: 44rem; }
.guide dt { font-weight: 600; color: var(--fg); }
.guide dd { margin: .1rem 0 0; color: var(--muted); }
.guide .g-orig { font-family: var(--greek); font-weight: 400; color: var(--accent); }
.guide .g-tr { font-weight: 400; color: var(--muted); font-style: italic; }
/* Outline mode */
.skim-link { display: block; font: inherit; font-size: 13px; color: var(--accent); background: none; border: 0; padding: 0; margin: -.2rem 0 .7rem; cursor: pointer; }
.skim-link:hover { text-decoration: underline; }
.outline-btn[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
body.skim .row, body.skim .fam, body.skim .colheads { display: none !important; }
body.skim h2.speech, body.skim h3.part, body.skim .part-desc, body.skim .speech-sub { cursor: pointer; }
body.skim h3.part { margin: 1.6rem 0 .5rem; }
body.skim h3.part:hover, body.skim h2.speech:hover { color: var(--accent); }
body.skim .text::before { content: "Outline — tap any section to read it"; display: block; font-family: var(--sans); font-size: 13px; color: var(--muted); margin: 1rem 0 0; }
.outline-row { display: none !important; }
.outline-row button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }
@media (max-width: 560px) { .outline-btn { display: none !important; } .outline-row { display: flex !important; } }

/* ── Library timeline: a rail down the side, a node per author, era dividers with small line drawings ── */
.timeline { position: relative; padding-left: 3.25rem; }
.timeline::before { content: ""; position: absolute; left: 1.05rem; top: .5rem; bottom: 0; width: 2px;
  background: linear-gradient(to bottom, color-mix(in srgb, var(--accent) 55%, var(--rule)), var(--rule) 92%, transparent); }
.timeline .author-block { position: relative; }
.timeline .author-block::before { content: ""; position: absolute; left: -2.62rem; top: 2.55rem; width: 11px; height: 11px;
  border-radius: 50%; background: var(--bg); border: 2px solid var(--accent); box-sizing: border-box; }
.era { position: relative; display: flex; align-items: baseline; gap: .75rem; margin: 2.6rem 0 .4rem; }
.era:first-child { margin-top: 1rem; }
.era-icon { position: absolute; left: -3.25rem; top: -.45rem; width: 2.3rem; height: 2.3rem; display: grid; place-items: center;
  background: var(--bg); color: var(--accent); border: 1.5px solid color-mix(in srgb, var(--accent) 55%, var(--rule)); border-radius: 50%; }
.era-icon svg { width: 1.35rem; height: 1.35rem; }
.era-name { font-family: var(--sans); font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.era-span { font-family: var(--sans); font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.timeline .era + .author-block { border-top: none; padding-top: 1.1rem; }
.timeline .era + .author-block::before { top: 1.65rem; }
@media (max-width: 700px) {
  .timeline { padding-left: 2.1rem; }
  .timeline::before { left: .62rem; }
  .timeline .author-block::before { left: -1.83rem; top: 2.85rem; }
  .timeline .era + .author-block::before { top: 1.95rem; }
  .era-icon { left: -2.1rem; width: 1.9rem; height: 1.9rem; top: -.35rem; }
  .era-icon svg { width: 1.1rem; height: 1.1rem; }
  .timeline .author-block ul { border-left: none; padding-left: 0; }   /* the rail does the grouping now */
}

/* Downloads on a work's landing page: PDF, parallel-text PDF, EPUB, Send to Kindle (files made by scripts/export.py) */
.dl { display: flex; flex-wrap: wrap; align-items: baseline; gap: .45rem 1.1rem; margin-top: 1.4rem; padding-top: 1rem;
  border-top: 1px solid var(--rule); font-family: var(--sans); font-size: 14px; max-width: var(--measure); position: relative; }
.dl-h { font-size: 12px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.dl > ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: .45rem 1.1rem; }
.dl > ul > li { display: inline-flex; align-items: baseline; gap: .35rem; }
.dl a { color: var(--fg); text-decoration: underline; text-decoration-color: var(--rule); text-decoration-thickness: 1px; text-underline-offset: .22em; }
.dl a:hover { color: var(--accent); text-decoration-color: currentColor; }
.dl-sz { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.kindle { position: relative; }
.kindle-btn { font: inherit; font-size: 13px; color: var(--fg); background: var(--bg); border: 1px solid var(--rule); border-radius: 999px;
  padding: .2rem .75rem; cursor: pointer; }
.kindle-btn:hover, .kindle-btn[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }
.dl a:focus-visible, .kindle-btn:focus-visible, .kp-x:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.kindle-pop:focus { outline: none; }   /* focus moves to the dialog itself when it opens */
.kindle-pop a { color: var(--accent); text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.kindle-pop { position: absolute; left: 0; top: calc(100% + .5rem); z-index: 30; width: min(22rem, calc(100vw - 32px));
  background: var(--bg); color: var(--fg); border: 1px solid var(--rule); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.14);
  padding: .75rem .9rem .8rem; font-size: 14px; line-height: 1.5; }
.kindle-pop[hidden] { display: none; }
.kp-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: .35rem; }
.kp-top strong { font-weight: 600; }
.kp-x { font: inherit; font-size: 20px; line-height: 1; background: none; border: 0; color: var(--muted); cursor: pointer; padding: .1rem .35rem; margin-right: -.35rem; }
.kp-x:hover { color: var(--fg); }
.kindle-pop ol { margin: 0; padding-left: 1.25rem; }
.kindle-pop li + li { margin-top: .35rem; }
.kp-again { margin: .65rem 0 0; font-size: 12.5px; color: var(--muted); }
@media (max-width: 560px) {
  .kindle { position: static; }                      /* popover spans the download row instead */
  .kindle-pop { left: 0; right: 0; width: auto; }
}

/* Multi-page works: make the way into the text obvious. */
.start-reading { display: inline-flex; flex-direction: column; gap: .1rem; margin-top: 1.4rem; padding: .7rem 1.1rem .75rem;
  border-radius: 8px; background: var(--fg); color: var(--bg); text-decoration: none; font-family: var(--sans); line-height: 1.25; }
.start-reading:hover { background: var(--accent); color: var(--bg); }
.start-reading .sr-k { font-size: 11px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; opacity: .75; }
.start-reading .sr-t { font-size: 16px; font-weight: 600; }
.toc-note { margin: -.2rem 0 .8rem; font-size: 13px; color: var(--muted); }
.split-toc ul { list-style: none; padding: 0; }
.front-side .split-toc ul { columns: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .6rem; }
.split-toc li.grp { position: relative; margin: 0 !important; padding: .7rem .9rem 2rem; border: 1px solid var(--rule); border-radius: 8px;
  transition: border-color .15s, background .15s; }
.split-toc li.grp:hover { border-color: var(--accent); }
.split-toc li.grp > a { color: var(--fg); font-size: 15px; }
.split-toc li.grp > a::after { content: ""; position: absolute; inset: 0; border-radius: 8px; }   /* whole card clickable */
.split-toc .toc-go { position: absolute; left: .9rem; bottom: .6rem; font-size: 12.5px; font-weight: 600; color: var(--accent); }
.split-toc li.grp:hover .toc-go { text-decoration: underline; text-underline-offset: .2em; }

/* Site footer and the short legal pages */
.site-foot { display: flex; justify-content: center; gap: .6rem; padding: 2.5rem 16px 3rem; font-family: var(--sans); font-size: 13px; color: var(--muted); }
.site-foot a { color: var(--muted); text-decoration: none; } .site-foot a:hover { color: var(--accent); }
.legal { max-width: 40rem; } .legal p { line-height: 1.65; margin: 0 0 1.1rem; }
.legal .updated { font-family: var(--sans); font-size: 13px; color: var(--muted); }
.legal a { color: var(--accent); }
