/* Shared styles for index.html and admin.html — theme: blue and peach (see THEME.md) */

/* Fonts are served from this site, so visitors' browsers never contact Google. */
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 600 700;
  font-display: swap;
  src: url(/fonts/fraunces.woff2) format('woff2');
}
@font-face {
  font-family: 'Work Sans';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url(/fonts/work-sans.woff2) format('woff2');
}

:root {
  --paper: #F8F7F4; --card: #FFFFFF; --ink: #1F2933; --muted: #5B6670; --line: #E4E2DC;
  --primary: #2E6290; --primary-soft: #E3EDF6; --on-primary: #FFFFFF;
  --peach: #F4B49A; --peach-soft: #FCE6DA; --peach-ink: #A34F33;
  --danger: #A8463D; --danger-soft: #F6DCD8;
  --shadow: 0 1px 2px rgba(31,41,51,.06), 0 6px 20px rgba(31,41,51,.06);
  --radius: 14px;
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Work Sans', system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #14191F; --card: #1B222A; --ink: #E8ECEF; --muted: #A3AEB8; --line: #2A333C;
    --primary: #8DB8E0; --primary-soft: #1D2C3B; --on-primary: #0F1A24;
    --peach: #F4B49A; --peach-soft: #3A2922; --peach-ink: #F2B49A;
    --danger: #E08A80; --danger-soft: #3A2220;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.6 var(--sans);
}
img { max-width: 100%; display: block; }
a { color: var(--primary); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 650; line-height: 1.2; margin: 0 0 .4em; color: var(--ink); }
h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); }
h2 { font-size: clamp(1.4rem, 3vw, 1.8rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Header and nav */
.site-header {
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 10;
}
@media (max-width: 560px) { .site-header { position: static; } }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; flex-wrap: wrap; }
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--serif); font-size: 1.35rem; font-weight: 650; color: var(--ink); text-decoration: none;
}
/* Brand dot: peach circle with a blue mark inside */
.brand::before {
  content: ""; width: 22px; height: 22px; border-radius: 50%; flex: none;
  background: var(--primary); box-shadow: inset 0 0 0 7px var(--peach);
}
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  text-decoration: none; color: var(--muted); padding: 8px 12px; border-radius: 999px; font-size: .95rem; font-weight: 500;
}
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { background: var(--primary-soft); color: var(--primary); font-weight: 600; }

/* Hero */
.hero { padding: 40px 0 24px; position: relative; }
.hero p { font-size: 1.1rem; color: var(--muted); max-width: 640px; }
.eyebrow, .hero .eyebrow {
  font: 600 12px/1.4 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--peach-ink); margin-bottom: 8px;
}

/* Home */
.home-hero { padding-top: 56px; }
.home-hero h1 { font-size: clamp(2.2rem, 5vw, 3.2rem); max-width: 720px; }
.section-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 8px 0 16px; }
@media (max-width: 720px) { .section-cards { grid-template-columns: 1fr; } }
.section-card {
  position: relative; overflow: hidden; display: flex; flex-direction: column;
  border-radius: var(--radius); padding: 28px 28px 24px; min-height: 280px;
  color: var(--ink); text-decoration: none; border: 1px solid transparent;
  transition: border-color .15s;
}
.section-card > * { position: relative; }
.section-card h2 { font-size: clamp(1.5rem, 3vw, 2rem); max-width: 80%; }
.section-card p { max-width: 85%; }
.section-card .stat-line { color: var(--muted); font-size: .9rem; margin-top: auto; }
.section-card .stat-line:empty { display: none; }
.section-card .go { color: var(--primary); font-weight: 600; margin-top: 4px; }
.section-card:hover { border-color: var(--primary); }
.section-card:hover .go { text-decoration: underline; }
/* Decorative circles, partly off the card's corner */
.section-card::before, .section-card::after { content: ""; position: absolute; border-radius: 50%; pointer-events: none; }
.section-card::before { width: 180px; height: 180px; right: -90px; top: -90px; }
.section-card::after { width: 36px; height: 36px; right: 24px; top: 24px; }
.section-card.reading { background: var(--peach-soft); }
.section-card.reading .eyebrow { color: var(--peach-ink); }
.section-card.reading::before { border: 2px solid var(--peach); }
.section-card.reading::after { background: var(--peach); }
.section-card.giving { background: var(--primary-soft); }
.section-card.giving .eyebrow { color: var(--primary); }
.section-card.giving::before { border: 2px solid var(--primary); opacity: .35; }
.section-card.giving::after { background: var(--card); border: 2px solid var(--primary); opacity: .5; }

.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; counter-reset: step; }
@media (max-width: 720px) { .steps { grid-template-columns: 1fr; } }
.steps li { counter-increment: step; display: flex; flex-direction: column; gap: 4px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.steps li::before {
  content: counter(step); width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--peach-soft); color: var(--peach-ink); font-weight: 600; font-size: .9rem; margin-bottom: 6px;
}
.steps strong { font-family: var(--serif); font-weight: 650; font-size: 1.1rem; }
.steps span { color: var(--muted); font-size: .95rem; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: 9px 18px; border-radius: 999px; font: inherit; font-size: .95rem; font-weight: 500; cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: var(--primary); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.outline { border-color: var(--primary); color: var(--primary); font-weight: 600; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); }
.btn.small { padding: 5px 12px; font-size: .85rem; }
.btn[disabled] { opacity: .55; cursor: default; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Sections */
section.block { padding: 24px 0; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.section-head p { margin: 0; }

/* Callouts */
.note { border-radius: var(--radius); padding: 14px 16px; font-size: .95rem; color: var(--ink); }
.note.info { background: var(--primary-soft); }
.note.peach { background: var(--peach-soft); border-left: 4px solid var(--peach); }

/* Filters */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.filters input[type="search"], .filters select { min-width: 0; }
.filters input[type="search"] { flex: 1 1 220px; }
.filters select { width: auto; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.chip {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 999px; padding: 5px 12px; font: inherit; font-size: .875rem; cursor: pointer;
}
.chip:hover { border-color: var(--primary); }
.chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); font-weight: 600; }

/* Forms */
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--paper);
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
textarea { min-height: 90px; resize: vertical; }
label { display: block; font-size: .9rem; font-weight: 600; margin-bottom: 4px; }
label .opt { font-weight: 400; color: var(--muted); }
.field { margin-bottom: 14px; }
.field .hint { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .row2 { grid-template-columns: 1fr; } }
/* Consent boxes */
.check {
  display: flex; gap: 10px; align-items: flex-start; font-weight: 400; font-size: .9rem;
  background: var(--peach-soft); color: var(--ink); border-radius: 10px; padding: 10px 12px; margin: 0;
}
.check input { width: auto; margin-top: 4px; accent-color: var(--primary); }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.checks label { display: flex; gap: 6px; align-items: center; font-weight: 400; margin: 0; }
.checks input, .toggle input { width: auto; accent-color: var(--primary); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-error { background: var(--danger-soft); color: var(--danger); font-size: .9rem; margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; }

/* Dialog */
dialog {
  border: 1px solid var(--line); border-radius: 18px; padding: 0; width: min(560px, calc(100vw - 24px));
  max-height: calc(100vh - 32px); background: var(--card); color: var(--ink);
}
dialog::backdrop { background: rgba(20, 25, 31, .5); }
.dialog-body { padding: 22px 22px 18px; overflow-y: auto; max-height: calc(100vh - 32px); }
.dialog-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; margin-bottom: 8px; }
.icon-btn { background: none; border: none; color: var(--muted); font-size: 1.5rem; line-height: 1; cursor: pointer; padding: 4px 8px; border-radius: 8px; }

/* Cards and grids */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column;
  transition: border-color .15s;
}
.card:hover { border-color: var(--primary); }
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card h3 { margin: 0; }
.card .by { color: var(--muted); font-size: .9rem; margin: 0; }
.card .foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-top: 8px; flex-wrap: wrap; }

/* Book colours: each book gets one pair, used for its spine and for its jacket when there is no cover */
.tone-0 { --tb: var(--primary);      --tf: var(--on-primary); }
.tone-1 { --tb: var(--peach-ink);    --tf: var(--paper); }
.tone-2 { --tb: var(--ink);          --tf: var(--peach); }
.tone-3 { --tb: var(--peach);        --tf: #1F2933; }
.tone-4 { --tb: var(--primary-soft); --tf: var(--primary); }
.tone-5 { --tb: var(--peach-soft);   --tf: var(--peach-ink); }

/* Two tiles of equal height on wide screens: the shelf on the left, the picked-up book on the right */
@media (min-width: 900px) {
  .shelf-layout.with-card { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(320px, 1fr); gap: 24px; align-items: stretch; }
  .shelf-layout.with-card .shelf-main { display: flex; flex-direction: column; min-width: 0; }
  .shelf-layout.with-card .bookcase { flex: 1; width: auto; min-width: 0; margin: 0; --s: .82; padding: 30px 30px 24px; }
  .shelf-layout.with-card .shelf-row:has(.pile) .decor { display: none; }
}
.book-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow); padding: 28px 26px 22px; display: flex; flex-direction: column;
}
/* on a tall shelf the card stays in view while you scroll */
.card-inner { position: sticky; top: 84px; }
.card-empty { margin: auto 0; text-align: left; }
@media (max-width: 899px) {
  .shelf-layout.with-card { display: block; }
  .book-card { display: none; }
}
.card-empty h3 { font-size: 1.7rem; margin-bottom: 10px; }
.card-empty p { color: var(--muted); }
.note-head { display: grid; grid-template-columns: 84px 1fr; gap: 16px; align-items: center; margin-bottom: 14px; }
.note-head .cover { aspect-ratio: 2 / 3; border-radius: 4px; border: 1px solid var(--line); }
.note-head .cover .ph { margin: 4px; padding: 6px 4px; gap: 4px; }
.note-head .cover .ph-title { font-size: .7rem; }
.note-head .cover .ph-by { display: none; }
.note-head h3 { font-size: 1.35rem; margin: 2px 0; }
.note-head .by { color: var(--muted); margin: 0; font-size: .9rem; }
.note-why { font-family: var(--serif); font-weight: 600; font-size: 1.08rem; line-height: 1.5; margin: 0 0 10px; }
.book-card .rec { font-size: .875rem; color: var(--muted); margin: 0 0 12px; }
.book-card .rec strong { color: var(--ink); font-weight: 500; }
.book-card .actions { gap: 10px; }
.note-comments { margin-top: 8px; border-top: 1px solid var(--line); }

/* Bookcase: floating wall shelves with a few books and small decorations on each */
.bookcase {
  --s: 1;
  --wood: #C98B5E;
  --wood-edge: #A86D45;
  --leaf: #6E8B5E;
  background: color-mix(in srgb, var(--peach-soft) 60%, var(--paper));
  border-radius: 18px; padding: 34px 40px 30px;
  width: fit-content; min-width: min(100%, 640px); max-width: 100%; margin: 0 auto;
  display: flex; flex-direction: column; justify-content: center;
}
.shelf-row {
  position: relative; display: flex; align-items: flex-end; gap: 4px;
  min-height: calc(290px * var(--s)); padding: 0 calc(28px * var(--s)); margin-bottom: calc(58px * var(--s));
}
.shelf-row > .spine, .shelf-row > .decor { flex: none; }
.shelf-row > .pile { flex: 0 1 auto; min-width: 0; }
.shelf-row:last-child { margin-bottom: 26px; }
/* the plank, a little wider than the books, with a darker front edge */
.shelf-row::after {
  content: ""; position: absolute; left: -10px; right: -10px; bottom: -16px; height: 16px;
  background: var(--wood); border-radius: 4px; box-shadow: inset 0 -5px 0 var(--wood-edge);
}
.bracket { position: absolute; bottom: -38px; width: 12px; height: 22px; background: var(--wood-edge); clip-path: polygon(0 0, 100% 0, 75% 100%, 25% 100%); }
.bracket.l { left: 30px; }
.bracket.r { right: 30px; }

.spine, .flat {
  position: relative; border: none; cursor: pointer; font: inherit; padding: 0;
  background: var(--tb); color: var(--tf); transition: transform .18s ease;
}
.spine {
  width: calc(var(--w) * var(--s)); height: calc(var(--h) * var(--s));
  border-radius: 6px 6px 3px 3px;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: 26px 0 16px;
  box-shadow: inset 4px 0 0 rgba(255,255,255,.14), inset -5px 0 0 rgba(0,0,0,.14);
}
/* three spine styles, like printed designs */
.spine.sv-0::before, .spine.sv-0::after {   /* bands at head and foot */
  content: ""; position: absolute; left: 7px; right: 7px; height: 6px;
  border-top: 2px solid currentColor; border-bottom: 2px solid currentColor; opacity: .45;
}
.spine.sv-0::before { top: 10px; }
.spine.sv-0::after { bottom: 7px; }
.spine.sv-1::before {                        /* coloured cap at the top */
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 15%;
  background: currentColor; opacity: .22; border-radius: 6px 6px 0 0;
}
.spine.sv-2::before {                        /* framed panel around the title */
  content: ""; position: absolute; inset: 14px 7px 30px; border: 2px solid currentColor; border-radius: 999px; opacity: .35;
}
.spine-title {
  position: relative; writing-mode: vertical-rl; font-family: var(--sans); font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em; font-size: calc(14px * var(--s)); line-height: 1.12;
  max-height: calc((var(--h) - 84px) * var(--s)); max-width: calc((var(--w) - 14px) * var(--s));
  overflow: hidden; text-align: center;
}
.sv-2 .spine-title, .sv-2 .flat-title { font-family: var(--serif); font-weight: 650; text-transform: none; letter-spacing: 0; font-size: calc(16px * var(--s)); }
.spine-mark { position: relative; width: 10px; height: 10px; border-radius: 50%; background: currentColor; opacity: .5; margin: 8px 0; flex: none; }
.spine-by { position: relative; writing-mode: vertical-rl; font-size: calc(10px * var(--s)); letter-spacing: .12em; text-transform: uppercase; opacity: .85; max-height: 90px; overflow: hidden; white-space: nowrap; }
.spine:hover, .spine:focus-visible { transform: translateY(-12px); }
.spine.selected { transform: translateY(-22px); box-shadow: inset 4px 0 0 rgba(255,255,255,.14), inset -5px 0 0 rgba(0,0,0,.14), 0 10px 0 -6px var(--primary); }
.spine.lean.selected { transform: rotate(9deg) translateY(-18px); }
.flat.selected { transform: translateX(14px); }
.spine:focus-visible, .flat:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
/* a book leaning on the others */
.spine.lean { transform-origin: bottom right; transform: rotate(9deg); margin-left: calc(30px * var(--s)); }
.spine.lean:hover, .spine.lean:focus-visible { transform: rotate(9deg) translateY(-10px); }
/* featured books: a star on the spine */
.spine.featured .spine-mark { opacity: 1; background: var(--peach); clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); width: 16px; height: 16px; }
.spine.tone-3.featured .spine-mark, .spine.tone-5.featured .spine-mark { background: var(--primary); }

/* a small pile of books lying flat, with their white page edges showing */
.pile { display: flex; flex-direction: column-reverse; align-items: flex-start; margin: 0 calc(10px * var(--s)); }
.flat {
  width: calc(var(--fw) * var(--s)); height: calc(42px * var(--s)); border-radius: 4px 8px 8px 4px;
  display: flex; align-items: center; gap: 10px; padding: 0 0 0 14px; overflow: hidden;
  box-shadow: inset 0 3px 0 rgba(255,255,255,.14), inset 0 -4px 0 rgba(0,0,0,.14);
}
.flat:nth-child(2) { margin-left: calc(16px * var(--s)); }
.flat-title { font-family: var(--sans); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; font-size: calc(12.5px * var(--s)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; text-align: left; }
.flat-by { font-size: calc(9.5px * var(--s)); letter-spacing: .12em; text-transform: uppercase; opacity: .85; white-space: nowrap; }
.flat .pages {
  align-self: stretch; width: calc(46px * var(--s)); margin: 6px 0; background: #FFFDF8; border-radius: 0 6px 6px 0; flex: none;
  box-shadow: inset 0 calc(9px * var(--s)) 0 -7px #E4E2DC, inset 0 calc(-9px * var(--s)) 0 -7px #E4E2DC;
}
.flat:hover, .flat:focus-visible { transform: translateX(6px); }

/* decorations */
.decor { flex: none; align-self: flex-end; margin: 0 calc(14px * var(--s)); line-height: 0; }
.decor svg { width: calc(var(--dw) * var(--s)); height: auto; display: block; }
.decor .wood { fill: var(--wood); } .decor .wood-edge { fill: var(--wood-edge); }
.decor .leaf { fill: var(--leaf); } .decor .stem { stroke: var(--wood-edge); }
.decor .p { fill: var(--primary); } .decor .ps { fill: var(--primary-soft); }
.decor .pe { fill: var(--peach); } .decor .pk { fill: var(--peach-ink); } .decor .pes { fill: var(--peach-soft); }

@media (max-width: 560px) {
  .bookcase { --s: .66; padding: 22px 14px 20px; border-radius: 14px; }
  .shelf-row { padding: 0 10px; gap: 3px; margin-bottom: 46px; }
  .shelf-row::after { left: -6px; right: -6px; height: 12px; bottom: -12px; box-shadow: inset 0 -4px 0 var(--wood-edge); }
  .bracket { bottom: -28px; width: 9px; height: 16px; }
  .bracket.l { left: 14px; } .bracket.r { right: 14px; }
  .shelf-row .spine { flex: none; }
  .shelf-row .pile { flex: 0 1 auto; min-width: 0; }
  .shelf-row .flat { max-width: 100%; }
  .shelf-row:has(.pile) .decor { display: none; }
  /* small spines: the title gets the whole height (the author is in the book's panel) */
  .bookcase .spine { padding: 14px 0 10px; justify-content: center; }
  .bookcase .spine-by, .bookcase .spine-mark { display: none; }
  .bookcase .spine.featured .spine-mark { display: block; position: absolute; bottom: 10px; }
  .bookcase .spine.featured .spine-title { margin-bottom: 18px; max-height: calc(var(--h) * var(--s) - 52px); }
  .spine-title { max-height: calc(var(--h) * var(--s) - 30px); letter-spacing: .03em; }
}

/* Shelf: compact cover tiles (or slim list rows); details open in the book panel */
.view-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--card); }
.view-toggle button { border: none; background: none; font: inherit; font-size: .875rem; color: var(--muted); padding: 5px 12px; border-radius: 999px; cursor: pointer; }
.view-toggle button[aria-pressed="true"] { background: var(--primary-soft); color: var(--primary); font-weight: 600; }

.shelf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 28px 20px; }
.tile { position: relative; min-width: 0; }
.tile .cover { aspect-ratio: 2 / 3; border-radius: 6px; border: 1px solid var(--line); box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; }
.tile:hover .cover { transform: translateY(-3px); box-shadow: 0 2px 4px rgba(31,41,51,.08), 0 10px 24px rgba(31,41,51,.12); }
.tile .cover .ph { margin: 6px; padding: 10px 8px; }
.tile .cover .ph-title { font-size: .9rem; }
.tile .cover .ph-by { font-size: .65rem; }
.tile-title {
  font-family: var(--serif); font-weight: 650; font-size: .95rem; line-height: 1.3; margin: 10px 0 2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tile-by { color: var(--muted); font-size: .8rem; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.counts { color: var(--muted); font-size: .75rem; margin-top: 4px; display: block; white-space: nowrap; }
/* The title button stretches over the whole tile, so anywhere on it opens the book */
.stretch { all: unset; cursor: pointer; }
.stretch::after { content: ""; position: absolute; inset: 0; }
.stretch:focus-visible { outline: none; }
.tile:has(.stretch:focus-visible), .row-item:has(.stretch:focus-visible) { outline: 2px solid var(--primary); outline-offset: 4px; border-radius: 8px; }
.tile:hover .tile-title, .row-item:hover h3 { color: var(--primary); }
@media (max-width: 560px) {
  .shelf-grid { grid-template-columns: repeat(3, 1fr); gap: 20px 12px; }
  .tile-title { font-size: .85rem; }
  .tile-by { font-size: .72rem; }
}

.shelf-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); overflow: hidden; }
.row-item { position: relative; display: grid; grid-template-columns: 44px 1fr auto; gap: 14px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.row-item:last-child { border-bottom: none; }
.row-item:hover { background: var(--paper); }
.row-item .cover { aspect-ratio: 2 / 3; border-radius: 3px; border: 1px solid var(--line); }
.row-item .cover .ph { margin: 2px; padding: 2px; border: none; }
.row-item .cover .ph-title { font-size: .45rem; }
.row-item .cover .ph-by { display: none; }
.row-main { min-width: 0; }
.row-main h3 { font-family: var(--serif); font-weight: 650; font-size: 1rem; margin: 0; }
.row-why { color: var(--muted); font-size: .85rem; margin: 2px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-item .counts { margin: 0; }
@media (max-width: 560px) { .row-why { display: none; } }

.show-more { text-align: center; margin-top: 28px; }

/* Book panel (opens from a tile) */
.detail { display: grid; grid-template-columns: 96px 1fr; gap: 16px; align-items: start; margin: 4px 0 8px; }
.detail .cover { aspect-ratio: 2 / 3; border-radius: 4px; border: 1px solid var(--line); }
.detail .cover .ph { margin: 4px; padding: 6px; }
.detail .cover .ph-title { font-size: .7rem; }
.detail .cover .ph-by { display: none; }
.detail-why { margin: 0 0 6px; }
.detail .rec { font-size: .85rem; color: var(--muted); margin: 0 0 8px; }
.detail .rec strong { color: var(--ink); font-weight: 500; }

/* Tags */
.tag { display: inline-block; font-size: .75rem; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); }
.tag.peach { background: var(--peach-soft); color: var(--peach-ink); }
.tag.plain { background: transparent; color: var(--muted); border: 1px solid var(--line); font-weight: 500; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }

.cover {
  aspect-ratio: 2 / 3; background: var(--tb, var(--peach-soft)); color: var(--tf, var(--peach-ink));
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; border-bottom: 1px solid var(--line);
}
.cover img { width: 100%; height: 100%; object-fit: cover; }
/* Title card for books without a cover: reads like a plain book jacket */
.cover .ph {
  display: flex; flex-direction: column; justify-content: center; gap: 10px; height: 100%; width: 100%;
  text-align: center; padding: 20px 16px; border: 1px solid currentColor;
  margin: 10px; border-radius: 2px; opacity: .95;
}
.cover .ph-title { font-family: var(--serif); font-weight: 650; font-size: 1.05rem; line-height: 1.25; }
.cover .ph-by { font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; opacity: .8; }

/* Fresh on the shelf: one large featured book; a carousel when two or three are pinned */
.spotlight-track {
  display: flex; align-items: flex-start; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth;
  scrollbar-width: none; border-radius: var(--radius); transition: height .25s ease;
}
.spotlight-track::-webkit-scrollbar { display: none; }
.spotlight {
  flex: 0 0 100%; scroll-snap-align: start; display: grid; grid-template-columns: 200px 1fr; gap: 32px; align-items: center;
  background: var(--primary-soft); border-radius: var(--radius); padding: 28px 32px; min-width: 0;
}
.spotlight .cover { aspect-ratio: 2 / 3; border-radius: 6px; border: none; box-shadow: var(--shadow); background: var(--card); }
.spotlight .cover .ph { border-color: var(--line); }
.spot-body { min-width: 0; }
.spot-body .eyebrow { margin-bottom: 6px; color: var(--primary); }
.spot-body h3 { font-size: clamp(1.5rem, 3vw, 2.1rem); margin-bottom: 4px; }
.spot-body .by { color: var(--muted); margin: 0 0 14px; }
.spot-why { font-size: 1.05rem; max-width: 560px; margin-bottom: 10px; }
.spot-body .rec { font-size: .875rem; color: var(--muted); margin-bottom: 14px; }
.spot-body .rec strong { color: var(--ink); font-weight: 500; }
.spot-body .actions { gap: 14px; }
.spot-nav { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 14px; }
.spot-arrow {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--card);
  color: var(--ink); cursor: pointer; font: inherit; font-size: 1rem;
}
.spot-arrow:hover { border-color: var(--primary); color: var(--primary); }
.spot-dots { display: flex; gap: 8px; }
.spot-dots button { width: 9px; height: 9px; border-radius: 50%; border: none; padding: 0; background: var(--line); cursor: pointer; }
.spot-dots button[aria-current="true"] { background: var(--primary); width: 24px; border-radius: 999px; }
@media (max-width: 560px) {
  .spotlight { grid-template-columns: 100px 1fr; gap: 16px; padding: 18px; align-items: start; }
  .spot-body h3 { font-size: 1.3rem; }
  .spot-body .by { margin-bottom: 8px; }
  .spot-why { font-size: .9rem; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
}

/* Comments panel */
.small-h { font-family: var(--sans); font-size: .8rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 18px 0 8px; }
.comment-list { margin-bottom: 4px; }
.comment { padding: 10px 0; border-bottom: 1px solid var(--line); }
.comment:last-child { border-bottom: none; }
.comment-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.comment p { margin: 2px 0 0; font-size: .95rem; }

.like-btn { background: none; border: none; border-radius: 999px; padding: 4px 8px; margin-left: -8px; cursor: pointer; color: var(--muted); font: inherit; font-size: .875rem; }
.like-btn:hover { color: var(--peach-ink); background: var(--peach-soft); }
.like-btn[aria-pressed="true"] { background: var(--peach-soft); color: var(--peach-ink); font-weight: 600; }
.link-btn { background: none; border: none; color: var(--primary); cursor: pointer; font: inherit; font-size: .875rem; font-weight: 500; padding: 4px 0; text-decoration: none; }
.link-btn:hover { text-decoration: underline; }

.reviews { margin-top: 8px; font-size: .85rem; }
.reviews summary { color: var(--primary); cursor: pointer; font-weight: 500; }
.review { margin-top: 6px; color: var(--muted); }
.review b { font-weight: 600; color: var(--ink); }

.list { display: flex; flex-direction: column; gap: 10px; }
.list-item { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.list-item.done { opacity: .65; }

.org .meta { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; font-size: .9rem; margin: 6px 0; }
.org .meta dt { color: var(--muted); }
.org .meta dd { margin: 0; overflow-wrap: anywhere; }
.contact { background: var(--primary-soft); color: var(--ink); border-radius: 10px; padding: 8px 10px; font-size: .9rem; overflow-wrap: anywhere; }
.contact.pending { background: var(--paper); color: var(--muted); border: 1px dashed var(--line); }
.contact.site { display: block; text-decoration: none; color: var(--primary); font-weight: 500; }
.contact.site:hover { text-decoration: underline; }
.tag.tried { background: var(--primary); color: var(--on-primary); }
.org .meta .cost { color: var(--peach-ink); font-weight: 500; }

/* Giving cards: name and label, a short summary, item tags, three facts, one button */
.org .card-body { padding: 18px 20px 14px; gap: 10px; }
.org-top { display: block; }
.org-top h3 { font-size: 1.12rem; line-height: 1.25; }
/* Trust tick: a small green check after the name, with its note on hover, focus or tap */
:root { --ok: #2F855A; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --ok: #68D391; } }
.trust { position: relative; display: inline-flex; vertical-align: -2px; margin-left: 6px; cursor: help; border-radius: 50%; outline: none; }
.trust svg { width: 18px; height: 18px; fill: var(--ok); stroke: var(--card); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.trust svg circle { stroke: none; }
.trust::after {
  content: attr(data-tip); position: absolute; left: 50%; top: calc(100% + 6px); transform: translateX(-50%);
  background: var(--ink); color: var(--paper); font: 500 12px/1.3 var(--sans); white-space: nowrap;
  padding: 6px 10px; border-radius: 8px; opacity: 0; pointer-events: none; transition: opacity .15s; z-index: 5;
}
.trust:hover::after, .trust:focus::after { opacity: 1; }
.trust:focus-visible { box-shadow: 0 0 0 2px var(--primary); }
.org-sum {
  margin: 0; font-size: .9rem; color: var(--muted); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.facts { list-style: none; margin: 2px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: .875rem; }
.facts li { display: flex; gap: 8px; align-items: flex-start; min-width: 0; }
.facts li span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.facts svg { width: 16px; height: 16px; flex: none; margin-top: 2px; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.facts .fee { color: var(--peach-ink); }
.facts .fee svg { stroke: var(--peach-ink); }
.facts.inline { flex-direction: row; flex-wrap: wrap; gap: 6px 22px; }
.org-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 20px 14px; border-top: 1px solid var(--line); }
.share-link { font-size: .85rem; color: var(--muted); text-decoration: none; }
.share-link:hover { color: var(--primary); text-decoration: underline; }
.vol-sum { margin: 0; color: var(--muted); font-size: .95rem; max-width: 760px; }

/* Giving: Give items | Volunteer */
.giving-tabs { margin-bottom: 14px; }
.giving-tabs button { font-size: .95rem; padding: 7px 16px; }
.vol-list { display: flex; flex-direction: column; gap: 18px; }
.vol .card-body { padding: 20px 22px; }
.acts { width: 100%; border-collapse: collapse; font-size: .9rem; margin: 6px 0 4px; }
.acts th { text-align: left; font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.acts td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.acts tr:last-child td { border-bottom: none; }
.acts td:nth-child(n+2) { white-space: nowrap; color: var(--muted); }
.table-scroll { overflow-x: auto; }

.empty { text-align: center; padding: 32px 16px; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }

/* About */
.prose { max-width: 720px; }
.prose h2 { margin-top: 1.4em; }
.prose ul { padding-left: 1.2em; }
.prose h3 { margin-top: 1.1em; }
.prose .updated { color: var(--muted); font-size: .85rem; margin: -6px 0 10px; }
.prose .changes { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin: 12px 0 8px; font-size: .9rem; }
.prose .changes summary { cursor: pointer; color: var(--primary); font-weight: 500; }
.prose .changes ul { margin: 8px 0 2px; }

/* Shown once to returning visitors after the privacy notice changes */
.notice-banner {
  display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap;
  background: var(--primary-soft); color: var(--ink); font-size: .9rem; padding: 8px 16px; border-bottom: 1px solid var(--line);
}
.notice-banner a { color: var(--primary); font-weight: 600; }
.notice-banner .icon-btn { font-size: 1.2rem; padding: 0 6px; }
.prose .tribute {
  display: flex; align-items: center; gap: 20px; margin: 4px 0 8px; padding: 16px 20px 16px 16px;
  border-left: 4px solid var(--primary);
  font-family: var(--serif); font-weight: 600; font-size: 1.15rem; line-height: 1.45;
}
.prose .tribute img { width: 132px; height: 132px; flex: none; border-radius: 10px; }
.prose .tribute p { margin: 0; }
@media (max-width: 560px) {
  .prose .tribute { gap: 14px; font-size: 1rem; }
  .prose .tribute img { width: 96px; height: 96px; }
}
.prose .closing { font-family: var(--serif); font-weight: 600; font-size: 1.05rem; margin-top: 1.6em; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); margin-top: 40px; padding: 24px 0 40px; color: var(--muted); font-size: .875rem; }
.site-footer .wrap { display: flex; flex-direction: column; gap: 6px; }

/* Success message */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100;
  background: var(--primary-soft); color: var(--ink); border: 1px solid var(--line);
  padding: 12px 18px; border-radius: 12px; max-width: calc(100vw - 32px); font-size: .95rem; font-weight: 500;
}
.banner { background: var(--peach-soft); color: var(--ink); text-align: center; font-size: .875rem; padding: 6px 16px; }
.loading { padding: 40px 0; text-align: center; color: var(--muted); }

/* Leave room for the sticky header when jumping to a section */
#privacy, #terms { scroll-margin-top: 84px; }
