/* base.css — reset, layout, typography, links, footer, accessible focus. */

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100svh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: var(--fs-body);
  line-height: var(--leading);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  position: relative;
  overflow-x: hidden;
}

/* skip link for keyboard users */
.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--candle); color: var(--candle-ink);
  padding: 10px 16px; border-radius: 0 0 8px 0; z-index: 100;
  font-family: var(--sans); font-size: var(--fs-small); text-decoration: none;
}
.skip:focus { left: 0; }

/* content sits above the atmosphere layers */
.page {
  position: relative;
  z-index: 1;
  max-width: 60rem;
  margin: 0 auto;
  padding: clamp(1.5rem, 5vw, 4rem) clamp(1.25rem, 5vw, 2.5rem) 4rem;
}

a { color: var(--candle); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
a:focus-visible,
.cta:focus-visible,
button:focus-visible {
  outline: 3px solid var(--candle);
  outline-offset: 3px;
  border-radius: 4px;
}

h1, h2, h3 { font-weight: 600; line-height: 1.16; letter-spacing: 0.01em; }

.eyebrow {
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.32em;
  font-size: 0.74rem;
  color: var(--muted);
  margin: 0 0 1.1rem;
}

.lead {
  font-size: var(--fs-lead);
  color: var(--text-dim);
  font-style: italic;
  max-width: var(--measure);
}

/* prose */
.prose { max-width: var(--measure); }
.prose p { margin: 0 0 1.25em; }
.prose p:first-of-type::first-letter {
  font-size: 3.1em;
  line-height: 0.82;
  float: left;
  padding: 0.04em 0.12em 0 0;
  color: var(--candle);
  font-weight: 600;
}
.prose em { color: var(--text); font-style: italic; }
.prose strong { color: var(--text); font-weight: 600; }
.prose blockquote {
  margin: 1.6em 0; padding: 0.2em 0 0.2em 1.2em;
  border-left: 2px solid var(--blood); color: var(--text-dim); font-style: italic;
}

/* scene break */
.scene-break {
  border: 0; text-align: center; margin: 2.4em auto; max-width: 8rem; color: var(--faint);
}
.scene-break::before { content: "\2767"; font-size: 1.3rem; letter-spacing: 0.4em; }

/* CTA */
.cta {
  display: inline-flex; align-items: center; gap: 0.6rem;
  min-height: 56px; padding: 0 2rem;
  font-family: var(--sans); font-weight: 600; font-size: 1.02rem; letter-spacing: 0.02em;
  color: var(--candle); background: transparent;
  border: 1px solid var(--candle); border-radius: 2px;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}
.cta:hover { background: var(--candle); color: var(--candle-ink); text-decoration: none; transform: translateY(-1px); }
.cta:active { transform: translateY(0); }
.cta.ghost { border-color: var(--border-2); color: var(--text-dim); }
.cta.ghost:hover { background: var(--bg-2); color: var(--text); border-color: var(--muted); }

/* chapter list (story index) */
.toc { list-style: none; padding: 0; margin: 2.5rem 0 0; max-width: var(--measure); }
.toc li { border-top: 1px solid var(--border); }
.toc li:last-child { border-bottom: 1px solid var(--border); }
.toc a {
  display: block; padding: 1.1rem 0.2rem; color: var(--text);
  display: flex; gap: 1rem; align-items: baseline;
}
.toc a:hover { text-decoration: none; color: var(--candle); }
.toc .num { font-family: var(--sans); color: var(--faint); font-size: 0.82rem; min-width: 2.2rem; }
.toc .t { font-size: 1.2rem; }
.toc .ll { display: block; color: var(--muted); font-size: var(--fs-small); font-style: italic; margin-top: 0.2rem; }

/* chapter nav */
.chapter-nav {
  display: flex; justify-content: space-between; gap: 1rem;
  margin: 3.5rem 0 0; padding-top: 1.5rem; border-top: 1px solid var(--border);
  font-family: var(--sans); font-size: var(--fs-small);
}

/* footer */
.site-footer {
  max-width: 60rem; margin: 4rem auto 0; padding: 1.6rem clamp(1.25rem, 5vw, 2.5rem) 2.5rem;
  border-top: 1px solid var(--border);
  font-family: var(--sans); color: var(--muted); font-size: var(--fs-small);
  position: relative; z-index: 1;
}
.site-footer p { margin: 0 0 0.4rem; }
.site-footer .fineprint { color: var(--faint); font-size: 0.78rem; }

/* decorative banner strip (story / lore page tops) */
.page-banner {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 6;
  max-height: 260px;
  margin: 0 0 2rem;
  border-radius: 3px;
  overflow: hidden;
  background: var(--bg-2);
}
.page-banner img { width: 100%; height: 100%; object-fit: cover; display: block; }
.page-banner::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(11,10,12,0.15), rgba(11,10,12,0.55));
}

/* per-chapter header image in the reader */
.chapter-hero {
  width: 100%;
  aspect-ratio: 2 / 1;
  max-height: 340px;
  object-fit: cover;
  object-position: center;
  display: block;
  border-radius: 3px;
  margin: 0.4rem 0 2rem;
  filter: saturate(0.92) brightness(0.94);
}

/* loading / error states for the reader */
.status { color: var(--muted); font-style: italic; }
