/*
 * theme.css — Monochrome-ink literary palette for Fernweed Press.
 * One warm ink on one paper ground; hierarchy comes from size, weight and
 * space, never from colour. Both modes declared per the shape contract.
 */

:root {
  --canvas: #f7f4ec;
  --surface: #fbfaf6;
  --surface-2: #efe8d8;
  --border: #ddd4bf;
  --border-strong: #b7ab90;
  --ink: #1b1812;
  --muted: #6a6761;
  --accent: #1b1812;
  --accent-hover: #322c22;
  --accent-ink: #f7f4ec;
  --accent-text: #1b1812;
  --accent-strong: #1b1812;
  --accent-soft: #eae2cd;
  --accent-border: #b7ab90;
  --success: #3f6b3f;
  --success-ink: #ffffff;
  --success-soft: #e2ead9;
  --success-strong: #345a34;
  --warning: #92661e;
  --warning-ink: #ffffff;
  --warning-soft: #f0e4cd;
  --warning-strong: #7c5518;
  --danger: #8a2e22;
  --danger-ink: #ffffff;
  --danger-soft: #f0ddd6;
  --danger-strong: #75261c;
  --chart-1: #1b1812;
  --chart-2: #4a453b;
  --chart-3: #6a6761;
  --chart-4: #8a8478;
  --chart-5: #b7ab90;
  --chart-6: #ddd4bf;

  --font-display: "Fraunces", ui-serif, Georgia, serif;
  --font-body: "Source Serif 4", ui-serif, Georgia, serif;
  --font-sans: "Source Serif 4", ui-serif, Georgia, serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --display-weight: 600;
  --display-tracking: -0.01em;
  --eyebrow-tracking: 0.06em;

  --radius-btn: 4px;
  --radius-card: 4px;
  --radius-input: 4px;
  --radius-lg: 4px;
  --radius-xl: 4px;
  --border-w: 1px;
  --border-strong-w: 1px;
  --shadow-card: none;
  --shadow-raised: 0 8px 24px color-mix(in srgb, var(--ink) 14%, transparent);
  --shadow-btn: none;
  --card-pad: 1.75rem;
  --caps: none;
  --caps-tracking: 0.02em;
  --btn-weight: 600;
  --measure: 62ch;
}

html[data-theme="dark"] {
  --canvas: #1b1812;
  --surface: #221e17;
  --surface-2: #2b271d;
  --border: #3c362a;
  --border-strong: #58503d;
  --ink: #f3ede0;
  --muted: #a79d89;
  --accent: #f3ede0;
  --accent-hover: #e2d9c4;
  --accent-ink: #1b1812;
  --accent-text: #f3ede0;
  --accent-strong: #f3ede0;
  --accent-soft: #322c22;
  --accent-border: #58503d;
  --success: #7fa877;
  --success-ink: #14210f;
  --success-soft: #26311f;
  --success-strong: #a4c99a;
  --warning: #c99a52;
  --warning-ink: #241a08;
  --warning-soft: #362a17;
  --warning-strong: #e0b878;
  --danger: #c47c69;
  --danger-ink: #240e08;
  --danger-soft: #3a2019;
  --danger-strong: #e0a190;
  --chart-1: #f3ede0;
  --chart-2: #cfc6b2;
  --chart-3: #a79d89;
  --chart-4: #847a67;
  --chart-5: #58503d;
  --chart-6: #3c362a;
}

/*
 * app.css — Quire's own screen: the running header, the paper bands, the
 * shelf grid and its one stagger, and the dark closing page. Tokens only.
 */

/* ---- The column every section shares -------------------------------- */
.run-header-inner {
  max-width: 46rem;
  margin-inline: auto;
  padding-inline: 1.5rem;
}

/* ---- Running header: scrolls off with the page, no blur, no border --- */
.run-header { padding-block: 1.75rem; }
.run-header .run-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.wordmark {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}
.wordmark:hover { text-decoration: none; }

/* ---- Hero: type only --------------------------------------------------- */
.hero-section { padding-block: 4.5rem 5rem; }
.hero-inner { max-width: 46rem; }
.hero-line {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.75rem, 5vw + 1.5rem, 5.25rem);
  line-height: 0.98;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.hero-sub {
  margin-top: 1.75rem;
  max-width: 38rem;
  font-size: 1.2rem;
  line-height: 1.6;
  color: var(--muted);
}
.hero-btn { margin-top: 2.25rem; }

/* ---- This month: a tinted band with the featured photograph ----------- */
.feature-band {
  background: var(--surface-2);
  padding-block: 3.5rem;
}
.feature-photo { max-height: 32.5rem; }
.feature-photo img { height: 100%; }
.feature-caption {
  margin-top: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  color: var(--muted);
}
.feature-edition { color: var(--ink); font-weight: 500; }
.feature-title { color: var(--ink); }
.feature-sep { color: var(--muted); }
.feature-meta { margin-left: 0; }
.feature-price { margin-left: auto; color: var(--ink); font-weight: 500; }

/* ---- Section heading shared by shelf / notes / join -------------------- */
.section-heading {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2rem, 2vw + 1.5rem, 2.75rem);
  letter-spacing: -0.01em;
  color: var(--ink);
}
.section-lede {
  margin-top: 0.75rem;
  max-width: 34rem;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

/* ---- The shelf: nine covers, one staggered entrance -------------------- */
.shelf-section { padding-block: 5rem; }
.shelf-grid {
  margin-top: 2.5rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.75rem 1.25rem;
  list-style: none;
  padding: 0;
}
/* Rests fully visible — a visitor whose script never ran sees the shelf as
   it is. Only once app.js has confirmed it can run does a card go to its
   offset starting point, immediately before it animates back in. */
.shelf-grid.pre-stagger .shelf-card { opacity: 0; transform: translateY(18px); }
.shelf-grid.is-inview .shelf-card {
  animation: shelf-in 560ms var(--ease-out, ease) both;
  animation-delay: calc(var(--i) * 70ms);
}
@keyframes shelf-in {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}
.shelf-cover {
  transition: transform 220ms ease;
  transform: perspective(800px) rotateX(0deg);
  transform-origin: 50% 100%;
}
.shelf-card:hover .shelf-cover { transform: perspective(800px) rotateX(6deg) translateY(-2px); }
.shelf-caption {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.01em;
}
.shelf-title { color: var(--ink); font-weight: 500; }
.shelf-author { color: var(--muted); }
.shelf-genre { color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.68rem; }

/* ---- Notes from readers ------------------------------------------------- */
.notes-section { padding-block: 4rem 5rem; }
.notes-inner { max-width: 40rem; }
.note {
  margin-top: 2.5rem;
  border: none;
  padding: 0;
}
.note p {
  font-family: var(--font-body);
  font-size: 1.3rem;
  line-height: 1.55;
  color: var(--ink);
}
.note cite {
  display: block;
  margin-top: 1rem;
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  color: var(--muted);
}
.note-city::before { content: " \2014 "; }

/* ---- Join the shelf: a library-card device ------------------------------ */
.join-band {
  background: var(--surface-2);
  padding-block: 5rem;
}
.join-inner { max-width: 34rem; }
.join-card {
  margin-top: 2rem;
  border: var(--border-w, 1px) solid var(--border-strong);
  border-radius: var(--radius-card);
  background: var(--surface);
  padding: 2rem;
}
.join-card-btn { margin-top: 1.5rem; width: 100%; }
.join-card-error {
  margin-bottom: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--danger-strong);
}
.join-card-done { text-align: center; }
.join-card-thanks {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--ink);
}

/* ---- Closing: a dark page, the last line -------------------------------- */
.closing-band {
  background: var(--ink);
  color: var(--canvas);
  padding-block: 6rem 3rem;
}
.closing-inner { max-width: 46rem; }
.closing-line {
  font-family: var(--font-display);
  font-weight: 500;
  font-style: normal;
  font-size: clamp(2.5rem, 4vw + 1.5rem, 4.5rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: var(--canvas);
}
.closing-line em {
  font-style: italic;
  font-weight: 500;
}
.closing-divider {
  margin-top: 4rem;
  border: none;
  border-top: 1px solid color-mix(in srgb, var(--canvas) 22%, transparent);
}
.closing-foot {
  margin-top: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.wordmark-dark { color: var(--canvas); }
.closing-links { display: flex; gap: 1.5rem; font-family: var(--font-mono); font-size: 0.8rem; }
.closing-links a { color: color-mix(in srgb, var(--canvas) 75%, transparent); text-decoration: none; }
.closing-links a:hover { color: var(--canvas); text-decoration: underline; }

/* ---- Responsive ---------------------------------------------------------- */
@media (max-width: 52rem) {
  .shelf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 26rem) {
  .shelf-grid { grid-template-columns: 1fr 1fr; gap: 1.25rem 1rem; }
  .join-card { padding: 1.5rem; }
  .closing-foot { flex-direction: column; align-items: flex-start; gap: 1rem; }
}

/* ---- Reduced motion ------------------------------------------------------- */
html.reduced-motion .shelf-card { opacity: 1; transform: none; animation: none !important; }
html.reduced-motion .shelf-cover { transition: none; }
