/* The Voltaire Press reader: a full-screen, page-turning view of one work or book.
   It is standalone (it does not load style.css). Pages are made by assets/js/reader.js. */

html { --bg:#fff; --fg:#1a1a1a; --muted:#6b6b6b; --bar:#f7f7f7; --line:#dcdcdc; --sheet:#fff;
       --hit:rgba(255,205,0,.5); --scrim:rgba(0,0,0,.38); --accent:#b3402a; --link:#800020; }
html[data-theme="paper"] { --bg:#f6efdc; --fg:#3b3226; --muted:#766a58; --bar:#efe6cf; --line:#d9cdb0; --sheet:#fbf6e8; --link:#7a2a1c; }
html[data-theme="dark"]  { --bg:#000; --fg:#e4e4e4; --muted:#9a9a9a; --bar:#151515; --line:#2c2c2c; --sheet:#1c1c1c;
                           --hit:rgba(255,200,0,.38); --scrim:rgba(0,0,0,.6); --accent:#e0715b; --link:#e4e4e4; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
body.reader {
  color: var(--fg);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- without JavaScript: the whole text, plainly, on one long page ---------- */
#source { display: none; }
html:not(.js) #source { display: block; max-width: 38rem; margin: 0 auto; padding: 0 1.2rem 3rem;
                        font: 19px/1.6 Georgia, "Iowan Old Style", serif; }
html:not(.js) .rd-plain, html:not(.js) .rd-plain-note { display: block; max-width: 38rem; margin: 0 auto; padding: 1rem 1.2rem; }
html:not(.js) body.reader { overflow: auto; height: auto; }
html:not(.js) #rd { display: none; }
html:not(.js) #source section { margin: 0 0 3rem; }
html:not(.js) #source section[data-kind="work"] > .r-h, html:not(.js) #source section[data-kind="work"] > .r-by { display: none; }
html:not(.js) #source .book-center { text-align: center; }
html:not(.js) #source img { max-width: 100%; height: auto; }
html:not(.js) #source a { color: var(--link); }
.rd-plain, .rd-plain-note { display: none; }
.rd-plain-title { font: 700 1.6rem/1.2 Georgia, serif; margin: .5rem 0 .2rem; }
.rd-plain a { color: var(--link); }

/* ---------- the reader shell ---------- */
.js body.reader { overflow: hidden; }
.rd { position: fixed; left: 0; top: 0; width: 100%; height: 100%; overflow: hidden; background: var(--bg); color: var(--fg);
      --ff: Georgia, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif; --fs: 19px; --mx: 24px;
      user-select: none; -webkit-user-select: none; }
.rd[data-font="sans"] { --ff: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
.rd-flow, .rd-flow * { user-select: text; -webkit-user-select: text; }
@media (min-width: 560px) { .rd { --mx: 44px; } .rd-stage { padding-top: calc(env(safe-area-inset-top, 0px) + 60px); } }
html[data-theme="dark"] { color-scheme: dark; }

.rd-stage { position: absolute; inset: 0; z-index: 1; outline: none; touch-action: pan-y; cursor: default;
            padding: calc(env(safe-area-inset-top, 0px) + 40px) calc(env(safe-area-inset-right, 0px) + var(--mx))
                     calc(env(safe-area-inset-bottom, 0px) + 56px) calc(env(safe-area-inset-left, 0px) + var(--mx)); }
.rd-view { position: absolute; overflow: hidden; }
.rd-flow { position: absolute; left: 0; top: 0; overflow: visible; will-change: transform;
           transition: transform .2s ease; column-fill: auto; font-family: var(--ff); font-size: var(--fs);
           line-height: 1.55; color: var(--fg); text-align: justify; hyphens: auto; -webkit-hyphens: auto;
           overflow-wrap: break-word; font-kerning: normal; }
.rd-flow.no-anim, .rd.measuring .rd-flow { transition: none !important; }
.rd.measuring .rd-top, .rd.measuring .rd-bottom, .rd.measuring .rd-edge, .rd.measuring .rd-scrim, .rd.measuring .rd-sheet { pointer-events: none !important; }
@media (prefers-reduced-motion: reduce) { .rd-flow, .rd-top, .rd-bottom, .rd-sheet, .rd-scrim { transition: none !important; } }

/* ---------- text inside a page ---------- */
.rd-flow > section { margin: 0; }
.rd-flow p { margin: 0; text-indent: 1.4em; orphans: 2; widows: 2; }
.rd-flow h2.r-h + *, .rd-flow .chapter-label + *, .rd-flow hr + p, .rd-flow blockquote p, .rd-flow li p,
.rd-flow .r-by + *, .rd-flow p:first-child { text-indent: 0; }
.rd-flow .prose-content > p:first-child, .rd-flow .prose-content > p:first-of-type { text-indent: 0; }
.rd-flow h2.r-h { margin: 0 0 .55em; font-size: 1.5em; line-height: 1.2; font-weight: 700; text-align: left; hyphens: none; -webkit-hyphens: none; break-after: avoid; }
.rd-flow h2.r-h::after { content: ""; display: block; width: 36px; height: 2px; margin: .75em 0 1em; background: var(--fg); opacity: .6; }
.rd-flow .chapter-label { margin: 0 0 .5em; font: 600 .62em/1.2 -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
                          letter-spacing: .14em; text-transform: uppercase; color: var(--muted); text-indent: 0; text-align: left; }
.rd-flow h2:not(.r-h), .rd-flow h3, .rd-flow h4 { margin: 1.4em 0 .5em; font-size: 1.15em; line-height: 1.25; text-align: left; hyphens: none; break-after: avoid; }
.rd-flow h2:not(.r-h) { border: 0; padding: 0; font-weight: 700; }
.rd-flow hr { border: 0; margin: 1.1em 0; text-align: center; height: auto; }
.rd-flow hr::after { content: "\2217\00a0\00a0\2217\00a0\00a0\2217"; color: var(--muted); letter-spacing: .1em; }
.rd-flow blockquote { margin: 1em 0 1em 1.1em; padding: 0 0 0 .9em; border-left: 2px solid var(--line); font-style: italic; }
.rd-flow ul, .rd-flow ol { margin: .8em 0; padding-left: 1.5em; }
.rd-flow li { margin: .2em 0; }
.rd-flow a { color: inherit; text-decoration: underline; text-underline-offset: .15em; text-decoration-thickness: 1px; }
.rd-flow img { display: block; max-width: 100%; max-height: calc(var(--ph, 600px) * .8); width: auto; height: auto; margin: 1em auto; object-fit: contain; break-inside: avoid; }
.rd-flow figure { margin: 1em 0; break-inside: avoid; }
.rd-flow figcaption { margin-top: .5em; font-size: .85em; font-style: italic; color: var(--muted); text-align: center; text-indent: 0; }
.rd-flow .footnote { margin-top: 1.4em; font-size: .85em; color: var(--muted); }
.rd-flow .footnote hr::after { content: ""; }
.rd-flow .footnote hr { border-top: 1px solid var(--line); margin: 0 0 .6em; width: 4em; }
.rd-flow .footnote p { text-indent: 0; }
.rd-flow sup { line-height: 0; }
.rd-flow .visually-hidden { display: none; }
.rd-flow mark.rd-hit { background: var(--hit); color: inherit; border-radius: 2px; padding: 0; }

/* Poems keep their lines and stanzas: left-aligned, never hyphenated */
.rd-flow .poem { text-align: left; hyphens: none; -webkit-hyphens: none; }
.rd-flow .poem p { text-indent: 0; margin: 0 0 1.15em; }
.rd-flow .poem p:last-child { margin-bottom: 0; }
.rd-flow .r-by { margin: -.2em 0 1.6em; font-size: .8em; color: var(--muted); text-align: left; text-indent: 0; letter-spacing: .02em; }

/* Title pages, epigraphs, plates: centered, and the script sets their top padding so they sit mid-page */
.rd-flow .book-center { text-align: center; margin: 0; hyphens: none; -webkit-hyphens: none; }
.rd-flow .book-center p { text-indent: 0; }
.rd-flow .book-center h2.r-h { text-align: center; }
.rd-flow .book-center h2.r-h::after { margin-left: auto; margin-right: auto; }
.rd-flow .book-title-page h2.r-h { font-size: 2.1em; margin-bottom: .4em; }
.rd-flow .book-title-page h2.r-h::after { display: block; margin: .9em auto 1.2em; }
.rd-flow .book-subtitle { font-style: italic; font-size: 1.05em; margin: 0 0 2em; }
.rd-flow .book-author { font-size: 1.1em; margin: 1.8em 0 2.4em; }
.rd-flow .book-publisher { font: 600 .62em/1.4 -apple-system, "Segoe UI", Roboto, Arial, sans-serif; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.rd-flow .book-small { font-size: .82em; line-height: 1.5; color: var(--muted); }
.rd-flow .book-small p { margin: 0 0 1em; }
.rd-flow .book-quote { font-style: italic; }
.rd-flow .book-quote p { margin: 0 0 1em; }
.rd-flow .book-plate .book-image { margin: 0; }
.rd-flow .book-plate img { max-height: calc(var(--ph, 600px) - 4em); margin: 0 auto; }
.rd-flow .book-back-cover { text-align: left; }
.rd-flow .book-back-title { font-size: 1.2em; font-weight: 700; margin: 0 0 1em; text-indent: 0; text-align: center; }
.rd-flow .bio p { text-indent: 0; margin: 0 0 .9em; }

/* ---------- toolbar (top) and progress (bottom) ---------- */
.rd-top { position: absolute; z-index: 5; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 2px;
          min-height: calc(56px + env(safe-area-inset-top, 0px)); padding: env(safe-area-inset-top, 0px) calc(env(safe-area-inset-right, 0px) + 6px) 0 calc(env(safe-area-inset-left, 0px) + 6px);
          background: var(--bar); border-bottom: 1px solid var(--line);
          transform: translateY(-101%); opacity: 0; pointer-events: none; transition: transform .18s ease, opacity .18s ease; }
.rd.ui .rd-top, .rd-top:focus-within { transform: none; opacity: 1; pointer-events: auto; }
.rd-btn { position: relative; flex: none; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px;
          padding: 0; border: 0; border-radius: 10px; background: transparent; color: var(--fg); cursor: pointer; text-decoration: none; }
.rd-btn:hover { background: color-mix(in srgb, var(--fg) 8%, transparent); }
.rd-btn:focus-visible, .rd-edge:focus-visible, .rd-seg button:focus-visible, .rd-list button:focus-visible, .rd-x:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.rd-btn svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.rd-btn .aa { font: 600 17px/1 Georgia, serif; letter-spacing: -.02em; }
.rd-btn .aa small { font-size: 12px; }
.rd-btn.on { color: var(--accent); }
.rd-btn.on svg { fill: currentColor; }
.rd-heading { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 0 4px; }
.rd-heading span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#rdTitle { font-size: 14px; font-weight: 600; }
#rdSub { font-size: 11.5px; color: var(--muted); min-height: 1.2em; }
.rd-btn[hidden] { display: none; }

.rd-bottom { position: absolute; z-index: 4; left: 0; right: 0; bottom: 0; padding: 0 calc(env(safe-area-inset-right, 0px) + var(--mx)) calc(env(safe-area-inset-bottom, 0px) + 12px) calc(env(safe-area-inset-left, 0px) + var(--mx));
             pointer-events: none; transition: background .18s ease; }
.rd.ui .rd-bottom { background: var(--bar); border-top: 1px solid var(--line); pointer-events: auto; padding-top: 6px; }
.rd-scrub { height: 0; opacity: 0; overflow: hidden; transition: height .18s ease, opacity .18s ease; }
.rd.ui .rd-scrub { height: 40px; opacity: 1; }
.rd-scrub input { width: 100%; height: 40px; margin: 0; background: transparent; accent-color: var(--fg); cursor: pointer; }
.rd-foot { display: flex; justify-content: space-between; gap: 1rem; font: 12px/1.6 -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--muted); font-variant-numeric: tabular-nums; }
.rd-foot span:nth-child(2) { visibility: hidden; }
.rd.ui .rd-foot span:nth-child(2) { visibility: visible; }
.rd-foot span:last-child { text-align: right; }

.rd-ribbon { position: absolute; z-index: 3; top: env(safe-area-inset-top, 0px); right: calc(env(safe-area-inset-right, 0px) + 14px); width: 20px; height: 38px;
             background: var(--accent); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%); transition: opacity .18s ease; }
.rd-ribbon[hidden] { display: none; }
.rd.ui .rd-ribbon { opacity: 0; }

/* Page-turn buttons for mouse users on wide screens */
.rd-edge { display: none; position: absolute; z-index: 2; top: 50%; width: 44px; height: 88px; margin-top: -44px; padding: 0; border: 0; border-radius: 10px;
           background: transparent; color: var(--muted); cursor: pointer; opacity: 0; transition: opacity .15s ease; }
.rd-edge svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.rd-edge-prev { left: 8px; } .rd-edge-next { right: 8px; }
@media (hover: hover) and (min-width: 820px) {
  .rd-edge { display: flex; align-items: center; justify-content: center; }
  .rd-stage:hover .rd-edge, .rd-edge:focus-visible { opacity: .75; }
  .rd-edge:hover { opacity: 1 !important; background: color-mix(in srgb, var(--fg) 7%, transparent); }
  .rd-edge[disabled] { visibility: hidden; }
}

/* ---------- sheets: display, contents, search ---------- */
.rd-scrim { position: absolute; inset: 0; z-index: 8; background: var(--scrim); opacity: 0; visibility: hidden; transition: opacity .18s ease, visibility .18s; }
.rd-scrim.on { opacity: 1; visibility: visible; }
.rd-scrim.clear { background: transparent; }
.rd-sheet { position: absolute; z-index: 9; left: 0; right: 0; bottom: 0; margin: 0 auto; width: 100%; max-width: 560px; max-height: 82%;
            display: flex; flex-direction: column; background: var(--sheet); color: var(--fg); border: 1px solid var(--line); border-bottom: 0;
            border-radius: 16px 16px 0 0; box-shadow: 0 -8px 30px rgba(0,0,0,.25);
            padding-bottom: env(safe-area-inset-bottom, 0px); transform: translateY(104%); visibility: hidden;
            transition: transform .22s ease, visibility .22s; }
.rd-sheet.on { transform: none; visibility: visible; }
.rd-sheet header { flex: none; display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 4px 20px; }
.rd-sheet h2 { margin: 0; font-size: 17px; font-weight: 700; }
.rd-x { width: 44px; height: 44px; border: 0; border-radius: 10px; background: transparent; font-size: 26px; line-height: 1; cursor: pointer; color: var(--muted); }
.rd-x:hover { color: var(--fg); }
.rd-body { flex: 1 1 auto; overflow-y: auto; padding: 4px 20px 22px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.rd-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); }
.rd-row:first-child { border-top: 0; }
.rd-lbl { font-size: 14px; color: var(--muted); }
.rd-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.rd-seg button { min-width: 48px; height: 44px; padding: 0 12px; border: 0; border-left: 1px solid var(--line); background: transparent; cursor: pointer; font-size: 14px; }
.rd-seg button:first-child { border-left: 0; }
.rd-seg button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }
.rd-seg .sw { width: 54px; font-size: 13px; }
.rd-seg [data-theme="white"] { background: #fff; color: #1a1a1a; }
.rd-seg [data-theme="paper"] { background: #f6efdc; color: #3b3226; }
.rd-seg [data-theme="dark"] { background: #000; color: #e4e4e4; }
.rd-seg .sw[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: -2px; }
.rd-seg [data-font="serif"] { font-family: Georgia, serif; } .rd-seg [data-font="sans"] { font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }

.rd-list { list-style: none; margin: 0; padding: 0; }
.rd-list li { display: flex; align-items: stretch; }
.rd-list button.go { flex: 1 1 auto; min-width: 0; display: flex; align-items: baseline; gap: .7em; text-align: left; padding: 11px 4px; border: 0; border-bottom: 1px solid var(--line);
                     background: transparent; cursor: pointer; font-size: 15.5px; line-height: 1.35; }
.rd-list button.go:hover { background: color-mix(in srgb, var(--fg) 6%, transparent); }
.rd-list .num { flex: none; min-width: 1.7em; color: var(--muted); font-variant-numeric: tabular-nums; }
.rd-list .cur { font-weight: 700; }
.rd-list .del { flex: none; width: 44px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 20px; cursor: pointer; }
.rd-group { margin: 18px 0 4px; font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.rd-sub { font-size: 13px; color: var(--muted); }
.rd-empty { margin: 14px 0; font-size: 14px; color: var(--muted); }
.rd-find { position: sticky; top: 0; z-index: 1; padding: 6px 0 10px; background: var(--sheet); }
.rd-find input { width: 100%; height: 46px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--fg); font-size: 16px; }
.rd-find input:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.rd-hit-part { margin: 16px 0 2px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.rd-hit-row { display: block; width: 100%; text-align: left; padding: 9px 4px; border: 0; border-bottom: 1px solid var(--line); background: transparent; cursor: pointer; font-size: 14.5px; line-height: 1.4; }
.rd-hit-row:hover { background: color-mix(in srgb, var(--fg) 6%, transparent); }
.rd-hit-row mark { background: var(--hit); color: inherit; border-radius: 2px; }
.rd[inert-sheet] .rd-stage { pointer-events: none; }
