/* ----------------------------------------------------------------------------
   On the Wings of My Mind — base stylesheet
   Shell, typography, and shared components. Themes (Night/Parchment/Storybook)
   override the CSS custom properties below to skin the same skeleton.

   Vocabulary note: the variable names below are written from the Night theme's
   point of view (it is the magazine's spine). In Parchment and Storybook the
   metaphor stretches — `--night` becomes the cream page, `--candle` becomes
   rust or twilight blue — but the role each token plays is identical, and the
   words keep the project's voice in the code.
   ---------------------------------------------------------------------------- */

:root {
  /* Defaults reflect Night; theme files override these for Parchment/Storybook. */
  --night:        #0a0908; /* page surface — the "page is night" */
  --hush:         #14110f; /* a quieter shade of the page */
  --night-card:   #1a1612; /* slightly raised surface (cards, panels) */
  --bone:         #e8dcc4; /* body text */
  --bone-dim:     #c9b994; /* secondary text */
  --whisper:      #8a7d5f; /* tertiary / faint text and edges */
  --rule:         #3a3128; /* hairlines */
  --candle:       #d4a04a; /* primary accent — candlelight */
  --candle-dim:   #b88534; /* accent shaded down */
  --ember:        #8b3a1f; /* secondary accent — embers, rust */
  --candle-flame: #ffb74a;
  --candle-glow:  rgba(255, 183, 74, 0.35);
  --candle-wax:   #efe2c4;

  --font-display: 'Cinzel', 'Trajan Pro', 'Times New Roman', serif;
  --font-body:    'EB Garamond', Garamond, 'Times New Roman', serif;

  --measure: 42.5rem; /* story column ≈ 680px */
  --gutter:  clamp(1.25rem, 4vw, 2.5rem);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--night);
  color: var(--bone);
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Atmospheric depth — a layered radial vignette behind the page. Themes can
   override the colors used in the gradient stops via overrides in their own
   stylesheets. The mix-blend-mode trick borrowed from the Fiddler's Cave
   mockup gives the parchment theme richer warmth without darkening Night. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 25% 20%, var(--vignette-1, rgba(212,160,74,0.07)) 0%, transparent 45%),
    radial-gradient(ellipse at 75% 70%, var(--vignette-2, rgba(212,160,74,0.05)) 0%, transparent 50%),
    radial-gradient(ellipse at center,    transparent 0%, var(--vignette-edge, rgba(10,9,8,0.55)) 100%);
  pointer-events: none;
  z-index: 1;
  mix-blend-mode: var(--vignette-blend, normal);
}

/* A whisper of SVG film grain — keeps the dark theme from going flat under
   reading-room light, and the cream from looking digital. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 1;
  opacity: var(--grain-opacity, 0.45);
  mix-blend-mode: var(--grain-blend, normal);
}

main, header.topnav, footer.footer, .candle { position: relative; z-index: 2; }

/* ---------- Top navigation -------------------------------------------------- */

.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.25rem var(--gutter);
  border-bottom: 1px solid var(--rule);
  background: var(--night);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(6px);
}

.topnav__brand {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--bone);
  font-family: var(--font-display);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  line-height: 1.05;
}
.topnav__brand-line { font-size: 0.9rem; }
.topnav__brand-sub  { font-size: 0.7rem; color: var(--whisper); }

.topnav__links {
  display: flex;
  gap: 1.6rem;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
}
.topnav__links a {
  color: var(--bone-dim);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition: color .2s, border-color .2s;
}
.topnav__links a:hover { color: var(--candle); border-bottom-color: var(--candle); }
.topnav__pdf { color: var(--candle); }

/* ---------- Page shell ------------------------------------------------------ */

.page {
  max-width: 64rem;
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 4rem) var(--gutter) 5rem;
}

.eyebrow {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.32em;
  font-size: 0.72rem;
  color: var(--whisper);
  margin: 0 0 0.6rem;
}

.footer {
  border-top: 1px solid var(--rule);
  padding: 1.5rem var(--gutter) 4rem;
  text-align: center;
  font-family: var(--font-display);
  letter-spacing: 0.18em;
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--whisper);
}

/* ---------- Cover ---------------------------------------------------------- */

.cover { max-width: 42rem; margin: 0 auto; text-align: center; padding-top: 3rem; }

.cover__hero {
  margin: 1.5rem auto 2.2rem;
  max-width: 24rem;
}
.cover__hero img {
  width: 100%;
  height: auto;
  display: block;
}

/* Victorian-engraving PNGs are pure black ink on a transparent ground. On
   the Night theme, invert them so the hatching reads as warm bone on the
   dark page; on Parchment/Storybook, leave the black ink as printed. */
.hero--engraving {
  display: block;
  margin: 0 auto;
  max-width: 22rem;
  height: auto;
}
.ornament--engraving {
  display: block;
  margin: 0 auto;
  max-width: 9rem;
  height: auto;
  opacity: 0.92;
}

[data-theme="night"] .hero--engraving,
[data-theme="night"] .ornament--engraving,
[data-theme="night"] .cover__hero img {
  filter: invert(0.92) sepia(0.18) hue-rotate(-12deg) saturate(0.6)
          drop-shadow(0 0 14px rgba(255,183,74,0.10));
}

.cover__edition {
  font-family: var(--font-display);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--whisper);
}

.cover__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.6rem, 8vw, 5.2rem);
  line-height: 1;
  letter-spacing: 0.04em;
  margin: 1.5rem 0 1rem;
  color: var(--bone);
}
.cover__title-line       { display: block; }
.cover__title-line--em   { font-style: italic; color: var(--candle); font-weight: 400; }

.cover__subtitle {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 1.3rem;
  color: var(--bone-dim);
  line-height: 1.5;
  margin: 0 auto;
  max-width: 36rem;
}

.cover__rule {
  width: 1px;
  height: 4.5rem;
  background: linear-gradient(to bottom, transparent, var(--candle), transparent);
  margin: 2.4rem auto;
}

.cover__lede {
  font-size: 1.125rem;
  line-height: 1.7;
  color: var(--bone-dim);
  max-width: 32rem;
  margin: 0 auto 2.5rem;
}

.cover__actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 4rem;
}

.btn {
  display: inline-block;
  padding: 0.85rem 1.6rem;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.78rem;
  text-decoration: none;
  border: 1px solid var(--candle);
  transition: background .3s ease, color .3s ease, letter-spacing .4s ease;
}
.btn:hover { letter-spacing: 0.32em; }
.btn--primary { background: var(--candle); color: var(--night); }
.btn--primary:hover { background: var(--candle-dim); }
.btn--ghost   { background: transparent;   color: var(--candle); }
.btn--ghost:hover { background: var(--candle); color: var(--night); }

.cover__recent { margin-top: 4rem; text-align: left; }
.cover__recent-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.8rem;
}
.cover__recent-list a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px dotted var(--rule);
  text-decoration: none;
  color: var(--bone);
}
.cover__recent-title  { font-style: italic; font-size: 1.1rem; }
.cover__recent-meta   { font-family: var(--font-display); font-size: 0.72rem;
                        letter-spacing: 0.18em; text-transform: uppercase;
                        color: var(--whisper); }
.cover__recent-list a:hover .cover__recent-title { color: var(--candle); }

.cover__frontispiece {
  margin: 4rem auto 1rem;
  max-width: 520px;
  text-align: center;
}
.cover__frontispiece img { width: 100%; height: auto; display: block; }
[data-theme="night"] .cover__frontispiece img {
  filter: invert(1) sepia(0.18) hue-rotate(-10deg) saturate(0.85);
}
.cover__frontispiece-caption {
  margin-top: 0.6rem;
  font-style: italic;
  font-size: 0.9rem;
  color: var(--bone-dim);
}

/* ---------- Table of Tales -------------------------------------------------- */

.contents__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  letter-spacing: 0.04em;
  margin: 0.4rem 0 0.4rem;
}
.contents__lede {
  font-style: italic;
  color: var(--bone-dim);
  margin-bottom: 3rem;
}

.contents__section { margin: 4rem 0 4rem; }

.contents__umbrella {
  font-style: italic;
  color: var(--bone-dim);
  max-width: 36em;
  margin: 0 0 3rem;
}

.contents__section-plate {
  display: block;
  margin: 0 auto 1.4rem;
  max-width: 360px;
  text-align: center;
}
.contents__section-plate img {
  width: 100%;
  height: auto;
  display: block;
}
[data-theme="night"] .contents__section-plate img,
[data-theme="night"] .section-page__plate img {
  filter: invert(1) sepia(0.18) hue-rotate(-10deg) saturate(0.85);
}
.contents__section-title a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted transparent;
  transition: border-color .3s ease;
}
.contents__section-title a:hover { border-bottom-color: currentColor; }

.contents__section-blurb {
  font-style: italic;
  color: var(--bone-dim);
  text-align: center;
  max-width: 36em;
  margin: 0 auto 1.4rem;
}

/* ---------- Section landing pages ------------------------------------------ */

.section-page {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
  padding: 2rem 0 4rem;
}
.section-page__eyebrow {
  font-family: var(--font-display);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  font-size: 0.78rem;
  color: var(--candle);
  margin: 0 0 2rem;
}
.section-page__plate {
  margin: 0 0 2rem;
}
.section-page__plate img {
  width: 100%;
  height: auto;
  display: block;
}
.section-page__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2rem, 5vw, 3.2rem);
  letter-spacing: 0.04em;
  margin: 0 0 1rem;
}
.section-page__blurb {
  font-style: italic;
  color: var(--bone-dim);
  max-width: 32em;
  margin: 0 auto 2rem;
}
.section-page__rule {
  height: 1px;
  background: var(--rule);
  margin: 2rem auto 2rem;
  max-width: 8rem;
}
.section-page__toc {
  text-align: left;
  margin: 0 auto;
}
.section-page__back {
  margin-top: 3rem;
  font-style: italic;
  color: var(--bone-dim);
}
.section-page__back a { color: var(--candle); text-decoration: none; }
.section-page__back a:hover { text-decoration: underline; }

/* Section header — centered under the engraved plate, no flanking rules
   (the plate above and the section rule below already frame the heading). */
.contents__section-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 1rem;
  padding: 0;
  border: none;
  text-align: center;
}
.contents__section-label {
  font-family: var(--font-display);
  letter-spacing: 0.32em;
  font-size: 0.78rem;
  text-transform: uppercase;
  color: var(--candle);
}
.contents__section-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.1rem, 2.4vw, 1.6rem);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--candle);
  margin: 0;
  max-width: 100%;
}

.toc { list-style: none; padding: 0; margin: 0; }
.toc__item {
  padding: 0.4rem 0;
  border-bottom: 1px dotted var(--rule);
}
.toc__link {
  display: grid;
  grid-template-columns: 2.5rem 1fr auto auto;
  gap: 0.8rem;
  align-items: baseline;
  text-decoration: none;
  color: var(--bone);
  padding: 0.8rem 0.5rem 0.8rem 0;
  position: relative;
  transition: padding-left .4s ease, color .3s ease;
}
.toc__link::before {
  content: "";
  position: absolute;
  left: -1rem;
  top: 50%;
  width: 0;
  height: 1px;
  background: var(--candle);
  transition: width .4s ease;
}
.toc__link:hover {
  padding-left: 1.4rem;
  color: var(--candle);
}
.toc__link:hover::before { width: 0.9rem; }
.toc__link:hover .toc__num,
.toc__link:hover .toc__year { color: var(--candle); }

.toc__num {
  font-family: var(--font-display);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  color: var(--whisper);
  transition: color .3s ease;
}
.toc__title  { font-size: 1.3rem; font-style: normal; letter-spacing: 0.01em; }
.toc__title em {
  display: block;
  font-size: 0.95rem;
  color: var(--bone-dim);
  font-style: italic;
  letter-spacing: 0;
  margin-top: 0.15rem;
}
.toc__leader { border-bottom: 1px dotted var(--whisper); transform: translateY(-4px); }
.toc__year   { font-family: var(--font-display); font-size: 0.78rem;
                letter-spacing: 0.18em; color: var(--whisper);
                transition: color .3s ease; }
.toc__note {
  font-size: 0.85rem;
  color: var(--whisper);
  font-style: italic;
  margin: 0.3rem 0 0 3.3rem;
}

/* Theme tag stripe at left edge of each TOC item */
.toc__item--night     { border-left: 3px solid #d4a04a; padding-left: 0.6rem; }
.toc__item--parchment { border-left: 3px solid #7a2811; padding-left: 0.6rem; }
.toc__item--storybook { border-left: 3px solid #4a3a6e; padding-left: 0.6rem; }

/* ---------- Dream Index ----------------------------------------------------- */

.dream-index__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  letter-spacing: 0.04em;
  margin: 0.4rem 0 0.6rem;
}
.dream-index__lede { font-style: italic; color: var(--bone-dim); max-width: 36rem; }
.dream-index__rule { height: 1px; background: var(--candle); width: 5rem; margin: 2.5rem 0; opacity: 0.6; }

.dream-index__section-title {
  font-family: var(--font-display);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.95rem;
  color: var(--candle);
  margin: 2.5rem 0 1.2rem;
}

.dream-index__universes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: 1.2rem;
  margin-bottom: 3rem;
}
.universe-card {
  background: var(--night-card);
  border: 1px solid var(--candle);
  padding: 1.4rem;
}
.universe-card__eyebrow {
  font-family: var(--font-display); font-size: 0.66rem;
  letter-spacing: 0.32em; text-transform: uppercase;
  color: var(--candle); margin: 0 0 0.4rem;
}
.universe-card__name {
  font-family: var(--font-display); font-weight: 500;
  font-size: 1.25rem; letter-spacing: 0.04em;
  margin: 0 0 0.8rem;
}
.universe-card__stories,
.motif-card__stories {
  list-style: none; padding: 0; margin: 0;
  font-size: 0.95rem; line-height: 1.5;
}
.universe-card__stories a,
.motif-card__stories a   { color: var(--bone); text-decoration: none;
                            border-bottom: 1px dotted var(--whisper); }
.universe-card__stories a:hover,
.motif-card__stories a:hover { color: var(--candle); border-bottom-color: var(--candle); }

.dream-index__motifs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem;
}
.motif-card {
  background: var(--hush);
  border: 1px solid var(--rule);
  padding: 1.2rem;
}
.motif-card__icon { color: var(--candle); margin-bottom: 0.5rem; }
.motif-card__name {
  font-family: var(--font-display); font-weight: 500;
  font-size: 1.05rem; letter-spacing: 0.04em;
  margin: 0 0 0.2rem;
}
.motif-card__count {
  font-family: var(--font-display); font-size: 0.7rem;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--whisper); margin: 0 0 0.6rem;
}
.dream-index__note { color: var(--whisper); margin-top: 3rem; }

/* ---------- Story page ------------------------------------------------------ */

.story { max-width: var(--measure); margin: 0 auto; }

.story__header { text-align: center; margin-bottom: 2rem; }
.story__section {
  font-family: var(--font-display);
  letter-spacing: 0.32em; text-transform: uppercase;
  font-size: 0.72rem; color: var(--candle); margin: 0;
}
.story__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  letter-spacing: 0.04em;
  margin: 0.8rem 0 0.6rem;
  line-height: 1.05;
}
.story__byline { font-style: italic; font-size: 1.05rem; margin: 0; color: var(--bone-dim); }
.story__provenance {
  font-size: 0.85rem; color: var(--whisper);
  margin: 0.3rem 0 0;
}
.story__dedication { font-size: 0.95rem; color: var(--bone-dim); margin: 0.5rem 0 0; }

.story__hero {
  text-align: center;
  margin: 3rem 0;
  color: var(--candle);
  filter: drop-shadow(0 0 25px rgba(212, 160, 74, 0.12));
}
.story__hero svg { max-width: 280px; height: auto; }

.story__body {
  font-size: 1.18rem;
  line-height: 1.95;
  color: var(--bone);
}

.story__body .p             { margin: 0 0 1.4rem; text-indent: 2em; }
.story__body .p--centered   { text-align: center; text-indent: 0; }
.story__body .p--italic     { font-style: italic; }

/* First paragraph: no indent, and the first letter promotes to a drop cap.
   We use ::first-letter (over a wrapper span) so the prose stays clean
   in source and the letter renders as a proper typographic drop cap. */
.story__body .p:first-of-type { text-indent: 0; }
.story__body .p:first-of-type::first-letter {
  font-family: var(--font-display);
  font-size: 5rem;
  float: left;
  line-height: 0.85;
  margin: 0.4rem 0.6rem 0 0;
  color: var(--candle);
  font-weight: 500;
}

/* ---------- Motif markers --------------------------------------------------- */

.motif-marker {
  color: inherit;
  text-decoration: none;
  background: linear-gradient(to bottom, transparent 70%, color-mix(in srgb, var(--candle) 30%, transparent) 70%);
  cursor: pointer;
  transition: background .25s ease, color .2s ease;
}
.motif-marker:hover {
  color: var(--candle);
  background: linear-gradient(to bottom, transparent 70%, color-mix(in srgb, var(--candle) 60%, transparent) 70%);
}

/* ---------- Pull quote ----------------------------------------------------- */

.pullquote {
  margin: 3.5rem -1.5rem;
  padding: 3rem 1.5rem 2.4rem;
  border-top:    1px solid var(--candle);
  border-bottom: 1px solid var(--candle);
  text-align: center;
  position: relative;
}
/* Opening quotation mark cut out of the top border — the page surface
   ("the night") punches through. Themes inherit because --night is the page. */
.pullquote::before {
  content: "\201C"; /* “ */
  position: absolute;
  top: -0.35em;
  left: 50%;
  transform: translateX(-50%);
  background: var(--night);
  padding: 0 1rem;
  font-family: var(--font-display);
  font-size: 3rem;
  line-height: 1;
  color: var(--candle);
}
.pullquote__mark { display: none; } /* legacy markup, no longer needed */
.pullquote__text {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 1.6rem;
  line-height: 1.45;
  color: var(--bone);
  max-width: 30rem;
  margin: 0 auto;
  text-indent: 0;
}

/* ---------- Scene-break divider -------------------------------------------- */

.scene-break {
  text-align: center;
  margin: 2.6rem 0;
  color: var(--candle);
}
.scene-break svg {
  display: inline-block;
  width: 110px;
  height: auto;
  opacity: 0.85;
}

/* ---------- Author's note (lighter touch) ---------------------------------- */

.author-note {
  margin: 4rem auto 2rem;
  padding: 2rem 2rem 1.6rem;
  background: var(--night-card);
  border: none;
  border-left: 2px solid var(--candle);
  font-family: var(--font-body);
  font-style: italic;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--bone-dim);
}
.author-note__label {
  font-family: var(--font-display);
  font-style: normal;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  font-size: 0.7rem;
  color: var(--candle);
  margin: 0 0 0.8rem;
  display: block;
}
.author-note__signoff {
  text-align: right;
  font-style: italic;
  color: var(--bone-dim);
  margin: 1rem 0 0;
}
.author-note__signoff-line { margin: 0.1rem 0; }
.author-note__placeholder  { color: var(--whisper); font-size: 0.95rem; }
.author-note__body         { font-style: normal; }
.author-note__paragraph    {
  margin: 0 0 1rem;
  font-style: normal;
  text-indent: 1.6em;
}
.author-note__paragraph:first-child { text-indent: 0; }
.author-note__body + .author-note__signoff { margin-top: 1.5rem; }

/* Preface panel — a personal note from the author, set apart at the top of the
   story like a folded letter laid in front of a printed plate. */
.story__preface {
  margin: 2.5rem auto 3rem;
  max-width: 36rem;
  padding: 1.8rem 2rem 1.5rem;
  background: var(--night-card);
  border-top: 1px solid var(--candle);
  border-bottom: 1px solid var(--candle);
  font-family: var(--font-body);
  font-style: italic;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--bone-dim);
}
.story__preface-label {
  font-family: var(--font-display);
  font-style: normal;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  font-size: 0.7rem;
  color: var(--candle);
  margin: 0 0 1rem;
  text-align: center;
}
.story__preface-body { font-style: italic; }
.story__preface-paragraph {
  margin: 0 0 0.9rem;
  text-indent: 0;
}
.story__preface-paragraph--centered { text-align: center; }
.story__preface-paragraph:last-child { margin-bottom: 0; }

/* Lost-passage card — runs of 4+ underscores in the source mark places where
   the author left a blank for later. Render as a faded, dotted-bordered slip
   sitting inline in the prose. */
.lost-passage {
  display: inline-block;
  padding: 0 0.55em;
  margin: 0 0.15em;
  border: 1px dashed var(--candle);
  border-radius: 2px;
  font-family: var(--font-display);
  font-size: 0.72em;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--candle);
  background: rgba(0, 0, 0, 0.12);
  vertical-align: 0.08em;
  font-style: normal;
}

/* Legacy editor note (used as a placeholder block on un-rendered stories). */
.editor-note {
  margin: 2.5rem 0;
  padding: 1rem 1.2rem;
  border-left: 3px solid var(--candle);
  background: var(--hush);
  font-size: 0.95rem;
  color: var(--bone-dim);
}
.editor-note__label {
  font-family: var(--font-display);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 0.7rem;
  color: var(--candle);
  margin: 0 0 0.4rem;
}

/* End marks ----------------------------------------------------------------- */

.endmark { text-align: center; margin: 3rem 0; }
.endmark__bar {
  display: inline-block; width: 1px; height: 2.5rem;
  background: linear-gradient(to bottom, transparent, var(--candle), transparent);
}
.endmark__finis {
  font-family: var(--font-display);
  letter-spacing: 0.4em;
  text-transform: uppercase;
  font-size: 0.85rem;
  color: var(--candle);
  position: relative;
  padding: 0 1.2rem;
}
.endmark__finis::before,
.endmark__finis::after {
  content: ""; position: absolute; top: 50%;
  width: 3rem; height: 1px; background: var(--candle); opacity: 0.6;
}
.endmark__finis::before { right: 100%; }
.endmark__finis::after  { left: 100%; }

/* Story navigation ---------------------------------------------------------- */

.story-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1rem;
  align-items: center;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-family: var(--font-display);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
}
.story-nav a { text-decoration: none; color: var(--bone-dim); }
.story-nav a:hover { color: var(--candle); }
.story-nav__prev     { text-align: left; }
.story-nav__next     { text-align: right; }
.story-nav__contents { text-transform: uppercase; letter-spacing: 0.28em; color: var(--candle); }
.story-nav__dir   { display: block; font-size: 0.65rem; letter-spacing: 0.28em;
                    text-transform: uppercase; color: var(--whisper); }
.story-nav__name  { display: block; font-style: italic; font-family: var(--font-body);
                    font-size: 1rem; letter-spacing: 0; margin-top: 0.2rem; }

/* ---------- About / Editor's Note ------------------------------------------- */

.about { max-width: var(--measure); margin: 0 auto; }
.about__title {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(2rem, 4.5vw, 3rem); letter-spacing: 0.04em;
  margin: 0.4rem 0 1.5rem;
}
.about__body { font-size: 1.125rem; line-height: 1.75; }
.about__body p { margin: 0 0 1.2rem; }

/* ---------- Storybook fairy-tale variant ----------------------------------- */
/* Used for the children's tales (The Golden Boy, The Music Box). A bordered
   header with corner ornaments, and an optional two-column opening grid. */

.story--storybook .story__header {
  position: relative;
  padding: 3.5rem 0 3rem;
  border-top: 1px solid var(--candle);
  border-bottom: 1px solid var(--candle);
  margin-bottom: 3rem;
}
.story--storybook .story__header::before,
.story--storybook .story__header::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 32px;
  background: var(--night);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M6 16h20M16 6v20' stroke='%23b89248' stroke-width='1' fill='none'/%3E%3Ccircle cx='16' cy='16' r='3' fill='%23b89248' opacity='0.4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 24px 24px;
}
.story--storybook .story__header::before { top: -16px; }
.story--storybook .story__header::after  { bottom: -16px; }

/* Two-column opening: hero illustration sits beside the first paragraphs.
   Only applies when both .story__hero and .story__body are present, and
   only on the storybook variant. */
.story--storybook .story__opening {
  display: grid;
  grid-template-columns: 1fr minmax(160px, 220px);
  gap: 2.5rem;
  align-items: start;
  margin: 0 0 1.5rem;
}
.story--storybook .story__opening .story__hero {
  margin: 0;
  text-align: center;
}
.story--storybook .story__opening .story__hero svg { max-width: 100%; }

@media (max-width: 600px) {
  .story--storybook .story__opening { grid-template-columns: 1fr; }
}

/* ---------- Persistent candle ---------------------------------------------- */
/* A redrawn candle with body, brass holder, and wax drips. The flame and glow
   are animated; the body sits still. */

.candle {
  position: fixed;
  right: 1.8rem;
  bottom: 1.8rem;
  width: 70px;
  height: 90px;
  pointer-events: none;
  z-index: 50;
  filter: drop-shadow(0 0 25px var(--candle-glow));
}
.candle svg { width: 100%; height: 100%; }

.candle__flame-group {
  transform-origin: 35px 28px;
  animation: candle-flicker 1.8s ease-in-out infinite;
}
.candle__glow {
  fill: var(--candle);
  opacity: 0.22;
  animation: candle-glow 2.2s ease-in-out infinite;
  transform-origin: 35px 20px;
}
.candle__fire { fill: var(--candle); }
.candle__core { fill: var(--candle-flame); opacity: 0.9; }
.candle__wax-body   { fill: var(--candle-wax); stroke: var(--candle-dim); stroke-width: 0.5; }
.candle__wax-drip   { fill: var(--candle-wax); }
.candle__holder     { fill: var(--candle-dim); }
.candle__holder-rim { fill: var(--ember); }

@keyframes candle-flicker {
  0%, 100% { transform: scaleY(1)    scaleX(1);    opacity: 1; }
  25%      { transform: scaleY(1.05) scaleX(0.95); opacity: 0.92; }
  50%      { transform: scaleY(0.95) scaleX(1.02); opacity: 1; }
  75%      { transform: scaleY(1.02) scaleX(0.98); opacity: 0.95; }
}
@keyframes candle-glow {
  0%, 100% { opacity: 0.18; }
  50%      { opacity: 0.30; }
}

@media (prefers-reduced-motion: reduce) {
  .candle__flame-group, .candle__glow { animation: none; }
}

@media (max-width: 600px) {
  .topnav { flex-direction: column; gap: 0.8rem; padding: 1rem var(--gutter); }
  .topnav__links { gap: 1rem; flex-wrap: wrap; justify-content: center; }
  .candle { right: 0.8rem; bottom: 0.8rem; transform: scale(0.8); transform-origin: bottom right; }
}
