:root {
  --paper: #faf7f1;
  --ink: #1f1b16;
  --muted: #6f675c;
  --rule: #ddd5c7;
  --accent: #8a3b1e;
  --card: #fffdf9;

  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;

  --measure: 34rem;
  --wide: 46rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #17150f;
    --ink: #ebe5d9;
    --muted: #a0978a;
    --rule: #38332a;
    --accent: #e0916f;
    --card: #1f1c15;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 4.5rem; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.25rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration-color: var(--accent); text-underline-offset: 0.18em; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

h1, h2, h3 { font-weight: 500; line-height: 1.15; margin: 0; text-wrap: balance; }

.kicker,
.sample-label,
.site-header nav,
.option-note,
.site-footer,
.subscribe input,
.subscribe button,
.start {
  font-family: var(--sans);
}

.kicker,
.sample-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 1rem;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}

.site-name { font-size: 1.15rem; font-weight: 600; text-decoration: none; white-space: nowrap; }

.site-header nav { display: flex; gap: 1.25rem; font-size: 0.85rem; }
.site-header nav a { text-decoration: none; color: var(--muted); white-space: nowrap; }
.site-header nav a:hover { color: var(--accent); }

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

main > section,
main > article {
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

/* ---------- Hero ---------- */

.hero { padding-block: clamp(4rem, 12vh, 8rem) 3rem; text-align: center; }
.hero h1 { font-size: clamp(2.5rem, 7vw, 4.25rem); letter-spacing: -0.015em; }
.dek { margin: 1.5rem auto 2.25rem; color: var(--muted); font-style: italic; max-width: 28rem; }

.start {
  display: inline-block;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  padding: 0.7rem 1.4rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
}
.start:hover { background: var(--ink); color: var(--paper); }

/* ---------- Sample ---------- */

.sample { padding-block: 3rem 1rem; border-top: 1px solid var(--rule); }
.sample-label { text-align: center; margin-bottom: 2.5rem; }
.sample p { margin: 0 0 1.4em; hanging-punctuation: first; }

.sample .dropcap::first-letter {
  float: left;
  font-size: 3.6em;
  line-height: 0.85;
  padding: 0.08em 0.1em 0 0;
  color: var(--accent);
}

.sample hr {
  border: 0;
  margin: 2.5rem 0;
  text-align: center;
}
.sample hr::before { content: "⁂"; color: var(--muted); font-size: 1.1rem; }

.sample h2 {
  font-size: clamp(1.7rem, 4.5vw, 2.2rem);
  text-align: center;
  margin: 4.5rem 0 2rem;
}
.sample .toc + h2 { margin-top: 3rem; }

.sample .dateline {
  font-family: var(--sans);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  color: var(--muted);
  margin: -1rem 0 2.25rem;
}

.toc {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem 1.25rem;
  font-family: var(--sans);
  font-size: 0.82rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--rule);
}
.toc a { color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--accent); }

.verse { margin: 0 0 3rem; }
.verse p { margin-bottom: 1.2em; }

/* ---------- Continue ---------- */

main > .continue {
  max-width: var(--wide);
  margin-top: 2rem;
  padding-block: 3.5rem;
  text-align: center;
  position: relative;
}

.continue::before {
  content: "";
  display: block;
  width: 3rem;
  height: 1px;
  background: var(--accent);
  margin: 0 auto 2.5rem;
}

.continue h2 { font-size: clamp(1.9rem, 5vw, 2.6rem); }
.continue-lede { color: var(--muted); margin: 0.75rem 0 2.25rem; }

.options {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  text-align: left;
}

.options li { flex: 1 1 13rem; max-width: 22rem; }
.options li[hidden] { display: none; }

.option {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  height: 100%;
  padding: 1.1rem 1.25rem;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 10px;
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}
.option:hover { border-color: var(--accent); color: inherit; transform: translateY(-2px); }
.option-name { font-size: 1.3rem; font-weight: 500; }
.option-name::after { content: " →"; color: var(--accent); }
.option-note { font-size: 0.82rem; color: var(--muted); line-height: 1.4; }

/* The first option is the one you most want people to take. */
.options li:first-child .option { border-color: var(--ink); }

/* ---------- More writing ---------- */

.more, .subscribe, .about { padding-block: 3.5rem; border-top: 1px solid var(--rule); }
.more h2, .subscribe h2, .about h2 { font-size: 1.6rem; margin-bottom: 1.5rem; }

.shelf { list-style: none; margin: 0; padding: 0; }
.shelf li { padding-block: 1.25rem; border-top: 1px solid var(--rule); }
.shelf li:first-child { border-top: 0; padding-top: 0; }
.shelf .kicker { margin-bottom: 0.4rem; }
.shelf h3 { font-size: 1.4rem; }
.shelf h3 a { text-decoration: none; }
.shelf p:last-child { margin: 0.4rem 0 0; color: var(--muted); font-size: 1.05rem; }

/* ---------- Subscribe ---------- */

.subscribe h2 { margin-bottom: 0.5rem; }
.subscribe > p { color: var(--muted); margin: 0 0 1.5rem; }
.subscribe form { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.subscribe input {
  flex: 1 1 14rem;
  min-width: 0;
  font-size: 1rem;
  padding: 0.8rem 1rem;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 8px;
}

.subscribe button {
  font-size: 1rem;
  font-weight: 500;
  padding: 0.8rem 1.5rem;
  color: var(--paper);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 8px;
  cursor: pointer;
}
.subscribe button:hover { background: var(--accent); border-color: var(--accent); }

/* ---------- About / footer ---------- */

.about p { margin: 0; }

.site-footer {
  padding: 2.5rem 1.25rem 3rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  border-top: 1px solid var(--rule);
}
.site-footer p { margin: 0; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 30rem) {
  body { font-size: 1.125rem; }
  .site-header nav { gap: 0.9rem; font-size: 0.8rem; }
}

/* ================= Multi-page additions ================= */

.site-header nav a[aria-current="page"] { color: var(--ink); font-weight: 600; }
.site-header nav a[hidden] { display: none; }

@media (max-width: 40rem) {
  .site-header { flex-direction: column; align-items: center; gap: 0.35rem; padding-block: 0.7rem; }
  html { scroll-padding-top: 6.5rem; }
}

.hero-small { padding-block: 3.5rem 2.5rem; }
.hero-small h1 { font-size: clamp(2rem, 5vw, 3rem); }
.hero-small .kicker { margin-bottom: 0.6rem; }

.page-head { padding-block: clamp(3rem, 9vh, 5.5rem) 2rem; text-align: center; }
.page-head h1 { font-size: clamp(2.2rem, 6vw, 3.4rem); letter-spacing: -0.01em; }

main > .empty {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 1rem 1.25rem 5rem;
  text-align: center;
  color: var(--muted);
  font-style: italic;
}

/* ---------- Text pages (About, Contact) ---------- */

.prose { padding-bottom: 3rem; }
.prose:empty { display: none; }
.prose .toc { margin-bottom: 1rem; }
.prose h2 { font-size: clamp(1.6rem, 4vw, 2rem); margin: 3.25rem 0 1.25rem; }
.prose .toc + h2, .prose h2:first-child { margin-top: 2.5rem; }
.prose h3 { font-size: 1.3rem; margin: 2.25rem 0 0.75rem; }
.prose p, .prose ul { margin: 0 0 1.3em; }
.prose ul { padding-left: 1.2em; }
.prose li { margin-bottom: 0.4em; }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5rem auto; width: 4rem; }
.prose figure { margin: 2rem 0; }
.prose img { display: block; max-width: 100%; height: auto; border-radius: 4px; }
.prose figcaption,
.gallery figcaption {
  font-family: var(--sans);
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--muted);
  margin-top: 0.6rem;
}

/* ---------- Gallery ---------- */

main > .gallery {
  max-width: 68rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 1.75rem 1.25rem;
  padding-bottom: 5rem;
}
.gallery:empty { display: none; }
.gallery figure { margin: 0; }
.gallery button { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.gallery img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 4px;
  background: var(--rule);
}

.lightbox {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: min(94vw, 80rem);
  max-height: 94vh;
  cursor: zoom-out;
}
.lightbox::backdrop { background: rgb(0 0 0 / 0.88); }
.lightbox img { display: block; max-width: 100%; max-height: 84vh; margin: 0 auto; }
.lightbox p {
  font-family: var(--sans);
  font-size: 0.9rem;
  color: #e8e2d6;
  text-align: center;
  margin: 0.9rem 0 0;
}

/* ---------- Contact ---------- */

.contact-form { padding-bottom: 3.5rem; }
.contact-form form { display: grid; gap: 0.4rem; }
.contact-form label {
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-top: 0.9rem;
}
.contact-form input,
.contact-form textarea {
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.5;
  padding: 0.75rem 0.9rem;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 8px;
  width: 100%;
}
.contact-form textarea { resize: vertical; }
.contact-form button {
  justify-self: start;
  margin-top: 1.25rem;
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 500;
  padding: 0.8rem 1.5rem;
  color: var(--paper);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 8px;
  cursor: pointer;
}
.contact-form button:hover { background: var(--accent); border-color: var(--accent); }

.elsewhere { padding-block: 2.5rem 4rem; border-top: 1px solid var(--rule); }
.elsewhere h2 { font-size: 1.5rem; margin-bottom: 1rem; }

.social { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; font-family: var(--sans); font-size: 0.9rem; }
.social[hidden] { display: none; }

/* ---------- Footer (same on every page) ---------- */

.site-footer {
  padding: 0 1.25rem 3rem;
  margin-top: 2rem;
  text-align: left;
  font-size: inherit;
  color: inherit;
  border-top: 1px solid var(--rule);
}
.site-footer .subscribe {
  max-width: var(--measure);
  margin-inline: auto;
  padding-block: 3rem;
  border-top: 0;
}
.footer-meta {
  max-width: var(--measure);
  margin-inline: auto;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
  display: grid;
  gap: 1.25rem;
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--muted);
}
.footer-meta .social { font-size: 0.85rem; }
.footer-meta .rights p { margin: 0 0 0.35rem; }
.site-footer .subscribe h2,
.site-footer .subscribe > p { font-family: var(--serif); }

/* Gallery shows each picture at its own shape, in columns. */
main > .gallery { display: block; columns: 3 15rem; column-gap: 1.25rem; }
.gallery figure { break-inside: avoid; margin: 0 0 1.5rem; }
.gallery img { aspect-ratio: auto; height: auto; }

.site-footer .subscribe[hidden] { display: none; }
main > section[hidden] { display: none; }
.site-footer .subscribe[hidden] + .footer-meta { border-top: 0; }

/* Pictures inside text pages, such as the author photo. */
.prose figure { max-width: 20rem; margin-inline: auto; text-align: center; }

/* Section images in the chapter, a little wider than the text column. */
.sample .section-art {
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  width: min(46rem, calc(100vw - 2.5rem));
  margin: 4.5rem 0 0;
}
.sample .toc + .section-art { margin-top: 2.5rem; }
.sample .section-art img { display: block; width: 100%; height: auto; border-radius: 3px; }
.sample .section-art + h2 { margin-top: 2rem; }
