:root {
  --bg:       #f6f3ec;
  --bg-tint:  #efeae0;
  --surface:  #fffdf8;
  --ink:      #211d18;
  --ink-soft: #514a41;
  --muted:    #8a8073;
  --line:     #e2dccf;
  --accent:   #b3462a;
  --accent-ink: #ffffff;

  --sans:  "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --read:  "Newsreader", Georgia, serif;

  --wrap: 68rem;
  --measure: 46rem;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(40,30,20,.05), 0 12px 30px rgba(40,30,20,.07);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg:       #14120e;
    --bg-tint:  #1b1813;
    --surface:  #201c16;
    --ink:      #efe9dd;
    --ink-soft: #c3bbac;
    --muted:    #948b7c;
    --line:     #322c22;
    --accent:   #e08a5b;
    --accent-ink: #1a140e;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 14px 34px rgba(0,0,0,.45);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.eyebrow {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 .8rem;
}
.muted { color: var(--muted); }

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: .95rem clamp(1rem, 4vw, 2.5rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.25rem;
  letter-spacing: -.01em;
  color: var(--ink);
}
.brand:hover { text-decoration: none; color: var(--accent); }
.site-nav { display: flex; gap: 1.6rem; }
.site-nav a {
  font-size: .9rem;
  font-weight: 500;
  color: var(--ink-soft);
}
.site-nav a:hover { color: var(--accent); text-decoration: none; }

/* ---------- layout ---------- */
.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: clamp(2rem, 6vw, 4.5rem) clamp(1rem, 4vw, 2.5rem) 5rem;
}

.hero { margin-bottom: clamp(2.5rem, 6vw, 4rem); }
.hero.compact { margin-bottom: 2.5rem; }
.hero h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: -.02em;
  margin: 0 0 1rem;
  color: var(--ink);
}
.lead {
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  color: var(--ink-soft);
  max-width: 40rem;
  margin: 0;
}

/* ---------- section blocks ---------- */
.block { margin-top: clamp(2.5rem, 6vw, 4rem); }
.block-head {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  margin-bottom: 1.4rem;
}
.block-head h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.5rem;
  margin: 0;
  letter-spacing: -.01em;
}
.rule { flex: 1; height: 1px; background: var(--line); }
.see-all { font-size: .85rem; font-weight: 600; }

/* ---------- cards ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
  gap: 1.3rem;
}
.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  color: var(--ink);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  text-decoration: none;
}
.card-cover {
  aspect-ratio: 16 / 10;
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(120% 120% at 20% 10%,
      hsl(var(--h, 210) 55% 62%), hsl(calc(var(--h, 210) + 35) 48% 42%));
}
@media (prefers-color-scheme: dark) {
  .card-cover {
    background:
      radial-gradient(120% 120% at 20% 10%,
        hsl(var(--h, 210) 42% 42%), hsl(calc(var(--h, 210) + 35) 40% 24%));
  }
}
.card-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.monogram {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 3rem;
  color: rgba(255,255,255,.9);
  text-shadow: 0 2px 12px rgba(0,0,0,.25);
}
.card-media { display: block; }
.card-body { padding: 1.1rem 1.15rem 1.25rem; display: flex; flex-direction: column; gap: .5rem; flex: 1; }
.card-body h3 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.2rem;
  margin: 0;
  letter-spacing: -.01em;
}
.card-title { color: var(--ink); }
.card-title:hover { color: var(--accent); text-decoration: none; }
.card-body p { margin: 0; color: var(--ink-soft); font-size: .92rem; flex: 1; }
.card-body p a { color: var(--accent); }

.tags { display: flex; flex-wrap: wrap; gap: .4rem; }
.tag {
  align-self: flex-start;
  display: inline-block;
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  background: var(--bg-tint);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .2rem .65rem;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-ink);
  padding: .68rem 1.3rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: .95rem;
  transition: filter .15s ease, transform .15s ease;
}
.btn:hover { text-decoration: none; filter: brightness(1.06); transform: translateY(-1px); }

/* ---------- novel header (TOC page) ---------- */
.novel-head {
  display: grid;
  grid-template-columns: 13rem 1fr;
  gap: clamp(1.5rem, 4vw, 2.5rem);
  align-items: center;
  padding-bottom: 1rem;
}
.novel-cover {
  aspect-ratio: 3 / 4;
  border-radius: var(--radius);
  overflow: hidden;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow);
  background: radial-gradient(120% 120% at 25% 10%,
    hsl(var(--h,210) 55% 62%), hsl(calc(var(--h,210) + 35) 48% 40%));
}
.novel-cover img { width: 100%; height: 100%; object-fit: cover; }
.novel-cover .monogram { font-size: 4.5rem; }
.novel-meta h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.9rem, 5vw, 2.8rem);
  line-height: 1.08;
  letter-spacing: -.02em;
  margin: 0 0 .35rem;
}
.byline { color: var(--muted); font-style: italic; margin: 0 0 1rem; }
.novel-actions { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; margin-top: 1.4rem; }

/* ---------- chapter list ---------- */
.arc-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--accent);
  margin: 1.8rem 0 .4rem;
  letter-spacing: .01em;
}
.arc-title:first-child { margin-top: .3rem; }
.chapter-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.chapter-list li { border-bottom: 1px solid var(--line); }
.chapter-list a {
  display: flex;
  align-items: baseline;
  gap: 1.1rem;
  padding: .95rem .4rem;
  color: var(--ink);
  transition: background .12s ease, padding-left .12s ease;
}
.chapter-list a:hover { text-decoration: none; background: var(--bg-tint); padding-left: 1rem; }
.ch-num {
  font-family: var(--serif);
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  min-width: 2.2rem;
}
.ch-title { font-size: 1.05rem; }
.ch-meta {
  margin-left: auto;
  padding-left: 1rem;
  color: var(--muted);
  font-size: .8rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
@media (max-width: 560px) {
  .ch-meta { display: none; }
}

/* ---------- reading view ---------- */
.reader { max-width: var(--measure); margin: 0 auto; }
.crumb { margin-bottom: 1.5rem; font-size: .9rem; }
.crumb a { color: var(--muted); }
.chapter { font-family: var(--read); font-size: 1.2rem; line-height: 1.85; color: var(--ink); }
.chapter h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.7rem, 4vw, 2.3rem);
  line-height: 1.12;
  letter-spacing: -.015em;
  margin: 0 0 1.8rem;
}
.chapter p { margin: 0 0 1.2rem; }
.chapter > p { text-indent: 1.8em; text-align: justify; hyphens: auto; }
.chapter blockquote {
  margin: 1.6rem 0;
  padding: .3rem 0 .3rem 1.4rem;
  border-left: 3px solid var(--accent);
  color: var(--ink-soft);
  font-style: italic;
}
.chapter code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: .88em;
  background: var(--bg-tint);
  padding: .1em .4em;
  border-radius: 5px;
}

/* ---------- verse (poems) ---------- */
.verse {
  font-family: var(--read);
  font-size: 1.2rem;
  line-height: 1.7;
  color: var(--ink);
}
.verse p { margin: 0 0 1.5rem; }   /* blank line in the source = stanza break */

/* ---------- chapter pager ---------- */
.chapter-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: .8rem;
  align-items: stretch;
  margin-top: 3rem;
  padding-top: 1.8rem;
  border-top: 1px solid var(--line);
}
.pager {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  padding: .8rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  transition: border-color .14s ease, background .14s ease;
}
.pager:hover { text-decoration: none; border-color: var(--accent); }
.pager.next { text-align: right; }
.pager.up { justify-content: center; text-align: center; color: var(--muted); }
.pager.empty { border: none; background: none; }
.pager-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.pager-title { font-family: var(--serif); font-size: .98rem; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--bg-tint); margin-top: 3rem; }
.footer-inner {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 2rem clamp(1rem, 4vw, 2.5rem);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
  color: var(--muted);
  font-size: .88rem;
}
.footer-brand { font-family: var(--serif); font-weight: 600; color: var(--ink); }

/* ---------- responsive ---------- */
@media (max-width: 640px) {
  .novel-head { grid-template-columns: 1fr; text-align: center; }
  .novel-cover { width: 11rem; margin: 0 auto; }
  .novel-actions { justify-content: center; }
  .chapter-nav { grid-template-columns: 1fr; }
  .pager.up { order: 3; }
  .pager.empty { display: none; }
}
