/* River of Reverence — single unified reading.
   Ambient flow field always on. SVG ribbon appears only when hovering or
   pinning an end-word. End-words are interactive (pointer cursor, click)
   but don't restyle themselves on hover — the ribbon and audio do that. */

:root {
  --reader-bg: #0a0806;
  --reader-ink: #ede4cf;
  --reader-ink-soft: rgba(237, 228, 207, 0.62);
  --reader-ink-faint: rgba(237, 228, 207, 0.28);
  --reader-rule: rgba(237, 228, 207, 0.08);

  /* Lineage colors — used ONLY for the SVG ribbon overlay on hover. */
  --lineage-0: #e8634a;
  --lineage-1: #d5b56f;
  --lineage-2: #7ab283;
  --lineage-3: #7ab2d4;
  --lineage-4: #b683d2;
  --lineage-5: #e6a06a;
}

body {
  margin: 0;
  background: var(--reader-bg);
  color: var(--reader-ink);
  font-family: 'EB Garamond', 'Iowan Old Style', Georgia, serif;
  -webkit-font-smoothing: antialiased;
}

/* Top bar — muted against the dark stage */
.toy-top-bar {
  background: rgba(10, 8, 6, 0.85);
  border-bottom-color: rgba(237, 228, 207, 0.06);
  color: var(--reader-ink);
}
.toy-top-bar .back-button {
  color: rgba(237, 228, 207, 0.55);
  background: rgba(237, 228, 207, 0.04);
  border-color: rgba(237, 228, 207, 0.1);
}
.toy-top-bar .back-button:hover {
  background: rgba(237, 228, 207, 0.08);
  color: var(--reader-ink);
}
.toy-top-bar .toy-name { color: var(--reader-ink); }
.toy-top-bar .bar-about,
.toy-top-bar .bar-share { color: rgba(237, 228, 207, 0.55); }
.toy-top-bar .bar-about:hover,
.toy-top-bar .bar-share:hover { color: var(--reader-ink); }

/* The text column is tight; the river fills the page beneath it. */
:root { --col: 380px; }

.reader-root {
  position: relative;
  min-height: calc(100vh - 48px);
  padding: 0 24px;
  overflow-x: hidden;
}

/* Flow-field & twist hosts: full viewport width. The river runs the
   entire page beneath the centered column. */
.ribbon-host,
.twist-host {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100vw;
  pointer-events: none;
}
.ribbon-host { z-index: 0; }
.twist-host  { z-index: 1; }

.twist-host canvas { mix-blend-mode: exclusion; }

.reader-page {
  position: relative;
  z-index: 2;
  max-width: var(--col);
  margin: 0 auto;
  padding: 80px 0 120px;
}

.reader-head {
  margin: 0 auto 64px;
  max-width: var(--col);
  text-align: center;
}

.reader-kicker {
  font-family: 'Space Mono', monospace;
  font-size: 0.82rem;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--reader-ink-soft);
  margin-bottom: 22px;
}

.reader-head h1 {
  font-family: 'EB Garamond', serif;
  font-weight: 400;
  font-size: 3.2rem;
  letter-spacing: -0.5px;
  line-height: 1.05;
}

.reader-head h1 em { font-style: italic; }

.reader-byline {
  font-family: 'EB Garamond', serif;
  font-style: italic;
  font-size: 1rem;
  color: var(--reader-ink-soft);
  margin-top: 14px;
  max-width: 40ch;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
}

/* Inline footer after the poem — centered call-to-action */
.reader-after {
  margin: 72px auto 0;
  padding-top: 40px;
  text-align: center;
  border-top: 1px solid var(--reader-rule);
  max-width: var(--col);
}

.reader-compose {
  display: inline-block;
  font-family: 'Space Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 2.2px;
  text-transform: uppercase;
  color: rgba(237, 228, 207, 0.7);
  text-decoration: none;
  padding: 10px 22px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid rgba(237, 228, 207, 0.2);
}

.reader-compose:hover {
  color: var(--reader-ink);
  border-color: rgba(237, 228, 207, 0.5);
  background: rgba(237, 228, 207, 0.04);
}

.stanza {
  margin: 0 auto 44px;
  max-width: var(--col);
}

.stanza-envoi {
  margin-top: 64px;
  padding-top: 32px;
  border-top: 1px solid var(--reader-rule);
}

/* Envoi: each of the three poetic lines breaks into a pair — the first
   half flush, the continuation slightly indented. The indent signifies
   "still the same line." Six visual lines, three poetic ones. */
.stanza-envoi .envoi-pair + .envoi-pair { margin-top: 18px; }
.stanza-envoi .line--cont { padding-left: 1.4em; }

.stanza-body .line {
  font-size: 1.25rem;
  line-height: 1.85;
  color: var(--reader-ink);
  text-align: left;
}

.line-lead { color: var(--reader-ink); }

/* End-words: italic, tinted by their lineage color (static — no hover
   restyle). Interactive via cursor; the twist ribbon + audio carry the
   hover/pin feedback. Letters that changed from the previous stanza's
   same-lineage word get a small dotted underline. */
.end-word {
  font-style: italic;
  cursor: pointer;
  color: var(--lineage, var(--reader-ink));
  display: inline-block;
}

.end-word .ch { display: inline-block; }

.end-word .ch-morph {
  border-bottom: 1px dotted currentColor;
}

.end-word.lineage-0 { --lineage: var(--lineage-0); }
.end-word.lineage-1 { --lineage: var(--lineage-1); }
.end-word.lineage-2 { --lineage: var(--lineage-2); }
.end-word.lineage-3 { --lineage: var(--lineage-3); }
.end-word.lineage-4 { --lineage: var(--lineage-4); }
.end-word.lineage-5 { --lineage: var(--lineage-5); }

/* Floating UI */
.reader-ui-top {
  position: fixed;
  top: 64px;
  right: 24px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}


/* Audio toggle pill */
.audio-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(10, 8, 6, 0.85);
  border: 1px solid rgba(237, 228, 207, 0.12);
  border-radius: 999px;
  color: rgba(237, 228, 207, 0.7);
  font-family: 'Space Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.audio-toggle:hover {
  color: var(--reader-ink);
  border-color: rgba(237, 228, 207, 0.3);
}

.audio-toggle.is-on {
  background: var(--reader-ink);
  color: var(--reader-bg);
  border-color: var(--reader-ink);
}

.audio-icon {
  font-size: 0.95rem;
  font-family: 'EB Garamond', serif;
  font-style: italic;
  letter-spacing: 0;
}

@media (max-width: 640px) {
  .reader-page { padding: 48px 0 120px; }
  .reader-head h1 { font-size: 2.2rem; }
  .stanza-body .line { font-size: 1.08rem; line-height: 1.7; }
  .reader-ui-top { top: 56px; right: 12px; }
}
