/* Styles for home, all books, search, book and chapter pages. Dark values follow data-bs-theme, set in base.html. */
:root {
  --nv-bg: #ffffff;
  --nv-surface: #f4f3ef;
  --nv-ink: #1c1b18;
  --nv-muted: #6b675e;
  --nv-line: #e4e1d8;
  --nv-amber: #f2b100;
  --nv-amber-ink: #7a4f00;
  --nv-amber-soft: #fff4d1;
  --nv-ok: #1d6b35;
  --nv-ok-soft: #e3f4e8;
  --nv-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}
[data-bs-theme="dark"] {
  /* neutrals follow Bootstrap's dark theme so these pages match the navbar, footer and other pages */
  --nv-bg: var(--bs-body-bg);
  --nv-surface: var(--bs-tertiary-bg);
  --nv-ink: var(--bs-emphasis-color);
  --nv-muted: var(--bs-secondary-color);
  --nv-line: var(--bs-border-color);
  --nv-amber-ink: #ffcf4d;
  --nv-amber-soft: #2c2310;
  --nv-ok: #8fd6a3;
  --nv-ok-soft: #16301f;
}

.nv { max-width: 1180px; margin: 0 auto; color: var(--nv-ink); }
/* style.css shrinks .container-fluid padding to 1% on phones */
@media (max-width: 768px) { .nv { padding-left: 12px; padding-right: 12px; } }
.nv a { color: inherit; text-decoration: none; }
.nv a:hover { text-decoration: underline; }
.nv a:focus-visible, .nv button:focus-visible, .nv input:focus-visible, .nv select:focus-visible { outline: 2px solid var(--nv-amber); outline-offset: 2px; }
.nv h1, .nv h2 { font-family: var(--nv-serif); font-weight: 600; letter-spacing: -0.01em; text-wrap: balance; }
.nv-muted { color: var(--nv-muted); }
.nv-num { font-variant-numeric: tabular-nums; }
.nv-clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.nv-ell { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* hero + search */
.nv-hero { padding: 8px 0 28px; }
.nv-hero h1 { font-size: clamp(28px, 5vw, 44px); line-height: 1.1; margin: 0 0 6px; }
.nv-hero p { color: var(--nv-muted); margin: 0 0 20px; max-width: 55ch; }
.nv-search { display: flex; align-items: center; gap: 8px; max-width: 560px; border: 1px solid var(--nv-line); border-radius: 999px; background: var(--nv-surface); padding: 4px 4px 4px 16px; }
.nv-search:focus-within { border-color: var(--nv-amber); }
.nv-search input { flex: 1; min-width: 0; border: 0; background: none; font: inherit; color: var(--nv-ink); padding: 8px 0; outline: none; }
.nv-search svg { flex: none; color: var(--nv-muted); }

/* buttons, chips, pills */
.nv-btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--nv-line); border-radius: 999px; background: var(--nv-bg); color: var(--nv-ink); font-weight: 600; font-size: 15px; padding: 11px 20px; cursor: pointer; }
.nv-btn-dark { background: var(--nv-ink); color: var(--nv-bg); border-color: var(--nv-ink); font-size: 14px; }
.nv-btn-amber { background: var(--nv-amber); border-color: var(--nv-amber); color: #1c1b18; font-weight: 700; }
.nv .nv-btn:hover { text-decoration: none; filter: brightness(.96); }
.nv-chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; }
.nv-chips.wrap { flex-wrap: wrap; overflow: visible; }
.nv-chip { flex: none; font-size: 14px; font-weight: 500; padding: 6px 13px; border-radius: 999px; background: var(--nv-amber-soft); color: var(--nv-amber-ink) !important; }
.nv-chip.on { background: var(--nv-amber); color: #1c1b18 !important; }
.nv .nv-chip:hover { text-decoration: none; background: var(--nv-amber); color: #1c1b18 !important; }
.nv-pill { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--nv-surface); color: var(--nv-muted); white-space: nowrap; }
.nv-pill.done { background: var(--nv-ok-soft); color: var(--nv-ok); }
.nv-seg { display: inline-flex; border: 1px solid var(--nv-line); border-radius: 999px; padding: 3px; font-size: 14px; }
.nv-seg a { padding: 6px 14px; border-radius: 999px; color: var(--nv-muted); }
.nv-seg a.on { background: var(--nv-ink); color: var(--nv-bg); font-weight: 600; }
.nv .nv-seg a:hover { text-decoration: none; }

/* sections */
.nv-sec { padding: 28px 0; border-top: 1px solid var(--nv-line); }
.nv-sh { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.nv-sh h2 { font-size: 22px; margin: 0; }
.nv-sh h2 small { font: 400 14px system-ui, sans-serif; color: var(--nv-muted); margin-left: 8px; }
.nv-sh > a { font-size: 14px; font-weight: 600; color: var(--nv-amber-ink) !important; white-space: nowrap; }

/* shelves: sideways scroll on phones, 6-up grid on desktop */
.nv-shelf { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(128px, 1fr); gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; }
@media (min-width: 900px) { .nv-shelf { grid-auto-flow: row; grid-template-columns: repeat(6, minmax(0, 1fr)); overflow: visible; } }
.nv-book { display: flex; flex-direction: column; gap: 6px; min-width: 0; scroll-snap-align: start; }
.nv .nv-book:hover { text-decoration: none; }
.nv-book h3 { font-size: 15px; font-weight: 600; line-height: 1.25; margin: 0; }
.nv-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--nv-muted); font-variant-numeric: tabular-nums; }
.nv-meta .r { color: var(--nv-amber-ink); font-weight: 600; }
.nv-cover { position: relative; display: block; aspect-ratio: 2 / 3; border-radius: 4px; overflow: hidden; background: var(--nv-surface); }
.nv-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nv-tag { position: absolute; top: 8px; left: 8px; font: 700 10px/1 system-ui, sans-serif; letter-spacing: .06em; text-transform: uppercase; padding: 4px 6px; border-radius: 3px; background: var(--nv-amber); color: #1c1b18; }
.nv-thumb { flex: none; width: 40px; aspect-ratio: 2 / 3; border-radius: 3px; object-fit: cover; background: var(--nv-surface); }

/* numbered charts and plain lists */
.nv-two, .nv-ranks { display: grid; gap: 28px 40px; grid-template-columns: 1fr; }
.nv-two > div, .nv-ranks > div { min-width: 0; }
.nv-two > div:only-child { grid-column: 1 / -1; }
@media (min-width: 900px) { .nv-two { grid-template-columns: 1fr 1fr; } }
@media (min-width: 760px) { .nv-ranks { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.nv-ranks h3 { font: 700 12px/1 system-ui, sans-serif; text-transform: uppercase; letter-spacing: .08em; color: var(--nv-muted); margin: 0 0 4px; padding-bottom: 8px; border-bottom: 2px solid var(--nv-amber); }
.nv-chart, .nv-list { list-style: none; margin: 0; padding: 0; }
.nv-chart { counter-reset: n; }
.nv-chart li { counter-increment: n; display: grid; grid-template-columns: 2.2ch 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--nv-line); }
.nv-chart.text li { grid-template-columns: 2.2ch minmax(0, 1fr) auto; }
.nv-chart li::before { content: counter(n); font: 600 20px/1 var(--nv-serif); color: var(--nv-muted); text-align: right; font-variant-numeric: tabular-nums; }
.nv-chart li:nth-child(-n+3)::before { color: var(--nv-amber-ink); }
.nv-list li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--nv-line); }
.nv-t { min-width: 0; flex: 1; }
.nv-t a { font-weight: 600; font-size: 15px; }
.nv-t span, .nv-side { font-size: 13px; color: var(--nv-muted); }
.nv-side { white-space: nowrap; font-variant-numeric: tabular-nums; }
.nv-amber { color: var(--nv-amber-ink) !important; }

/* catalogue rows (all books, search) */
.nv-rows { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; column-gap: 40px; }
@media (min-width: 800px) { .nv-rows.two { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.nv-rows li { border-bottom: 1px solid var(--nv-line); min-width: 0; }
.nv-rows li > a { display: flex; gap: 14px; padding: 14px 0; align-items: center; }
.nv .nv-rows li > a:hover { text-decoration: none; }
.nv .nv-rows li > a:hover .nv-title { text-decoration: underline; }
.nv-rows .nv-thumb { width: 56px; }
.nv-rows .nv-title { font-size: 16px; font-weight: 600; line-height: 1.3; }
.nv-rows mark { background: var(--nv-amber-soft); color: var(--nv-amber-ink); padding: 0 2px; border-radius: 2px; }
.nv-toolbar { display: flex; flex-direction: column; gap: 14px; padding-bottom: 20px; border-bottom: 1px solid var(--nv-line); }
.nv-toolbar .row2 { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; }
.nv-select { font: inherit; font-size: 14px; color: var(--nv-ink); background: var(--nv-surface); border: 1px solid var(--nv-line); border-radius: 8px; padding: 8px 10px; }
.nv-pager { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 32px; font-size: 15px; font-variant-numeric: tabular-nums; flex-wrap: wrap; }
.nv-pager a, .nv-pager span { min-width: 44px; text-align: center; padding: 10px 8px; border-radius: 8px; }
.nv-pager .on { background: var(--nv-ink); color: var(--nv-bg); font-weight: 600; }
.nv-pager .off { color: var(--nv-muted); opacity: .6; }
.nv-empty { margin-top: 28px; padding: 28px; border-radius: 12px; background: var(--nv-surface); display: flex; flex-direction: column; gap: 12px; }
.nv-empty h2 { margin: 0; font-size: 24px; }
.nv-empty p { margin: 0; color: var(--nv-muted); max-width: 55ch; }

/* book page */
.nv-band { background: var(--nv-surface); border-radius: 12px; padding: 24px; margin-bottom: 8px; }
.nv-crumbs { font-size: 14px; color: var(--nv-muted); margin-bottom: 20px; display: flex; gap: 8px; flex-wrap: wrap; min-width: 0; }
.nv-crumbs [aria-current] { color: var(--nv-ink); }
.nv-bookhead { display: flex; gap: 40px; align-items: flex-start; }
.nv-bookhead .nv-cover { flex: none; width: 200px; max-width: 100%; border-radius: 6px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); }
.nv-bookhead > div:last-child { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.nv-bookhead h1 { font-size: clamp(30px, 5vw, 44px); line-height: 1.1; margin: 0; }
@media (max-width: 760px) { .nv-bookhead { flex-direction: column; gap: 20px; } .nv-bookhead .nv-cover { width: 140px; } .nv-band { padding: 16px; } }
.nv-stats { display: flex; flex-wrap: wrap; gap: 12px 32px; margin: 0; font-variant-numeric: tabular-nums; }
.nv-stats dt { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--nv-muted); font-weight: 500; }
.nv-stats dd { margin: 2px 0 0; font-size: 20px; font-weight: 700; }
.nv-stats dd.none { font-size: 15px; font-weight: 500; color: var(--nv-muted); padding-top: 4px; }
.nv-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.nv-link-btn { background: none; border: 0; color: var(--nv-muted); font-size: 14px; padding: 11px 8px; cursor: pointer; }
.nv-summary { max-width: 65ch; font-family: var(--nv-serif); font-size: 18px; line-height: 1.65; }
.nv-summary p { margin: 0 0 14px; }
.nv-chapters { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; column-gap: 40px; }
@media (min-width: 760px) { .nv-chapters { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.nv-chapters li { border-bottom: 1px solid var(--nv-line); min-width: 0; }
.nv-chapters a { display: grid; grid-template-columns: 4ch minmax(0, 1fr) auto; gap: 12px; align-items: baseline; padding: 11px 0; font-variant-numeric: tabular-nums; }
.nv-chapters a > span:first-child { font-size: 13px; color: var(--nv-muted); text-align: right; }
.nv-chapters a > span:last-child { font-size: 13px; color: var(--nv-muted); }
.nv-jump { display: flex; align-items: center; gap: 8px; }
.nv-jump input { width: 84px; font: inherit; font-size: 14px; color: var(--nv-ink); background: var(--nv-surface); border: 1px solid var(--nv-line); border-radius: 8px; padding: 9px; }
.nv-review-form { max-width: 640px; display: flex; flex-direction: column; gap: 12px; padding: 24px; border: 1px solid var(--nv-line); border-radius: 12px; margin-bottom: 24px; }
.nv-review-form textarea { font: inherit; font-size: 15px; color: var(--nv-ink); background: var(--nv-surface); border: 1px solid var(--nv-line); border-radius: 8px; padding: 12px; resize: vertical; }
.nv-review-form legend, .nv-review-form > label { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.nv-stars { display: inline-flex; flex-direction: row-reverse; gap: 2px; }
.nv-stars input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.nv-stars label { font-size: 28px; line-height: 1; padding: 4px; cursor: pointer; color: var(--nv-line); }
.nv-stars input:checked ~ label, .nv-stars label:hover, .nv-stars label:hover ~ label { color: var(--nv-amber); }
.nv-stars input:focus-visible + label { outline: 2px solid var(--nv-amber); border-radius: 4px; }
.nv-reviews { list-style: none; margin: 0; padding: 0; max-width: 720px; }
.nv-reviews li { display: flex; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--nv-line); }
.nv-reviews img { width: 44px; height: 44px; border-radius: 50%; flex: none; object-fit: cover; }
.nv-reviews p { margin: 4px 0 0; }
.nv-owner { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-size: 14px; padding: 12px 0; }

@media (prefers-reduced-motion: no-preference) { .nv-cover img { transition: transform .15s; } .nv-book:hover .nv-cover img { transform: scale(1.03); } }

/* chapter reader */
.nv-reader { max-width: 720px; }
.nv-reader-head { text-align: center; padding: 8px 0 20px; }
.nv-reader-head .book { font-size: 14px; font-weight: 600; color: var(--nv-amber-ink) !important; }
.nv-reader-head h1 { font-size: clamp(26px, 5vw, 36px); line-height: 1.15; margin: 8px 0 6px; }
.nv-reader-head p { margin: 0; font-size: 14px; color: var(--nv-muted); font-variant-numeric: tabular-nums; }
.nv-tools { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; padding: 8px; border: 1px solid var(--nv-line); border-radius: 999px; background: var(--nv-bg); width: fit-content; max-width: 100%; margin: 0 auto 8px; }
.nv-tools.playing { position: sticky; top: 8px; z-index: 20; box-shadow: 0 4px 16px rgba(0, 0, 0, .12); }
.nv-tool { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 40px; height: 40px; padding: 0 10px; border: 0; border-radius: 999px; background: none; color: var(--nv-ink); font: 600 14px system-ui, sans-serif; cursor: pointer; }
.nv-tool:hover { background: var(--nv-surface); }
.nv-tool:disabled { opacity: .4; cursor: default; }
.nv-tool svg { width: 18px; height: 18px; }
.nv-tools .sep { width: 1px; height: 24px; background: var(--nv-line); }
.nv-progress { width: 120px; height: 6px; border-radius: 3px; background: var(--nv-surface); cursor: pointer; overflow: hidden; }
.nv-progress > div { height: 100%; width: 0; background: var(--nv-amber); }
.nv-text { --size: 19px; font-family: var(--nv-serif); font-size: var(--nv-read-size, var(--size)); line-height: 1.75; padding: 16px 0 8px; overflow-wrap: break-word; }
.nv-text p { margin: 0 0 1.1em; }
@media (max-width: 600px) { .nv-text { --size: 18px; } }
.nv-chapnav { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; padding: 16px 0; }
.nv-chapnav > :first-child { justify-self: start; }
.nv-chapnav > :last-child { justify-self: end; }
.nv-chapnav .pos { font-size: 14px; color: var(--nv-muted); font-variant-numeric: tabular-nums; text-align: center; }
.nv-chapnav .nv-btn { padding: 10px 16px; }
.nv-chapnav .off { opacity: .4; pointer-events: none; }
@media (max-width: 420px) { .nv-chapnav .label { display: none; } }
.nv-note { display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; font-size: 14px; color: var(--nv-muted); padding: 16px; border-radius: 12px; background: var(--nv-surface); margin: 8px 0 24px; text-align: center; }
