/* Loaded only by reader templates. Reuses the existing brand tile without changing homepage styles. */
:root {
  color-scheme:light; --r-bg:#f9f5ec; --r-panel:#faf7f0; --r-text:#2c302e; --r-muted:#65675f;
  --r-line:#ded8cb; --r-accent:#3b4948; --r-soft:#e5e5df; --r-focus:#2963ae;
  --r-size:18px; --r-leading:1.65; --r-width:66ch; --r-control-height:102px;
  --r-font:Georgia,'Times New Roman',serif;
  scrollbar-gutter:stable;
  scroll-padding:24px 0 calc(var(--r-control-height) + 36px);
}
@media(min-width:900px) { :root { --r-size:20px; } }
:root[data-reader-theme=paper] { --r-bg:#f3e8d3; --r-panel:#faf3e5; --r-text:#3c342a; --r-muted:#6a5c49; --r-line:#d3c3a8; --r-accent:#514d33; --r-soft:#e7ddc4; }
:root[data-reader-theme=dark] { color-scheme:dark; --r-bg:#1c2522; --r-panel:#252f2a; --r-text:#e4e7dd; --r-muted:#acb6ab; --r-line:#46544b; --r-accent:#bdcfb4; --r-soft:#354238; --r-focus:#edc788; }
@media(prefers-color-scheme:dark) {
  :root[data-reader-theme=system] { color-scheme:dark; --r-bg:#1c2522; --r-panel:#252f2a; --r-text:#e4e7dd; --r-muted:#acb6ab; --r-line:#46544b; --r-accent:#bdcfb4; --r-soft:#354238; --r-focus:#edc788; }
}
.reader,.reader * { box-sizing:border-box; }
.reader { margin:0; background:var(--r-bg); color:var(--r-text); font:16px/1.5 system-ui,-apple-system,sans-serif; min-height:100vh; padding-bottom:calc(var(--r-control-height) + 32px); }
.reader::before { content:''; position:fixed; inset:0; pointer-events:none; z-index:0; background:url('/images/reader/paper-grain.svg'); opacity:.28; }
.reader a { color:inherit; text-underline-offset:.22em; }
.reader button,.reader input,.reader select,.reader summary { font:inherit; }
.reader button,.reader select { color:var(--r-text); background:var(--r-panel); border:1px solid var(--r-line); border-radius:8px; }
.reader button,.reader summary,.reader select { cursor:pointer; min-height:44px; }
.reader button { padding:10px 16px; }
.reader button:disabled { color:var(--r-muted); cursor:default; opacity:.55; }
.reader :focus-visible { outline:3px solid var(--r-focus); outline-offset:4px; }
.reader [hidden] { display:none!important; }
.enhanced-only { display:none!important; }
.reader-ready .enhanced-only { display:inline-flex!important; }
.reader-ready .reader-nojs { display:none!important; }
.reader-header { position:relative; z-index:2; width:100%; min-height:88px; margin:0 auto; padding:18px 4%; display:flex; align-items:center; gap:24px; }
.reader-book .reader-header { background:linear-gradient(var(--r-bg),color-mix(in srgb,var(--r-bg) 92%,transparent) 48%,transparent); }
.reader-brand { display:flex; align-items:center; gap:10px; text-decoration:none; min-height:44px; letter-spacing:.025em; font-family:Georgia,serif; font-size:22px; }

.reader-badge { color:var(--r-muted); font-size:10px; letter-spacing:.09em; text-transform:uppercase; margin-left:auto; }
.reader-back-book { display:inline-flex; align-items:center; gap:8px; min-height:44px; padding:8px 0; font-size:13px; text-decoration:none; margin-left:auto; }
.reader-badge + .reader-back-book { margin-left:0; }
.reader-path { display:flex; align-items:center; justify-content:center; flex:1; gap:10px; color:var(--r-muted); font-size:11px; }
.reader-path > a { min-height:44px; display:flex; align-items:center; }
.reader-menu { width:44px; height:44px; padding:10px!important; border:0!important; background:transparent!important; color:inherit!important; }
.reader-menu svg { width:24px; height:24px; fill:none; stroke:currentColor; stroke-width:1.8; }
.reader-main { position:relative; z-index:1; width:100%; }
.reader-column { width:min(calc(100% - 48px),var(--r-width)); font-size:var(--r-size); font-family:var(--r-font); margin:0 auto; }
.chapter-intro { display:flex; flex-direction:column; width:100%; margin:20px auto 18px; }
.chapter-heading { position:relative; text-align:center; width:min(920px,calc(100% - 48px)); margin:0 auto 22px; }
.book-context { display:inline-flex; align-items:center; justify-content:center; font-size:12px; color:var(--r-muted)!important; min-height:44px; letter-spacing:.07em; text-decoration:none; padding:10px 0; }
.eyebrow { font:10px/1.5 system-ui,sans-serif; letter-spacing:.2em; text-transform:uppercase; color:var(--r-muted); margin:12px 0; }
.chapter-count { display:inline-block; padding-left:16px; opacity:.75; letter-spacing:.06em; }
.reader h1 { font:normal clamp(30px,3.3vw,42px)/1.2 Georgia,serif; text-wrap:balance; margin:10px 0 16px; overflow-wrap:anywhere; }
.chapter-ornament { display:flex; justify-content:center; align-items:center; gap:16px; color:var(--r-accent); font-size:7px; margin:24px auto 0; }
.chapter-ornament::before,.chapter-ornament::after { content:''; width:42px; height:1px; background:var(--r-line); }
.prototype-note { font:11px/1.65 system-ui,sans-serif; color:var(--r-muted); text-align:center; margin:0 0 14px; }
.chapter-illustration { margin:0 auto 12px; width:min(calc(100% - 48px),var(--r-width)); font:var(--r-size) var(--r-font); }
.illustration-link { display:block; position:relative; aspect-ratio:16/9; }
.illustration-link picture { display:block; width:100%; height:100%; }
.illustration-link img {
  display:block; width:100%; height:100%; object-fit:cover; object-position:center;
  mask-image:linear-gradient(to bottom,transparent,#000 4%,#000 93%,transparent),linear-gradient(to right,transparent,#000 3%,#000 97%,transparent);
  mask-composite:intersect; mask-size:100% 100%; mask-repeat:no-repeat;
  -webkit-mask-image:linear-gradient(to bottom,transparent,#000 4%,#000 93%,transparent),linear-gradient(to right,transparent,#000 3%,#000 97%,transparent);
  -webkit-mask-composite:source-in; -webkit-mask-size:100% 100%;
}
.enlarge-label { position:absolute; right:16%; bottom:18%; color:var(--r-bg); background:var(--r-accent); font:10px/1.2 system-ui,sans-serif; letter-spacing:.04em; padding:9px 12px; border-radius:30px; opacity:0; transition:opacity .15s; }
.illustration-link:hover .enlarge-label,.illustration-link:focus-visible .enlarge-label { opacity:1; }
.image-error { position:absolute; inset:15%; padding:20px; display:flex; flex-direction:column; gap:8px; align-items:center; justify-content:center; text-align:center; font:13px/1.5 system-ui,sans-serif; }
.image-failed img,.image-failed .enlarge-label { visibility:hidden; }
.chapter-illustration figcaption { color:var(--r-muted); font:10px/1.5 system-ui,sans-serif; text-align:center; max-width:520px; margin:-8px auto 0; padding:0 24px; }
/* A single reading composition; historical presentation metadata cannot select a spread. */
.reader-hide-illustrations .chapter-illustration,.reader-text-only .chapter-illustration { display:none; }
.reader-text-only .reader::before { display:none; }
.chapter-text { line-height:var(--r-leading); text-align:left; overflow-wrap:break-word; }
.chapter-text p { margin:0 0 1.15em; }
.chapter-text blockquote { white-space:pre-line; margin:1.5em 0; padding:0 0 0 1em; border-left:2px solid var(--r-line); }
.reader:not(.reader-book) .chapter-text > p:first-child::first-letter { float:left; font:3.2em/.83 Georgia,serif; padding:9px 10px 0 0; color:var(--r-accent); }
.reader-text-only .reader .chapter-text > p:first-child::first-letter { float:none; font:inherit; padding:0; color:inherit; }
.scene-break { text-align:center; color:var(--r-muted); margin:2.4em 0; letter-spacing:.5em; font-size:14px; }
.reader-footer { position:relative; z-index:1; margin:24px auto 24px; max-width:calc(100% - 40px); color:var(--r-muted); text-align:center; font-size:10px; letter-spacing:.12em; }
.reader-footer span { margin:0 8px; }
.reader-note,.book-description { font:16px/1.7 system-ui,sans-serif; }
.reader-note { color:var(--r-muted); }
.start-reading { display:inline-flex; gap:20px; padding:14px 22px; background:var(--r-accent); color:var(--r-bg)!important; border-radius:8px; text-decoration:none; font:16px/1.5 system-ui,sans-serif; margin:16px 0 32px; }
.reader-book { padding-bottom:24px; }
.reader-book .reader-main { margin:60px auto; }
.reader-book h2 { font:26px Georgia,serif; }
/* The same floating book control on desktop and phone. */
.reader-toolbar { display:flex; justify-content:center; align-items:center; position:fixed; bottom:22px; left:50%; transform:translateX(-50%); width:min(820px,calc(100% - 64px)); z-index:5; gap:4px; background:var(--r-panel); border:1px solid var(--r-line); border-radius:24px; padding:5px 14px; box-shadow:0 8px 28px #342b201a; }
.reader-toolbar > a,.reader-toolbar > button,.reader-toolbar > details,.nojs-aa { display:flex; flex:1; min-width:0; min-height:56px; justify-content:center; align-items:center; gap:10px; text-decoration:none; text-align:center; font-size:13px; border-radius:14px; }
.reader-toolbar > button,.reader-toolbar > a { padding:6px 8px; }
.reader-toolbar button { border:0; background:transparent; }
.reader-toolbar a:hover,.reader-toolbar button:not(:disabled):hover { background:var(--r-soft); }
.reader-toolbar [aria-hidden=true] { font-size:23px; line-height:1; }
.reader-toolbar .aa-button { flex-direction:column; gap:0; font-family:Georgia,serif; font-size:26px; line-height:1.1; }
.reader-toolbar .aa-button small { font:10px/1.5 system-ui,sans-serif; }
.toolbar-icon { width:20px; height:20px; fill:none; stroke:currentColor; stroke-width:1.7; }
.nav-wide { display:none; }.nav-short { display:inline; }
.reader-dialog { color:var(--r-text); background:var(--r-panel); border:1px solid var(--r-line); border-radius:16px; padding:24px 28px; width:min(420px,calc(100% - 32px)); max-height:calc(100dvh - 48px); overflow-y:auto; overscroll-behavior:contain; box-shadow:0 24px 90px #0004; }
.reader-dialog::backdrop { background:#18202252; backdrop-filter:blur(2px); }
.reader-dialog h2 { font:normal 20px/1.25 Georgia,serif; margin:0; }
.dialog-header { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:16px; }
.dialog-header .eyebrow { margin:0 0 7px; }
.dialog-close { width:44px; height:44px; flex-shrink:0; font-size:24px!important; padding:0!important; border:0!important; }
.dialog-book { color:var(--r-muted); font-size:13px; }
.reader-toc-list { list-style:none; margin:20px 0 0; padding:0; font:17px/1.5 Georgia,serif; }
.reader-toc-list a { display:flex; gap:14px; padding:10px 10px; border-bottom:0; text-decoration:none; border-radius:6px; min-height:44px; }
.reader-toc-list a[aria-current=page] { background:var(--r-soft); color:var(--r-accent); }
.toc-number { color:var(--r-muted); flex:0 0 20px; }
.reader-toc-list small { display:block; font-size:11px; margin-top:6px; }
.setting-row { display:flex; justify-content:space-between; align-items:center; gap:12px; font-size:14px; margin:14px 0 4px; }
.setting-row output { color:var(--r-muted); font-size:12px; }
.reader input[type=range] { width:100%; height:44px; margin:2px 0 4px; accent-color:var(--r-accent); }
.reader fieldset { border:0; margin:12px 0; padding:0; }
.reader legend { font-size:13px; padding:0; margin-bottom:8px; }
.choice-row { display:flex; gap:8px; }
.choice-row label { position:relative; flex:1; min-width:0; }
.choice-row input { position:absolute; width:1px; height:1px; opacity:0; }
.choice-row label > span { display:flex; min-height:46px; align-items:center; justify-content:center; border:1px solid var(--r-line); border-radius:8px; padding:9px 7px; font-size:13px; cursor:pointer; }
.choice-row input:checked + span { border-color:var(--r-accent); box-shadow:inset 0 0 0 1px var(--r-accent); background:var(--r-soft); }
.choice-row input:focus-visible + span { outline:3px solid var(--r-focus); outline-offset:3px; }
.font-serif { font-family:Georgia,serif; }
.themes label > span { flex-direction:column; font-size:10px; gap:6px; }
.swatch { display:block; width:22px; height:22px; border-radius:50%; border:1px solid #869285; }
.swatch.light { background:#faf9f6; }.swatch.paper { background:#f3e9d5; }.swatch.dark { background:#1c2522; }.swatch.system { background:linear-gradient(90deg,#faf9f6 50%,#1c2522 50%); }
.width-label { display:block; font-size:14px; margin:14px 0 8px; }.width-label small { color:var(--r-muted); margin-left:8px; font-size:10px; }
.reader select { width:100%; padding:10px 12px; }
.illustration-toggle { display:flex; align-items:center; justify-content:space-between; min-height:48px; margin:12px 0; gap:14px; font-size:13px; cursor:pointer; }
.illustration-toggle input { width:24px; height:24px; accent-color:var(--r-accent); }
.reset-preferences { width:100%; font-size:12px!important; }
.settings-note,.storage-status,.text-mode-hint { font-size:10px; color:var(--r-muted); line-height:1.5; margin-bottom:0; }
.text-mode-hint { display:none; margin:0 0 14px; }.reader-text-only .text-mode-hint { display:block; }
.storage-status:not(:empty) { padding:12px; border:1px solid var(--r-line); }

.reader-skip { position:fixed; top:-100px; left:16px; z-index:20; background:var(--r-panel); padding:12px; }.reader-skip:focus { top:12px; }
.inline-toc { display:block!important; }.reader-ready .inline-toc { display:none!important; }
.inline-toc summary { display:grid; align-items:center; padding:10px; }
.inline-toc-content { position:fixed; bottom:calc(var(--r-control-height) + 12px); left:50%; transform:translateX(-50%); width:min(440px,calc(100% - 40px)); max-height:65vh; overflow:auto; padding:20px; text-align:left; background:var(--r-panel); border:1px solid var(--r-line); box-shadow:0 12px 50px #0003; z-index:9; }
@media(max-width:899px) {
  .reader-header { min-height:68px; padding:10px 24px; gap:18px; }.reader-brand { font-size:20px; }.reader-badge { font-size:9px; }
  .reader-column { width:min(calc(100% - 44px),var(--r-width)); }
  .reader-toolbar { width:min(660px,calc(100% - 40px)); }
  .reader-dialog { padding:20px 24px; max-height:calc(100dvh - 32px); }
}
@media(max-width:539px) {
  .reader-header { padding:10px 22px; gap:8px; flex-wrap:wrap; }.reader-badge { display:none; }
  .reader-brand { font-size:19px; }
  .reader-header .reader-back-book { order:4; flex-basis:100%; margin:0; min-height:36px; font-size:11px; }
  .reader-header .reader-menu { margin-left:auto; }
  .chapter-intro { margin-top:12px; margin-bottom:12px; }.chapter-heading { width:calc(100% - 40px); margin-bottom:12px; }
  .eyebrow { margin:10px 0; font-size:10px; }
  .prototype-note { font-size:9px; margin-bottom:12px; }
  .reader-toolbar { bottom:0; width:100%; gap:0; padding:5px 8px calc(5px + env(safe-area-inset-bottom,0px)); border-radius:20px 20px 0 0; }
  .reader-toolbar > a,.reader-toolbar > button,.reader-toolbar > details,.nojs-aa { flex-direction:column; gap:5px; min-height:58px; padding:5px 2px; font-size:10px; }
  .reader-toolbar > a:last-child,.reader-toolbar > button:last-child { flex-direction:column-reverse; }
  .reader-toolbar .aa-button { font-size:26px; gap:0; }.reader-toolbar .aa-button small { display:none; }
  .reader-dialog { padding:18px 22px; }
}
@media(max-width:340px) {
  .reader-header { padding-inline:16px; gap:4px; }.reader-brand { font-size:16px; }
  .reader-column { width:calc(100% - 32px); }
  .reader-toolbar { padding-inline:4px; }.reader-toolbar > a,.reader-toolbar > button { font-size:9px; }
  .reader-dialog { width:calc(100% - 16px); max-width:calc(100% - 16px); padding:12px; border-radius:10px; }
  .reader-dialog h2 { font-size:18px; overflow-wrap:anywhere; }.dialog-header { gap:4px; }
  .themes { display:grid!important; grid-template-columns:repeat(2,minmax(0,1fr)); }
  .choice-row label > span { padding-inline:3px; font-size:11px; overflow-wrap:anywhere; }
  .setting-row { font-size:12px; gap:6px; }.reader legend small { display:block; }
}
@media(prefers-reduced-motion:reduce) { .reader * { scroll-behavior:auto!important; transition:none!important; } }

/* The lightbox is a top-layer viewport, never a themed card. Rules follow compact dialog overrides. */
.visually-hidden { position:absolute!important; width:1px!important; height:1px!important; padding:0!important; margin:-1px!important; overflow:hidden!important; clip-path:inset(50%)!important; white-space:nowrap!important; border:0!important; }
.reader .image-dialog { width:100%; max-width:none; height:100dvh; max-height:none; inset:0; margin:0; padding:0; border:0; border-radius:0; box-shadow:none; background:transparent; color:#f5f5ef; overflow:hidden; }
.image-dialog[open] { display:grid; place-items:center; }
.image-dialog::backdrop { background:rgba(5,9,8,.93); backdrop-filter:none; }
.image-dialog .large-image-frame { display:contents; }
.image-dialog #large-image { display:block; width:auto; height:auto; max-width:calc(100vw - 64px); max-height:calc(100dvh - 128px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px)); margin:0; object-fit:contain;  }
.reader .image-dialog .dialog-close { position:fixed; z-index:2; top:calc(12px + env(safe-area-inset-top,0px)); right:calc(16px + env(safe-area-inset-right,0px)); color:#fff; background:#111b17; border-radius:50%; width:48px; height:48px; }
.image-dialog :focus-visible { outline-color:#edc788; }
.large-image-error { max-width:min(380px,calc(100vw - 48px)); margin:0; text-align:center; color:#f5f5ef; font-size:15px; line-height:1.6; }
@media(max-width:539px) { .image-dialog #large-image { max-width:calc(100vw - 32px); max-height:calc(100dvh - 144px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px)); } }
/* Hiding art removes the overlap as well as the image, including in text-only mode. */
.reader-text-only .reader .chapter-heading,.reader-hide-illustrations .reader .chapter-heading { margin-top:0; }

/* The original paper panels keep their palette even when the reader chooses dark text pages. */
.reader #settings-dialog,.reader #toc-dialog {
  color-scheme:light; --r-bg:#f9f5ec; --r-panel:#faf7f0; --r-text:#2c302e; --r-muted:#65675f;
  --r-line:#ded8cb; --r-accent:#3b4948; --r-soft:#e5e5df; --r-focus:#2963ae;
}
:root[data-reader-theme=paper] .reader #settings-dialog,:root[data-reader-theme=paper] .reader #toc-dialog {
  --r-bg:#f3e8d3; --r-panel:#faf3e5; --r-text:#3c342a; --r-muted:#6a5c49; --r-line:#d3c3a8; --r-accent:#514d33; --r-soft:#e7ddc4;
}

/* Paper settings: the order and controls follow the single supplied collage. */
.reader #settings-dialog,.reader #toc-dialog { --r-accent:#2664b8; --r-focus:#2963ae; --r-soft:#e1e3e3; }
.reader-dialog .dialog-header { margin-bottom:8px; }
.reader-dialog h2 { font-size:19px; }
.reader-dialog .dialog-book { font:21px/1.4 Georgia,serif; color:var(--r-text); margin:16px 0 22px; padding-bottom:20px; border-bottom:1px solid var(--r-line); }
.reader-dialog .reader-toc-list { margin-top:8px; }
.reader-dialog .reader-toc-list a[aria-current=page] { color:var(--r-text); }
.reader-dialog .reader-toc-list a { gap:10px; }
.reader-dialog .toc-number::after { content:'.'; }
.reader #toc-dialog { min-height:380px; }
.reader #settings-dialog fieldset { margin:10px 0; }
.reader #settings-dialog legend,.reader #settings-dialog .setting-row { font:15px/1.4 Georgia,serif; }
.reader #settings-dialog legend small { font:12px/1.4 Georgia,serif; }
.reader #settings-dialog legend output { color:var(--r-muted); font:11px system-ui,sans-serif; margin-left:8px; }
.reader #settings-dialog .theme-setting { margin:0 0 10px; }
.themes label > span { border:0; padding:2px; min-height:72px; background:transparent!important; gap:7px; }
.themes input:checked + span { box-shadow:none; color:var(--r-text); font-weight:600; }
.themes .swatch { width:40px; height:40px; border:1px solid #b3b5b3; box-shadow:inset 0 0 0 1px #fff7; }
.themes input:checked + span .swatch { outline:2px solid var(--r-accent); outline-offset:3px; }
.swatch.system { background:#fcfcfa; }.swatch.light { background:#fff; }.swatch.paper { background:#f3e8d3; }.swatch.dark { background:#454746; }
.size-controls { display:flex; align-items:center; gap:14px; }
.size-controls button { padding:0 10px; min-width:52px; font:24px/1 Georgia,serif; }
.size-controls input { flex:1; min-width:0; }
.choice-row label > span { min-height:44px; padding:7px 5px; font-size:13px; border-radius:6px; }
.choice-row input:checked + span { box-shadow:inset 0 0 0 .5px var(--r-accent); }
.themes input:checked + span { box-shadow:none; }
.themes label > span { min-height:72px; font-size:10px; }
.fonts input:checked + span::before { content:'✓'; font:12px system-ui,sans-serif; margin-right:6px; color:var(--r-accent); }
.lines { display:block; width:30px; height:20px; background:repeating-linear-gradient(to bottom,currentColor 0 2px,transparent 2px 6px); }
.lines.dense { height:12px; background-size:100% 5px; }
.lines.spacious { height:26px; background:repeating-linear-gradient(to bottom,currentColor 0 2px,transparent 2px 8px); }
.lines.narrow { width:22px; }.lines.wide { width:40px; }
.reader .illustration-toggle { justify-content:flex-start; margin:0; gap:10px; min-height:44px; font:14px/1.4 Georgia,serif; }
.reader .illustration-toggle input { appearance:none; width:38px; height:23px; flex:0 0 38px; border:1px solid #82877f; border-radius:20px; background:#b2b5b0; margin:0; position:relative; cursor:pointer; }
.reader .illustration-toggle input::before { content:''; position:absolute; width:17px; height:17px; background:white; border-radius:50%; top:2px; left:2px; box-shadow:0 1px 3px #0003; }
.reader .illustration-toggle input:checked { background:var(--r-accent); border-color:var(--r-accent); }
.reader .illustration-toggle input:checked::before { left:17px; }
.reader .illustration-toggle input:disabled { opacity:.45; cursor:default; }
.reader .reset-preferences { background:transparent; border:0; border-top:1px solid var(--r-line); border-radius:0; margin-top:6px; color:var(--r-muted); }
.settings-note { text-align:center; font-size:9px; margin-top:4px; }
@media(max-width:340px) {
  .size-controls { gap:5px; }.size-controls button { min-width:44px; padding:0 4px; }
  .reader #settings-dialog legend,.reader #settings-dialog .setting-row { font-size:13px; }
  .fonts { flex-direction:column; }.choice-row label > span { font-size:11px; }
  .lines { width:24px; }.lines.wide { width:28px; }.lines.narrow { width:18px; }
}

/* Canonical v1. All four widths use the same font context, so ch resolves identically. */
.reader-chapter { font:var(--r-size)/1.5 var(--r-font); }
.reader-chapter::before { content:none; background:none; }
.reader-chapter .reader-header,.reader-chapter .reader-main,.reader-chapter .reader-toolbar {
  width:min(calc(100% - 48px),var(--r-width)); font:var(--r-size)/1.5 var(--r-font);
}
.reader-chapter .reader-header { min-height:76px; padding:12px 0; gap:16px; background:none; }
.reader-chapter .reader-brand { font-size:20px; letter-spacing:0; }
.reader-chapter .reader-back-book { margin-left:auto; font:13px/1.5 system-ui,sans-serif; }
.reader-chapter .reader-main { margin:0 auto; }
.reader-chapter .reader-column { width:100%; }
.reader-chapter .chapter-intro { margin:20px 0 18px; }
.reader-chapter .chapter-heading { width:100%; margin:0 0 24px; }
:root .reader-chapter h1 { font:normal clamp(36px,4vw,48px)/1.2 Georgia,serif; margin:8px 0 0; }
.reader-chapter .eyebrow { margin:0 0 10px; font-size:clamp(18px,1.6vw,20px); font-weight:500; letter-spacing:.12em; color:var(--r-text); }
.reader-chapter .chapter-illustration { width:100%; margin:0; }
.reader-chapter .illustration-link { aspect-ratio:auto; }
.reader-chapter .illustration-link picture { height:auto; }
.reader-chapter .illustration-link img { height:auto; object-fit:contain; mask-image:none; -webkit-mask-image:none; }
.reader-chapter .enlarge-label { right:12px; bottom:12px; }
.reader-chapter .prototype-note { margin-bottom:20px; font-size:10px; }
.reader-chapter .chapter-text > p:first-child::first-letter { float:none; font:inherit; padding:0; color:inherit; }
.reader-chapter .reader-toolbar { bottom:16px; padding:4px 8px; gap:2px; border-radius:14px; box-shadow:0 3px 14px #342b2010; }
.reader-chapter .reader-toolbar > a,.reader-chapter .reader-toolbar > button,.reader-chapter .reader-toolbar > details,.reader-chapter .nojs-aa {
  min-height:44px; font:12px/1.4 system-ui,sans-serif; border-radius:8px; padding:4px; gap:7px;
}
.reader-chapter .reader-toolbar .aa-button { font:24px/1.2 Georgia,serif; }
.reader-chapter .aa-button small { display:none; }
.reader-chapter .reader-footer { font:10px/1.5 system-ui,sans-serif; }
:root[data-reader-theme] .reader-chapter #settings-dialog,:root[data-reader-theme] .reader-chapter #toc-dialog {
  --r-panel:#f7f5f0; --r-text:#252828; --r-muted:#606363; --r-line:#d9dcd9;
  --r-accent:#1265df; --r-soft:#e0e2e3; --r-focus:#2963ae; font:14px/1.5 system-ui,sans-serif;
  border-radius:12px; box-shadow:0 12px 40px #0002;
}
.reader-chapter .toc-book-heading { display:flex; align-items:center; gap:18px; margin:16px 0 24px; }
.reader-chapter .toc-thumbnail { width:56px; height:auto; }
.reader-chapter .dialog-book { margin:0; padding:0; border:0; font-size:20px; }
.reader-chapter #toc-dialog { min-height:0; }
/* Intermediate scale between the earlier 250px and overly fine 83px oak/acorn tiles.
   Its low-opacity layer is covered by a solid central strip, never placed under text. */
@media(min-width:900px) {
  .reader-chapter::before {
    content:''; background:url('/images/brand/dubravnik-pattern-outline-light-tile-varied-acorns.png') repeat 0 0 / 150px 150px;
    opacity:.045;
  }
  .reader-chapter::after {
    content:''; position:fixed; inset:0; width:min(100%,calc(var(--r-width) + 64px)); margin:0 auto;
    background:var(--r-bg); pointer-events:none; z-index:0;
  }
  :root[data-reader-theme=dark] .reader-chapter::before { opacity:.035; }
}
@media(prefers-color-scheme:dark) and (min-width:900px) {
  :root[data-reader-theme=system] .reader-chapter::before { opacity:.035; }
}
@media(max-width:899px) {
  .reader-chapter::before,.reader-chapter::after { content:none; display:none; background-image:none; }
  .reader-chapter .reader-header { min-height:66px; }
}
@media(max-width:539px) {
  .reader-chapter .reader-header,.reader-chapter .reader-main { width:calc(100% - 40px); }
  .reader-chapter .reader-header { flex-wrap:nowrap; gap:8px; padding:8px 0; }
  .reader-chapter .reader-brand { font-size:17px; gap:6px; }
  .reader-chapter .reader-back-book { order:0; flex-basis:auto; font-size:11px; min-height:44px; }
  .reader-chapter .reader-menu { margin-left:0; }
  .reader-chapter .chapter-intro { margin-top:18px; }
  .reader-chapter .chapter-heading { margin-bottom:22px; }
  .reader-chapter .reader-toolbar { width:100%; bottom:0; border-radius:12px 12px 0 0; padding:5px 8px calc(5px + env(safe-area-inset-bottom,0px)); }
  .reader-chapter .reader-toolbar > a,.reader-chapter .reader-toolbar > button,.reader-chapter .reader-toolbar > details,.reader-chapter .nojs-aa { min-height:48px; font-size:10px; gap:4px; }
  .reader-chapter .reader-toolbar .aa-button { font-size:26px; }
}
@media(max-width:340px) {
  .reader-chapter .reader-header { flex-wrap:wrap; }
  .reader-chapter .reader-back-book { order:4; flex-basis:100%; margin:0; }
  .reader-chapter .reader-menu { margin-left:auto; }
  .reader-chapter .reader-toolbar { padding-inline:4px; }
  .reader-chapter .reader-toolbar > a,.reader-chapter .reader-toolbar > button { font-size:9px; }
}
.reader-text-only .reader-chapter::before { display:none; }
