/* ---- My notes: the library of highlights, notes and bookmarks (js/bible-library.js) ----
   A sheet over the page, as the search is (css/manuscript.css, .bb-search): only the list inside it scrolls. Every color
   is a theme token; the highlight colors are the reader's (css/reader.css), with these fallbacks until it defines them. */
.bb-lib {
  --lib-yellow: var(--hl-yellow, rgba(240, 200, 60, 0.35));
  --lib-green: var(--hl-green, rgba(110, 190, 110, 0.32));
  --lib-blue: var(--hl-blue, rgba(100, 160, 240, 0.32));
  --lib-pink: var(--hl-pink, rgba(240, 120, 170, 0.32));
  --lib-orange: var(--hl-orange, rgba(245, 150, 60, 0.36));
  width: calc(100% - 20px); max-width: 44rem; height: min(88vh, 48rem); max-height: calc(100vh - 24px);
  margin-top: 12px; margin-bottom: auto; padding: 0;
  border: 1px solid var(--press); border-radius: 6px; background: var(--bg); color: var(--ink);
  box-shadow: 0 18px 50px var(--shadow, rgba(0, 0, 0, 0.45)); overflow: hidden;
}
.bb-lib[open] { display: flex; flex-direction: column; }
.bb-lib::backdrop { background: var(--overlay, rgba(10, 6, 14, 0.62)); }
.bb-lib button { border-radius: 0; box-shadow: none; font-family: inherit; -webkit-tap-highlight-color: transparent; }
.bb-lib-c-yellow { --c: var(--lib-yellow); }
.bb-lib-c-green { --c: var(--lib-green); }
.bb-lib-c-blue { --c: var(--lib-blue); }
.bb-lib-c-pink { --c: var(--lib-pink); }
.bb-lib-c-orange { --c: var(--lib-orange); }

.bb-lib-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 6px 6px 16px; border-bottom: 1px solid var(--rule); }
.bb-lib-head h3 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 1.4rem; color: var(--rubric); }
.bb-lib-x { flex: none; display: inline-flex; align-items: center; justify-content: center; min-width: 40px; min-height: 40px; padding: 0 0 3px; border: 0; background: none; font-size: 1.7rem; line-height: 1; color: var(--muted); cursor: pointer; }
.bb-lib-x:hover { color: var(--ink); }

/* the tabs */
.bb-lib-tabs { flex: none; display: flex; padding: 0 8px; border-bottom: 1px solid var(--rule); }
.bb-lib-tab { flex: 1 1 0; min-width: 0; min-height: 44px; display: inline-flex; align-items: baseline; justify-content: center; gap: 0.4em; margin-bottom: -1px; padding: 11px 4px 8px; border: 0; border-bottom: 3px solid transparent; background: none; font-family: var(--caps); font-size: 1.02rem; letter-spacing: 0.06em; color: var(--muted); white-space: nowrap; cursor: pointer; }
.bb-lib-tab:hover { color: var(--ink); }
.bb-lib-tab[aria-selected="true"] { border-bottom-color: var(--rubric); color: var(--ink); }
.bb-lib-tab-t { overflow: hidden; text-overflow: ellipsis; }
.bb-lib-tab-n { font-family: var(--text); font-size: 0.92rem; letter-spacing: 0; font-feature-settings: "lnum"; color: var(--muted); }
.bb-lib-tab[aria-selected="true"] .bb-lib-tab-n { color: var(--rubric); }

/* a tab's page: its tools, a line on what it shows, and the list, which scrolls */
.bb-lib-panel { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.bb-lib-panel[hidden] { display: none; }
.bb-lib-tools { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 12px 14px 2px; }
.bb-lib-q { flex: 1 1 11rem; min-width: 0; box-sizing: border-box; min-height: 40px; padding: 7px 12px; border: 1px solid var(--rule); border-radius: 0; background: none; font: inherit; font-size: 1.05rem; color: var(--ink); -webkit-appearance: none; appearance: none; }
.bb-lib-q::placeholder { color: var(--muted); opacity: 0.85; font-style: italic; }
.bb-lib-q:focus { outline: 2px solid var(--focus); outline-offset: 1px; }
.bb-lib-seg { flex: none; display: inline-flex; }
.bb-lib-seg button { position: relative; min-height: 40px; padding: 5px 12px; border: 1px solid var(--rule); background: none; font-size: 0.98rem; color: var(--muted); white-space: nowrap; cursor: pointer; }
.bb-lib-seg button + button { margin-left: -1px; }
.bb-lib-seg button:hover { color: var(--ink); }
.bb-lib-seg button[aria-pressed="true"] { z-index: 1; border-color: var(--rubric); background: color-mix(in srgb, var(--rubric) 12%, transparent); color: var(--rubric); }
.bb-lib-chips { gap: 6px; }
.bb-lib-chip { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-width: 40px; min-height: 40px; padding: 4px 10px; border: 1px solid var(--rule); background: none; font-size: 0.98rem; color: var(--muted); font-feature-settings: "lnum"; cursor: pointer; }
.bb-lib-chip:hover { border-color: var(--muted); color: var(--ink); }
.bb-lib-chip[aria-pressed="true"] { border-color: var(--rubric); box-shadow: inset 0 0 0 1px var(--rubric); color: var(--ink); }
.bb-lib-chip.is-none:not([aria-pressed="true"]) { opacity: 0.55; }
/* a swatch: the same thin color three times over, so that it reads clearly as the color it names */
.bb-lib-sw { flex: none; display: inline-block; width: 15px; height: 15px; box-sizing: border-box; border: 1px solid color-mix(in srgb, var(--ink) 35%, transparent); background: linear-gradient(var(--c), var(--c)), linear-gradient(var(--c), var(--c)), var(--c); }
.bb-lib-status { flex: none; margin: 8px 16px 0; font-size: 0.95rem; font-style: italic; color: var(--muted); font-feature-settings: "lnum"; }
.bb-lib-status:empty { margin-top: 0; }
.bb-lib-scroll { flex: 1 1 auto; min-height: 0; padding: 2px 12px 14px; overflow-y: auto; overscroll-behavior: contain; }

/* the heading of a book (highlights) */
.bb-lib-bh { display: flex; align-items: baseline; justify-content: space-between; margin: 14px 0 0; padding: 0 4px 3px; border-bottom: 1px solid var(--rule); font-family: var(--caps); font-weight: 400; font-size: 0.95rem; letter-spacing: 0.12em; color: var(--rubric); }
.bb-lib-bh span { font-family: var(--text); font-size: 0.9rem; letter-spacing: 0; color: var(--muted); font-feature-settings: "lnum"; }

/* an entry: the whole of it opens the passage; the button at its side deletes it */
.bb-lib-list { margin: 0; padding: 0; list-style: none; }
.bb-lib-e { display: flex; align-items: flex-start; gap: 2px; border-bottom: 1px dotted var(--rule); }
.bb-lib-card { flex: 1 1 auto; min-width: 0; padding: 10px 6px 11px; cursor: pointer; }
.bb-lib-card:hover { background: color-mix(in srgb, var(--rubric) 7%, transparent); }
.bb-lib-top { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 9px; }
.bb-lib-ref { padding: 0; border: 0; background: none; font-family: var(--caps); font-size: 0.92rem; letter-spacing: 0.08em; line-height: 1.35; color: var(--rubric); text-align: left; cursor: pointer; }
.bb-lib-card:hover .bb-lib-ref { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.bb-lib-top time { margin-left: auto; font-size: 0.9rem; font-style: italic; color: var(--muted); font-feature-settings: "lnum"; white-space: nowrap; }
.bb-lib-note { margin: 5px 0 0; font-size: 1.08rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.bb-lib-v { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; line-clamp: 4; overflow: hidden; margin: 6px 0 0; font-size: 1.02rem; line-height: 1.5; overflow-wrap: break-word; }
.bb-lib-notes .bb-lib-v { padding-left: 10px; border-left: 2px solid var(--rule); font-size: 0.98rem; color: var(--muted); }
.bb-lib-hl .bb-lib-v { margin-top: 4px; }
.bb-lib-hl .bb-lib-t { padding: 1px 2px; background: var(--c); -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.bb-lib-t.bb-lib-miss { padding: 0; background: none; font-style: italic; color: var(--muted); }
/* words highlighted within a verse: the verse in its version, those words marked in their colors */
.bb-lib-top .bb-lib-sw + .bb-lib-sw { margin-left: -6px; }
.bb-lib-kind { font-size: 0.88rem; font-style: italic; color: var(--muted); }
.bb-lib-ver { margin-right: 0.15em; font-family: var(--caps); font-size: 0.78em; letter-spacing: 0.1em; color: var(--muted); }
.bb-lib mark.bb-w { padding: 1px 1px; background: var(--c); color: inherit; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.bb-lib-n { position: relative; top: -0.1em; margin-right: 0.22em; font-size: 0.66em; line-height: 0; vertical-align: super; color: var(--rubric); font-feature-settings: "lnum"; }
.bb-lib-wait { color: var(--muted); letter-spacing: 0.1em; }
.bb-lib-del { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; margin-top: 5px; padding: 0; border: 1px solid transparent; background: none; color: var(--muted); cursor: pointer; }
.bb-lib-del svg { fill: none; stroke: currentColor; stroke-width: 1.25; stroke-linecap: round; stroke-linejoin: round; }
.bb-lib-del:hover { border-color: var(--rule); color: var(--rubric); }

/* what was deleted a moment ago, with Undo */
.bb-lib-gone { align-items: center; flex-wrap: wrap; gap: 4px 8px; min-height: 52px; padding: 5px 6px; font-style: italic; color: var(--muted); }
.bb-lib-gone-r { font-family: var(--caps); font-style: normal; font-size: 0.9rem; letter-spacing: 0.08em; }
.bb-lib-undo { min-height: 40px; padding: 4px 14px; border: 1px solid var(--rubric); background: none; font-size: 1rem; font-style: normal; color: var(--rubric); cursor: pointer; }
.bb-lib-undo:hover { background: color-mix(in srgb, var(--rubric) 12%, transparent); }

/* nothing to show */
.bb-lib-empty { max-width: 30rem; margin: 30px auto 0; padding: 0 10px; text-align: center; }
.bb-lib-empty p { margin: 0 0 12px; font-size: 1.1rem; line-height: 1.5; }
.bb-lib-empty .bb-lib-empty-s { font-size: 0.98rem; font-style: italic; color: var(--muted); }
.bb-lib-empty b { font-weight: 600; }
.bb-lib-none { margin: 20px 4px 4px; text-align: center; font-style: italic; color: var(--muted); }
.bb-lib-link { display: inline-block; min-height: 40px; padding: 4px 6px; border: 0; background: none; font-size: 1rem; font-style: normal; color: var(--rubric); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* the foot: save, bring in, clear */
.bb-lib-foot { flex: none; padding: 10px 14px 12px; border-top: 1px solid var(--rule); }
.bb-lib-acts, .bb-lib-confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.bb-lib-acts[hidden], .bb-lib-confirm[hidden] { display: none; }
.bb-lib-btn { min-height: 40px; padding: 5px 13px; border: 1px solid var(--rule); background: none; font-size: 1rem; color: var(--ink); white-space: nowrap; cursor: pointer; }
.bb-lib-btn:hover:not(:disabled) { border-color: var(--rubric); color: var(--rubric); }
.bb-lib-btn:disabled { opacity: 0.4; cursor: default; }
.bb-lib-clear { margin-left: auto; color: var(--muted); }
.bb-lib-ask { flex: 1 1 14rem; margin: 0; font-size: 1.02rem; }
.bb-lib-confirm-btns { display: inline-flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.bb-lib-btn.bb-lib-danger { border-color: var(--bad, var(--rubric)); color: var(--bad, var(--rubric)); }
.bb-lib-btn.bb-lib-danger:hover { background: color-mix(in srgb, var(--bad, var(--rubric)) 12%, transparent); color: var(--bad, var(--rubric)); }
.bb-lib-msg { margin: 8px 2px 0; font-size: 0.97rem; line-height: 1.4; color: var(--muted); overflow-wrap: anywhere; }
.bb-lib-msg:empty { margin: 0; }
.bb-lib-msg.is-err { color: var(--bad, var(--rubric)); }
.bb-lib-msg .bb-lib-undo { min-height: 36px; margin-left: 6px; padding: 2px 12px; }

/* focus, seen from the keyboard */
.bb-lib-x:focus-visible, .bb-lib-seg button:focus-visible, .bb-lib-chip:focus-visible, .bb-lib-del:focus-visible, .bb-lib-undo:focus-visible, .bb-lib-link:focus-visible, .bb-lib-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.bb-lib-tab:focus-visible { outline: 2px solid var(--focus); outline-offset: -3px; }
.bb-lib-ref:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.bb-lib-del:focus-visible { outline-offset: -2px; }

@media (max-width: 780px) {
  .bb-lib { width: calc(100% - 12px); margin-top: 6px; }
  .bb-lib-head { padding-left: 14px; }
  .bb-lib-tabs { padding: 0 4px; }
  .bb-lib-tab { gap: 0.3em; font-size: 0.98rem; letter-spacing: 0.03em; }
  .bb-lib-tools { padding: 10px 10px 2px; }
  .bb-lib-status { margin-left: 12px; margin-right: 12px; }
  .bb-lib-scroll { padding: 2px 8px 12px; }
  .bb-lib-card { padding: 10px 4px 11px; }
  .bb-lib-note { font-size: 1.03rem; }
  .bb-lib-v { font-size: 0.98rem; }
  .bb-lib-notes .bb-lib-v { font-size: 0.94rem; }
  .bb-lib-foot { padding: 8px 10px 10px; }
  .bb-lib-btn { padding: 5px 10px; }
  .bb-lib-del { width: 42px; height: 42px; margin-top: 3px; }
}
@media (max-width: 380px) {
  .bb-lib-tab-t { font-size: 0.92em; }
  .bb-lib-chip { padding: 4px 7px; gap: 5px; }
}
@media print { .bb-lib { display: none !important; } }
