:root {
  --bg: #f7f1e8;
  --paper: #fffaf3;
  --ink: #2b1a14;
  --muted: #7a6559;
  --accent: #b5562d;
  --line: #e6d9c8;
  --brown: #3a1d16;
  --green: #145a32;
  --green-light: #3ddc84;
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Jost", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* Hero */
.hero {
  background: var(--brown);
  color: #f5e9dc;
  padding: 72px 0 56px;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute; inset: auto -10% -60% auto;
  width: 520px; height: 520px; border-radius: 50%;
  background: radial-gradient(circle, rgba(181, 86, 45, .35), transparent 70%);
  pointer-events: none;
}
.eyebrow {
  text-transform: uppercase; letter-spacing: .18em;
  font-size: .8rem; color: #d9a27f; margin-bottom: 12px;
}
.hero h1 {
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.1; font-weight: 700; max-width: 14ch;
}
.hero h1 span { color: #e9a77f; }
.lead { margin-top: 16px; color: #cdb8a8; max-width: 46ch; font-size: 1.05rem; }

.stats {
  display: flex; flex-wrap: wrap; gap: 14px; margin-top: 36px;
  position: relative; z-index: 1;
}
.stat {
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: var(--radius);
  padding: 14px 20px; min-width: 120px;
}
.stat strong {
  display: block; font-family: "Fraunces", serif;
  font-size: 1.9rem; line-height: 1; color: #fff;
}
.stat span { font-size: .85rem; color: #cdb8a8; }

/* Toolbar */
main.container { flex: 1; padding-top: 32px; padding-bottom: 64px; }
.toolbar {
  display: flex; flex-wrap: wrap; gap: 14px;
  align-items: center; justify-content: space-between;
  margin-bottom: 28px;
}
.tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.tab {
  font: inherit; font-weight: 500; cursor: pointer;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink);
  padding: 8px 18px; border-radius: 999px; transition: .2s;
}
.tab:hover { border-color: var(--accent); }
.tab[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 999px; padding: 8px 16px; flex: 0 1 280px;
}
.search:focus-within { border-color: var(--accent); }
.search svg { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.search input { border: 0; outline: 0; background: transparent; font: inherit; color: var(--ink); width: 100%; }

/* Shelves */
.shelf { margin-bottom: 48px; }
.shelf-head {
  display: flex; align-items: baseline; gap: 12px;
  border-bottom: 2px solid var(--line); padding-bottom: 10px; margin-bottom: 20px;
}
.shelf-head h2 { font-family: "Fraunces", serif; font-size: 2rem; }
.shelf-head span { color: var(--muted); font-size: .95rem; }

.grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.book {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px var(--radius) var(--radius) 6px;
  padding: 20px 18px 18px 30px;
  min-height: 150px;
  display: flex; flex-direction: column;
  box-shadow: 0 2px 0 var(--line);
  transition: transform .25s, box-shadow .25s;
  animation: rise .45s both;
}
.book::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 12px;
  background: var(--spine, var(--accent));
  border-radius: 6px 0 0 6px;
}
.book:hover { transform: translateY(-4px); box-shadow: 0 12px 24px rgba(58, 29, 22, .12); }
.book .num {
  font-family: "Fraunces", serif; font-size: .9rem; color: var(--muted);
}
.book h3 {
  font-family: "Fraunces", serif; font-size: 1.2rem; line-height: 1.25;
  margin: 8px 0 12px;
}
.book .author { font-size: .9rem; color: var(--muted); margin-top: auto; }

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* Footer */
.footer {
  background: var(--brown); color: #cdb8a8;
  border-top: 1px solid rgba(255, 255, 255, .08);
  text-align: center; padding: 32px 0 36px; font-size: .95rem;
}
.credit {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 18px; padding: 10px 22px;
  background: var(--green); color: #fff; text-decoration: none;
  border: 1px solid #2a8a52; border-radius: 999px;
  transition: background .2s, transform .2s;
}
.credit:hover { background: #1b7442; transform: translateY(-2px); }
.credit .heart { color: var(--green-light); }
.credit strong { font-weight: 600; }

@media (max-width: 600px) {
  .hero { padding: 52px 0 40px; }
  .search { flex: 1 1 100%; }
  .grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .book { animation: none; }
}
