@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600&family=Libre+Caslon+Display&display=swap");

:root {
  --ink: #19211d;
  --muted: #647069;
  --paper: #f8f4eb;
  --paper-deep: #ece4d5;
  --green: #173d2a;
  --green-soft: #dce7de;
  --rust: #b8502e;
  --white: #fffdf7;
  --line: rgba(25, 33, 29, 0.14);
  --shadow: 0 18px 50px rgba(35, 38, 31, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "DM Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

.hero {
  min-height: 680px;
  color: var(--white);
  background:
    radial-gradient(circle at 83% 20%, rgba(197, 127, 63, 0.28), transparent 29rem),
    linear-gradient(135deg, #102c20, var(--green) 58%, #244d35);
  padding: 0 max(5vw, 28px) 72px;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.topbar {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.topbar > div { display: flex; justify-content: flex-end; gap: 28px; }
.topbar a { text-decoration: none; }
.topbar a:hover, .topbar a[aria-current="page"] { color: #eacb9e; }
.wordmark { font-family: "Libre Caslon Display", Georgia, serif; font-size: 1.45rem; }

.hero-copy { align-self: center; max-width: 960px; padding: 68px 0; }
.eyebrow { margin: 0 0 20px; text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.73rem; font-weight: 600; }
.hero h1 { margin: 0; font: 400 clamp(4rem, 9vw, 8.5rem)/0.88 "Libre Caslon Display", Georgia, serif; letter-spacing: -0.045em; }
.hero h1 em { color: #eacb9e; font-weight: 400; }
.lede { max-width: 710px; margin: 34px 0 0; font-size: clamp(1.02rem, 2vw, 1.28rem); line-height: 1.65; color: rgba(255, 253, 247, 0.78); }
.release-note {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 0;
  padding: 11px 15px;
  border: 1px solid rgba(234, 203, 158, 0.52);
  border-radius: 999px;
  background: rgba(255, 253, 247, 0.1);
  box-shadow: 0 8px 30px rgba(5, 25, 16, 0.18);
}
.release-note span { color: rgba(255, 253, 247, 0.84); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.11em; text-transform: uppercase; }
.release-note time { color: #f3d2a3; font-size: 1rem; font-weight: 700; font-variant-numeric: tabular-nums; }

.stats { margin: 0; display: flex; gap: clamp(30px, 6vw, 90px); }
.stats div { display: grid; }
.stats dt { font: 400 2rem/1 "Libre Caslon Display", Georgia, serif; }
.stats dd { margin: 7px 0 0; color: rgba(255, 253, 247, 0.64); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; }

main { max-width: 1500px; margin: 0 auto; padding: 94px max(4vw, 24px) 120px; }
.catalog-heading { display: flex; align-items: end; justify-content: space-between; gap: 28px; }
.catalog-heading h2 { margin: 0; font: 400 clamp(2.7rem, 5vw, 5rem)/1 "Libre Caslon Display", Georgia, serif; }
.catalog-heading .eyebrow { color: var(--rust); }

.search input {
  width: min(420px, 40vw);
  padding: 14px 2px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--ink);
  border-radius: 0;
  font: inherit;
  outline: none;
}
.search input:focus { border-bottom-color: var(--rust); box-shadow: 0 2px 0 var(--rust); }

.filters { display: flex; gap: 9px; flex-wrap: wrap; margin: 42px 0 18px; }
.filters button {
  padding: 9px 14px;
  color: var(--green);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  font: 500 0.78rem/1 "DM Sans", sans-serif;
}
.filters button span { margin-left: 5px; opacity: 0.6; }
.filters button:hover, .filters button.active { color: var(--white); background: var(--green); border-color: var(--green); }
.result-count { margin: 0 0 26px; color: var(--muted); font-size: 0.85rem; }

.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(245px, 1fr)); gap: 38px 24px; }
.book-card { min-width: 0; }
.book-card[hidden] { display: none; }
.cover-wrap { aspect-ratio: 0.72; display: grid; place-items: center; padding: 9%; overflow: hidden; background: var(--paper-deep); border: 1px solid var(--line); }
.cover { display: block; width: 100%; height: 100%; object-fit: contain; filter: saturate(0.9); box-shadow: var(--shadow); transition: transform 220ms ease; }
.book-card:hover .cover { transform: translateY(-4px) rotate(-0.3deg); }
.book-copy { padding: 20px 2px 0; }
.category-label { margin: 0 0 9px; color: var(--rust); font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.09em; }
.book-card h3 { margin: 0; font: 400 1.56rem/1.08 "Libre Caslon Display", Georgia, serif; }
.author { min-height: 2.6em; margin: 8px 0 10px; color: var(--muted); font-size: 0.88rem; line-height: 1.45; }
.upload-date { margin: 0 0 17px; color: var(--muted); font-size: 0.74rem; line-height: 1.4; }
.upload-date span { color: var(--ink); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.upload-date time { color: var(--rust); font-weight: 600; }
.card-actions { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; }
.download { display: flex; justify-content: space-between; gap: 10px; padding: 11px 13px; color: var(--white); background: var(--green); text-decoration: none; font-size: 0.78rem; font-weight: 600; }
.download:hover { background: var(--rust); }
.download span { opacity: 0.68; font-weight: 400; }
.source { color: var(--muted); font-size: 0.72rem; text-underline-offset: 3px; }
.empty-state { padding: 70px 0; font: 400 2rem "Libre Caslon Display", Georgia, serif; text-align: center; }

.spec-hero {
  color: var(--white);
  background:
    radial-gradient(circle at 78% 12%, rgba(197, 127, 63, 0.25), transparent 25rem),
    linear-gradient(135deg, #102c20, var(--green) 62%, #244d35);
  padding: 0 max(5vw, 28px);
}
.spec-hero-copy { max-width: 1000px; padding: 72px 0 84px; }
.spec-hero h1 { max-width: 820px; margin: 0; font: 400 clamp(3.6rem, 8vw, 7.5rem)/0.92 "Libre Caslon Display", Georgia, serif; letter-spacing: -0.04em; }
.spec-lede { max-width: 760px; margin: 30px 0 0; color: rgba(255, 253, 247, 0.78); font-size: clamp(1rem, 2vw, 1.2rem); line-height: 1.65; }
.spec-lede code { color: var(--white); }
.spec-actions { display: flex; align-items: center; gap: 24px; margin-top: 34px; font-size: 0.84rem; }
.spec-actions a { text-underline-offset: 4px; }
.spec-action-primary { padding: 12px 16px; color: var(--green); background: #eacb9e; text-decoration: none; font-weight: 600; }
.spec-action-primary:hover { color: var(--white); background: var(--rust); }

.spec-main { max-width: none; margin: 0; padding: 0; }
.spec-layout { display: grid; grid-template-columns: minmax(180px, 250px) minmax(0, 820px); justify-content: center; gap: clamp(48px, 8vw, 120px); max-width: 1380px; margin: 0 auto; padding: 84px max(5vw, 28px) 120px; }
.spec-sidebar { min-width: 0; }
.spec-toc { position: sticky; top: 28px; padding-top: 8px; color: var(--muted); font-size: 0.78rem; line-height: 1.45; }
.spec-toc > p { margin: 0 0 16px; color: var(--rust); font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em; }
.spec-toc ul { margin: 0; padding: 0; list-style: none; }
.spec-toc ul ul { padding-left: 14px; }
.spec-toc li { margin: 8px 0; }
.spec-toc a { text-decoration: none; }
.spec-toc a:hover { color: var(--rust); }

.spec-content { min-width: 0; font-size: 1rem; line-height: 1.75; overflow-wrap: anywhere; }
.spec-content h2 { margin: 2.2em 0 0.6em; font: 400 clamp(2.2rem, 5vw, 3.5rem)/1 "Libre Caslon Display", Georgia, serif; letter-spacing: -0.025em; }
.spec-content h2:first-child { margin-top: 0; }
.spec-content h3 { margin: 2em 0 0.7em; font: 400 1.65rem/1.15 "Libre Caslon Display", Georgia, serif; }
.spec-content h4 { margin: 1.8em 0 0.6em; font-size: 1rem; }
.spec-content p, .spec-content ul, .spec-content ol { margin: 0 0 1.15em; }
.spec-content li + li { margin-top: 0.36em; }
.spec-content a { color: var(--rust); text-underline-offset: 3px; }
.spec-content .headerlink { margin-left: 0.28em; color: var(--muted); text-decoration: none; opacity: 0; }
.spec-content h2:hover .headerlink, .spec-content h3:hover .headerlink, .spec-content .headerlink:focus { opacity: 1; }
.spec-content blockquote { margin: 0 0 2em; padding: 20px 24px; color: var(--green); background: var(--green-soft); border-left: 4px solid var(--green); }
.spec-content blockquote p:last-child { margin-bottom: 0; }
.spec-content code { padding: 0.12em 0.3em; background: var(--paper-deep); border-radius: 3px; font-size: 0.88em; }
.spec-content pre { max-width: 100%; margin: 1.4em 0 2em; padding: 20px; overflow-x: auto; color: #edf4ed; background: #15251d; border-radius: 4px; line-height: 1.55; }
.spec-content pre code, footer code { padding: 0; color: inherit; background: transparent; }
.spec-content table { display: block; width: 100%; margin: 1.5em 0 2.2em; overflow-x: auto; border-collapse: collapse; }
.spec-content th, .spec-content td { min-width: 150px; padding: 11px 13px; text-align: left; vertical-align: top; border: 1px solid var(--line); }
.spec-content th { color: var(--green); background: var(--green-soft); }

footer { display: flex; justify-content: space-between; gap: 40px; padding: 52px max(5vw, 28px); color: rgba(255, 253, 247, 0.7); background: #101a15; font-size: 0.78rem; line-height: 1.55; }
footer p { max-width: 620px; }

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

@media (max-width: 720px) {
  .hero { min-height: 610px; }
  .topbar { gap: 18px; }
  .topbar > div { flex-wrap: wrap; gap: 8px 15px; font-size: 0.82rem; }
  .catalog-heading { align-items: stretch; flex-direction: column; }
  .search input { width: 100%; }
  .stats { gap: 24px; }
  .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 30px 14px; }
  .cover-wrap { padding: 6%; }
  .book-card h3 { font-size: 1.2rem; }
  .card-actions { grid-template-columns: 1fr; }
  .source { padding-left: 2px; }
  .spec-hero-copy { padding: 56px 0 64px; }
  .spec-hero h1 { font-size: clamp(3.2rem, 15vw, 5rem); }
  .spec-actions { align-items: flex-start; flex-direction: column; gap: 16px; }
  .spec-layout { grid-template-columns: 1fr; gap: 48px; padding-top: 58px; }
  .spec-toc { position: static; }
  .spec-content h2 { font-size: 2.35rem; }
  footer { flex-direction: column; }
}

@media (max-width: 430px) {
  .book-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 3.6rem; }
  .release-note { align-items: flex-start; flex-direction: column; gap: 4px; border-radius: 14px; }
}
