:root {
  --ink: #14110e;
  --ink-2: #1c1814;
  --panel: #221c16;
  --line: rgba(212, 184, 132, 0.22);
  --gold: #d4b884;
  --gold-dim: #9a7d4a;
  --paper: #f0e6d4;
  --paper-dim: #cbbfaa;
  --mute: #8f8678;
  --warn: #c45c4a;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --serif: "Source Serif 4", "Iowan Old Style", "Palatino Linotype", Palatino, "Times New Roman", serif;
  --display: "Cormorant Garamond", "Iowan Old Style", Palatino, serif;
  --ui: "Source Serif 4", Georgia, serif;
  --measure: 36rem;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.6;
  min-height: 100%;
}

main { padding-bottom: 3.2rem; }

img { max-width: 100%; display: block; }
a { color: var(--gold); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--paper); }

.wrap {
  width: min(1120px, calc(100% - 2.4rem));
  margin: 0 auto;
}

/* —— Header —— */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 0 1rem;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--paper);
  letter-spacing: 0.08em;
}

.brand strong {
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.35rem;
  letter-spacing: 0.14em;
  text-transform: lowercase;
  white-space: nowrap;
}

.brand span {
  font-size: 0.72rem;
  color: var(--mute);
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.nav {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  font-size: 0.95rem;
}

.nav a { color: var(--paper-dim); text-decoration: none; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--gold); }

.badge-18 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.1rem;
  height: 1.35rem;
  padding: 0 0.4rem;
  border: 1px solid var(--warn);
  color: var(--warn);
  font-family: var(--ui);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  font-weight: 600;
}

/* —— Hero —— */
.hero {
  position: relative;
  margin: 1.6rem 0 2.4rem;
  min-height: 28rem;
  overflow: hidden;
  border: 1px solid var(--line);
}

.hero img {
  width: 100%;
  height: 28rem;
  object-fit: cover;
  filter: saturate(0.85) contrast(1.05);
}

.hero-copy {
  position: absolute;
  inset: auto 0 0 0;
  padding: 2.4rem 1.6rem 1.35rem;
  background: linear-gradient(to top, rgba(20, 17, 14, 0.88), rgba(20, 17, 14, 0.08));
}

.kicker {
  margin: 0 0 0.4rem;
  color: var(--gold);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 0.72rem;
}

.legal table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  margin: 1rem 0;
}

.legal th, .legal td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 0.45rem 0.3rem;
  vertical-align: top;
}

.hero-copy p.kicker {
  margin: 0 0 0.4rem;
  color: var(--gold);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-size: 0.72rem;
}

.hero-copy h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(2.4rem, 6vw, 4.4rem);
  letter-spacing: 0.04em;
  line-height: 0.95;
}

.hero-line {
  margin: 0;
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(1.2rem, 2.4vw, 2rem);
  letter-spacing: 0.03em;
  line-height: 1;
  white-space: nowrap;
  color: var(--paper);
}

.hero-copy .lead {
  max-width: 36rem;
  color: var(--paper-dim);
  margin: 0.8rem 0 0;
}

/* —— Shelf —— */
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin: 0 0 1.2rem;
}

.section-head h1,
.section-head h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 500;
  font-size: 2rem;
  letter-spacing: 0.06em;
}

.section-head p { margin: 0; color: var(--mute); font-size: 0.95rem; }

.shelf {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.8rem;
}

.card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--ink-2);
  border: 1px solid var(--line);
  min-height: 100%;
  color: inherit;
  transition: border-color 0.2s, transform 0.2s;
}

.card:hover {
  border-color: var(--gold-dim);
  transform: translateY(-3px);
  color: inherit;
}

.cover {
  aspect-ratio: 2 / 3;
  background:
    radial-gradient(circle at 30% 20%, rgba(212, 184, 132, 0.12), transparent 45%),
    var(--panel);
  overflow: hidden;
}

.cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-body {
  padding: 1.15rem 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1;
  min-width: 0;
}

.card-body h3 {
  margin: 0.35rem 0 0.7rem;
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.45rem;
  letter-spacing: 0.03em;
  line-height: 1.15;
}

.card-body h3 a {
  color: inherit;
  text-decoration: none;
}

.card-body h3 a:hover { color: var(--gold); }

.card-genre {
  margin: 0;
  color: var(--gold);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.card-volume {
  margin: 0 0 0.85rem;
  color: var(--mute);
  font-size: 0.85rem;
}

.card-blurb {
  margin: 0;
  color: var(--paper-dim);
  font-size: 0.95rem;
  line-height: 1.45;
}

.card-meta {
  margin: 0;
  color: var(--mute);
  font-size: 0.85rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: auto;
  padding-top: 1.1rem;
}

.card .actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

.card .btn {
  width: 100%;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--gold-dim);
  color: var(--gold);
  text-decoration: none;
  font-size: 0.88rem;
  letter-spacing: 0.04em;
  background: transparent;
  cursor: pointer;
  min-width: 0;
  font-family: inherit;
}

.btn:hover { background: rgba(212, 184, 132, 0.1); color: var(--paper); }
.btn.solid { background: var(--gold); color: var(--ink); border-color: var(--gold); }
.btn.solid:hover { background: var(--paper); color: var(--ink); }
.btn.ghost { border-color: var(--line); color: var(--paper-dim); }

/* —— Book page —— */
.book-hero {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 2rem;
  margin: 2rem 0 2.4rem;
}

.book-cover {
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.book-hero h1 {
  margin: 0.35rem 0 0.75rem;
  font-family: var(--display);
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  font-weight: 500;
  line-height: 1;
}

.book-hero .card-volume { margin-bottom: 1.1rem; }

.blurb { color: var(--paper-dim); max-width: 40rem; margin: 0 0 1.2rem; }

.book-hero .actions { padding-top: 0.2rem; }

.wrap > h2 {
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.7rem;
  letter-spacing: 0.04em;
  margin: 0 0 0.8rem;
}

.chapters { list-style: none; padding: 0; margin: 0 0 3rem; }
.chapters li { border-top: 1px solid var(--line); }
.chapters a {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0.1rem;
  color: var(--paper);
  text-decoration: none;
}
.chapters a:hover { color: var(--gold); }
.chapters .n { color: var(--mute); font-variant-numeric: tabular-nums; }

/* —— Reader —— */
.reader-bar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
  color: var(--mute);
}

.chapter {
  width: min(var(--measure), calc(100% - 2rem));
  margin: 2.6rem auto 3rem;
}

.chapter h1 {
  font-family: var(--display);
  font-weight: 500;
  font-size: 2.2rem;
  line-height: 1.2;
  margin: 0 0 1.8rem;
}

.prose {
  font-size: 1.15rem;
  line-height: 1.75;
  letter-spacing: 0.01em;
}

.prose p {
  margin: 0 0 1.15em;
}

.chapter-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  width: min(var(--measure), calc(100% - 2rem));
  margin: 0 auto 4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.chapter-nav a { text-decoration: none; }

/* —— Legal —— */
.legal {
  width: min(42rem, 100%);
  margin: 2rem auto 4rem;
}

.legal h1 {
  font-family: var(--display);
  font-weight: 500;
  font-size: 2.6rem;
  margin: 0 0 1rem;
}

.legal h2 {
  font-family: var(--display);
  font-weight: 500;
  margin: 1.8rem 0 0.6rem;
}

.legal p, .legal li { color: var(--paper-dim); }

.legal p:first-of-type {
  color: var(--paper);
  font-size: 1.08em;
}

/* —— Footer —— */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.4rem 0 2rem;
  color: var(--mute);
  font-size: 0.88rem;
}

.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-footer nav { display: flex; gap: 1rem; }
.site-footer a { color: var(--mute); text-decoration: none; }
.site-footer a:hover { color: var(--gold); }

/* —— Age gate —— */
.gate {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: var(--ink);
  display: grid;
  place-items: center;
}

.gate[hidden] { display: none; }

.gate-card {
  width: min(36rem, calc(100% - 2rem));
  border: 1px solid var(--line);
  background: var(--ink-2);
  overflow: hidden;
}

.gate-card img {
  width: 100%;
  height: 11rem;
  object-fit: cover;
}

.gate-copy { padding: 1.4rem 1.5rem 1.6rem; text-align: center; }

.gate-copy h1 {
  font-family: var(--display);
  font-weight: 500;
  margin: 0.2rem 0 0.6rem;
  font-size: 2.2rem;
}

.gate-copy p { color: var(--paper-dim); margin: 0 0 1rem; }
.gate-actions { display: flex; justify-content: center; gap: 0.7rem; flex-wrap: wrap; }

.denied {
  position: fixed;
  inset: 0;
  background: var(--ink);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 2rem;
}

.denied[hidden] { display: none; }

body.is-reader .nav a { display: none; }

@media (max-width: 900px) {
  .shelf { grid-template-columns: repeat(2, 1fr); }
  .book-hero { grid-template-columns: 160px 1fr; }
  .hero, .hero img { min-height: 20rem; height: 20rem; }
}

@media (max-width: 560px) {
  html { font-size: 17px; }
  .shelf { grid-template-columns: 1fr; gap: 1.1rem; }
  .nav { gap: 0.7rem; font-size: 0.85rem; }
  .book-hero { grid-template-columns: 1fr; }
  .book-cover { max-width: 220px; }
  .hero-copy { padding: 1.6rem 1rem 1.1rem; }
}
