:root {
  --paper: #f3f0e8;
  --paper-strong: #fffdf8;
  --ink: #17211f;
  --muted: #65706c;
  --line: rgba(23, 33, 31, .14);
  --accent: #a6613d;
  --shadow: 0 24px 60px rgba(25, 34, 31, .12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: radial-gradient(circle at top right, rgba(166,97,61,.09), transparent 32rem), var(--paper); }
a { color: inherit; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.site-header { height: 82px; max-width: 1480px; margin: 0 auto; padding: 0 42px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; gap: 12px; align-items: center; text-decoration: none; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--ink); border-radius: 50%; font-family: Georgia, serif; font-size: 14px; }
.brand strong, .brand small { display: block; line-height: 1; }
.brand strong { font-family: Georgia, serif; font-size: 21px; }
.brand small { margin-top: 5px; color: var(--muted); text-transform: uppercase; letter-spacing: .22em; font-size: 10px; }
.header-link { text-decoration: none; font-size: 13px; text-transform: uppercase; letter-spacing: .12em; border-bottom: 1px solid currentColor; padding-bottom: 4px; }
main { max-width: 1480px; margin: 0 auto; padding: 0 42px 80px; }
.hero { min-height: 530px; padding: 90px 0 70px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 520px); align-items: end; gap: 60px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.eyebrow { margin: 0 0 22px; color: var(--accent); font-weight: 750; font-size: 11px; letter-spacing: .23em; }
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; }
h1 { margin: 0; max-width: 930px; font-size: clamp(52px, 7vw, 112px); line-height: .92; letter-spacing: -.055em; font-weight: 500; }
.hero-copy > p:last-child { max-width: 650px; margin: 36px 0 0; color: var(--muted); font-size: clamp(17px, 1.6vw, 23px); line-height: 1.55; }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); background: rgba(255,255,255,.25); }
.hero-stats div { min-height: 130px; padding: 25px 22px; display: flex; flex-direction: column; justify-content: space-between; border-right: 1px solid var(--line); }
.hero-stats div:last-child { border-right: 0; }
.hero-stats strong { font-family: Georgia, serif; font-weight: 500; font-size: 30px; }
.hero-stats span { color: var(--muted); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
.library { padding-top: 94px; }
.library-heading { display: grid; grid-template-columns: 1fr minmax(300px, 520px); gap: 40px; align-items: end; }
h2 { margin: 0; font-size: clamp(40px, 5vw, 72px); line-height: 1; font-weight: 500; letter-spacing: -.04em; }
.search-box { height: 58px; display: flex; align-items: center; gap: 14px; border-bottom: 1px solid var(--ink); }
.search-box svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; font-size: 17px; color: var(--ink); }
.search-box input::placeholder { color: #8a928f; }
.toolbar { margin-top: 48px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.categories { display: flex; flex-wrap: wrap; gap: 9px; }
.category-chip { border: 1px solid var(--line); border-radius: 999px; padding: 9px 15px; color: var(--muted); background: rgba(255,255,255,.2); cursor: pointer; transition: .18s ease; }
.category-chip:hover, .category-chip.active { color: var(--paper-strong); border-color: var(--ink); background: var(--ink); }
.sort-control { display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: 13px; }
.sort-control select { border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); padding: 7px 25px 7px 4px; }
.results-summary { min-height: 22px; margin: 34px 0 22px; color: var(--muted); font-size: 13px; }
.book-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 44px 24px; }
.book-card { min-width: 0; }
.cover-button { display: block; width: 100%; padding: 0; border: 0; background: transparent; cursor: pointer; }
.book-cover { display: block; width: 100%; aspect-ratio: 5 / 8; object-fit: cover; box-shadow: 0 17px 38px rgba(24,30,27,.16); transition: transform .22s ease, box-shadow .22s ease; }
.cover-button:hover .book-cover { transform: translateY(-6px); box-shadow: var(--shadow); }
.book-meta { padding-top: 18px; }
.book-category { color: var(--accent); font-size: 10px; font-weight: 750; letter-spacing: .16em; text-transform: uppercase; }
.book-title { margin: 9px 0 0; font-size: 24px; line-height: 1.04; letter-spacing: -.02em; font-weight: 500; }
.book-subtitle { min-height: 0; margin: 5px 0 0; color: var(--muted); font-family: Georgia, serif; font-style: italic; font-size: 13px; }
.book-subtitle:empty { display: none; }
.book-author { margin: 9px 0 0; color: var(--muted); font-size: 13px; }
.book-actions { margin-top: 17px; display: flex; flex-wrap: wrap; gap: 8px; }
.button { min-height: 38px; padding: 10px 13px; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; border: 1px solid var(--ink); font-size: 12px; font-weight: 700; transition: .18s ease; }
.button.primary { background: var(--ink); color: var(--paper-strong); }
.button.primary:hover { background: var(--accent); border-color: var(--accent); }
.button.secondary:hover { background: var(--paper-strong); }
.empty-state { padding: 90px 20px; text-align: center; border: 1px solid var(--line); }
.empty-state h3 { margin: 0; font-size: 34px; }
.empty-state p { color: var(--muted); }
.book-dialog { width: min(920px, calc(100vw - 32px)); padding: 0; border: 0; background: var(--paper-strong); color: var(--ink); box-shadow: 0 32px 110px rgba(10,18,15,.4); }
.book-dialog::backdrop { background: rgba(15,22,20,.68); backdrop-filter: blur(5px); }
.dialog-close { position: absolute; right: 18px; top: 14px; z-index: 2; width: 42px; height: 42px; border: 0; border-radius: 50%; background: rgba(255,255,255,.75); font-size: 28px; cursor: pointer; }
.dialog-layout { display: grid; grid-template-columns: minmax(260px, 38%) 1fr; }
.dialog-layout img { width: 100%; height: 100%; min-height: 600px; object-fit: cover; }
.dialog-copy { padding: 72px 58px 50px; }
.dialog-copy h2 { font-size: clamp(42px, 6vw, 72px); }
.dialog-copy .dialog-author { margin-top: 18px; color: var(--muted); font-size: 17px; }
.dialog-copy .dialog-description { margin: 38px 0; color: #4e5955; line-height: 1.75; }
.dialog-details { padding-top: 22px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
footer { max-width: 1480px; margin: 0 auto; padding: 30px 42px 44px; display: flex; justify-content: space-between; gap: 30px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
@media (max-width: 1180px) { .book-grid { grid-template-columns: repeat(4, 1fr); } .hero { grid-template-columns: 1fr; } .hero-stats { max-width: 640px; } }
@media (max-width: 900px) { .book-grid { grid-template-columns: repeat(3, 1fr); } .library-heading { grid-template-columns: 1fr; } .dialog-layout { grid-template-columns: 1fr; } .dialog-layout img { max-height: 540px; min-height: 0; object-position: top; } }
@media (max-width: 680px) {
  .site-header, main, footer { padding-left: 20px; padding-right: 20px; }
  .site-header { height: 70px; }
  .header-link { display: none; }
  .hero { min-height: auto; padding: 58px 0; }
  h1 { font-size: clamp(47px, 16vw, 72px); }
  .hero-stats { grid-template-columns: 1fr; }
  .hero-stats div { min-height: 90px; border-right: 0; border-bottom: 1px solid var(--line); }
  .hero-stats div:last-child { border-bottom: 0; }
  .library { padding-top: 64px; }
  .toolbar { align-items: flex-start; flex-direction: column; }
  .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 36px 14px; }
  .book-title { font-size: 20px; }
  .book-actions { flex-direction: column; }
  .button { width: 100%; }
  .dialog-copy { padding: 56px 26px 35px; }
  footer { flex-direction: column; }
}
@media (max-width: 390px) { .book-grid { grid-template-columns: 1fr; } .book-cover { max-width: 280px; margin: 0 auto; } }
