:root {
  --paper: #faf6ef;
  --card: #fffdf9;
  --ink: #2a2320;
  --muted: #6b5f57;
  --line: #e6dccd;
  --accent: #7a2e3a;
  --accent-ink: #fffdf9;
  --shadow: 0 1px 2px rgb(42 35 32 / 0.08), 0 6px 18px rgb(42 35 32 / 0.10);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1b1716;
    --card: #24201e;
    --ink: #efe7dc;
    --muted: #b3a597;
    --line: #3a312d;
    --accent: #e0939f;
    --accent-ink: #1b1716;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 6px 18px rgb(0 0 0 / 0.35);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1.0625rem/1.55 var(--serif);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
main { flex: 1; padding-block: 2rem 4rem; }
img { max-width: 100%; display: block; }
a { color: var(--accent); text-underline-offset: 0.15em; }
[hidden] { display: none !important; }

.wrap { max-width: 72rem; margin-inline: auto; padding-inline: 1.25rem; }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--card); padding: 0.5rem 1rem; z-index: 10; }

/* Header */
.site-header { border-bottom: 1px solid var(--line); }
.header-inner {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: 0.5rem 1.5rem; padding-block: 1.1rem;
}
.wordmark {
  font-size: 1.6rem; letter-spacing: 0.01em; color: var(--ink); text-decoration: none;
}
.wordmark em { color: var(--accent); }
nav { display: flex; gap: 1.25rem; font-family: var(--sans); font-size: 0.95rem; }
nav a { color: var(--muted); text-decoration: none; padding-block: 0.25rem; }
nav a:hover { color: var(--ink); }
nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px var(--accent); }

/* Intro */
.intro { max-width: 40rem; margin-bottom: 2rem; }
.intro h1 { font-size: clamp(1.9rem, 4.5vw, 2.8rem); line-height: 1.15; font-weight: normal; margin: 0 0 0.6rem; }
.intro h1 em { color: var(--accent); }
.intro p { color: var(--muted); margin: 0; font-size: 1.15rem; }

/* Toggle */
.toggle {
  display: inline-flex; padding: 0.25rem; gap: 0.25rem; margin-bottom: 1.75rem;
  border: 1px solid var(--line); border-radius: 999px; background: var(--card);
  font-family: var(--sans);
}
.toggle button {
  font: inherit; font-size: 0.95rem; border: 0; border-radius: 999px; cursor: pointer;
  padding: 0.5rem 1rem; background: transparent; color: var(--muted);
}
.toggle button:hover { color: var(--ink); }
.toggle button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.toggle .count { font-size: 0.8em; opacity: 0.75; margin-left: 0.2em; }

/* Shelves. Without JS both are shown, each with its heading; with JS the toggle replaces the headings. */
.shelf + .shelf { margin-top: 3rem; }
.shelf h2 { font-weight: normal; font-size: 1.4rem; margin: 0 0 1rem; }
.js .shelf h2 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.js .shelf + .shelf { margin-top: 0; }
.empty { color: var(--muted); font-style: italic; }

/* Book grid */
.books {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 2.25rem 1.5rem;
}
@media (max-width: 30rem) {
  .books { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.75rem 1rem; }
}
.book { display: flex; flex-direction: column; }
/* Same-sized slot for every cover; the whole cover is shown at its own proportions,
   centred and sitting on the bottom edge so titles below still line up. */
.cover {
  display: flex; align-items: flex-end; justify-content: center;
  aspect-ratio: 2 / 3;
}
.cover img {
  width: auto; height: auto; max-width: 100%; max-height: 100%;
  border-radius: 3px; box-shadow: var(--shadow);
  transition: transform 0.15s ease;
}
.book:hover .cover img { transform: translateY(-3px); }
.cover-blank {
  display: flex; align-items: center; justify-content: center; width: 100%; height: 100%;
  padding: 1rem; text-align: center; color: var(--muted); font-style: italic;
  background: var(--line); border-radius: 3px; box-shadow: var(--shadow);
}
.book-body { padding-top: 0.8rem; }
.book-title { font-size: 1.08rem; line-height: 1.25; margin: 0; font-weight: 600; }
.book-title a { color: var(--ink); text-decoration: none; }
.book-title a:hover { color: var(--accent); text-decoration: underline; }
.book-sub { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.88rem; font-style: italic; line-height: 1.3; }
.book-author { margin: 0.45rem 0 0; font-size: 0.95rem; }
.book-author a { color: var(--ink); text-decoration: none; }
.book-author a:hover { color: var(--accent); text-decoration: underline; }
.book-meta { margin: 0.2rem 0 0; color: var(--muted); font-family: var(--sans); font-size: 0.8rem; }
/* Star rating: five stars, filled in proportion to --r (0–5), so 4.6 shows 4.6 stars. */
.book-rating {
  margin: 0.3rem 0 0; display: flex; align-items: center; gap: 0.35rem;
  font-family: var(--sans); font-size: 0.8rem; color: var(--muted);
}
.stars {
  --star: var(--accent);
  font-size: 0.85rem; letter-spacing: 0.05em; line-height: 1;
  background: linear-gradient(90deg, var(--star) calc(var(--r) / 5 * 100%), var(--line) 0);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* Pager (added by site.js) */
.pager { margin-top: 2.5rem; display: flex; flex-direction: column; align-items: center; gap: 0.6rem; font-family: var(--sans); }
.pager-buttons { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0.35rem; }
.pager button {
  font: inherit; font-size: 0.9rem; min-width: 2.4rem; height: 2.4rem; padding: 0 0.7rem;
  border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--ink); cursor: pointer;
}
.pager button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.pager button[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pager button:disabled { opacity: 0.4; cursor: default; }
.pager-gap { color: var(--muted); padding: 0 0.15rem; }
.pager-status { margin: 0; color: var(--muted); font-size: 0.82rem; }
@media (max-width: 30rem) {
  .pager-step { flex-basis: calc(50% - 0.2rem); order: 1; }  /* Previous/Next on their own row below the numbers */
}
.toggle { scroll-margin-top: 1rem; }

/* Authors */
.authors { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); }
.author {
  display: flex; gap: 1.1rem; align-items: flex-start;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 1.25rem;
  scroll-margin-top: 1rem;
}
.author:target { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.author-photo { width: 5rem; height: 5rem; border-radius: 50%; object-fit: cover; flex: none; background: var(--line); }
.author-initial { display: flex; align-items: center; justify-content: center; font-size: 2rem; color: var(--muted); }
.author-body { min-width: 0; flex: 1; }
.author h2 { font-weight: 600; font-size: 1.25rem; margin: 0; }
.author-counts { margin: 0.2rem 0 0.6rem; color: var(--muted); font-family: var(--sans); font-size: 0.9rem; }
.n-pub { color: var(--ink); font-weight: 600; }
.badge {
  display: inline-block; font-family: var(--sans); font-size: 0.75rem; font-weight: 600;
  letter-spacing: 0.02em; color: var(--accent); border: 1px solid var(--accent);
  border-radius: 999px; padding: 0.1rem 0.55rem; vertical-align: 0.1em;
}
.declares { margin: 0.35rem 0 0; font-family: var(--sans); font-size: 0.85rem; display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.legend { margin-top: 0.75rem !important; font-size: 1rem !important; }
.bio { margin-bottom: 0.8rem; font-size: 0.95rem; }
.bio summary { cursor: pointer; color: var(--muted); font-family: var(--sans); font-size: 0.88rem; }
.bio p { margin: 0.5rem 0 0; }
.button {
  display: inline-block; font-family: var(--sans); font-size: 0.88rem; text-decoration: none;
  border: 1px solid var(--accent); color: var(--accent); border-radius: 999px; padding: 0.4rem 0.9rem;
}
.button:hover { background: var(--accent); color: var(--accent-ink); }
.author .button { margin-top: 0; }
.author-body > p:last-child { margin-bottom: 0; }

/* Prose pages */
.prose { max-width: 38rem; }
.prose h1 { font-weight: normal; font-size: clamp(1.9rem, 4.5vw, 2.6rem); margin: 0 0 1rem; }
.prose h2 { font-weight: 600; font-size: 1.2rem; margin: 2rem 0 0.4rem; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding-block: 1.5rem; color: var(--muted); }
.site-footer p { margin: 0.2rem 0; }
.site-footer .fine { font-family: var(--sans); font-size: 0.8rem; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
