.bib-reader{--bib-bg:#fff;--bib-ink:#292621;--bib-muted:#706b63;--bib-border:#e5e0d8;--bib-font-size:18px;background:var(--bib-bg);color:var(--bib-ink);min-height:80vh}.bib-reader[data-theme=sepia]{--bib-bg:#f7efdf;--bib-ink:#433b2f;--bib-border:#d9ccb7}.bib-reader[data-theme=dark]{--bib-bg:#1d2127;--bib-ink:#e8e5df;--bib-muted:#b2ada4;--bib-border:#40454c}.bib-toolbar{position:sticky;top:0;z-index:30;background:var(--bib-bg);border-bottom:1px solid var(--bib-border);display:flex;align-items:center;gap:16px;padding:12px 24px;font:14px system-ui}.bib-toolbar-title{flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.bib-toolbar button,.bib-toolbar select,.bib-chapters button{background:var(--bib-bg);color:var(--bib-ink);border:1px solid var(--bib-border);border-radius:8px;min-height:44px;padding:8px 12px}.bib-reader a{color:inherit}.bib-layout{display:grid;grid-template-columns:270px minmax(0,1fr);max-width:1500px;margin:auto}.bib-chapters{position:sticky;top:74px;align-self:start;height:calc(100dvh - 90px);overflow:auto;padding:24px;border-right:1px solid var(--bib-border);font:15px/1.5 system-ui}.bib-chapters-heading{display:flex;justify-content:space-between;align-items:center}.bib-chapters-heading button{display:none}.bib-chapters ol{list-style:none;padding:0;margin-top:20px}.bib-chapters a{display:block;padding:12px 10px;text-decoration:none;border-radius:6px;overflow-wrap:anywhere}.bib-chapters a[aria-current]{background:var(--bib-border);font-weight:650}.bib-reading{min-width:0;width:100%;max-width:820px;margin:auto;padding:40px 48px 80px}.bib-book-heading{border-bottom:1px solid var(--bib-border);padding-bottom:24px;margin-bottom:36px}.bib-book-heading>p{color:var(--bib-muted);font:14px system-ui}.bib-book-heading h1{font:600 clamp(26px,4vw,40px)/1.2 Georgia,serif}.bib-prose{font:var(--bib-font-size)/1.85 Georgia,serif;overflow-wrap:anywhere}.bib-prose p{margin:0 0 1.25em}.bib-prose h1,.bib-prose h2,.bib-prose h3{line-height:1.3;margin:1.5em 0 .8em}.bib-prose h1{font-size:1.65em}.bib-prose h2{font-size:1.35em}.bib-prose h3{font-size:1.15em}.bib-prose blockquote{border-left:3px solid var(--bib-border);padding-left:1.2em;margin:1.5em 0}.bib-prose img{max-width:100%;height:auto}.bib-prose figure{margin:2em 0}.bib-prose figcaption{font:14px/1.6 system-ui;color:var(--bib-muted);margin-top:12px}.bib-prose .book-reader-snippet-order{display:none}.bib-prose .publication-separator{text-align:center;margin:2em 0;letter-spacing:.4em}.bib-prose .book-reader-image-hint{display:block;font:12px system-ui;color:var(--bib-muted)}.bib-pagination{display:flex;justify-content:space-between;gap:16px;margin-top:48px;font:15px system-ui}.bib-pagination a{padding:12px}.bib-reader.chapters-hidden .bib-layout{grid-template-columns:1fr}.bib-reader.chapters-hidden .bib-chapters{display:none}.bib-backdrop[hidden]{display:none}.bib-reader :focus-visible{outline:3px solid #b88a32;outline-offset:3px}
@media(max-width:800px){.bib-toolbar{padding:8px 12px;gap:8px;flex-wrap:wrap}.bib-toolbar-title{display:none}.bib-toolbar>a{flex:1}.bib-size-label{font-size:0}.bib-size-label select{font-size:14px}.bib-toolbar select{max-width:110px;padding:6px}.bib-layout{display:block}.bib-reading{padding:24px 20px 50px}.bib-chapters,.bib-reader.chapters-hidden .bib-chapters{display:block;position:fixed;top:0;left:0;bottom:0;height:100dvh;width:min(85vw,320px);z-index:102;background:var(--bib-bg);transform:translateX(-105%);transition:transform .18s}.bib-reader.chapters-open .bib-chapters{transform:translateX(0)}.bib-chapters-heading button{display:block}.bib-backdrop{position:fixed;inset:0;background:#0008;border:0;z-index:101}.bib-prose{line-height:1.75}.bib-book-heading{margin-bottom:24px}}
@media(prefers-reduced-motion:reduce){.bib-chapters{transition:none}}
/* The reader owns its sticky controls; the site's header scrolls away. */
body:has(.bib-reader)>.navbar{position:static}.bib-reading{margin:0 auto}.bib-chapters{scrollbar-gutter:stable}
@media(max-width:800px){.bib-chapters,.bib-reader.chapters-hidden .bib-chapters{z-index:1041}.bib-backdrop{z-index:1040}}
@media(max-width:800px){#bib-menu{min-width:44px}#bib-menu span{display:none}.bib-toolbar select{max-width:100px}}

/* Keep the reader controls compact and grouped while preserving the shared layout. */
.bib-toolbar{background:color-mix(in srgb,var(--bib-bg) 94%,transparent);backdrop-filter:blur(12px);justify-content:space-between;padding:9px 24px}
.bib-toolbar-main,.bib-toolbar-tools{display:flex;align-items:center;gap:8px;min-width:0}
.bib-toolbar-main{flex:1}.bib-toolbar-tools{flex-shrink:0}.bib-toolbar-library{font-weight:650;text-decoration:none}.bib-toolbar-title{color:var(--bib-muted)}
.bib-control{display:flex;align-items:center;gap:6px;color:var(--bib-muted);font-size:12px}.bib-toolbar select{font-size:13px}.bib-toolbar button,.bib-toolbar select{min-height:38px;padding:6px 10px}.bib-toolbar button:hover,.bib-toolbar select:hover{border-color:var(--bib-muted)}
.reader-highlights-tab{white-space:nowrap}.reader-highlights-heading{display:flex;align-items:center;justify-content:space-between;gap:1rem}.reader-highlights-heading h2{margin:0 0 .4rem}.reader-highlights-heading>button{border:0;font-size:1.25rem;line-height:1;padding:.2rem .35rem}.site-footer--reader-compact .container{font-size:.84rem}.site-footer--reader-compact{margin-top:0}
@media(max-width:800px){.bib-toolbar{padding:8px 12px}.bib-toolbar-main,.bib-toolbar-tools{width:100%}.bib-toolbar-library{margin-right:auto}.bib-toolbar-tools{justify-content:flex-end}.bib-control{font-size:0}.bib-control select{font-size:13px}.bib-toolbar-title{display:none}}

.bib-reader{--bib-font-family:Georgia,serif;--bib-line-height:1.85;--bib-reading-width:820px}
.bib-reading{max-width:var(--bib-reading-width)}
.bib-prose{font-family:var(--bib-font-family);line-height:var(--bib-line-height)}
.bib-settings-wrap{position:relative}.bib-settings-panel{position:absolute;right:0;top:calc(100% + 9px);z-index:50;width:250px;padding:16px;border:1px solid var(--bib-border);border-radius:12px;background:var(--bib-bg);box-shadow:0 14px 40px #0002;color:var(--bib-ink)}
.bib-settings-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px;font-size:13px}.bib-settings-heading button{border:0!important;font-size:20px!important;line-height:1;padding:0 4px!important}
.bib-settings-panel label{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:10px;color:var(--bib-muted);font-size:12px}.bib-settings-panel select{min-height:34px;max-width:132px;color:var(--bib-ink)}
.bib-toolbar-progress{flex:none;color:var(--bib-muted);font-size:11px;font-variant-numeric:tabular-nums}
.bib-reader .reader-highlights{position:fixed;z-index:40;right:24px;top:68px;width:min(420px,calc(100vw - 48px));max-height:calc(100dvh - 92px);overflow:auto;margin:0;box-shadow:0 16px 48px #0003}
@media(max-width:800px){.bib-settings-panel{position:fixed;right:12px;top:96px;width:min(280px,calc(100vw - 24px))}.bib-toolbar-progress{display:none}.bib-toolbar-tools{overflow-x:auto}.bib-settings-wrap #bib-settings span{display:none}.bib-reader .reader-highlights{right:12px;top:112px;width:calc(100vw - 24px);max-height:calc(100dvh - 128px)}}

/* Reader patterns borrowed from modern open-source reading systems: search, focus, and a persistent progress scrubber. */
.bib-search-panel{position:sticky;top:57px;z-index:29;padding:10px 24px;border-bottom:1px solid var(--bib-border);background:color-mix(in srgb,var(--bib-bg) 96%,transparent);backdrop-filter:blur(12px)}
.bib-search-panel form{display:flex;align-items:center;gap:8px;max-width:960px;margin:0 auto}.bib-search-panel label{font-size:12px;color:var(--bib-muted);white-space:nowrap}.bib-search-panel input[type=search]{min-width:220px;flex:1;min-height:38px;border:1px solid var(--bib-border);border-radius:8px;padding:7px 10px;background:var(--bib-bg);color:var(--bib-ink)}.bib-search-panel button{min-height:38px;border:1px solid var(--bib-border);border-radius:8px;padding:6px 10px;background:var(--bib-bg);color:var(--bib-ink)}.bib-search-panel button:hover{border-color:var(--bib-muted)}.bib-search-status{min-width:78px;color:var(--bib-muted);font-size:12px}.bib-search-close{font-size:20px;line-height:1}
.bib-chapter-filter{display:block;margin-top:16px}.bib-chapter-filter input{box-sizing:border-box;width:100%;min-height:36px;border:1px solid var(--bib-border);border-radius:8px;padding:7px 9px;background:var(--bib-bg);color:var(--bib-ink);font:13px system-ui}.bib-chapter-filter input::placeholder{color:var(--bib-muted)}
.bib-progress-scrubber{position:fixed;right:24px;bottom:20px;z-index:25;display:flex;align-items:center;gap:8px;padding:8px 10px;border:1px solid var(--bib-border);border-radius:999px;background:color-mix(in srgb,var(--bib-bg) 94%,transparent);box-shadow:0 8px 24px #0002;backdrop-filter:blur(10px);font:11px system-ui;color:var(--bib-muted)}.bib-progress-scrubber input{width:130px;accent-color:#9a722d}
.bib-focus-mode .bib-chapters{display:none}.bib-focus-mode .bib-layout{display:block}.bib-focus-mode .bib-reading{max-width:min(820px,calc(100% - 40px))}.bib-focus-mode .bib-toolbar-tools>*:not(#bib-search):not(#bib-bookmark):not(#bib-focus){display:none}.bib-focus-mode .bib-toolbar{opacity:.35;transition:opacity .2s}.bib-focus-mode .bib-toolbar:hover,.bib-focus-mode .bib-toolbar:focus-within{opacity:1}
@media(max-width:800px){.bib-search-panel{top:104px;padding:10px 12px}.bib-search-panel form{flex-wrap:wrap}.bib-search-panel label{width:100%}.bib-search-panel input[type=search]{min-width:0;width:calc(100% - 80px)}.bib-search-status{flex:1}.bib-progress-scrubber{right:12px;bottom:12px}.bib-progress-scrubber input{width:90px}.bib-focus-mode .bib-reading{max-width:none}}

/* Long-form reading: measured progress, complete-book search, and touch controls. */
.bib-reader{--bib-bg:#faf8f2;--bib-ink:#263c36;--bib-muted:#6b7269;--bib-border:#deded3;--bib-font-size:21px;--bib-line-height:1.85}
.bib-reader [hidden]{display:none!important}.bib-toolbar button,.bib-toolbar select,.bib-chapter-filter input,.bib-search-panel button{min-height:44px}.bib-toolbar-progress{white-space:nowrap}.bib-book-heading h1{font-weight:400;letter-spacing:-.025em}.bib-book-heading{margin-bottom:24px}.bib-chapter-context{font:12px/1.8 Inter,system-ui,sans-serif;color:var(--bib-muted);margin:0 0 30px}.bib-chapter-context span{padding:0 8px}.bib-prose [id]{scroll-margin-top:180px}.bib-prose :target{outline:2px solid #b88a3270;outline-offset:8px;border-radius:2px}.bib-prose table{display:block;max-width:100%;overflow:auto}.bib-prose pre{white-space:pre-wrap}.bib-search-panel{top:62px}.bib-search-results{max-width:960px;margin:14px auto 0;max-height:35dvh;overflow:auto}.bib-search-results>p{font-size:12px;color:var(--bib-muted)}.bib-search-results ol{list-style:none;padding:0;margin:0}.bib-search-results a{display:block;padding:12px;border-top:1px solid var(--bib-border);text-decoration:none}.bib-search-results strong,.bib-search-results span{display:block;font:13px/1.65 system-ui}.bib-search-results strong{font-weight:650;margin-bottom:4px}.bib-search-results span{color:var(--bib-muted)}.bib-saved-bookmark{font-size:12px;border:1px solid var(--bib-border);margin-top:16px}.bib-filter-empty{font-size:12px;margin-top:20px;color:var(--bib-muted)}.bib-progress-scrubber{bottom:calc(16px + env(safe-area-inset-bottom));min-height:44px}.bib-progress-scrubber input{min-height:28px}.bib-focus-mode .bib-toolbar{opacity:1}.bib-toolbar-tools{gap:6px}.bib-chapters{top:72px}.bib-reading{padding-bottom:100px}
@media(max-width:1100px) and (min-width:801px){.bib-toolbar{flex-wrap:wrap}.bib-toolbar-main,.bib-toolbar-tools{width:100%}.bib-toolbar-tools{justify-content:flex-end}.bib-chapters{top:116px;height:calc(100dvh - 128px)}.bib-search-panel{top:112px}}
@media(max-width:800px){.bib-toolbar{gap:4px;padding:6px 12px}.bib-toolbar-tools{overflow:visible;flex-wrap:wrap;justify-content:flex-start;gap:4px}.bib-toolbar-tools>button,.bib-toolbar-tools .bib-settings-wrap>button{font-size:11px;padding:6px 8px}.bib-toolbar-progress{display:inline;font-size:11px}.bib-toolbar-main{gap:10px}.bib-search-panel{top:108px}.bib-search-panel label{font-size:12px}.bib-settings-panel{top:118px;max-height:calc(100dvh - 140px);overflow:auto}.bib-reader .reader-highlights{top:120px;max-height:calc(100dvh - 140px)}.bib-prose{font-size:var(--bib-font-size)}.bib-reading{padding:30px 24px 100px}.bib-chapters{top:0}.bib-search-panel input[type=search]{font-size:16px}.bib-chapter-filter input{font-size:16px}.bib-prose [id]{scroll-margin-top:165px}.bib-focus-mode .bib-toolbar-tools{justify-content:flex-end}}
@media(max-width:370px){.bib-toolbar-tools #readerHighlight{display:none}.bib-toolbar-tools #bib-bookmark span{display:none}}
.bib-highlights-icon{display:none}.bib-toolbar button{min-width:44px}.bib-search-panel{top:var(--bib-toolbar-height,108px)}.bib-reader .reader-highlights{top:calc(var(--bib-toolbar-height,108px) + 12px)}
@media(max-width:800px){#bib-bookmark span,.bib-highlights-label{display:none}.bib-highlights-icon{display:inline}.bib-settings-panel{top:calc(var(--bib-toolbar-height,108px) + 12px)}}
