/* The ALB Library — hub, shelves, and the reader page */

.lib{max-width:56rem;margin:0 auto;padding:0 1rem}
.lib h1{margin-bottom:.2rem}
.lib-logo{display:block;max-width:16rem;width:100%;height:auto}
.lib-tag{color:#72777d;margin-top:0}
.lib-crumbs{font-size:.85rem;color:#54595d;margin:.4rem 0 1rem}
.lib-crumbs a{color:#3366cc}

/* hub — shelf cards */
.shelf-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(15rem,1fr));gap:1rem;margin:1rem 0 2rem}
.shelf-card{display:block;border:1px solid #c8ccd1;border-radius:8px;background:#f8f9fa;padding:1rem;text-decoration:none;color:inherit;transition:box-shadow .15s,border-color .15s}
.shelf-card:hover{border-color:#3366cc;box-shadow:0 2px 8px rgba(51,102,204,.18);text-decoration:none}
.shelf-card img{display:block;margin:0 auto .6rem}
.sc-name{display:block;font-weight:bold;font-size:1.05rem;color:#202122;text-align:center}
.sc-count{display:block;font-size:.82rem;color:#72777d;text-align:center;margin-top:.1rem}
.sc-blurb{display:block;font-size:.85rem;color:#54595d;margin-top:.55rem;line-height:1.45}

/* formats explainer */
.lib-formats{display:grid;grid-template-columns:repeat(auto-fit,minmax(13rem,1fr));gap:.9rem;margin:1.2rem 0}
.fmt{border:1px solid #c8ccd1;border-radius:6px;background:#f8f9fa;padding:.8rem 1rem}
.fmt h3{margin:0 0 .35rem;font-size:.95rem}
.fmt p{margin:0;font-size:.87rem;color:#54595d}
.lib-note{background:#f4f9ff;border:1px solid #9cc4e4;border-radius:8px;padding:.7rem 1rem;margin:1.5rem 0}

/* category page */
.cat-head{display:flex;gap:1rem;align-items:flex-start;margin:.5rem 0 .75rem}
.cat-emblem{flex:0 0 auto;margin-top:.3rem}
.lib-tools{display:flex;gap:.6rem;align-items:center;margin:.6rem 0;flex-wrap:wrap}
#shelf-filter{flex:1 1 11rem;min-width:9rem;max-width:26rem;padding:.45rem .7rem;font-size:.95rem;border:1px solid #a2a9b1;border-radius:6px}
.lib-count{font-size:.82rem;color:#72777d}
.shelf-wrap{overflow-x:auto}

/* the shelf table */
.shelf{border-collapse:collapse;width:100%;margin:1rem 0 2rem}
.shelf th,.shelf td{text-align:left;padding:.4rem .6rem;border-bottom:1px solid #eaecf0;font-size:.93rem;vertical-align:top}
.shelf th{color:#54595d;font-weight:normal;text-transform:uppercase;font-size:.78rem;letter-spacing:.05em}
.shelf th.sortable{cursor:pointer;user-select:none;white-space:nowrap}
.shelf th.sortable:hover{color:#3366cc}
.shelf th.sortable::after{content:" ⇅";font-size:.7rem;opacity:.5}
.shelf th.sortable.asc::after{content:" ↑";opacity:1;color:#3366cc}
.shelf th.sortable.desc::after{content:" ↓";opacity:1;color:#3366cc}
.shelf td.lt a{color:#3366cc}
.shelf td.ls,.shelf td.lp{white-space:nowrap;color:#72777d;font-size:.85rem}
.shelf td.ld{white-space:nowrap;color:#72777d;font-size:.85rem}
.pgnum{font-variant-numeric:tabular-nums}
tr.hidden{display:none}

/* reader page */
body[data-page="library-reader"] .lib{max-width:46rem}
.reader-head{display:flex;gap:1.3rem;align-items:flex-start;border-bottom:1px solid #c8ccd1;padding-bottom:.8rem;margin-bottom:1.2rem}
.bk-cover{flex:0 0 auto;filter:drop-shadow(2px 3px 6px rgba(0,0,0,.25))}
.reader-meta{min-width:0}
.reader-head h1{font-size:1.6rem;line-height:1.25}
.reader-byline{color:#54595d;font-size:.92rem;margin:.2rem 0 .2rem}
.reader-stats{color:#72777d;font-size:.82rem;margin:0 0 .6rem}
.reader-tools{margin:0;display:flex;gap:1.2rem;font-size:.88rem}
.rtool{color:#3366cc;text-decoration:none}
.rtool:hover{text-decoration:underline}
.reader-text{font-family:ui-monospace,"Cascadia Mono","Courier New",monospace;font-size:var(--lr-size,.92rem);line-height:1.55;white-space:pre-wrap;word-break:break-word;color:var(--lr-ink,#202122);background:var(--lr-paper,#fdfdfb);border:1px solid var(--lr-edge,#eaecf0);border-radius:6px;padding:1.4rem 1.6rem}
.reader-text::selection{background:#dbe8fd}
.reader-text .ch{scroll-margin-top:4.5rem}

/* reading toolbar — sticky so it travels with the book */
.reader-bar{position:sticky;top:0;z-index:40;display:flex;flex-wrap:wrap;gap:.4rem;align-items:center;background:var(--lr-paper,#fff);border:1px solid #d0d3d8;border-radius:8px;padding:.45rem .6rem;margin:.6rem 0 .8rem;box-shadow:0 1px 4px rgba(0,0,0,.06)}
.reader-bar button{font:inherit;font-size:.82rem;padding:.3rem .55rem;border:1px solid #a2a9b1;border-radius:5px;background:#f8f9fa;color:#202122;cursor:pointer}
.reader-bar button:hover{border-color:#3366cc;color:#3366cc}
#libfind{flex:1;min-width:8rem;max-width:16rem;padding:.32rem .55rem;font-size:.85rem;border:1px solid #a2a9b1;border-radius:5px}
#libfind-count{font-size:.78rem;color:#72777d;white-space:nowrap}

/* top reading-progress bar */
#libprog{position:fixed;top:0;left:0;right:0;height:3px;z-index:90;background:transparent;pointer-events:none}
#libprog-fill{height:100%;width:0;background:#3366cc;transition:width .12s linear}

/* contents panel */
#libtoc{position:fixed;top:0;left:0;bottom:0;width:min(21rem,88vw);z-index:80;background:#fff;border-right:1px solid #d0d3d8;box-shadow:4px 0 18px rgba(0,0,0,.15);overflow-y:auto;padding:0}
.lt-head{position:sticky;top:0;background:#fff;display:flex;align-items:center;gap:.5rem;font-size:.95rem;font-weight:bold;padding:.8rem 1rem;border-bottom:1px solid #eaecf0}
.lt-n{font-weight:normal;font-size:.78rem;color:#72777d}
.lt-x{margin-left:auto;border:none;background:none;font-size:1.2rem;cursor:pointer;color:#54595d;line-height:1}
.lt-list{list-style:none;margin:0;padding:.4rem 0 .8rem}
.lt-list a{display:block;padding:.34rem 1rem;font-size:.88rem;color:#202122;text-decoration:none;line-height:1.35}
.lt-list a:hover{background:#f4f9ff;color:#3366cc}

/* in-book search results */
#libfind-list{position:absolute;z-index:60;max-width:min(30rem,92vw);max-height:22rem;overflow-y:auto;background:#fff;border:1px solid #d0d3d8;border-radius:8px;box-shadow:0 6px 22px rgba(0,0,0,.18);padding:.3rem}
.reader-bar{position:sticky}
.lf-item{display:block;width:100%;text-align:left;border:none;background:none;padding:.4rem .55rem;font-size:.82rem;color:#202122;cursor:pointer;border-radius:5px;line-height:1.35}
.lf-item:hover,.lf-item.on{background:#f4f9ff}
.lf-item.on{outline:1px solid #9cc4e4}
.lf-more{padding:.4rem .55rem;font-size:.78rem;color:#72777d}
mark.libhit{background:#ffd76e;color:inherit;padding:0 .1em;border-radius:2px}

/* book furniture */
.illus-note{display:block;margin:.7em 0;padding:.35rem .7rem;border-left:3px solid #9cc4e4;background:#f4f9ff;font-family:Georgia,serif;font-size:.85em;font-style:italic;color:#4a5568;white-space:normal}
a.fnref{color:#3366cc;text-decoration:none;font-size:.8em;vertical-align:super;line-height:1}
a.fnref:hover{text-decoration:underline}
.fndef{scroll-margin-top:6rem}
.fndef.fn-flash{outline:2px solid #3366cc;border-radius:3px}
.chunk{display:block}
.cb-pend{display:block}
body.lr-th-dark .illus-note{background:#1b2531;border-color:#3a5a80;color:#a9bdd1}

@media (max-width:36rem){
  .reader-head{flex-direction:column}
  .bk-cover{align-self:center}
}

/* resume chip */
#libresume{position:fixed;bottom:1.2rem;left:50%;transform:translateX(-50%);z-index:70;background:#202122;color:#fff;font-size:.85rem;padding:.45rem .9rem;border-radius:999px;text-decoration:none;box-shadow:0 3px 14px rgba(0,0,0,.3);cursor:pointer}
#libresume:hover{background:#3366cc}

/* typefaces */
body.lr-serif .reader-text{font-family:Charter,"Bitstream Charter",Georgia,"Times New Roman",serif;line-height:1.65}
body.lr-sans .reader-text{font-family:"Segoe UI",system-ui,-apple-system,sans-serif;line-height:1.6}

/* themes */
body.lr-th-sepia{--lr-paper:#f6f0e3;--lr-ink:#3a3125;--lr-edge:#ded3bd}
body.lr-th-sepia .reader-bar{background:#f2ecdd;border-color:#ded3bd}
body.lr-th-dark{--lr-paper:#16181d;--lr-ink:#d6d9df;--lr-edge:#2e3239}
body.lr-th-dark .reader-bar{background:#1b1e24;border-color:#2e3239}
body.lr-th-dark .reader-bar button{background:#23262d;color:#d6d9df;border-color:#3a3f47}
body.lr-th-dark #libfind{background:#23262d;color:#d6d9df;border-color:#3a3f47}
body.lr-th-dark #libfind-list{background:#1b1e24;border-color:#2e3239}
body.lr-th-dark .lf-item{color:#d6d9df}
body.lr-th-dark .lf-item:hover,.lr-th-dark .lf-item.on{background:#232b3a}
body.lr-th-dark .reader-text::selection{background:#3a4a66}
body.lr-th-dark #libtoc{background:#1b1e24;border-color:#2e3239}
body.lr-th-dark .lt-head{background:#1b1e24;color:#d6d9df;border-color:#2e3239}
body.lr-th-dark .lt-list a{color:#d6d9df}
body.lr-th-dark .lt-list a:hover{background:#232b3a}
body.lr-th-dark mark.libhit{background:#8a6d1f}

/* zen mode — strip the chrome, keep the text */
body.lr-zen #header,body.lr-zen #footer,body.lr-zen .skipnav,
body.lr-zen .lib-crumbs,body.lr-zen .reader-head,body.lr-zen .reader-bar{display:none}
body.lr-zen #libprog{position:fixed;display:block}
body.lr-zen .lib{max-width:48rem}
body.lr-zen::after{content:"esc to exit zen";position:fixed;bottom:.7rem;right:.9rem;font-size:.7rem;color:#a2a9b1;pointer-events:none}

@media (max-width:40rem){
  .cat-head img{width:64px;height:64px}
  .shelf td.ld,.shelf .th-ld{display:none}
  .shelf td.ll,.shelf .th-ll{display:none}
  .shelf td.lp,.shelf .th-lp{display:none}
  .view-ctl button{padding:.3rem .55rem;font-size:.9rem}
  .lib-tools select#shelf-group{max-width:100%;flex:1 1 9rem}
}
@media print{
  #header,#footer,.skipnav,.reader-tools,.lib-crumbs,.lib-tools{display:none}
  .reader-text{border:none;padding:0;font-size:10pt}
}

/* ---- braille edition ---- */
.brl-head h1 .brl-tag{font-size:.55em;font-weight:600;color:#3366cc;vertical-align:middle;letter-spacing:.05em}
.brl-note{max-width:56rem;color:#54595d}
.brl-note a{color:#3366cc}
.brl-stats{color:#6b7280;font-size:.85rem;margin:.4rem 0 .8rem}
.brl-foot{color:#6b7280;font-size:.85rem;max-width:56rem}
.brl-page{border:1px solid #ded3bd;border-radius:6px;background:#fdfcf7;padding:1rem 1.2rem;box-shadow:0 1px 3px rgba(0,0,0,.06);max-width:64rem;overflow-x:auto}
.brl-lines{font-family:"Segoe UI Symbol","Noto Sans Braille",monospace;font-size:22px;line-height:1.9;letter-spacing:.12em;white-space:pre;margin:0;color:#202122}
@media print{.brl-foot,.reader-tools{display:none}}

/* braille pager */
.brl-pager{display:flex;align-items:center;gap:1rem;margin:.6rem 0;flex-wrap:wrap}
.brl-pager .rtool{min-width:7rem;text-align:center}
.brl-jump{display:flex;align-items:center;gap:.5rem;font-size:.9rem;color:#54595d}
.brl-jump input{width:5rem;padding:.15rem .3rem;border:1px solid #c8ccd1;border-radius:3px;font:inherit}
.brl-jump button{padding:.15rem .7rem;border:1px solid #c8ccd1;border-radius:3px;background:#f8f9fa;cursor:pointer;font:inherit}
.brl-jump button:hover{background:#fff}

/* ---- shelf tools: group filter + view toggle ---- */
.lib-tools select#shelf-group{padding:.3rem .5rem;border:1px solid #c8ccd1;border-radius:4px;background:#f8f9fa;font:inherit;max-width:16rem}
.lib-tools #shelf-view{padding:.3rem .8rem;border:1px solid #c8ccd1;border-radius:4px;background:#f8f9fa;cursor:pointer;font:inherit}
.lib-tools #shelf-view:hover{background:#fff}
.shelf td.lg,.shelf td.ll{font-size:.85rem;color:#54595d;white-space:nowrap}
tr.hidden{display:none}

/* ---- spine view: thumbnail bookshelf ---- */
#spine-view[hidden],#cover-view[hidden]{display:none}
#spine-view{display:flex;flex-wrap:wrap;align-items:flex-end;gap:2px 3px;padding:1rem .4rem;border-top:3px solid #8b6f4e}
.spine{position:relative;display:inline-flex;align-items:center;justify-content:center;width:34px;min-height:40px;background:hsl(var(--h) 32% 32%);border-radius:2px 2px 0 0;box-shadow:inset 2px 0 3px rgba(255,255,255,.25),inset -2px 0 3px rgba(0,0,0,.3);text-decoration:none;overflow:hidden;transition:transform .08s}
.spine:hover{transform:translateY(-4px)}
.spine.hidden{display:none}
.spine .sp-title{writing-mode:vertical-rl;transform:rotate(180deg);font-size:.6rem;line-height:1;color:#f4f0e6;max-height:90%;overflow:hidden;font-family:Georgia,serif;padding:3px 0}
.spine .sp-author{position:absolute;bottom:2px;left:0;right:0;text-align:center;font-size:.45rem;color:rgba(244,240,230,.75);overflow:hidden;white-space:nowrap;padding:0 2px}
.spine .sp-dot{position:absolute;top:3px;left:50%;transform:translateX(-50%);width:5px;height:5px;border-radius:50%;background:rgba(255,255,255,.55)}
#spine-view .hidden{display:none}

/* ---- view control: list / shelf / covers ---- */
.view-ctl{display:inline-flex;border:1px solid #c8ccd1;border-radius:4px;overflow:hidden}
.view-ctl button{padding:.3rem .8rem;border:0;background:#f8f9fa;cursor:pointer;font:inherit;color:#54595d}
.view-ctl button + button{border-left:1px solid #c8ccd1}
.view-ctl button:hover{background:#fff}
.view-ctl button.on{background:#3366cc;color:#fff}

/* ---- cover view: front-facing cloth boards ---- */
#cover-view{display:flex;flex-wrap:wrap;gap:.9rem .8rem;padding:1.2rem .3rem;align-items:flex-end}
.cover{position:relative;display:block;width:104px;height:150px;box-sizing:border-box;
  padding:12px 9px 8px;border-radius:2px 4px 4px 2px;
  background:hsl(var(--h) 30% 30%);
  background-image:linear-gradient(90deg,rgba(0,0,0,.28) 0,rgba(0,0,0,0) 9px),
    linear-gradient(135deg,rgba(255,255,255,.07),rgba(0,0,0,.12));
  box-shadow:2px 3px 6px rgba(0,0,0,.28),inset 0 0 30px rgba(0,0,0,.12);
  text-decoration:none;color:#f4f0e6;transition:transform .08s}
.cover:hover{transform:translateY(-4px) scale(1.02)}
.cover.hidden{display:none}
.cv-title{display:block;font-family:Georgia,serif;font-size:.7rem;line-height:1.3;
  max-height:5.5em;overflow:hidden;color:#f3ead7}
.cv-rule{display:block;height:1px;background:#c9a959;margin:.45em 6% .5em 6%}
.cv-author{position:absolute;bottom:20px;left:9px;right:9px;font-size:.55rem;
  color:#d8cfae;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
.cv-mark{position:absolute;bottom:4px;left:0;right:0;text-align:center;
  font-size:.42rem;letter-spacing:.18em;color:rgba(216,207,174,.55)}
.cv-dot{position:absolute;top:5px;right:5px;width:6px;height:6px;border-radius:50%;
  background:rgba(255,255,255,.55)}
@media (max-width:40rem){
  .cover{width:88px;height:128px}
  .cv-title{font-size:.62rem}
}
