:root {
  --bg: #fcfbf8;
  --card: #ffffff;
  --text: #1d1b2a;
  --muted: #5d5a70;
  --line: #e2ded4;
  --accent: #5b3fd6;
  --on-accent: #ffffff;
  --cover-bg: #e9e5f7;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0c16;
    --card: #171626;
    --text: #ecebf5;
    --muted: #a3a0b8;
    --line: #2a2840;
    --accent: #a999ff;
    --on-accent: #0d0c16;
    --cover-bg: #24223a;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.wrap--narrow { max-width: 760px; }

header { padding: 40px 0 20px; }

.crumb { font-size: 14px; margin: 0 0 14px; }
.crumb a { text-decoration: none; }
.crumb a:hover { text-decoration: underline; }

h1 {
  font: 700 40px/1.1 Georgia, "Iowan Old Style", serif;
  margin: 0;
  letter-spacing: -0.5px;
}

.tagline { font-size: 19px; color: var(--muted); margin: 8px 0 0; }
.intro { max-width: 680px; margin: 16px 0 0; }
.about-link { white-space: nowrap; }

/* Row of links to the shelves. */
.shelves {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  padding: 12px 0;
}
.shelves--sticky {
  position: sticky;
  top: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  z-index: 1;
}
.shelves__label {
  font-size: 14px;
  font-weight: 650;
  color: var(--text);
}
.shelves a {
  font-size: 14px;
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
  white-space: nowrap;
}
.shelves a:hover { color: var(--accent); }

/* Personal picks: badge on a book, and the list on the About page. */
.side {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.pick {
  margin: 0;
  padding: 1px 8px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.picks ul {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.picks li { display: flex; gap: 12px; align-items: center; min-width: 0; }
.picks .cover { width: 72px; height: 108px; }

/* Home page: one block per shelf, with compact cards. */
.shelf { padding-top: 36px; scroll-margin-top: 90px; }
.shelf h2 {
  font: 700 24px/1.2 Georgia, "Iowan Old Style", serif;
  margin: 0 0 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent);
}
.shelf h2 a { color: var(--text); text-decoration: none; }
.shelf h2 a:hover { color: var(--accent); }
.shelf__more { margin: 12px 0 0; font-size: 14px; }

.books {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}
.book {
  display: flex;
  gap: 14px;
  padding: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.cover {
  flex: none;
  width: 96px;
  height: 144px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--cover-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover-empty { font: 700 36px Georgia, serif; color: var(--accent); }
.book__body { min-width: 0; }
.book__title { font-weight: 650; color: var(--text); text-decoration: none; }
.book__title:hover { color: var(--accent); text-decoration: underline; }
.meta { font-size: 13px; color: var(--muted); margin: 2px 0 6px; }
.blurb { font-size: 14px; margin: 0; }
.book__links { font-size: 13px; margin: 8px 0 0; }
.book__links { line-height: 1.7; }
.book__links a { text-decoration: none; }
.book__links a:hover { text-decoration: underline; }

/* Gray "#ad" tag next to every Amazon link. */
.ad { margin-left: 6px; font-size: 12px; color: var(--muted); opacity: 0.6; }

/* Shelf page: one full write-up per book. */
.reviews { list-style: none; margin: 24px 0 0; padding: 0; }
.review {
  display: flex;
  gap: 18px;
  padding: 22px 0;
  border-top: 1px solid var(--line);
  scroll-margin-top: 12px;
}
.review .cover { width: 120px; height: 180px; }
.review h2 {
  font: 700 22px/1.25 Georgia, "Iowan Old Style", serif;
  margin: 0;
}
.review p { margin: 8px 0 0; }
.review .meta { margin: 2px 0 0; }
.next { font-size: 14px; color: var(--muted); }
.buy {
  display: inline-block;
  margin-top: 12px;
  padding: 7px 14px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.buy:hover { filter: brightness(1.1); }

.more-shelves { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.more-shelves h2 {
  font: 700 20px/1.2 Georgia, "Iowan Old Style", serif;
  margin: 0 0 4px;
}

/* About page: plain text content. */
.prose h2 {
  font: 700 20px/1.2 Georgia, "Iowan Old Style", serif;
  margin: 28px 0 0;
}
.prose p { margin: 10px 0 0; }
.prose ul { margin: 10px 0 0; padding-left: 20px; }
.prose li + li { margin-top: 4px; }
.prose .picks ul { padding: 0; }
.prose .picks li { margin: 0; }

footer {
  margin-top: 48px;
  padding: 24px 0 40px;
  border-top: 1px solid var(--line);
}
footer p { margin: 0; }
.footer__small { margin-top: 8px; font-size: 13px; color: var(--muted); }
.footer__small a { color: inherit; }

@media (max-width: 700px) {
  .picks ul { grid-template-columns: 1fr; gap: 12px; }
  .shelves--sticky { position: static; }
  .shelf { scroll-margin-top: 12px; }
}

@media (max-width: 480px) {
  h1 { font-size: 30px; }
  .books { grid-template-columns: 1fr; }
  .cover { width: 72px; height: 108px; }
  .pick { padding: 1px 5px; font-size: 10px; }
  .review { gap: 14px; }
  .review .cover { width: 84px; height: 126px; }
  .review h2 { font-size: 19px; }
}
