/* Scoutreads website (ADR 0015 §4). Tokens first; light and dark from the start. */

:root {
  --paper: #fbf8f3;
  --surface: #ffffff;
  --sunken: #f2ede4;
  --ink: #1f1c18;
  --muted: #6b645a;
  --line: #e3dccf;
  --accent: #1f5f4a;
  --accent-ink: #ffffff;
  --accent-soft: #e3efe9;
  --heart: #d23b3b;
  --star: #c98a12;
  --danger: #b3261e;
  --ok: #1f6f3f;
  --shadow: 0 1px 2px rgb(31 28 24 / 8%), 0 4px 12px rgb(31 28 24 / 6%);
  --cover-shadow: 0 1px 2px rgb(0 0 0 / 18%), 0 6px 16px rgb(0 0 0 / 12%);
  --radius: 10px;
  --serif: "Iowan Old Style", "Charter", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --page: 72rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #171512;
    --surface: #211e1a;
    --sunken: #2a2621;
    --ink: #eee8de;
    --muted: #a9a094;
    --line: #3a352e;
    --accent: #6cc3a0;
    --accent-ink: #10231c;
    --accent-soft: #1f3a30;
    --heart: #ff6b6b;
    --star: #f0b43c;
    --danger: #ff8a80;
    --ok: #7fd49c;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%);
    --cover-shadow: 0 1px 2px rgb(0 0 0 / 50%), 0 6px 16px rgb(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: 16px/1.55 var(--sans);
  overflow-wrap: break-word;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; margin: 0 0 0.5rem; }
h1 { font-size: clamp(1.75rem, 3vw + 1rem, 2.5rem); }
h2 { font-size: 1.4rem; margin-top: 2rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1rem; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--surface); padding: 0.5rem 1rem; z-index: 10; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }

/* --- Layout --------------------------------------------------------------------- */

.wrap { max-width: var(--page); margin: 0 auto; padding: 0 1rem; }
main { padding: 2rem 0 4rem; min-height: 60vh; }
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; gap: 1rem; min-height: 4rem; flex-wrap: wrap; }
.wordmark { font: 700 1.5rem/1 var(--serif); color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.wordmark span { color: var(--accent); }
.search { flex: 1 1 16rem; display: flex; }
@media (max-width: 40rem) {
  .search { order: 3; flex-basis: 100%; padding-bottom: 0.75rem; }
  .nav { gap: 0.75rem; font-size: 0.95rem; }
}
.search input { width: 100%; }
.nav { display: flex; gap: 1rem; align-items: center; margin-left: auto; }
.nav a { color: var(--ink); text-decoration: none; font-weight: 500; }
.nav a:hover { color: var(--accent); }
.beta { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--accent); border: 1px solid currentColor; border-radius: 999px; padding: 0.1rem 0.45rem; }
.site-footer { border-top: 1px solid var(--line); padding: 2rem 0; color: var(--muted); font-size: 0.9rem; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; margin-bottom: 0.75rem; }
.site-footer a { color: var(--muted); }

.columns { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2rem; }
@media (min-width: 52rem) { .columns { grid-template-columns: 14rem minmax(0, 1fr); gap: 3rem; } }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); }
.narrow { max-width: 28rem; margin: 0 auto; }
.prose { max-width: 42rem; }
.prose img { border-radius: 6px; }
.prose blockquote { border-left: 3px solid var(--line); margin: 1rem 0; padding-left: 1rem; color: var(--muted); }

/* --- Forms and buttons -------------------------------------------------------------- */

label { display: block; font-weight: 600; margin-bottom: 0.25rem; }
.field { margin-bottom: 1rem; }
.field .hint { font-size: 0.85rem; color: var(--muted); margin-top: 0.25rem; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=number],
input[type=file], select, textarea {
  font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: 0.55rem 0.75rem; width: 100%;
}
textarea { min-height: 8rem; resize: vertical; }
.check { display: flex; gap: 0.5rem; align-items: center; font-weight: 400; }
.check input { width: auto; }
button, .button {
  font: 600 0.95rem/1 var(--sans); cursor: pointer; border-radius: 999px; padding: 0.65rem 1.1rem;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  text-decoration: none; display: inline-flex; align-items: center; gap: 0.4rem;
}
button.quiet, .button.quiet { background: transparent; color: var(--accent); }
button.link { background: none; border: none; color: var(--accent); padding: 0; font-weight: 500; }
button[disabled] { opacity: 0.6; cursor: progress; }
.form-error { color: var(--danger); font-weight: 600; min-height: 1.2em; }
.form-ok { color: var(--ok); font-weight: 600; }
.notice { background: var(--accent-soft); border-radius: var(--radius); padding: 0.85rem 1rem; margin-bottom: 1rem; }

/* --- Books ----------------------------------------------------------------------- */

.cover { aspect-ratio: 2 / 3; width: 100%; border-radius: 4px; box-shadow: var(--cover-shadow);
  background: var(--sunken); object-fit: cover; }
.cover.placeholder { display: flex; align-items: center; justify-content: center; padding: 0.75rem;
  font: 600 0.95rem/1.25 var(--serif); text-align: center; color: var(--muted);
  background: linear-gradient(160deg, var(--sunken), var(--line)); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: 1.5rem 1.25rem; }
.card { text-decoration: none; color: var(--ink); display: block; }
.card .title { font: 600 0.95rem/1.3 var(--serif); margin-top: 0.6rem; }
.card .by { font-size: 0.85rem; color: var(--muted); }
.list { display: flex; flex-direction: column; gap: 1rem; }
.list-item { display: grid; grid-template-columns: 4.5rem minmax(0, 1fr); gap: 1rem; align-items: start; }
.book-head { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2rem; }
@media (min-width: 44rem) { .book-head { grid-template-columns: 13rem minmax(0, 1fr); } }
.book-head .cover { max-width: 13rem; }
.byline { font-size: 1.1rem; margin-bottom: 1rem; }
.meta { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; color: var(--muted); font-size: 0.9rem; }
.description { max-width: 42rem; white-space: pre-line; }

/* --- Widgets: shelving, stars, hearts ------------------------------------------- */

.shelve { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.shelve button[aria-pressed=true] { background: var(--accent); color: var(--accent-ink); }
.shelve button[aria-pressed=false] { background: transparent; color: var(--accent); }
.stars { display: inline-flex; gap: 0.1rem; }
.stars button { background: none; border: none; padding: 0.1rem; color: var(--line); font-size: 1.6rem; line-height: 1; border-radius: 4px; }
.stars button.on { color: var(--star); }
.stars-static { color: var(--star); letter-spacing: 0.05em; }
.heart { background: none; border: none; padding: 0.25rem; color: var(--heart); line-height: 0; border-radius: 999px; }
.heart svg { width: 1.6rem; height: 1.6rem; fill: none; stroke: currentColor; stroke-width: 2; }
.heart[aria-pressed=true] svg { fill: currentColor; }
.heart[disabled] { opacity: 0.5; }
.tag { display: inline-block; font-size: 0.8rem; background: var(--sunken); border-radius: 999px; padding: 0.15rem 0.6rem; }

/* --- Reviews, comments, tables ------------------------------------------------------ */

.review { border-top: 1px solid var(--line); padding: 1.25rem 0; }
.review .who { font-weight: 600; }
.review .body { white-space: pre-line; margin-top: 0.5rem; }
details.spoiler summary { cursor: pointer; color: var(--muted); }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 0.5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.pager { display: flex; justify-content: space-between; margin-top: 1.5rem; }
.tabs { display: flex; gap: 1rem; border-bottom: 1px solid var(--line); margin-bottom: 1.5rem; flex-wrap: wrap; }
.tabs a { padding: 0.5rem 0; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; }
.tabs a[aria-current=page] { color: var(--ink); border-color: var(--accent); }
.favorites { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); }
.hero { padding: 3rem 0 2rem; max-width: 40rem; }
.hero p { font-size: 1.2rem; color: var(--muted); }
