/* Self-hosted (SIL OFL) so the pages make no third-party requests under a strict CSP. */
@font-face { font-family: "Cinzel"; font-weight: 400 900; font-display: swap; src: url("assets/fonts/Cinzel.woff2") format("woff2"); }
@font-face { font-family: "EB Garamond"; font-weight: 400 700; font-style: normal; font-display: swap; src: url("assets/fonts/EBGaramond.woff2") format("woff2"); }
@font-face { font-family: "EB Garamond"; font-weight: 400 700; font-style: italic; font-display: swap; src: url("assets/fonts/EBGaramond-Italic.woff2") format("woff2"); }

/* Candlelight: dark wood, warm ink, gold leaf. */
:root {
  --night: #0f0c09;
  --wood: #17120d;
  --panel: #1e1813;
  --edge: #3a2e22;
  --gold: #d4ab55;
  --gold-hi: #f0cd7a;
  --ember: #d8823a;
  --ink: #ece2cd;
  --muted: #b4a68d;
  --title: "Cinzel", Georgia, serif;
  --text: "EB Garamond", Garamond, Georgia, serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--night);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1.125rem;
  line-height: 1.6;
  overflow-x: hidden;
}
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none; z-index: 1;
  opacity: .07;
  background-image: url("assets/noise.svg");
}
a { color: var(--gold); }
a:hover, a:focus-visible { color: var(--gold-hi); }
:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 3px; }

.kicker {
  margin: 0 0 8px;
  font-family: var(--title); font-weight: 700;
  font-size: .8rem; letter-spacing: .32em; text-transform: uppercase;
  color: var(--gold);
}

/* A picture behind the title, darkened at the bottom so the words stay readable. */
.hero, .story-hero {
  position: relative; z-index: 2;
  display: flex; align-items: flex-end;
  overflow: hidden;
  background: var(--wood);
}
.scene {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  animation: settle 2.4s ease-out both;
}
@keyframes settle { from { opacity: 0; transform: scale(1.04); } }
.hero::after, .story-hero::after {
  content: "";
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(15, 12, 9, .25) 0%, rgba(15, 12, 9, .1) 35%, rgba(15, 12, 9, .85) 82%, var(--night) 100%),
    radial-gradient(ellipse 80% 60% at 50% 100%, rgba(216, 130, 58, .18), transparent 70%);
}

/* ---------- Library (index.html) ---------- */
.hero { min-height: min(78svh, 720px); justify-content: center; text-align: center; }
.home {
  position: absolute; top: 18px; left: 16px; z-index: 3;
  color: var(--ink); text-decoration: none;
  font-family: var(--title); font-weight: 700;
  font-size: .78rem; letter-spacing: .22em; text-transform: uppercase;
  text-shadow: 0 1px 6px rgba(0, 0, 0, .8);
}
.home::before { content: "\2190  "; }
.hero-text { position: relative; z-index: 2; padding: 0 16px 56px; }
/* The crest above the title: the Gold Oak Forge shield with the Tome's book badge. */
.hero-crest {
  display: block;
  width: clamp(104px, 16vw, 160px); height: auto;
  margin: 0 auto 14px;
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, .8));
}
.hero h1 {
  margin: 0;
  font-family: var(--title); font-weight: 700;
  font-size: clamp(2.8rem, 11vw, 5.6rem); line-height: 1; letter-spacing: .06em;
  color: var(--ink);
  text-shadow: 0 4px 30px rgba(0, 0, 0, .8), 0 0 40px rgba(216, 130, 58, .3);
}
.lede {
  margin: 14px 0 0;
  font-style: italic; font-size: clamp(1.15rem, 3vw, 1.4rem);
  color: var(--ink);
  text-shadow: 0 2px 12px rgba(0, 0, 0, .9);
}
/* The teaser under the lede: a few lines, kept narrow so they read as a paragraph. */
.teaser {
  max-width: 46ch;
  margin: 18px auto 0;
  font-size: clamp(1rem, 2.2vw, 1.12rem); line-height: 1.55;
  color: var(--ink);
  text-shadow: 0 2px 12px rgba(0, 0, 0, .9);
}

.library-main { position: relative; z-index: 2; max-width: 1120px; margin: 0 auto; padding: 0 16px 40px; }
.shelf { padding: 48px 0 8px; }
.shelf-head {
  display: grid; grid-template-columns: minmax(0, 260px) 1fr; gap: 24px; align-items: center;
  margin-bottom: 28px;
}
.shelf-head img { width: 100%; height: auto; border: 1px solid var(--edge); }
.shelf-head h2, .shelf-title {
  margin: 0;
  font-family: var(--title); font-weight: 700;
  font-size: clamp(1.5rem, 4.2vw, 2.2rem); letter-spacing: .05em;
  color: var(--gold);
}
.shelf-head p, .shelf-note { margin: 6px 0 0; font-style: italic; color: var(--muted); }
.shelf-title { margin-bottom: 24px; }
.shelf-note { margin: -16px 0 22px; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 24px;
}
.card {
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--panel), var(--wood));
  border: 1px solid var(--edge);
  border-top: 2px solid var(--gold);
}
.card-img { display: block; overflow: hidden; }
.card-img img { display: block; width: 100%; height: auto; transition: transform .6s ease; }
.card:hover .card-img img { transform: scale(1.04); }
.card-body { display: flex; flex-direction: column; flex: 1; padding: 18px 20px 20px; }
.card h3 { margin: 0; font-family: var(--title); font-weight: 700; font-size: 1.3rem; line-height: 1.25; }
.card h3 a { color: var(--ink); text-decoration: none; }
.card h3 a:hover { color: var(--gold-hi); }
.card-cast {
  margin: 6px 0 10px;
  font-family: var(--title); font-size: .72rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--gold);
}
.card-text { margin: 0 0 14px; color: var(--muted); font-size: 1.05rem; line-height: 1.5; }
.card-read {
  margin-top: auto; align-self: flex-start;
  font-family: var(--title); font-weight: 700;
  font-size: .8rem; letter-spacing: .18em; text-transform: uppercase; text-decoration: none;
}
.card-read::after { content: "  \2192"; }
.chapters { margin: auto 0 0; padding: 0; list-style: none; counter-reset: ch; }
.chapters li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 7px 0; border-top: 1px solid var(--edge);
  counter-increment: ch;
}
.chapters li::before { content: counter(ch) "."; color: var(--gold); margin-right: 8px; min-width: 1.2em; }
.chapters a { flex: 1; color: var(--ink); text-decoration: none; }
.chapters a:hover { color: var(--gold-hi); }
.chapters span { color: var(--muted); font-size: .9rem; white-space: nowrap; }

.cast-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(46%, 180px), 1fr));
  gap: 22px 18px;
}
.cast-grid figure { margin: 0; }
.cast-grid img {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--edge);
  box-shadow: 0 14px 30px rgba(0, 0, 0, .55);
  transition: transform .3s ease, box-shadow .3s ease;
}
.cast-grid a:hover img { transform: translateY(-3px); box-shadow: 0 18px 36px rgba(0, 0, 0, .6), 0 0 24px rgba(216, 130, 58, .25); }
.cast-grid figcaption { margin-top: 10px; font-size: .98rem; line-height: 1.35; color: var(--muted); }
.cast-grid figcaption strong {
  display: block; margin-bottom: 2px;
  font-family: var(--title); font-size: .95rem; letter-spacing: .06em; color: var(--ink);
}
.cast-grid figcaption a { text-decoration: none; }

/* ---------- Story pages ---------- */
html:has(.story) { scroll-padding-top: 60px; }
.bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 22px;
  padding: 11px 16px;
  background: rgba(15, 12, 9, .93);
  border-bottom: 1px solid var(--edge);
  backdrop-filter: blur(6px);
  font-family: var(--title); font-weight: 700;
  font-size: .78rem; letter-spacing: .2em; text-transform: uppercase;
}
.bar a { color: var(--muted); text-decoration: none; }
.bar a:hover, .bar a:focus-visible { color: var(--gold-hi); }
.bar-home::before { content: "\2190  "; }
.bar-link { margin-left: auto; }

.story-hero { min-height: min(62svh, 560px); }
.story-title { position: relative; z-index: 2; width: 100%; max-width: 760px; margin: 0 auto; padding: 0 20px 34px; }
.story-title h1 {
  margin: 0;
  font-family: var(--title); font-weight: 700;
  font-size: clamp(1.9rem, 6.4vw, 3.3rem); line-height: 1.12; letter-spacing: .03em;
  text-shadow: 0 3px 24px rgba(0, 0, 0, .85);
}
.subtitle { margin: 8px 0 0; font-style: italic; font-size: clamp(1.15rem, 3vw, 1.45rem); text-shadow: 0 2px 12px rgba(0, 0, 0, .9); }
.story-title .meta { margin: 12px 0 0; color: var(--muted); font-size: 1rem; text-shadow: 0 2px 10px rgba(0, 0, 0, .9); }
.watch-link { margin: 12px 0 0; font-size: 1.05rem; text-shadow: 0 2px 10px rgba(0, 0, 0, .9); }
.watch-link a { color: var(--gold); }
.watch-link a:hover { color: var(--gold-hi); }

.page { position: relative; z-index: 2; max-width: 760px; margin: 0 auto; padding: 8px 20px 24px; }
.cast { display: flex; flex-wrap: wrap; gap: 16px; margin: 0 0 28px; }
.cast figure { margin: 0; width: 112px; }
.cast img { display: block; width: 100%; height: auto; border: 1px solid var(--edge); box-shadow: 0 10px 22px rgba(0, 0, 0, .55); }
.cast figcaption {
  margin-top: 6px;
  font-family: var(--title); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--gold);
}

.parts {
  margin: 0 0 36px;
  padding: 18px 22px;
  background: linear-gradient(180deg, var(--panel), var(--wood));
  border: 1px solid var(--edge);
  border-top: 2px solid var(--gold);
}
.parts h2 { margin: 0 0 8px; font-family: var(--title); font-size: 1.1rem; letter-spacing: .1em; color: var(--gold); }
.parts ol { margin: 0; padding: 0; list-style: none; columns: 2 260px; column-gap: 28px; }
.parts li { break-inside: avoid; border-bottom: 1px solid var(--edge); }
.parts a { display: block; padding: 6px 0; color: var(--ink); text-decoration: none; line-height: 1.35; }
.parts a:hover { color: var(--gold-hi); }

.prose { font-size: 1.24rem; line-height: 1.72; }
.prose p { margin: 0 0 1.05em; hyphens: auto; }
.prose > p:first-child::first-letter {
  float: left;
  margin: .06em .1em 0 0;
  font-family: var(--title); font-weight: 700;
  font-size: 3.4em; line-height: .82;
  color: var(--gold);
}
.prose h2.part {
  margin: 2.4em 0 .9em;
  padding-bottom: .5em;
  border-bottom: 1px solid var(--edge);
  font-family: var(--title); font-weight: 700;
  font-size: clamp(1.45rem, 4.4vw, 1.9rem); line-height: 1.25;
  color: var(--ink);
}
.part-no {
  display: block; margin-bottom: 4px;
  font-size: .78rem; letter-spacing: .3em; text-transform: uppercase; color: var(--ember);
}
.sep { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.prose h3 {
  margin: 1.9em 0 .6em;
  font-family: var(--title); font-weight: 600;
  font-size: 1.12rem; line-height: 1.35; letter-spacing: .04em;
  color: var(--gold);
}
.prose h4 {
  margin: 1.6em 0 .5em;
  font-family: var(--title); font-weight: 600;
  font-size: 1rem; line-height: 1.35; letter-spacing: .03em;
  color: var(--ink);
}
.prose .beat { font-weight: 600; color: var(--ink); }
.break, .end { margin: 1.6em 0; text-align: center; color: var(--gold); letter-spacing: 1em; padding-left: 1em; }
.end { margin-top: 2.4em; font-size: 1.4rem; }

.turn { display: flex; flex-wrap: wrap; gap: 14px; margin: 28px 0 18px; }
.turn a {
  flex: 1 1 200px;
  padding: 14px 18px;
  border: 1px solid var(--edge);
  background: var(--panel);
  color: var(--ink); text-decoration: none;
  font-size: 1.05rem; line-height: 1.3;
}
.turn a:hover { border-color: var(--gold); color: var(--gold-hi); }
.turn span {
  display: block; margin-bottom: 4px;
  font-family: var(--title); font-weight: 700;
  font-size: .7rem; letter-spacing: .2em; text-transform: uppercase; color: var(--gold);
}
.turn .next { text-align: right; }
.version { margin: 0; text-align: center; color: var(--muted); font-size: .9rem; font-style: italic; }

/* ---------- Footer ---------- */
.footer {
  position: relative; z-index: 2;
  margin-top: 32px;
  padding: 32px 16px 40px;
  text-align: center;
  color: var(--muted); font-size: .9rem;
  border-top: 1px solid var(--edge);
}
.footer p { margin: 0; }
.maker {
  display: inline-flex; align-items: center; gap: 12px;
  margin-bottom: 12px;
  color: var(--ink); text-decoration: none;
  font-family: var(--title); font-weight: 700; font-size: .8rem; letter-spacing: .18em; text-transform: uppercase;
}
.maker img { filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .6)); }
.maker:hover span { color: var(--gold-hi); }
.fine { font-size: .85rem; opacity: .85; }

@media (max-width: 640px) {
  body { font-size: 1.06rem; }
  .prose { font-size: 1.14rem; line-height: 1.68; }
  .shelf-head { grid-template-columns: 1fr; gap: 14px; }
  .cast figure { width: 88px; }
  .bar { gap: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* ---------- Forge bar: the same header on every Gold Oak Forge site ----------
   Keep this block the same on goldoakforge.com, the Tome, The Way and the 3D site
   (only the two fonts on the first line differ). Its colours are fixed, not the site's. */
.forgebar {
  --fb-brand: var(--title); --fb-link: var(--title);
  position: sticky; top: 0; z-index: 6;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 24px;
  padding: 8px max(16px, calc((100% - 1100px) / 2));
  background: #0d0e10;
  border-bottom: 1px solid #24262b;
}
.forgebar-home {
  display: inline-flex; align-items: center; gap: 12px;
  color: #ece5d6; text-decoration: none;
  font-family: var(--fb-brand); font-weight: 700; font-size: 1.05rem; line-height: 1.2;
  text-transform: uppercase; letter-spacing: .04em;
}
.forgebar-home img { display: block; width: 30px; height: auto; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .6)); }
.forgebar-links { display: flex; flex-wrap: wrap; gap: 2px 20px; }
.forgebar-links a {
  color: #a7a196; text-decoration: none;
  font-family: var(--fb-link); font-weight: 700; font-size: .85rem; line-height: 1.6;
  letter-spacing: .14em; text-transform: uppercase;
}
.forgebar a:hover, .forgebar a:focus-visible { color: #e0a92e; outline: none; }
.forgebar-links a[aria-current] { color: #e0a92e; }
/* Reading pages keep their own bar at the top while you scroll; this one scrolls away. */
.reader .forgebar, .story .forgebar { position: static; }
@media (max-width: 600px) {
  .forgebar { justify-content: center; }
  .forgebar-links { justify-content: center; gap: 2px 14px; }
  .forgebar-links a { font-size: .76rem; }
}
