/* book.css — the book page (a panel over the library) and its dialogs. */

.sheet.book-sheet { width: min(780px, 100vw); background: var(--bg); }
.book-sheet .sheet-body { padding: 0; position: relative; }
.book-sheet .sheet-foot { padding: 0; border-top: 1px solid var(--line); background: var(--surface); justify-content: stretch; }

.bp { position: relative; padding-bottom: var(--s6); }
.bp-close { position: absolute; top: calc(var(--s3) + var(--safe-top)); right: var(--s3); z-index: 3; background: color-mix(in srgb, var(--surface) 80%, transparent); }
.sheet-right .bp-close { top: var(--s3); }

/* The top of the panel is washed in the cover's own colour. */
.bp-hero {
  --tint: var(--bark-soft);
  display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: var(--s6);
  padding: var(--s7) var(--s6) var(--s6);
  background: linear-gradient(180deg, color-mix(in srgb, var(--tint) 34%, var(--bg)) 0%, var(--bg) 100%);
}
.bp-cover .cover { box-shadow: var(--shadow-2); }
.bp-info { display: flex; flex-direction: column; gap: var(--s2); min-width: 0; padding-top: var(--s2); }
.bp-series { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); font-weight: 800; color: var(--brand-deep); }
.bp-title { font-size: clamp(1.7rem, 3vw, 2.4rem); line-height: 1.08; overflow-wrap: anywhere; }
.bp-subtitle { font-size: var(--fs-lg); font-weight: 700; color: var(--text-2); }
.bp-authors { font-size: var(--fs-lg); font-weight: 800; color: var(--text-2); }
.bp-facts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--s2); }
.bp-facts .badge { padding: 4px 10px; font-size: 12px; }
.bp-facts .badge .icon { width: 13px; height: 13px; }

.bp-progress { margin-top: var(--s4); padding: var(--s3) var(--s4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); display: flex; flex-direction: column; gap: 8px; }
.bp-progress .bar > i { background: var(--sun); }
.bp-progress-line { font-size: var(--fs-sm); }
.bp-progress-when { font-size: var(--fs-xs); font-weight: 700; }
.bp-finished { flex-direction: row; align-items: center; gap: var(--s2); font-weight: 800; color: var(--ok); }

.bp-section { padding: var(--s5) var(--s6) 0; }
.bp-section h2 { font-size: var(--fs-lg); margin-bottom: var(--s3); }
.bp-desc { font-size: 1.02rem; line-height: 1.65; color: var(--text); max-width: 64ch; }
.bp-desc p { margin-bottom: .8em; }
.bp-narration { margin: var(--s4) var(--s6) 0; }
.bp-narration .bar { margin: 8px 0 4px; max-width: 320px; }
.bp-narration .bar > i { background: var(--brand-deep); }

.bp-readers { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s3); }
.bp-readers li { display: flex; align-items: center; gap: var(--s2); padding: 6px var(--s3) 6px 6px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--line); font-size: var(--fs-sm); font-weight: 700; }
.bp-reader-name { font-weight: 800; }
.bp-shelves { display: flex; flex-wrap: wrap; gap: var(--s2); }

.bp-details { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px var(--s5); margin: 0; font-size: var(--fs-sm); }
.bp-details dt { font-weight: 800; color: var(--text-3); }
.bp-details dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

.bp-missing { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s3); padding: var(--s8) var(--s5); }

/* The action bar: always on screen, a word under every icon on a phone. */
.bp-bar { width: 100%; }
.bp-actions { display: flex; gap: var(--s2); padding: var(--s3) var(--s5) calc(var(--s3) + var(--press-depth)); align-items: center; }
.bp-actions .bp-read { flex: 1 1 auto; max-width: 280px; }
.bp-actions .btn:last-child { margin-left: auto; }
.bp-actions .btn[aria-disabled="true"] { opacity: .6; cursor: default; }
.bp-confirm { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s5); background: var(--danger-soft); flex-wrap: wrap; }
.bp-confirm p { margin: 0; flex: 1 1 260px; font-weight: 700; color: var(--text); }

@media (max-width: 760px) {
  .bp-hero { grid-template-columns: 1fr; justify-items: center; text-align: center; padding: calc(var(--s7) + var(--safe-top)) var(--s4) var(--s5); gap: var(--s4); }
  .bp-cover { width: 170px; }
  .bp-info { align-items: center; }
  .bp-facts { justify-content: center; }
  .bp-progress { width: 100%; text-align: left; }
  .bp-section { padding: var(--s5) var(--s4) 0; }
  .bp-narration { margin: var(--s4) var(--s4) 0; }
  .bp-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--s1); padding: var(--s2) var(--s2) calc(var(--s2) + var(--press-depth)); }
  .bp-actions .btn { flex-direction: column; gap: 2px; min-height: 58px; padding: 6px 4px; border-radius: var(--r-md); font-size: 12px; }
  .bp-actions .btn:not(.btn-primary) { --btn-bd: transparent; --btn-bg: transparent; }
  .bp-actions .btn .icon { width: 22px; height: 22px; }
  .bp-actions .btn > span[data-long] { font-size: 0; }
  .bp-actions .btn > span[data-long]::after { content: attr(data-short); font-size: 12px; }
  .bp-actions .bp-read { max-width: none; }
  .bp-actions .btn:last-child { margin-left: 0; }
}

/* ------------------------------------------------------------------ narrate dialog */
.nr-voices { display: flex; flex-direction: column; gap: var(--s2); max-height: 46vh; overflow: auto; }
.nr-voice { display: flex; align-items: center; gap: var(--s3); padding: var(--s2) var(--s3); border: 1.5px solid var(--line); border-radius: var(--r-md); cursor: pointer; }
.nr-voice:has(input:checked) { border-color: var(--outline); background: var(--accent-soft); }
.nr-voice input { width: 18px; height: 18px; accent-color: var(--accent-deep); }
.nr-voice-text { display: flex; flex-direction: column; flex: 1; font-size: var(--fs-sm); }

/* ------------------------------------------------------------------ fix details */
.fx-form { display: grid; grid-template-columns: minmax(0, 1fr) 180px auto; gap: var(--s3); align-items: end; margin-bottom: var(--s4); }
@media (max-width: 760px) { .fx-form { grid-template-columns: 1fr; } }
.fx-results { display: flex; flex-direction: column; gap: var(--s2); min-height: 120px; }
.fx-wait { display: flex; align-items: center; gap: var(--s3); padding: var(--s5); color: var(--text-2); font-weight: 700; justify-content: center; }
.fx-row {
  display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: var(--s4); align-items: center;
  padding: var(--s3); border: 1.5px solid var(--line); border-radius: var(--r-md); background: var(--surface-2);
  text-align: left;
}
.fx-row:hover, .fx-row:focus-visible { border-color: var(--outline); background: var(--raise); }
.fx-row-main { display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-sm); min-width: 0; }
.fx-row-main strong { font-size: var(--fs-md); }
.fx-badges { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }
.fx-cover { width: 56px; }
.fx-cover .cover-gen .gt { font-size: 8px; }
.fx-review { display: flex; flex-direction: column; gap: var(--s4); }
.fx-review-head { display: flex; gap: var(--s5); align-items: flex-start; }
.fx-review-head h3 { margin-bottom: 4px; }
.fx-cover-lg { width: 110px; flex: none; }
.fx-diffs { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.fx-diff { display: grid; grid-template-columns: 22px 130px minmax(0, 1fr) 18px minmax(0, 1fr); gap: var(--s3); align-items: start; padding: var(--s3); border-bottom: 1px solid var(--line); font-size: var(--fs-sm); cursor: pointer; }
.fx-diff:last-child { border-bottom: 0; }
.fx-diff input { width: 18px; height: 18px; accent-color: var(--accent-deep); margin-top: 2px; }
.fx-diff-label { font-weight: 800; color: var(--text-2); }
.fx-diff-old { color: var(--text-3); text-decoration: line-through; text-decoration-color: var(--line-2); overflow-wrap: anywhere; }
.fx-diff-new { font-weight: 700; overflow-wrap: anywhere; }
.fx-diff .icon { color: var(--text-3); margin-top: 3px; }
.fx-diff:has(input:not(:checked)) .fx-diff-new { opacity: .45; }
.fx-review-actions { display: flex; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
@media (max-width: 760px) {
  .fx-diff { grid-template-columns: 22px minmax(0, 1fr); }
  .fx-diff-old, .fx-diff .icon { display: none; }
  .fx-diff-new { grid-column: 2; }
  .fx-review-head { flex-direction: column; }
}

/* ------------------------------------------------------------------ edit details */
.ed-form { display: flex; flex-direction: column; gap: var(--s4); }
.ed-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); }
.ed-pair { display: grid; grid-template-columns: minmax(0, 1fr) 100px; gap: var(--s3); }
@media (max-width: 760px) { .ed-grid { grid-template-columns: 1fr; } }

/* A volume split out of a collection file says where it came from. */
.bp-from { display: flex; align-items: center; gap: 6px; margin-top: var(--s2); font-size: var(--fs-sm); font-weight: 700; color: var(--text-3); }
