/* library.css - the Christian classics library (prefix lb-): shelves, book pages, the reader, search.
   Uses christian.css tokens. The reader follows the Bible reader: serif text, size steps, night mode. */

/* shelves and browse */
.lb-span { margin: -6px 0 10px; font-size: .9rem; }
.lb-cards .cx-card span { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.lb-browse { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 6px 24px; }
.lb-browse h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--cx-muted); margin: 6px 0 8px; }
.lb-browse .cx-chips a small { color: var(--cx-muted); font-size: .75rem; }
.lb-browse .cx-chips a.on small { color: #fff; }
.lb-resume { margin: 0 0 16px; padding: 10px 14px; border: 1px solid var(--cx-line); border-left: 3px solid var(--cx-gold); border-radius: var(--cx-radius); background: var(--cx-soft); }
.lb-resume[hidden] { display: none; }
.lb-resume b { display: block; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--cx-gold); margin-bottom: 4px; }
.lb-resume ul { list-style: none; margin: 0; padding: 0; }
.lb-resume li { padding: 3px 0; }
.lb-resume small { color: var(--cx-muted); margin-left: 6px; }

/* book page */
.lb-continue[hidden] { display: none; }
.lb-dl { grid-template-columns: max-content minmax(0, 1fr); }
.lb-dl dd { overflow-wrap: anywhere; }
.lb-dl .cx-chips { display: inline-flex; }
.lb-part { font-family: var(--cx-serif); font-size: 1.05rem; margin: 16px 0 6px; }
.lb-toc { list-style: none; padding: 0; margin: 0 0 8px; }
.lb-toc li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--cx-line); }
.lb-toc li a { text-decoration: none; min-width: 0; overflow-wrap: anywhere; }
.lb-toc li a[aria-current] { font-weight: 700; }
.lb-toc li small { color: var(--cx-muted); font-size: .78rem; white-space: nowrap; }
.lb-toc li.lb-here a { font-weight: 700; }
.lb-toc li.lb-here a::before { content: "\25B8 "; color: var(--cx-gold); }

/* the reader */
.lb-wrap { --lb-size: 1.12rem; --lb-bg: transparent; --lb-ink: var(--cx-ink); }
.lb-wrap.lb-night .lb-reader { background: #15130f; color: #e6dfd2; border-radius: var(--cx-radius); padding: 18px 16px; }
.lb-wrap.lb-night .lb-reader a { color: #d9b56e; }
.lb-wrap.lb-night .lb-reader .lb-notes, .lb-wrap.lb-night .lb-reader .lb-q { color: #b9b0a0; border-color: #3a3733; }
.lb-head { margin-bottom: 6px; }
.lb-kicker { margin: 0 0 4px; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--cx-gold); font-weight: 600; }
.lb-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0 16px; padding: 8px 0; border-bottom: 1px solid var(--cx-line); position: relative; }
.lb-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.lb-tools .cx-btn { padding: 5px 11px; }
.lb-tools .cx-btn[aria-pressed="true"] { background: var(--cx-accent); color: #fff; border-color: var(--cx-accent); }
.lb-pos { font-size: .82rem; margin-left: auto; }
.lb-pick > summary { list-style: none; cursor: pointer; padding: 5px 12px; border: 1px solid var(--cx-line); border-radius: 999px; background: var(--cx-card); font-size: .92rem; }
.lb-pick > summary::-webkit-details-marker { display: none; }
.lb-pick > summary::after { content: " \25BE"; color: var(--cx-muted); }
.lb-pick[open] > summary { border-color: var(--cx-accent); }
.lb-pop { position: absolute; left: 0; right: 0; top: 100%; z-index: 20; max-height: 70vh; overflow: auto; background: var(--cx-card); border: 1px solid var(--cx-line); border-radius: var(--cx-radius); padding: 10px 14px; box-shadow: 0 10px 28px rgba(0,0,0,.14); }
.lb-pop .lb-toc li { padding: 4px 0; }
.lb-reader { font-family: var(--cx-serif); font-size: var(--lb-size); line-height: 1.75; max-width: 70ch; padding: 4px 2px; overflow-wrap: break-word; }
.lb-reader p { margin: 0 0 .95em; }
.lb-reader .lb-h { font-family: var(--cx-serif); font-size: 1.08em; font-weight: 700; margin: 1.5em 0 .6em; line-height: 1.4; }
.lb-reader .lb-lines { margin: 0 0 1em 1.2em; font-size: .97em; }
.lb-reader .lb-q { margin: 0 0 1em; padding: 0 0 0 1em; border-left: 3px solid var(--cx-line); font-size: .96em; }
.lb-reader .lb-q p { margin: 0; }
.lb-reader a.lb-ref { color: inherit; text-decoration: underline; text-decoration-color: var(--cx-gold); text-underline-offset: 2px; }
.lb-reader a.lb-ref:hover { color: var(--cx-accent-ink); }
.lb-reader sup { font-family: system-ui, sans-serif; font-size: .62em; line-height: 0; }
.lb-reader .lb-vn { color: var(--cx-gold); font-weight: 700; margin-right: 2px; }
.lb-reader .lb-fn { color: var(--cx-muted); }
.lb-reader [id]:target, .lb-reader .lb-mark { background: rgba(176, 138, 62, .2); border-radius: 4px; }
.lb-notes { margin-top: 2em; padding-top: .6em; border-top: 1px solid var(--cx-line); font-family: system-ui, sans-serif; font-size: .82rem; line-height: 1.5; color: var(--cx-muted); }
.lb-notes .lb-h { font-size: .95rem !important; margin-top: 0 !important; }
.lb-notes ul { list-style: none; padding: 0; margin: 0; }
.lb-notes li { margin: 0 0 6px; }
.lb-edition { font-size: .82rem; color: var(--cx-muted); margin: 18px 0 0; max-width: 70ch; }
.lb-pager a { display: flex; flex-direction: column; max-width: 48%; min-width: 0; }
.lb-pager a span { font-size: .78rem; color: var(--cx-muted); }
.lb-pager a b { font-weight: 600; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-pager a[rel="next"], .lb-pager a:last-child { text-align: right; margin-left: auto; }

/* search */
.lb-results { padding-left: 1.4em; margin: 0; }
.lb-results li { padding: 10px 0; border-bottom: 1px solid var(--cx-line); }
.lb-results small { display: block; color: var(--cx-muted); font-size: .8rem; }
.lb-snip { display: block; font-family: var(--cx-serif); font-size: 1.02rem; line-height: 1.55; margin-top: 3px; }
.lb-snip mark { background: rgba(176, 138, 62, .3); color: inherit; padding: 0 1px; }

html[data-fs-theme="dark"] .lb-reader [id]:target, html[data-fs-theme="dark"] .lb-reader .lb-mark { background: rgba(201, 164, 92, .18); }
html[data-fs-theme="dark"] .lb-pop { box-shadow: 0 10px 28px rgba(0,0,0,.5); }

@media (max-width: 480px) {
  .lb-reader { font-size: calc(var(--lb-size) * .97); }
  .lb-pos { width: 100%; margin-left: 0; }
  .lb-dl { grid-template-columns: 1fr; }
  .lb-dl dt { margin-top: 6px; }
  .lb-pager a b { white-space: normal; }
}
@media print {
  .lb-bar, .lb-pager, .lb-tools, .lb-resume { display: none !important; }
  .lb-wrap.lb-night .lb-reader { background: none; color: #000; }
}
