@charset "UTF-8";

:root {
  --paper: #f7f6f2;
  --ink: #272c28;
  --muted: #626b5d;
  --line: #e2e3db;
  --accent: #3c5747;
  --wash: #e9ede5;
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; }
button, a, select, input { -webkit-tap-highlight-color: transparent; }
button, select { cursor: pointer; }
button { color: inherit; }
button, input { border-radius: 0; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.skip-link { position: fixed; top: -100px; left: 20px; z-index: 5; padding: 12px 20px; background: var(--ink); color: white; }
.skip-link:focus { top: 16px; }
.toolbar { min-height: 102px; padding: 24px 48px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 32px; }
.collection-stat { display: flex; align-items: center; gap: 13px; min-width: 213px; color: var(--accent); }
.collection-stat span { font-size: 12px; color: var(--muted); letter-spacing: .02em; }
.collection-stat strong { color: var(--ink); font-weight: 550; }
.search { display: flex; gap: 12px; align-items: center; border: 1px solid #d7dad0; border-radius: 6px; height: 46px; padding: 0 15px; width: min(100%, 580px); margin: 0 auto 0 0; background: #ffffff65; color: var(--muted); transition: border-color .18s, background .18s; }
.search:focus-within { border-color: var(--accent); background: #fff; }
.search input { flex: 1; min-width: 0; outline: none; background: transparent; color: var(--ink); border: 0; font-size: 13px; height: 100%; }
.search input::placeholder { color: var(--muted); }
.search input:focus-visible { outline: none; }
.search-shortcut { border: 1px solid var(--line); border-radius: 3px; padding: 0 6px; font-size: 11px; color: #8d9188; }
.sort-control { display: flex; align-items: center; gap: 10px; flex-shrink: 0; font-size: 12px; }
.sort-control label { color: var(--muted); }
select { color: var(--ink); border: 0; background: transparent; padding: 8px 21px 8px 2px; max-width: 100%; }
.layout { display: grid; grid-template-columns: 213px minmax(0,1fr); gap: 32px; padding: 38px 48px 0; max-width: 1920px; margin: auto; }
.section-label { text-transform: uppercase; font-size: 10px; font-weight: 600; letter-spacing: .15em; color: var(--muted); }
.sidebar { align-self: start; position: sticky; top: 32px; max-height: calc(100dvh - 64px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #c7cebf transparent; padding-right: 4px; margin-right: -4px; }
.sidebar > .section-label { padding-left: 11px; margin: 4px 0 19px; }
#genres { display: flex; flex-direction: column; gap: 4px; }
.genre-button { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 9px 11px; min-height: 37px; text-align: left; border: 0; border-radius: 4px; background: transparent; font-size: 12px; line-height: 1.5; transition: background .18s, color .18s; }
.genre-button span:last-child { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 10px; }
.genre-button:hover { background: #eeeee7; }
.genre-button[aria-pressed="true"] { background: var(--wash); color: var(--accent); font-weight: 600; }
.genre-button[aria-pressed="true"] span:last-child { color: var(--accent); }
.genre-button:first-child { margin-bottom: 11px; }
.sidebar-note { margin: 32px 11px; border-top: 1px solid var(--line); padding-top: 24px; color: var(--muted); font-family: var(--serif); font-size: 14px; line-height: 1.6; font-style: italic; }
.results-bar { display: flex; min-height: 37px; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; gap: 16px; }
.results-bar > div { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.results-bar .section-label { color: var(--ink); }
#results-count { font-size: 11px; color: var(--muted); }
.text-button { border: 0; background: none; padding: 0; font-size: 11px; color: var(--accent); white-space: nowrap; }
.text-button span { margin-left: 6px; }
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 34px 27px; align-items: start; }
.book-grid:focus { outline: none; }
.book-card { display: block; min-width: 0; width: 100%; padding: 0; border: 0; text-align: left; background: transparent; }
.cover-wrap { position: relative; aspect-ratio: 1; display: block; border-radius: 4px; background: #e8e7de; box-shadow: 0 3px 5px #252b2210, 0 10px 20px #252b2206; transition: transform .22s ease, box-shadow .22s; }
.book-cover { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 4px; }
.cover-fallback { display: flex; align-items: center; justify-content: center; padding: 24px; width: 100%; height: 100%; background: #dce3d6; color: var(--accent); border-radius: 4px; text-align: center; font: 21px/1.3 var(--serif); }
.cover-open { display: grid; place-items: center; position: absolute; bottom: 12px; right: 12px; width: 31px; height: 31px; border-radius: 50%; color: var(--ink); background: #fffdf6; opacity: 0; transform: translateY(4px); transition: opacity .18s, transform .18s; box-shadow: 0 1px 8px #0002; }
.book-card:hover .cover-wrap, .book-card:focus-visible .cover-wrap { transform: translateY(-4px); box-shadow: 0 8px 16px #252b221b, 0 16px 24px #252b220a; }
.book-card:hover .cover-open, .book-card:focus-visible .cover-open { opacity: 1; transform: none; }
.card-details { display: block; padding: 15px 1px 0; }
.card-author { display: block; color: var(--muted); font-size: 10px; letter-spacing: .025em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 5px; }
.card-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font: 18px/1.25 var(--serif); letter-spacing: -.015em; }
.card-duration { display: block; color: var(--muted); font-size: 10px; margin-top: 8px; font-variant-numeric: tabular-nums; }
.collection-footer { display: flex; justify-content: space-between; gap: 20px; padding: 25px 0 28px; margin-top: 46px; border-top: 1px solid var(--line); font-size: 10px; color: var(--muted); }
.empty-state { padding: 80px 24px 100px; text-align: center; color: var(--muted); }
.empty-state svg { color: #8b9b86; }
.empty-state h1 { margin: 20px 0 10px; color: var(--ink); font: 28px var(--serif); }
.empty-state p { font-size: 13px; margin-bottom: 24px; }
.outline-button { padding: 10px 19px; border: 1px solid var(--line); background: transparent; border-radius: 4px; font-size: 12px; color: var(--accent); }
.mobile-genre { display: none; }

.password-gate { min-height: 100dvh; display: grid; place-items: center; padding: 32px 24px; }
.password-form { width: min(100%, 310px); }
.password-icon { color: var(--accent); margin-bottom: 19px; }
.password-copy { color: var(--muted); font: 22px/1.4 var(--serif); margin: 0 0 29px; }
.password-form label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 8px; }
.password-form input { display: block; width: 100%; height: 46px; padding: 10px 13px; border: 1px solid #cbd1c4; border-radius: 5px; background: #fff9; color: var(--ink); font-size: 16px; }
.password-form input[aria-invalid="true"] { border-color: #a9533f; }
.password-error { color: #9a3d2e; margin: 10px 0 0; font-size: 12px; }
.password-submit { display: flex; justify-content: space-between; align-items: center; width: 100%; margin-top: 17px; min-height: 46px; padding: 10px 15px; border: 1px solid var(--accent); border-radius: 5px; background: var(--accent); color: white; font-size: 12px; transition: background .18s; }
.password-submit:hover { background: #2d4638; }

dialog { border: 1px solid #dbddd5; border-radius: 10px; background: var(--paper); color: var(--ink); width: min(960px, calc(100% - 48px)); max-height: calc(100dvh - 64px); padding: 0; box-shadow: 0 28px 100px #101a1940; overscroll-behavior: contain; }
dialog::backdrop { background: #19221e9c; backdrop-filter: blur(5px); }
body:has(dialog[open]) { overflow: hidden; }
.close-dialog { z-index: 1; position: sticky; top: 17px; display: grid; place-items: center; width: 34px; height: 34px; margin: 17px 17px -51px auto; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--paper); color: var(--muted); transition: color .18s, background .18s; }
.close-dialog:hover { background: var(--wash); color: var(--ink); }
.dialog-layout { display: grid; grid-template-columns: 264px minmax(0, 1fr); gap: 40px; padding: 48px; }
.dialog-artwork { align-self: start; }
#dialog-cover { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 5px; box-shadow: 0 8px 25px #1f291320; background: #e8e7de; }
#downloads { display: flex; flex-direction: column; gap: 8px; margin-top: 24px; }
.download-button { display: flex; align-items: center; justify-content: center; gap: 10px; background: var(--accent); color: white; border: 1px solid var(--accent); border-radius: 5px; min-height: 46px; padding: 10px 12px; text-decoration: none; font-size: 12px; font-weight: 500; transition: background .18s; }
.download-button:hover { background: #2d4638; }
.download-info { text-align: center; color: var(--muted); font-size: 10px; margin: 11px 0 22px; }
.companions { display: flex; flex-direction: column; gap: 9px; }
.companions a { text-decoration-color: #c5ccbc; text-underline-offset: 3px; font-size: 11px; color: var(--accent); overflow-wrap: anywhere; }
.genre-tags { display: flex; flex-wrap: wrap; gap: 6px; padding-right: 15px; margin-bottom: 17px; }
.genre-tag { font-size: 9px; padding: 4px 7px; border: 1px solid #d9dfd0; border-radius: 3px; color: #64725b; line-height: 1.4; }
#book-title { font: 36px/1.12 var(--serif); letter-spacing: -.025em; margin: 0 0 10px; overflow-wrap: anywhere; }
.book-subtitle { font: 17px/1.4 var(--serif); color: var(--muted); margin: 0 0 19px; }
.book-author { font-size: 13px; margin: 20px 0 3px; }
.book-narrator { font-size: 11px; color: var(--muted); margin: 0 0 14px; }
.book-rating { font-size: 10px; color: var(--muted); margin: 14px 0 22px; }
.book-rating .star { color: #a78743; margin-right: 5px; }
.book-rating strong { font-weight: 600; color: var(--ink); }
.metadata-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 24px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 23px 0; margin: 22px 0 27px; }
.metadata-grid div { min-width: 0; }
.metadata-grid dt { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; margin-bottom: 4px; }
.metadata-grid dd { font-size: 11px; margin: 0; overflow-wrap: anywhere; }
.description-label { margin-bottom: 13px; }
.book-description { font-size: 12px; line-height: 1.85; color: #656c61; overflow-wrap: anywhere; }
.book-description p { margin: 0 0 14px; }
.metadata-link { display: inline-block; margin-top: 15px; font-size: 10px; text-decoration: none; color: var(--accent); border-bottom: 1px solid #cbd2c3; padding-bottom: 3px; }

@media (min-width: 1550px) { .book-grid { grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap: 39px 30px; } .toolbar { padding-left: max(48px, calc((100vw - 1824px) / 2)); padding-right: max(48px, calc((100vw - 1824px) / 2)); } }
@media (max-width: 1100px) {
  .toolbar { padding: 22px 30px; gap: 22px; }
  .collection-stat { min-width: 185px; }
  .layout { grid-template-columns: 185px minmax(0,1fr); gap: 22px; padding: 32px 30px 0; }
  .book-grid { gap: 29px 22px; grid-template-columns: repeat(auto-fill,minmax(145px,1fr)); }
  .sort-control label { display: none; }
  .dialog-layout { grid-template-columns: 230px minmax(0,1fr); gap: 30px; padding: 40px; }
}
@media (max-width: 760px) {
  .toolbar { flex-wrap: wrap; padding: 21px 22px; gap: 17px; min-height: auto; }
  .collection-stat { min-width: 0; margin-right: auto; }
  .collection-stat svg { width: 21px; height: 21px; }
  .sort-control { font-size: 11px; }
  .search { order: 3; flex-basis: 100%; width: 100%; height: 44px; }
  .search-shortcut { display: none; }
  .layout { display: block; padding: 24px 22px 0; }
  .sidebar { display: none; }
  .mobile-genre { display: block; margin-bottom: 23px; }
  .mobile-genre select { width: 100%; border: 1px solid #d7dad0; border-radius: 4px; padding: 11px 12px; font-size: 12px; }
  .results-bar { margin-bottom: 14px; min-height: 26px; }
  .book-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 27px 19px; }
  .card-title { font-size: 17px; }
  .card-author { font-size: 9px; }
  dialog { width: calc(100% - 24px); max-height: calc(100dvh - 24px); }
  .dialog-layout { grid-template-columns: 185px minmax(0,1fr); padding: 42px 28px 30px; gap: 25px; }
  #book-title { font-size: 29px; }
  .genre-tags { padding-right: 0; }
}
@media (max-width: 520px) {
  .toolbar { padding: 18px 18px; gap: 16px; }
  .collection-stat { gap: 9px; }
  .collection-stat span { font-size: 10px; }
  .sort-control { font-size: 10px; }
  .sort-control select { padding-right: 3px; }
  .layout { padding: 22px 18px 0; }
  .book-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 27px 20px; }
  .card-details { padding-top: 12px; }
  .card-title { font-size: 18px; }
  .card-author { font-size: 10px; }
  .results-bar > div { gap: 9px; }
  .results-bar .section-label { max-width: 200px; font-size: 9px; }
  #results-count { font-size: 10px; }
  .dialog-layout { display: block; padding: 40px 24px 30px; }
  .dialog-artwork { width: min(100%, 240px); margin: 0 auto 30px; }
  .dialog-details { border-top: 1px solid var(--line); padding-top: 27px; }
  #book-title { font-size: 32px; }
  .genre-tag { font-size: 9px; }
  .metadata-grid { gap: 18px; }
  .metadata-grid dd, .book-description { font-size: 12px; }
  .close-dialog { top: 11px; margin: 11px 11px -45px auto; }
  .collection-footer { font-size: 9px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
