:root {
  --bg: #f4f0e8;
  --paper: #fffdf8;
  --ink: #18211d;
  --muted: #68716c;
  --deep: #121b18;
  --accent: #b78d4a;
  --line: rgba(24, 33, 29, .12);
  --shadow: 0 20px 55px rgba(28, 32, 29, .11);
  --radius: 20px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
a { color: inherit; }
.hidden { display: none !important; }

.site-header {
  min-height: 76px;
  padding: 14px clamp(20px, 4vw, 64px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(18, 27, 24, .98);
  color: #fff;
}
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  color: var(--deep); background: #d6b16e;
  font-family: Georgia, serif; font-size: 23px; font-weight: 700;
}
.brand-copy { display: grid; gap: 1px; }
.brand-copy strong { font-size: 15px; letter-spacing: .01em; }
.brand-copy small { color: rgba(255,255,255,.64); font-size: 12px; }
.header-link { color: rgba(255,255,255,.82); text-decoration: none; font-size: 14px; }
.header-link:hover { color: #fff; }

.hero {
  padding: clamp(66px, 9vw, 126px) 24px;
  background:
    radial-gradient(circle at 82% 15%, rgba(183,141,74,.24), transparent 31%),
    linear-gradient(145deg, #17231f 0%, #0e1613 78%);
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.hero-inner { max-width: 960px; margin: 0 auto; text-align: center; }
.eyebrow, .section-kicker {
  margin: 0 0 13px;
  font-weight: 750; font-size: 12px; letter-spacing: .17em;
  color: var(--accent);
}
.hero h1 {
  max-width: 860px; margin: 0 auto;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(42px, 6vw, 76px);
  line-height: .99; font-weight: 500; letter-spacing: -.035em;
}
.hero h1 span { color: #dfc18b; }
.hero-text {
  max-width: 690px; margin: 25px auto 31px;
  color: rgba(255,255,255,.72); line-height: 1.65;
  font-size: clamp(16px, 2vw, 19px);
}
.primary-button, .secondary-button {
  min-height: 50px; padding: 0 20px;
  border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none; font-weight: 740; font-size: 14px;
  transition: .18s ease;
}
.primary-button { background: #d1aa63; color: #17201d; }
.primary-button:hover { transform: translateY(-1px); background: #dfbd7d; }
.secondary-button { border: 1px solid var(--line); background: #fff; color: var(--ink); }
.secondary-button:hover { border-color: rgba(24,33,29,.3); }

.catalog-section, .continue-section {
  max-width: 1240px; margin: 0 auto;
  padding: clamp(54px, 7vw, 90px) 24px;
}
.continue-section { padding-bottom: 0; }
.section-head {
  display: flex; gap: 24px; justify-content: space-between; align-items: end;
  margin-bottom: 34px;
}
.section-head.compact { margin-bottom: 18px; }
.section-head h2 {
  margin: 0; font-family: Georgia, serif; font-size: clamp(32px, 4vw, 48px); font-weight: 500;
}
.book-count { margin: 7px 0 0; color: var(--muted); font-size: 14px; }
.catalog-tools { display: flex; gap: 10px; align-items: center; }
.search-box {
  width: min(360px, 36vw); height: 46px; padding: 0 14px;
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.72);
}
.search-box span { color: var(--muted); font-size: 20px; transform: rotate(-15deg); }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); }
.sort-select {
  height: 46px; border: 1px solid var(--line); border-radius: 12px;
  background: rgba(255,255,255,.72); color: var(--ink); padding: 0 36px 0 12px;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(24px, 3vw, 42px) clamp(16px, 2.2vw, 28px);
}
.book-card { min-width: 0; }
.cover-button {
  position: relative; width: 100%; padding: 0; border: 0; background: none;
  cursor: pointer; border-radius: 5px 12px 12px 5px; overflow: hidden;
  box-shadow: 0 13px 28px rgba(35,34,29,.15);
  aspect-ratio: 2 / 3;
  transition: transform .2s ease, box-shadow .2s ease;
}
.cover-button:hover { transform: translateY(-5px); box-shadow: 0 20px 35px rgba(35,34,29,.2); }
.book-cover { width: 100%; height: 100%; display: block; object-fit: cover; }
.cover-overlay {
  position: absolute; inset: auto 10px 10px; min-height: 38px;
  display: grid; place-items: center;
  color: #fff; background: rgba(9,15,12,.86); border: 1px solid rgba(255,255,255,.12);
  border-radius: 9px; opacity: 0; transform: translateY(6px);
  font-size: 12px; font-weight: 750; transition: .18s ease;
}
.cover-button:hover .cover-overlay, .cover-button:focus-visible .cover-overlay { opacity: 1; transform: none; }
.book-card-copy { padding-top: 14px; }
.book-card-copy h3 { margin: 0 0 4px; font-family: Georgia, serif; font-size: 18px; line-height: 1.18; font-weight: 600; }
.book-card-copy p { margin: 0; color: var(--muted); font-size: 13px; }
.mini-progress { height: 3px; margin-top: 9px; background: rgba(24,33,29,.11); overflow: hidden; border-radius: 999px; }
.mini-progress span { display: block; height: 100%; background: var(--accent); }
.empty-state { padding: 65px 20px; border: 1px dashed var(--line); text-align: center; border-radius: 18px; }
.empty-state strong, .empty-state span { display: block; }
.empty-state span { margin-top: 6px; color: var(--muted); }

.continue-card {
  display: grid; grid-template-columns: 86px 1fr auto; gap: 18px; align-items: center;
  max-width: 620px; padding: 16px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 10px 28px rgba(28,32,29,.05); text-decoration: none;
}
.continue-card img { width: 86px; aspect-ratio: 2/3; object-fit: cover; border-radius: 4px 7px 7px 4px; }
.continue-copy { min-width: 0; }
.continue-copy > span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 12px; }
.continue-copy strong { display: block; margin-bottom: 12px; font-family: Georgia, serif; font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress-track { height: 5px; background: #e6e1d7; border-radius: 999px; overflow: hidden; }
.progress-track span { display: block; height: 100%; background: var(--accent); }
.continue-copy small { display: block; margin-top: 5px; color: var(--muted); }
.continue-arrow { padding: 0 10px; font-size: 24px; }

.site-footer {
  margin-top: 10px; padding: 32px 24px;
  display: flex; justify-content: center; gap: 12px; flex-wrap: wrap;
  background: var(--deep); color: rgba(255,255,255,.64); font-size: 13px;
}
.site-footer strong { color: #fff; }

.modal { position: fixed; inset: 0; z-index: 50; display: none; }
.modal.is-open { display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(5,10,8,.73); backdrop-filter: blur(7px); }
.modal-panel {
  position: relative; z-index: 1; width: min(820px, 100%); max-height: calc(100vh - 40px); overflow: auto;
  background: var(--paper); border-radius: 22px; box-shadow: var(--shadow);
}
.modal-close {
  position: absolute; top: 14px; right: 14px; z-index: 2;
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: rgba(255,255,255,.92);
  cursor: pointer; font-size: 25px; line-height: 1;
}
.modal-layout { display: grid; grid-template-columns: 250px 1fr; gap: 38px; padding: 36px; align-items: center; }
.modal-cover { width: 100%; aspect-ratio: 2/3; object-fit: cover; border-radius: 5px 12px 12px 5px; box-shadow: 0 18px 32px rgba(20,22,20,.2); }
.modal-meta { margin: 0 0 8px; color: var(--accent); font-size: 12px; font-weight: 760; letter-spacing: .08em; text-transform: uppercase; }
.modal-content h2 { margin: 0; font-family: Georgia, serif; font-size: clamp(34px, 5vw, 52px); line-height: 1.02; font-weight: 500; }
.modal-description { margin: 19px 0 25px; color: var(--muted); line-height: 1.65; }
.modal-actions { display: flex; gap: 10px; flex-wrap: wrap; }
body.modal-open { overflow: hidden; }

@media (max-width: 980px) {
  .book-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .section-head { align-items: stretch; flex-direction: column; }
  .catalog-tools { width: 100%; }
  .search-box { flex: 1; width: auto; }
}

@media (max-width: 720px) {
  .site-header { min-height: 68px; padding: 11px 16px; }
  .brand-mark { width: 38px; height: 38px; }
  .brand-copy small, .header-link { display: none; }
  .hero { padding: 62px 20px 70px; }
  .hero h1 { font-size: clamp(40px, 12vw, 58px); }
  .hero-text { font-size: 16px; }
  .catalog-section, .continue-section { padding-left: 16px; padding-right: 16px; }
  .catalog-tools { display: grid; grid-template-columns: 1fr; }
  .search-box, .sort-select { width: 100%; }
  .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 31px 15px; }
  .book-card-copy { padding-top: 10px; }
  .book-card-copy h3 { font-size: 16px; }
  .cover-overlay { display: none; }
  .modal.is-open { align-items: end; padding: 0; }
  .modal-panel { width: 100%; max-height: 92vh; border-radius: 22px 22px 0 0; }
  .modal-layout { grid-template-columns: 120px 1fr; gap: 18px; padding: 28px 18px 24px; align-items: start; }
  .modal-content h2 { padding-right: 35px; font-size: 31px; }
  .modal-description { grid-column: 1 / -1; }
  .modal-actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; }
  .continue-card { grid-template-columns: 66px 1fr auto; gap: 12px; padding: 12px; }
  .continue-card img { width: 66px; }
  .continue-copy strong { font-size: 17px; }
}
