/* ── Anakalypsis — A Structured Map of Biblical Revelation ── */

:root {
  --bg:          #0f1117;
  --bg-panel:    #181b24;
  --bg-card:     #1e222d;
  --bg-hover:    #252a38;
  --border:      #2a2f3e;
  --text:        #e4e6ed;
  --text-muted:  #8b90a0;
  --accent:      #c9a227;      /* gold — revelation, glory */
  --accent-dim:  #8a7019;
  --blue:        #5b8dd9;
  --green:       #4caf7d;
  --red:         #d45d5d;
  --purple:      #9b72cf;
  --orange:      #d4944c;
  --font-body:   'Crimson Pro', 'Georgia', serif;
  --font-page:   'EB Garamond', 'Crimson Pro', 'Georgia', serif;
  --font-ui:     'Inter', system-ui, sans-serif;
  --font-mono:   'JetBrains Mono', monospace;
  --radius:      8px;
  --transition:  150ms ease;
}

[data-theme="light"] {
  --bg:          #f5f3ee;
  --bg-panel:    #ede9e0;
  --bg-card:     #fff;
  --bg-hover:    #f0ece3;
  --border:      #d4cfc4;
  --text:        #2c2418;
  --text-muted:  #6b6358;
  --accent:      #8a6d1b;
  --accent-dim:  #c4a84a;
  --blue:        #3a6db5;
  --green:       #2e8a5a;
  --red:         #b94444;
  --purple:      #7a52b0;
  --orange:      #b87530;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

::selection {
  background: rgba(201, 162, 39, 0.35);
  color: var(--text);
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
}

/* ── Layout ─────────────────────────────────────────────────── */

.app {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
}

.app > header {
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
}

.logo-icon {
  width: 2rem;
  height: 2rem;
  color: var(--accent);
  flex-shrink: 0;
}

.app > header h1 {
  font-family: var(--font-ui);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.03em;
}

.app > header h1 span {
  color: var(--text-muted);
  font-weight: 400;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  font-family: var(--font-ui);
  font-size: 0.85rem;
}

nav a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition);
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
}

nav a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

nav a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: rgba(201, 162, 39, 0.08);
  border-radius: 4px 4px 0 0;
}

[data-theme="light"] nav a.active {
  background: rgba(138, 109, 27, 0.08);
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius);
  transition: color var(--transition), border-color var(--transition);
  margin-left: 0.5rem;
  line-height: 1;
  vertical-align: middle;
}

.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
}

main {
  padding: 2rem;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

footer {
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  padding: 1rem 2rem;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

/* ── Cards ──────────────────────────────────────────────────── */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: border-color var(--transition), background var(--transition);
}

.card:hover {
  border-color: var(--accent-dim);
  background: var(--bg-hover);
}

.card h2 {
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--accent);
}

.card h3 {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.card p {
  font-size: 0.95rem;
  color: var(--text-muted);
}

/* ── Grid layouts ───────────────────────────────────────────── */

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1rem; }

@media (max-width: 1200px) {
  .grid-5 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; }
}

/* ── Breadcrumb ────────────────────────────────────────────── */

.breadcrumb {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}
.breadcrumb a {
  color: var(--accent);
  text-decoration: none;
}
.breadcrumb a:hover {
  text-decoration: underline;
}

/* ── Hero ───────────────────────────────────────────────────── */

.hero {
  text-align: center;
  padding: 4rem 2rem 3rem;
}

.hero h1 {
  font-family: var(--font-body);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.hero h1 em {
  color: var(--accent);
  font-style: normal;
}

.hero p {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 700px;
  margin: 0 auto 2rem;
}

.hero-greek {
  font-family: var(--font-body);
  font-size: 1.35rem;
  color: var(--accent);
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
}

.hero-epigraph {
  max-width: 560px;
  margin: 1.25rem auto 1.5rem;
  padding: 0;
  border: none;
}

.hero-epigraph p {
  font-family: var(--font-page);
  font-size: 1.05rem;
  font-style: italic;
  line-height: 1.7;
  color: var(--text);
  opacity: 0.75;
  margin-bottom: 0.4rem;
}

.hero-epigraph cite {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-style: normal;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.hero-epigraph cite a {
  color: var(--accent-dim);
  text-decoration: none;
}

.hero-epigraph cite a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
}

/* ── Home page stats & cards ─────────────────────────────── */

.home-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
  padding: 0 2rem 1rem;
}

.home-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}

.home-stat-num {
  font-family: var(--font-ui);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--accent);
}

.home-stat-label {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.home-card {
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
  color: var(--text);
}
a.home-card h3 {
  color: var(--accent);
}
a.home-card p {
  color: var(--text-muted);
}

.home-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-dim);
  box-shadow: 0 4px 16px rgba(201, 162, 39, 0.15);
}

.home-card-icon {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.home-reading-progress {
  margin-top: 2rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.progress-bar-wrap {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 0.5rem;
}

.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.5s ease;
  min-width: 2px;
}

/* ── Parallel text table ──────────────────────────────────── */

.parallel-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.parallel-th {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.parallel-row {
  border-bottom: 1px solid var(--border);
}

.parallel-row:hover {
  background: rgba(201, 162, 39, 0.08);
}

.parallel-verse-num {
  padding: 0.5rem 0.25rem;
  vertical-align: top;
  white-space: nowrap;
}

.parallel-td {
  padding: 0.5rem 0.75rem;
  vertical-align: top;
  line-height: 1.6;
  border-left: 1px solid var(--border);
}

@media (max-width: 768px) {
  .parallel-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .parallel-td { min-width: 200px; font-size: 0.85rem; }
}

/* ── Entity grid ─────────────────────────────────────────── */

.entity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
}

.entity-card {
  padding: 1rem;
}

.entity-card h3 {
  font-size: 0.9rem;
  margin-bottom: 0.2rem;
}

/* ── Reader layout ─────────────────────────────────────────── */

.reader-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.5rem;
  align-items: start;
  position: relative;
}

@media (max-width: 1000px) {
  .reader-layout { grid-template-columns: 1fr; }
}

.sidebar-toggle-mobile {
  display: none;
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 100;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: #000;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  align-items: center;
  justify-content: center;
}

@media (max-width: 1000px) {
  .sidebar-toggle-mobile { display: flex; }
  .sidebar { display: none; }
  .sidebar--mobile-open {
    display: block;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 320px;
    max-width: 85vw;
    z-index: 200;
    background: var(--bg-panel);
    overflow-y: auto;
    padding: 1rem;
    box-shadow: -4px 0 16px rgba(0,0,0,0.3);
    animation: slide-in-right 0.2s ease-out;
  }
  .sidebar-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 199;
    background: rgba(0,0,0,0.5);
  }
}

@keyframes slide-in-right {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.reader-main {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.reader-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  position: relative;
  z-index: 10;
}

.reader-nav-arrows {
  display: flex;
  gap: 0.25rem;
}

.sidebar {
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}

.sidebar-conn-list {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0 0.5rem 0 1.5rem;
}

/* Timeline vertical line */
.sidebar-conn-list::before {
  content: '';
  position: absolute;
  left: 0.45rem;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border);
}

/* ── Text tradition tabs ──────────────────────────────────── */

.tradition-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: -0.5rem;
}

.tradition-tab {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  padding: 0.5rem 1rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
}

.tradition-tab:hover {
  color: var(--text);
}

.tradition-tab--active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── Book page ─────────────────────────────────────────────── */

.page {
  background: #faf6ef;
  border-radius: 4px;
  box-shadow:
    0 4px 12px rgba(0,0,0,0.2),
    0 20px 60px rgba(0,0,0,0.35),
    inset 0 0 80px rgba(0,0,0,0.03);
  position: relative;
  border: 1px solid rgba(180,170,150,0.25);
  animation: pageReveal 0.6s ease-out both;
}

@keyframes pageReveal {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.page::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 4px;
  pointer-events: none;
  /* Parchment texture — layered subtle gradients for paper feel */
  background:
    linear-gradient(135deg, rgba(200,190,170,0.06) 0%, transparent 50%),
    linear-gradient(to bottom, rgba(0,0,0,0.015) 0%, transparent 8%, transparent 92%, rgba(0,0,0,0.02) 100%),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(139,119,90,0.008) 2px,
      rgba(139,119,90,0.008) 3px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 3px,
      rgba(139,119,90,0.005) 3px,
      rgba(139,119,90,0.005) 4px
    );
  opacity: 0.98;
}

[data-theme="light"] .page {
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 4px 12px rgba(0,0,0,0.08);
}

.page-inner {
  padding: 2.5rem 3rem 2rem;
  position: relative;
  max-width: 860px;
  margin: 0 auto;
}

@media (max-width: 700px) {
  .page-inner { padding: 2rem 1.5rem 1.5rem; }
}

/* Page header — running head */
.page-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(140,130,110,0.2);
  animation: headerReveal 0.8s ease-out 0.1s both;
}

@keyframes headerReveal {
  from { opacity: 0.5; }
  to   { opacity: 1; }
}

.page-header-book {
  font-family: var(--font-page);
  font-size: 0.8rem;
  font-weight: 400;
  font-variant: small-caps;
  letter-spacing: 0.18em;
  color: #8a7d6b;
}

.page-header-sep {
  width: 20px;
  height: 1px;
  background: rgba(140,130,110,0.25);
}

.page-header-chapter {
  font-family: var(--font-page);
  font-size: 0.8rem;
  font-weight: 400;
  font-variant: small-caps;
  letter-spacing: 0.18em;
  color: #8a7d6b;
}

/* Chapter ornament — decorative separator before chapter number */
.chapter-ornament {
  text-align: center;
  font-size: 1rem;
  color: #c4a55a;
  opacity: 0;
  margin-bottom: 0.5rem;
  letter-spacing: 0.5em;
  animation: ornamentReveal 1s ease-out 0.15s both;
}

@keyframes ornamentReveal {
  from { opacity: 0; filter: blur(1px); transform: scale(0.98); }
  to   { opacity: 0.5; filter: blur(0); transform: scale(1); }
}

/* Chapter number — decorative block above text */
.chapter-number {
  font-family: var(--font-page);
  font-size: 3.5rem;
  font-weight: 400;
  line-height: 1;
  color: #c4a55a;
  text-align: center;
  margin-bottom: 1.5rem;
  opacity: 0;
  letter-spacing: 0.05em;
  animation: chapterReveal 1s ease-out 0.25s both;
}

@keyframes chapterReveal {
  from { opacity: 0; letter-spacing: 0.12em; }
  to   { opacity: 0.5; letter-spacing: 0.05em; }
}

/* Gold accent rule below chapter number */
.chapter-number::after {
  content: '';
  display: block;
  width: 3rem;
  height: 1px;
  background: linear-gradient(to right, transparent, #c4a55a, transparent);
  margin: 0.75rem auto 0;
  opacity: 0;
  animation: ruleReveal 0.8s ease-out 0.4s both;
}

@keyframes ruleReveal {
  from { opacity: 0; transform: scaleX(0); }
  to   { opacity: 0.6; transform: scaleX(1); }
}

/* Scripture text — the main reading area */
.scripture-text {
  color: #2b2a28;
  font-family: var(--font-page);
  font-size: 1.2rem;
  line-height: 1.72;
}

.scripture-para {
  margin-bottom: 0.8em;
  text-indent: 1.5em;
  hanging-punctuation: first allow-end;
  animation: textReveal 0.7s ease-out both;
}

/* First paragraph gets subtle lift; rest are opacity-only */
.scripture-para:nth-child(1) { animation-name: textRevealFirst; animation-delay: 0.3s; }
.scripture-para:nth-child(2) { animation-delay: 0.38s; }
.scripture-para:nth-child(3) { animation-delay: 0.44s; }
.scripture-para:nth-child(4) { animation-delay: 0.48s; }
.scripture-para:nth-child(5) { animation-delay: 0.51s; }
.scripture-para:nth-child(n+6) { animation-delay: 0.53s; }

@keyframes textReveal {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes textRevealFirst {
  from { opacity: 0; transform: translateY(3px); }
  to   { opacity: 1; transform: translateY(0); }
}

.scripture-para--first {
  text-indent: 0;
}

/* Drop cap — first letter of the chapter */
.scripture-para--first .drop-cap {
  float: left;
  font-family: var(--font-page);
  font-size: 4.5rem;
  line-height: 0.78;
  padding-right: 0.1em;
  padding-top: 0.06em;
  margin-right: 0.02em;
  color: #8a6d1b;
  font-weight: 500;
  animation: dropCapReveal 1s ease-out 0.5s both;
}

@keyframes dropCapReveal {
  from { opacity: 0; transform: scale(0.92) translateY(1px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* Poetry lines (Psalms, Proverbs, etc.) */
.scripture-line {
  margin-bottom: 0.35em;
  padding-left: 1.5em;
  text-indent: -1.5em;
}

/* Verse units */
.verse-unit {
  border-radius: 3px;
  padding: 1px 2px;
  transition: background 300ms ease;
}

.verse-unit:hover {
  background: rgba(210,180,120,0.06);
}

.verse-unit--active {
  background: rgba(210,180,120,0.15);
}

.verse-unit--highlighted {
  background: rgba(100,160,255,0.15);
  border-radius: 2px;
  box-shadow: 0 0 0 3px rgba(100,160,255,0.12);
  transition: background 0.3s, box-shadow 0.3s;
}

.verse-unit--playing {
  background: rgba(210,180,120,0.14);
  border-radius: 3px;
  outline: 1px solid rgba(210,180,120,0.2);
  transition: background 300ms ease;
}

.audio-play-btn { white-space: nowrap; }
.audio-duration {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: 0.25rem;
}
.audio-play-btn--active {
  color: var(--accent);
  background: rgba(201,162,39,0.15);
}

.verse-num {
  font-family: var(--font-ui);
  font-size: 0.65em;
  font-weight: 400;
  color: rgba(140,120,70,0.45);
  vertical-align: super;
  margin-left: -0.15em;
  margin-right: 0.15em;
  letter-spacing: 0.02em;
  cursor: pointer;
  line-height: 0;
  transition: color 150ms ease;
}

.verse-num:hover {
  color: #8a6d1b;
  opacity: 1;
}

/* Greek and Latin text styling */
.scripture-text--greek {
  font-family: 'EB Garamond', 'Gentium Plus', 'Gentium', 'Georgia', serif;
  font-size: 1.15rem;
  direction: ltr;
}

.scripture-text--latin {
  font-family: 'EB Garamond', 'Crimson Pro', 'Georgia', serif;
  font-style: italic;
  font-size: 1.15rem;
}

/* Page footer — chapter navigation */
.page-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 2rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(140,130,110,0.2);
}

.page-footer-link {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: #8a7d6b;
  text-decoration: none;
  transition: color 150ms ease;
}

.page-footer-link:hover {
  color: #c4a55a;
}

/* ── Tags / Pills ───────────────────────────────────────────── */

.tag {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  margin: 0.15rem;
  cursor: pointer;
  transition: all var(--transition);
}

.tag:hover { border-color: var(--accent); color: var(--accent); }
.tag.active { background: var(--accent); color: var(--bg); border-color: var(--accent); }

.tag--prophecy { border-color: var(--blue); color: var(--blue); }
.tag--theophany { border-color: var(--purple); color: var(--purple); }
.tag--theme { border-color: var(--green); color: var(--green); }
.tag--history { border-color: var(--orange); color: var(--orange); }
.tag--tradition { border-color: var(--red); color: var(--red); }

/* ── Prophecy cards ─────────────────────────────────────────── */

.prophecy-card {
  cursor: pointer;
}

.prophecy-card .type-badge {
  font-family: var(--font-ui);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--blue);
  margin-bottom: 0.5rem;
}

.prophecy-card .consensus {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  color: var(--text-muted);
}

.prophecy-card .ref {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
}

/* ── Theophany cards ────────────────────────────────────────── */

.theophany-card .classification {
  font-family: var(--font-ui);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.25rem;
}

/* Christological status colors */
.classification--consensus { color: var(--green); }
.classification--majority { color: var(--blue); }
.classification--minority { color: var(--orange); }
.classification--disputed { color: var(--red); }

/* ── Search ─────────────────────────────────────────────────── */

.search-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.search-bar input {
  flex: 1;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  padding: 0.6rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  outline: none;
  transition: border-color var(--transition);
}

.search-bar input:focus { border-color: var(--accent); }

.search-bar input::placeholder { color: var(--text-muted); }

/* ── Buttons ────────────────────────────────────────────────── */

.btn {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
}

.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn--primary { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.btn--primary:hover { background: var(--accent-dim); }

/* ── Filter bar ─────────────────────────────────────────────── */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  align-items: center;
}

.filters label {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-right: 0.25rem;
}

.filter-select {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  padding: 0.3rem 0.6rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  outline: none;
}

.filter-select:focus { border-color: var(--accent); }

/* ── Connections panel ──────────────────────────────────────── */

.connection {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: var(--radius);
  transition: background var(--transition);
  cursor: pointer;
}

.connection:hover { background: var(--bg-hover); }

.connection-type {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  min-width: 80px;
  padding-top: 0.15rem;
}

.connection-ref {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--accent);
}

.connection-summary {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ── Confidence bar ─────────────────────────────────────────── */

.confidence-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 0.5rem;
  overflow: hidden;
}

.confidence-bar .fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 300ms ease;
}

/* ── Loading ────────────────────────────────────────────────── */

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 0.9rem;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 600ms linear infinite;
  margin-right: 0.75rem;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Source text cards ──────────────────────────────────────── */

.source-card {
  cursor: default;
}

.source-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.source-author {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--accent);
}

.source-work {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-left: 0.5rem;
}

.source-period {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-left: 0.5rem;
}

.source-claim {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--text);
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

.source-text-toggle {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--blue);
  cursor: pointer;
  user-select: none;
  margin-bottom: 0.25rem;
}

.source-text-toggle:hover {
  color: var(--accent);
}

.source-text-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 400ms ease, padding 300ms ease;
  padding: 0;
}

.source-text-body.expanded {
  max-height: 2000px;
  padding: 0.75rem 0;
}

.source-heading {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.source-passage {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text);
  border-left: 3px solid var(--accent-dim);
  padding-left: 1rem;
  white-space: pre-wrap;
}

/* Source work entry in corpus browser */
.source-work-entry {
  padding: 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border);
}

.source-work-entry:last-child {
  border-bottom: none;
}

.source-work-entry:hover {
  background: var(--bg-hover);
}

/* ── Stories ────────────────────────────────────────────────── */

.story-layout {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 1.5rem;
  align-items: start;
  max-width: 1200px;
  margin: 0 auto;
}

.story-nav-rail {
  position: sticky;
  top: 4rem;
  max-height: calc(100vh - 5rem);
  overflow-y: auto;
  padding-top: 0.5rem;
}

.story-nav-rail::-webkit-scrollbar { width: 0; }

@media (max-width: 900px) {
  .story-layout { grid-template-columns: 1fr; }
  .story-nav-rail { display: none; }
}

.story-article {
  max-width: 900px;
}

.story-header {
  display: flex;
  flex-direction: column;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.story-icon-large {
  font-size: 2rem;
  text-align: center;
  color: var(--accent);
  opacity: 0.5;
  margin-bottom: 1rem;
  width: 100%;
}

.story-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  opacity: 0.5;
}

.story-title {
  font-family: var(--font-body);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 1rem;
  width: 100%;
}

.story-subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  width: 100%;
}

.story-meta {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  gap: 1.5rem;
  width: 100%;
}

.story-section {
  margin-bottom: 3rem;
  scroll-margin-top: 6rem;
}

.story-section-heading {
  font-family: var(--font-ui);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.story-prose {
  font-size: 1.05rem;
  line-height: 1.85;
  margin-bottom: 1.25rem;
  color: var(--text);
}

.story-verse {
  border-left: 3px solid var(--accent);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  background: rgba(201, 162, 39, 0.05);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.story-verse p {
  font-family: var(--font-page);
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--text);
  font-style: italic;
}

.story-verse cite {
  display: block;
  margin-top: 0.5rem;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-style: normal;
}

.story-verse cite a {
  color: var(--accent);
  text-decoration: none;
}

.story-verse cite a:hover {
  text-decoration: underline;
}

.story-source, .story-father {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 1.5rem 0;
}

.story-source-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: baseline;
  margin-bottom: 0.75rem;
  font-family: var(--font-ui);
  font-size: 0.85rem;
}

.story-source-author {
  font-weight: 600;
  color: var(--accent);
}

.story-source-work {
  color: var(--text-muted);
}

.story-source-ref, .story-source-date {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.story-source blockquote, .story-father blockquote {
  border-left: 3px solid var(--border);
  padding-left: 1rem;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text);
  font-style: italic;
}

.story-source-note {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
  font-style: italic;
}

.story-corpus-link {
  display: inline-block;
  margin-top: 0.75rem;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--blue);
  text-decoration: none;
}

.story-corpus-link:hover {
  color: var(--accent);
}

.story-keypoint {
  border-left: 3px solid var(--green);
  background: rgba(76, 175, 125, 0.06);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.6;
  color: var(--text);
}

.story-list {
  list-style: none;
  margin: 1.5rem 0;
  padding: 0;
}

.story-list li {
  font-family: var(--font-ui);
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text);
  padding: 0.4rem 0 0.4rem 1.5rem;
  position: relative;
  border-bottom: 1px solid var(--border);
}

.story-list li:last-child {
  border-bottom: none;
}

.story-list li::before {
  content: '';
  position: absolute;
  left: 0.25rem;
  top: 0.85rem;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.story-note {
  border-left: 3px solid var(--blue);
  background: rgba(91, 141, 217, 0.06);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.story-note-label {
  display: block;
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--blue);
  margin-bottom: 0.35rem;
}

.story-objection {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 1rem 0;
}

.story-objection-name {
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.story-objection-row {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.story-objection-label {
  font-weight: 600;
  color: var(--text);
}

.story-toc {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-left: 1px solid var(--border);
  padding-left: 0;
}

.story-toc-link {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
  border-left: 2px solid transparent;
  margin-left: -1px;
  line-height: 1.4;
}

.story-toc-link:hover {
  color: var(--accent);
  border-left-color: var(--accent);
}

/* ── Genealogy tree diagram ─────────────────────────────────── */
.story-genealogy {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  margin: 1.5rem 0;
  text-align: center;
}
.genealogy-title {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}
.genealogy-node {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  padding: 0.35rem 0;
  position: relative;
}
.genealogy-node a {
  color: var(--accent);
  text-decoration: none;
}
.genealogy-node a:hover {
  text-decoration: underline;
}
.genealogy-root {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.5rem;
}
.genealogy-merge-node {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent);
  margin-top: 0.75rem;
}
.genealogy-cursed {
  color: #c0392b;
}
.genealogy-cursed a {
  color: #c0392b;
}
.genealogy-cursed::before {
  content: '\2716 ';
  font-size: 0.7em;
  color: #c0392b;
}
.genealogy-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--text-muted);
  font-style: italic;
}
.genealogy-branch-label {
  display: flex;
  justify-content: space-around;
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0.75rem 0 0.25rem;
  padding: 0 1rem;
}
.genealogy-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin: 0 auto;
  max-width: 420px;
}
.genealogy-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  border-top: 2px solid var(--border);
  padding-top: 0.5rem;
}
.genealogy-col-left {
  border-right: 1px solid var(--border);
}
.genealogy-ellipsis {
  font-size: 1rem;
  color: var(--text-muted);
  padding: 0.15rem 0;
  line-height: 1;
}

@media (max-width: 600px) {
  .story-genealogy { padding: 1.25rem 0.75rem; }
  .genealogy-columns { gap: 0.5rem; }
  .genealogy-node { font-size: 0.78rem; }
}

/* ── Table of Contents panel ────────────────────────────────── */

.toc-btn {
  font-size: 1.1rem;
  padding: 0.4rem 0.7rem;
  line-height: 1;
}

.toc-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: 340px;
  height: 100vh;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  z-index: 200;
  transform: translateX(-100%);
  transition: transform 250ms ease;
  overflow-y: auto;
}

.toc-panel--open {
  transform: translateX(0);
}

.toc-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 199;
  opacity: 0;
  pointer-events: none;
  transition: opacity 250ms ease;
}

.toc-panel--open ~ .toc-overlay {
  opacity: 1;
  pointer-events: auto;
}

.toc-panel-inner {
  padding: 1.25rem;
}

.toc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.toc-header h2 {
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
}

.toc-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0 0.25rem;
  line-height: 1;
  transition: color var(--transition);
}

.toc-close:hover {
  color: var(--text);
}

.toc-section {
  margin-bottom: 1.25rem;
}

.toc-section-title {
  font-family: var(--font-ui);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border);
}

.toc-book {
  margin-bottom: 0.15rem;
}

.toc-book--active > .toc-book-name {
  color: var(--accent);
  font-weight: 600;
}

.toc-book-name {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--text);
  padding: 0.3rem 0.5rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.toc-book-name:hover {
  background: var(--bg-hover);
  color: var(--accent);
}

.toc-chapters {
  display: none;
  flex-wrap: wrap;
  gap: 2px;
  padding: 0.25rem 0.5rem 0.5rem;
}

.toc-chapters--open {
  display: flex;
}

.toc-ch {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  width: 28px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  color: var(--text-muted);
  text-decoration: none;
  transition: all var(--transition);
  background: var(--bg);
}

.toc-ch:hover {
  background: var(--accent-dim);
  color: var(--text);
}

.toc-ch--active {
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
}

@media (max-width: 500px) {
  .toc-panel { width: 100vw; }
}

/* ── Chapter picker ────────────────────────────────────────── */

.chapter-picker-wrap {
  position: relative;
}

.chapter-picker-btn {
  font-weight: 600;
  min-width: 60px;
}

.chapter-picker {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  z-index: 50;
  flex-wrap: wrap;
  gap: 3px;
  width: 280px;
  max-height: 300px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.chapter-picker--open {
  display: flex;
}

.ch-pick {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  width: 30px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  color: var(--text-muted);
  text-decoration: none;
  background: var(--bg);
  transition: all var(--transition);
}

.ch-pick:hover {
  background: var(--accent-dim);
  color: var(--text);
}

.ch-pick--active {
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
}

.ch-pick--read {
  color: var(--text);
  background: var(--bg-hover);
  border-bottom: 2px solid var(--accent-dim);
}

/* ── Reading progress in TOC ───────────────────────────────── */

.toc-ch--read {
  color: var(--text);
  background: var(--bg-hover);
  border-bottom: 2px solid var(--accent-dim);
}

/* ── SVG connector (verse → sidebar) ───────────────────────── */

.verse-connector-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
  overflow: visible;
}

.connector-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  opacity: 0.4;
  stroke-dasharray: 6 3;
}

.connector-line--auto {
  fill: none;
  stroke: var(--accent);
  stroke-width: 0.75;
  opacity: 0.15;
  stroke-dasharray: 4 4;
  transition: opacity 0.2s, stroke-width 0.2s;
}

.connector-line--highlight {
  opacity: 0.5;
  stroke-width: 1.5;
  stroke-dasharray: none;
}

.connector-dot {
  fill: var(--accent);
  opacity: 0.6;
}

/* ── Sidebar sections (expandable) ─────────────────────────── */

.sidebar-verse-header {
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
}

.sidebar-verse-id {
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--accent);
  font-weight: 600;
  font-variant: small-caps;
  letter-spacing: 0.04em;
}

.sidebar-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  overflow: hidden;
}

.sidebar-section-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  cursor: pointer;
  transition: background var(--transition);
}

.sidebar-section-header:hover {
  background: var(--bg-hover);
}

.sidebar-section-title {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  font-variant: small-caps;
  letter-spacing: 0.04em;
  flex: 1;
}

.sidebar-section-count {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--bg);
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
}

.sidebar-section-arrow {
  font-size: 0.7rem;
  color: var(--text-muted);
  transition: transform 200ms ease;
}

.sidebar-section--closed .sidebar-section-arrow {
  transform: rotate(-90deg);
}

.sidebar-section-body {
  padding: 0 0.5rem 0.5rem;
  max-height: 600px;
  overflow-y: auto;
  transition: max-height 300ms ease, padding 200ms ease;
}

.sidebar-section--closed .sidebar-section-body {
  max-height: 0;
  padding: 0 0.5rem;
  overflow: hidden;
}

/* Cross-reference text previews */
.xref-preview {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: 0.2rem;
  font-style: italic;
}

/* ── Chapter connections timeline ───────────────────────────── */

.conn-entry {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--transition);
}

/* Timeline dot */
.conn-entry::before {
  content: '';
  position: absolute;
  left: -1.05rem;
  top: 0.55rem;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 1.5px solid var(--accent);
  z-index: 1;
}

/* Connector line from dot to card */
.conn-entry::after {
  content: '';
  position: absolute;
  left: -0.6rem;
  top: 0.82rem;
  width: 0.6rem;
  height: 1px;
  background: var(--border);
}

.conn-entry:hover {
  border-color: var(--accent-dim);
}

.conn-entry-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.5rem;
  cursor: pointer;
}

.conn-entry-verse {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  min-width: 1.5rem;
}

.conn-entry-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
}

.conn-badge {
  font-family: var(--font-ui);
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  letter-spacing: 0.02em;
}

.conn-badge--theo { background: rgba(155, 114, 207, 0.15); color: var(--purple); }
.conn-badge--theo-cont { background: none; color: var(--purple); font-size: 0.85rem; opacity: 0.5; padding: 0; }
.conn-badge--prop { background: rgba(91, 141, 217, 0.15); color: var(--blue); }
.conn-badge--ful  { background: rgba(76, 175, 125, 0.15); color: var(--green); }
.conn-badge--quote { background: rgba(255, 255, 255, 0.06); color: var(--text-muted); }
.conn-badge--theme { background: rgba(76, 175, 125, 0.1); color: var(--green); }

/* Theophany full info block */
.conn-theo-full {
  margin-bottom: 0.3rem;
}

.conn-theo-tradition {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-top: 0.15rem;
  font-style: italic;
}

.conn-theo-link {
  font-family: var(--font-ui);
  font-size: 0.65rem;
  color: var(--purple);
  text-decoration: none;
  display: inline-block;
  margin-top: 0.25rem;
}

.conn-theo-link:hover {
  color: var(--accent);
}

.conn-theo-verses {
  font-family: var(--font-ui);
  font-size: 0.65rem;
  color: var(--purple);
  opacity: 0.7;
  margin-top: 0.1rem;
}

/* Theophany span lines — connecting entry to each referenced verse */
.theo-span-line {
  position: absolute;
  left: 0.42rem;
  width: 2px;
  background: rgba(155, 114, 207, 0.4);
  pointer-events: none;
  z-index: 0;
}

.theo-span-dot {
  position: absolute;
  left: 0.2rem;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(155, 114, 207, 0.5);
  border: 1px solid var(--purple);
  pointer-events: none;
  z-index: 1;
}

.conn-entry-detail {
  max-height: 0;
  overflow: hidden;
  padding: 0 0.5rem;
  transition: max-height 250ms ease, padding 200ms ease;
}

.conn-entry--open .conn-entry-detail {
  max-height: 300px;
  overflow-y: auto;
  padding: 0.25rem 0.5rem 0.5rem;
}

.conn-detail-item {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  padding: 0.2rem 0;
  line-height: 1.45;
}

.conn-detail-item a {
  text-decoration: none;
}

.conn-detail-item a:hover {
  color: var(--accent) !important;
}

.sidebar-loading {
  padding: 1.5rem 1rem;
  text-align: center;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

/* ── Page transitions ───────────────────────────────────────── */

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

main > *:not(.toc-panel):not(.toc-overlay) {
  animation: fadeIn 0.25s ease both;
}

/* ── Quiz & Flashcard styles ──────────────────────────────── */

.quiz-layout {
  max-width: 700px;
  margin: 0 auto;
}

.quiz-categories {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

.quiz-cat-card {
  padding: 1.25rem;
  text-align: center;
  cursor: pointer;
  text-decoration: none;
}

.quiz-cat-card:hover {
  transform: translateY(-2px);
}

.quiz-cat-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.quiz-cat-count {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Quiz in progress */
.quiz-progress-bar {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.quiz-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.quiz-question-num {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.quiz-question {
  font-family: var(--font-body);
  font-size: 1.3rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
  color: var(--text);
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.quiz-option {
  font-family: var(--font-ui);
  font-size: 0.95rem;
  padding: 0.85rem 1.25rem;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
}

.quiz-option:hover:not(.quiz-option--answered) {
  border-color: var(--accent-dim);
  background: var(--bg-hover);
}

.quiz-option--correct {
  border-color: var(--green) !important;
  background: rgba(76, 175, 125, 0.1) !important;
  color: var(--green) !important;
}

.quiz-option--wrong {
  border-color: var(--red) !important;
  background: rgba(212, 93, 93, 0.08) !important;
  color: var(--red) !important;
  opacity: 0.7;
}

.quiz-option--answered {
  cursor: default;
  opacity: 0.5;
}

.quiz-option--answered.quiz-option--correct { opacity: 1; }

.quiz-feedback {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-top: 1rem;
  animation: fadeIn 0.2s ease both;
}

.quiz-feedback--correct {
  background: rgba(76, 175, 125, 0.1);
  border: 1px solid var(--green);
  color: var(--green);
}

.quiz-feedback--wrong {
  background: rgba(212, 93, 93, 0.08);
  border: 1px solid var(--red);
  color: var(--text);
}

/* Results */
.quiz-result {
  text-align: center;
  padding: 2rem 1rem;
}

.quiz-score-ring {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 6px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
}

.quiz-score-ring--perfect { border-color: var(--accent); }
.quiz-score-ring--great { border-color: var(--green); }
.quiz-score-ring--good { border-color: var(--blue); }
.quiz-score-ring--try { border-color: var(--orange); }

.quiz-score-pct {
  font-family: var(--font-ui);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
}

.quiz-result-title {
  font-family: var(--font-ui);
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.quiz-result-subtitle {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.quiz-result-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Flashcard mode */
.flashcard {
  perspective: 1000px;
  width: 100%;
  max-width: 500px;
  height: 280px;
  margin: 2rem auto;
  cursor: pointer;
}

.flashcard-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.5s ease;
  transform-style: preserve-3d;
}

.flashcard--flipped .flashcard-inner {
  transform: rotateY(180deg);
}

.flashcard-front, .flashcard-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  text-align: center;
}

.flashcard-front {
  background: var(--bg-card);
}

.flashcard-back {
  background: var(--bg-hover);
  transform: rotateY(180deg);
}

.flashcard-front p {
  font-family: var(--font-body);
  font-size: 1.15rem;
  line-height: 1.7;
  color: var(--text);
  font-style: italic;
}

.flashcard-back p {
  font-family: var(--font-ui);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent);
}

.flashcard-hint {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 1rem;
}

.flashcard-nav {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1rem;
}

.flashcard-counter {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.5rem;
}

/* ── Connected verse indicator (non-invasive) ─────────────── */

.verse-unit--connected {
  position: relative;
}

.verse-unit--connected::before {
  content: '';
  position: absolute;
  left: -0.6rem;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.5;
}

.verse-unit--connected > .verse-num {
  color: #c4a55a;
  text-shadow: 0 0 6px rgba(201, 162, 39, 0.3);
}

/* ── Verse of the Day ──────────────────────────────────────── */

.votd-card {
  max-width: 600px;
  margin: 1.5rem auto 0;
  padding: 1.5rem 2rem;
  background: var(--bg-card);
  border: 1px solid var(--accent-dim);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  text-align: center;
}

.votd-label {
  font-family: var(--font-ui);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.votd-text {
  font-family: var(--font-page);
  font-size: 1.15rem;
  line-height: 1.8;
  color: var(--text);
  font-style: italic;
  margin-bottom: 0.75rem;
}

.votd-ref {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--accent);
  text-decoration: none;
}

.votd-ref:hover {
  text-decoration: underline;
}

/* ── Verse bookmark button ─────────────────────────────────── */

.verse-bookmark-btn {
  font-size: 0.85rem;
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  padding: 0 0.2rem;
  vertical-align: super;
  line-height: 0;
  opacity: 0.6;
  transition: opacity var(--transition);
}

.verse-bookmark-btn:hover {
  opacity: 1;
}

/* ── Timeline & Map ─────────────────────────────────────────── */

/* Timeline fills the full viewport height */
.tl-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0; /* allow flex shrinking */
}

/* Top bar — compact, map-first layout */
.tl-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}
.tl-topbar .breadcrumb { margin-bottom: 0; }
.tl-topbar-left { display: flex; align-items: center; gap: 0.5rem; }
.tl-topbar-right { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }

.tl-primary-select {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.35rem 0.6rem;
  font-family: var(--font-ui);
  font-size: 0.8rem;
}
.tl-icon-btn {
  width: 2rem;
  height: 2rem;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tl-icon-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent);
}

/* Collapsible filter panel */
.tl-filters-panel {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-wrap: wrap;
  animation: tl-slide-down 0.2s ease-out;
}
@keyframes tl-slide-down {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.tl-filters-panel select {
  background: var(--bg-hover);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.3rem 0.5rem;
  font-family: var(--font-ui);
  font-size: 0.8rem;
}

.tl-filters {
  display: flex;
  gap: 0.5rem;
}

.tl-cat-tag {
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s;
}
.tl-cat-tag.active { opacity: 1; }
.tl-cat-tag[data-cat="biblical"] { background: #d4af37; color: #000; }
.tl-cat-tag[data-cat="empire"]   { background: #c75c5c; color: #000; }
.tl-cat-tag[data-cat="cultural"] { background: #5ba3d9; color: #000; }

/* Status bar below timeline */
.tl-statusbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.25rem 0;
  margin-bottom: 0.5rem;
}

.tl-year-range {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--text-muted);
}
.tl-event-count {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.7;
}

.tl-map {
  flex: 1;
  min-height: 300px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 0.5rem;
  overflow: hidden;
}

/* Override Leaflet for dark theme */
.tl-map .leaflet-control-zoom a {
  background: var(--bg-card);
  color: var(--text);
  border-color: var(--border);
}
.tl-map .leaflet-control-attribution {
  background: rgba(15,17,23,0.7);
  color: var(--text-muted);
  font-size: 0.6rem;
}
.tl-map .leaflet-control-attribution a { color: var(--accent); }

.tl-strip-wrapper {
  display: flex;
  align-items: stretch;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
  flex-shrink: 0;
}

.tl-strip {
  flex: 1;
  height: 160px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: grab;
  position: relative;
}

.tl-strip canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.tl-zoom-btn {
  width: 32px;
  font-size: 1.2rem;
  font-weight: bold;
  border-radius: var(--radius);
}

.btn--small {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
}

.tl-detail {
  margin-bottom: 1rem;
  transition: opacity 0.25s ease;
}
.tl-detail--active {
  animation: tl-detail-in 0.3s ease-out;
}
@keyframes tl-detail-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Welcome state */
.tl-welcome {
  text-align: center;
  padding: 1rem 0;
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 0.9rem;
}
.tl-welcome kbd {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.1rem 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.tl-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tl-link {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--accent);
  text-decoration: none;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.tl-link:hover {
  background: var(--bg-hover);
}
.tl-link--wiki {
  color: var(--text-muted);
}
.tl-link--wiki:hover {
  color: var(--text);
}
.tl-link--empire {
  color: var(--text-muted);
  border-color: rgba(180,50,50,0.3);
}
.tl-link--empire:hover {
  color: var(--text);
  border-color: rgba(180,50,50,0.6);
}

.tl-waypoint-progress {
  margin-top: 0.5rem;
  height: 4px;
  background: var(--bg);
  border-radius: 2px;
  overflow: hidden;
}
.tl-waypoint-bar {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* Journey transport controls (media player) */
.tl-transport {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
}
.tl-transport button {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 4px;
  width: 2rem;
  height: 2rem;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), border-color var(--transition);
}
.tl-transport button:hover {
  background: var(--border);
  border-color: var(--text-muted);
}
.tl-transport button.active {
  background: var(--accent-dim);
  border-color: var(--accent);
}
.tl-transport-bar {
  flex: 1;
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  cursor: pointer;
  position: relative;
  min-width: 80px;
}
.tl-transport-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  transition: width 0.15s ease;
  pointer-events: none;
}
.tl-transport-thumb {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-card);
  transform: translate(-50%, -50%);
  pointer-events: none;
  transition: left 0.15s ease;
}
.tl-transport-label {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 3rem;
  text-align: center;
}

/* (title row removed — replaced by tl-topbar) */

/* Flash effect when journey auto-starts */
.tl-transport-flash {
  animation: tl-flash 1.2s ease-out;
}
@keyframes tl-flash {
  0% { box-shadow: 0 0 12px 4px var(--accent); border-color: var(--accent); }
  100% { box-shadow: none; border-color: var(--border); }
}

/* Full-window mode — centered content */
.tl-fullwindow-mode {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  background: var(--bg);
  overflow: hidden;
  padding: 1rem;
  margin: 0;
  max-width: none;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.tl-fullwindow-mode > .tl-page {
  width: 100%;
  max-width: 1400px;
  flex: 1;
  min-height: 0;
}
.tl-fullwindow-mode .tl-map {
  flex: 1;
  min-height: 300px;
}
.tl-fullwindow-mode .tl-strip {
  height: 200px;
}

@media (max-width: 900px) {
  .tl-map { min-height: 250px; }
  .tl-strip { height: 120px; }
  .tl-topbar { flex-direction: column; align-items: flex-start; }
  .tl-topbar-right { width: 100%; }
  .tl-primary-select { flex: 1; min-width: 0; }
  .tl-filters-panel { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 500px) {
  .tl-map { min-height: 200px; }
  .tl-strip { height: 100px; }
}

/* ── Reader Font Controls ──────────────────────────────────── */

.reader-font-controls {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.font-btn {
  min-width: 32px;
  text-align: center;
  font-weight: 700;
  letter-spacing: -0.5px;
}

/* ── Reader Search ─────────────────────────────────────────── */

.reader-search {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  padding: 0.3rem 0.6rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  outline: none;
  width: 140px;
  transition: border-color var(--transition);
}

.reader-search::placeholder {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.reader-search:focus {
  border-color: var(--accent);
}

.verse-unit--search-dim {
  opacity: 0.25;
  transition: opacity 200ms ease;
}

.verse-unit--search-match {
  opacity: 1;
  transition: opacity 200ms ease;
}

.scripture-text mark {
  background: rgba(201, 162, 39, 0.4);
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

/* ── Empty state ────────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}
.empty-state-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  opacity: 0.5;
}
.empty-state p {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* ── Toast ──────────────────────────────────────────────────── */

.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--accent);
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-size: 0.85rem;
  z-index: 9999;
  animation: toast-in 0.3s ease-out, toast-out 0.3s ease-in 1.7s forwards;
  pointer-events: none;
}
@keyframes toast-in { from { opacity: 0; transform: translateX(-50%) translateY(20px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes toast-out { from { opacity: 1; } to { opacity: 0; } }

/* ── Streak lost ───────────────────────────────────────────── */

.streak-lost-msg {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--orange);
  margin-top: 0.5rem;
}

/* ── Search count ──────────────────────────────────────────── */

.search-count {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-left: 0.5rem;
  white-space: nowrap;
}

/* ── Prophecy Arcs Visualization ────────────────────────────── */

.prophecy-viz {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.pv-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}
.pv-topbar .breadcrumb { margin-bottom: 0; }
.pv-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.pv-controls select {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.3rem 0.5rem;
  font-family: var(--font-ui);
  font-size: 0.8rem;
}
.pv-canvas-wrap {
  flex: 1;
  min-height: 350px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}
.pv-canvas-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.pv-detail {
  margin-top: 0.5rem;
}
.pv-detail--active {
  animation: tl-detail-in 0.3s ease-out;
}

/* ── Prophecy Viz — extended styles ────────────────────────── */

.prophecy-viz {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.pv-legend {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.4rem 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.pv-legend-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.pv-legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.pv-legend-ful {
  background: #fff !important;
  box-sizing: border-box;
}
.pv-arc-count {
  margin-left: auto;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.pv-tooltip {
  position: absolute;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.7rem;
  font-size: 0.8rem;
  color: var(--text);
  pointer-events: none;
  z-index: 20;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  max-width: 280px;
  white-space: nowrap;
}
.pv-tooltip strong {
  color: var(--accent);
}
.pv-tooltip-ref {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.pv-detail-inner {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.5rem;
  position: relative;
  animation: tl-detail-in 0.3s ease-out;
}
.pv-detail-inner h3 {
  color: var(--accent);
  font-family: var(--font-page);
  margin-bottom: 0.5rem;
  font-size: 1.2rem;
}
.pv-detail-inner h4 {
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.3rem;
}
.pv-detail-close {
  position: absolute;
  top: 0.6rem;
  right: 0.8rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
  line-height: 1;
}
.pv-detail-close:hover { color: var(--text); }
.pv-detail-desc {
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  margin: 0.6rem 0;
  line-height: 1.5;
}
.pv-detail-verses {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin: 0.8rem 0;
}
.pv-detail-col a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
}
.pv-detail-col a:hover { text-decoration: underline; }
.pv-detail-arrow {
  color: var(--text-muted);
  font-size: 1.4rem;
  padding-top: 1rem;
}
.pv-detail-traditions {
  margin-top: 0.5rem;
}
.pv-detail-traditions .tag {
  margin-right: 0.3rem;
  margin-bottom: 0.3rem;
}
.pv-subject-tag {
  background: var(--blue);
  color: #fff;
}
.pv-conf-high { background: #d4af37; color: #1a1500; }
.pv-conf-medium { background: #8b90a0; color: #1a1a20; }
.pv-conf-low { background: #4a4d5a; color: #ccc; }
.pv-loading, .pv-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 250px;
  color: var(--text-muted);
  font-family: var(--font-ui);
  gap: 0.8rem;
}
.pv-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: pv-spin 0.8s linear infinite;
}
@keyframes pv-spin {
  to { transform: rotate(360deg); }
}

/* ── Bible Heatmap ─────────────────────────────────────────── */

.heatmap-page {
  display: flex;
  flex-direction: column;
}
.hm-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}
.hm-topbar .breadcrumb { margin-bottom: 0; }
.hm-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.hm-controls select {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.3rem 0.5rem;
  font-family: var(--font-ui);
  font-size: 0.8rem;
}
.hm-legend {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--text-muted);
}
.hm-legend-bar {
  width: 120px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid var(--border);
}
.hm-section-header {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin: 1rem 0 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border);
}
.hm-section-header:first-child { margin-top: 0; }
.hm-book-row {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 2px;
}
.hm-book-label {
  font-family: var(--font-ui);
  font-size: 0.65rem;
  color: var(--text-muted);
  width: 40px;
  min-width: 40px;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hm-cells {
  display: flex;
  gap: 1px;
  flex-wrap: nowrap;
}
.hm-cell {
  width: 10px;
  height: 14px;
  border-radius: 2px;
  cursor: pointer;
  transition: transform 0.1s ease;
  position: relative;
}
.hm-cell:hover {
  transform: scale(1.8);
  z-index: 10;
  outline: 1px solid var(--accent);
}
.hm-tooltip {
  position: fixed;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.4rem 0.7rem;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--text);
  pointer-events: none;
  z-index: 9999;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  max-width: 200px;
}
.hm-tooltip-metric {
  font-weight: 600;
  color: var(--accent);
}
.hm-tooltip-hint {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

@media (max-width: 600px) {
  .hm-cell { width: 7px; height: 10px; }
  .hm-book-label { width: 30px; min-width: 30px; font-size: 0.55rem; }
  .pv-controls { width: 100%; }
  .pv-controls select { flex: 1; }
}

/* ── Scrollbar ──────────────────────────────────────────────── */

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Focus-visible (accessibility) ─────────────────────────── */

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

a.card:focus-visible,
a.home-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

nav a:focus-visible {
  color: var(--accent);
  border-bottom-color: var(--accent);
  outline: none;
}

.quiz-option:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.tag:focus-visible,
.tradition-tab:focus-visible,
.theme-toggle:focus-visible,
.filter-select:focus-visible,
.select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Clickable card hover states ───────────────────────────── */

.entity-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-dim);
  box-shadow: 0 4px 16px rgba(201, 162, 39, 0.15);
}

.prophecy-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-dim);
  box-shadow: 0 4px 16px rgba(201, 162, 39, 0.15);
}

.entity-card,
.prophecy-card {
  cursor: pointer;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}

/* ── Base select styling ───────────────────────────────────── */

.select {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  padding: 0.3rem 0.6rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  outline: none;
  transition: border-color var(--transition);
}

.select:focus {
  border-color: var(--accent);
}

/* ── Mobile nav ────────────────────────────────────────────── */

@media (max-width: 600px) {
  nav {
    font-size: 0.75rem;
    gap: 0.35rem 0.75rem;
  }

  nav a[href="#/"] {
    display: none;
  }

  .app > header {
    padding: 0.75rem 1rem;
  }

  .app > header h1 span {
    display: none;
  }
}

/* ── Reader nav wrap ───────────────────────────────────────── */

@media (max-width: 768px) {
  .reader-nav {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .reader-nav .reader-search {
    width: 100%;
    order: 10;
  }

  .reader-font-controls {
    margin-left: auto;
  }
}

/* ── Reading mode toggle button ─────────────────────────────── */

.reading-mode-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--accent);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  transition: background var(--transition), color var(--transition);
}

.reading-mode-toggle:hover {
  background: rgba(201,162,39,0.15);
}

/* ══════════════════════════════════════════════════════════════
   Reading Modes
   ══════════════════════════════════════════════════════════════ */

/* ── Heirloom Bible (default) ──────────────────────────────── */
/* The base styles above are already heirloom. These reinforce. */

[data-reading-mode="heirloom"] .page {
  background: #faf6ef;
}

/* ── Scholar Mode ──────────────────────────────────────────── */

[data-reading-mode="scholar"] .page {
  background: #f8f7f4;
  border: 1px solid #ddd;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

[data-reading-mode="scholar"] .page::before {
  display: none;
}

[data-reading-mode="scholar"] .chapter-ornament {
  display: none;
}

[data-reading-mode="scholar"] .chapter-number {
  font-size: 2rem;
  font-weight: 700;
  opacity: 0.8;
  margin-bottom: 1rem;
}

[data-reading-mode="scholar"] .chapter-number::after {
  display: none;
}

[data-reading-mode="scholar"] .scripture-text {
  font-family: 'Georgia', serif;
  font-size: 1.05rem;
  line-height: 1.7;
}

[data-reading-mode="scholar"] .scripture-para {
  margin-bottom: 0.5em;
}

[data-reading-mode="scholar"] .scripture-para--first .drop-cap {
  float: none;
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
  padding: 0;
  animation: none;
}

[data-reading-mode="scholar"] .verse-num {
  font-size: 0.6rem;
  font-weight: 600;
  color: #666;
}

[data-reading-mode="scholar"] .page-inner {
  padding: 2rem 2.5rem;
  max-width: 750px;
}

/* Scholar in dark mode — true dark reader */
[data-theme="dark"][data-reading-mode="scholar"] .page {
  background: #1e1e1e;
  border-color: #333;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

[data-theme="dark"][data-reading-mode="scholar"] .scripture-text {
  color: #d0d0d0;
}

[data-theme="dark"][data-reading-mode="scholar"] .verse-num {
  color: rgba(180,180,180,0.45);
}

[data-theme="dark"][data-reading-mode="scholar"] .page-header-book,
[data-theme="dark"][data-reading-mode="scholar"] .page-header-chapter {
  color: rgba(180,180,180,0.5);
}

[data-theme="dark"][data-reading-mode="scholar"] .page-header-sep {
  background: rgba(180,180,180,0.2);
}

[data-theme="dark"][data-reading-mode="scholar"] .page-header {
  border-bottom-color: rgba(180,180,180,0.1);
}

[data-theme="dark"][data-reading-mode="scholar"] .page-footer {
  border-top-color: rgba(180,180,180,0.1);
}

[data-theme="dark"][data-reading-mode="scholar"] .page-footer-link {
  color: rgba(180,180,180,0.5);
}

[data-theme="dark"][data-reading-mode="scholar"] .chapter-number {
  color: rgba(180,180,180,0.4);
}

/* ── Monastic Mode ─────────────────────────────────────────── */
/* Manuscript tradition: dim stone room, parchment pages,     */
/* rubricated verse numbers, illuminated initials.            */

[data-reading-mode="monastic"] .page {
  background: #24211b;
  border: 1px solid rgba(160,130,70,0.15);
  box-shadow:
    0 4px 12px rgba(0,0,0,0.5),
    0 20px 60px rgba(0,0,0,0.6),
    inset 0 0 80px rgba(80,60,30,0.06),
    inset 0 1px 0 rgba(160,130,70,0.08);
}

[data-reading-mode="monastic"] .page::before {
  background:
    /* Vignette — darker edges like aged parchment */
    radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.15) 100%),
    /* Warm corner glow — like candlelight */
    radial-gradient(ellipse at 20% 20%, rgba(160,120,50,0.04) 0%, transparent 50%),
    /* Grain texture */
    linear-gradient(135deg, rgba(100,85,55,0.06) 0%, transparent 50%),
    linear-gradient(to bottom, rgba(0,0,0,0.04) 0%, transparent 8%, transparent 92%, rgba(0,0,0,0.05) 100%),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(120,100,60,0.015) 2px,
      rgba(120,100,60,0.015) 3px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 3px,
      rgba(120,100,60,0.012) 3px,
      rgba(120,100,60,0.012) 4px
    );
}

[data-reading-mode="monastic"] .scripture-text {
  color: #d4c9a8;
  font-size: 1.25rem;
  line-height: 1.9;
}

/* Rubrication — crimson verse numbers, the manuscript tradition */
[data-reading-mode="monastic"] .verse-num {
  color: rgba(138,45,45,0.6);
  font-weight: 500;
}

[data-reading-mode="monastic"] .verse-num:hover {
  color: rgba(180,60,60,0.8);
}

/* Chapter ornament — manuscript cross divider */
[data-reading-mode="monastic"] .chapter-ornament {
  color: rgba(138,45,45,0.5);
  font-size: 0.8rem;
  visibility: hidden;
  margin-bottom: 0.75rem;
  animation: ornamentReveal 1s ease-out 0.15s both;
}

[data-reading-mode="monastic"] .chapter-ornament::after {
  content: '\2014\2009\2720\2009\2014';
  visibility: visible;
  letter-spacing: 0.2em;
}

@keyframes monasticOrnamentReveal {
  from { opacity: 0; filter: blur(1px); }
  to   { opacity: 0.7; filter: blur(0); }
}

/* Chapter number — rubricated crimson */
[data-reading-mode="monastic"] .chapter-number {
  color: rgba(138,45,45,0.6);
  animation: monasticChapterReveal 1s ease-out 0.25s both;
}

@keyframes monasticChapterReveal {
  from { opacity: 0; letter-spacing: 0.12em; }
  to   { opacity: 0.5; letter-spacing: 0.05em; }
}

[data-reading-mode="monastic"] .chapter-number::after {
  background: linear-gradient(to right, transparent, rgba(138,45,45,0.4), transparent);
  animation: monasticRuleReveal 0.8s ease-out 0.4s both;
}

@keyframes monasticRuleReveal {
  from { opacity: 0; transform: scaleX(0); }
  to   { opacity: 0.8; transform: scaleX(1); }
}

/* Drop cap — illuminated initial: gold letter in a crimson frame */
[data-reading-mode="monastic"] .scripture-para--first .drop-cap {
  color: #d4aa3c;
  font-size: 4.8rem;
  font-weight: 600;
  background: rgba(120,30,30,0.2);
  border: 1px solid rgba(138,45,45,0.35);
  padding: 0.08em 0.15em 0.05em 0.12em;
  margin-right: 0.15em;
  margin-bottom: 0.05em;
  text-shadow:
    0 0 8px rgba(210,170,60,0.2),
    1px 1px 0 rgba(100,25,25,0.25);
  box-shadow:
    inset 0 0 12px rgba(120,30,30,0.15),
    0 1px 3px rgba(0,0,0,0.3);
  animation: monasticDropCapReveal 1s ease-out 0.5s both;
}

@keyframes monasticDropCapReveal {
  from { opacity: 0; transform: scale(0.92) translateY(1px); filter: blur(1px); }
  to   { opacity: 1; transform: scale(1) translateY(0); filter: blur(0); }
}

/* Running header — rubricated */
[data-reading-mode="monastic"] .page-header {
  border-bottom-color: rgba(138,45,45,0.12);
}

[data-reading-mode="monastic"] .page-header-book {
  color: rgba(196,165,90,0.4);
}

[data-reading-mode="monastic"] .page-header-chapter {
  color: rgba(138,45,45,0.55);
}

[data-reading-mode="monastic"] .page-header-sep {
  background: rgba(138,45,45,0.25);
}

/* Footer */
[data-reading-mode="monastic"] .page-footer {
  border-top-color: rgba(138,45,45,0.12);
}

[data-reading-mode="monastic"] .page-footer-link {
  color: rgba(196,165,90,0.35);
}

[data-reading-mode="monastic"] .page-footer-link:hover {
  color: #c4a55a;
}

/* Spacing — wide margins like a manuscript leaf */
[data-reading-mode="monastic"] .page-inner {
  padding: 4rem 5.5rem 3.5rem;
}

/* Manuscript double-rule border */
[data-reading-mode="monastic"] .page-inner::before {
  content: '';
  position: absolute;
  top: 1.5rem;
  left: 2rem;
  right: 2rem;
  bottom: 1.5rem;
  border: 1px solid rgba(138,45,45,0.12);
  outline: 1px solid rgba(138,45,45,0.06);
  outline-offset: 4px;
  pointer-events: none;
}

/* Corner ornaments */
[data-reading-mode="monastic"] .page-inner::after {
  content: '\2726';
  position: absolute;
  top: 1.1rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  color: rgba(138,45,45,0.3);
  pointer-events: none;
}

/* Paragraph separator flourish between paragraphs */
[data-reading-mode="monastic"] .scripture-para + .scripture-para {
  position: relative;
}

/* Page header — rubricated style */
[data-reading-mode="monastic"] .page-header {
  border-bottom: none;
  position: relative;
}

[data-reading-mode="monastic"] .page-header::after {
  content: '\2014\2009\2726\2009\2014';
  display: block;
  text-align: center;
  color: rgba(138,45,45,0.25);
  font-size: 0.7rem;
  margin-top: 0.5rem;
  letter-spacing: 0.3em;
}

/* Footer flourish */
[data-reading-mode="monastic"] .page-footer {
  border-top: none;
  position: relative;
}

[data-reading-mode="monastic"] .page-footer::before {
  content: '\2014\2009\2720\2009\2014';
  display: block;
  text-align: center;
  color: rgba(138,45,45,0.2);
  font-size: 0.65rem;
  margin-bottom: 0.75rem;
  letter-spacing: 0.3em;
}

/* Verse highlights — warmer, dimmer in candlelight */
[data-reading-mode="monastic"] .verse-unit--active {
  background: rgba(196,165,90,0.08);
}

[data-reading-mode="monastic"] .verse-unit:hover {
  background: rgba(196,165,90,0.04);
}

[data-reading-mode="monastic"] .verse-unit--playing {
  background: rgba(196,165,90,0.08);
  outline-color: rgba(196,165,90,0.12);
}

/* ── Genealogy ──────────────────────────────────────────────────── */

.genealogy-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

.genealogy-view-toggle {
  display: flex;
  gap: 0.25rem;
}

.genealogy-btn {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 3px;
  transition: all 0.2s;
}

.genealogy-btn:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.genealogy-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.genealogy-select {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 3px;
}

.genealogy-canvas {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.genealogy-svg {
  min-width: 960px;
}

.genealogy-svg .genealogy-bar:hover rect:not([fill="transparent"]) {
  opacity: 1 !important;
  filter: brightness(1.2);
}

.genealogy-svg .genealogy-bar:hover text {
  opacity: 1 !important;
  font-weight: 600;
}

/* ── Covenant Lineage ── */

.genealogy-lineage {
  text-align: center;
  padding: 2rem 1rem;
}

.lineage-title {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.lineage-subtitle {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 2rem;
}

.lineage-chain {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.lineage-node {
  padding: 0.6rem 1.5rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--node-color, var(--accent));
  background: var(--card-bg, var(--bg));
  border-radius: 4px;
  text-align: left;
  min-width: 180px;
  cursor: pointer;
  transition: all 0.2s;
}

.lineage-node:hover {
  border-color: var(--node-color, var(--accent));
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.lineage-name {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  color: var(--text);
}

.lineage-role {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--node-color, var(--text-muted));
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.lineage-years {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.lineage-connector {
  color: var(--accent);
  font-size: 1.2rem;
  line-height: 1;
  opacity: 0.5;
  padding: 0.15rem 0;
}

/* ── Family Tree ── */

.genealogy-tree {
  padding: 1rem;
}

.tree-container {
  padding: 1rem 0;
}

.tree-node {
  padding-left: calc(var(--depth, 0) * 1.5rem);
  margin: 0.15rem 0;
}

.tree-name {
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text);
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  border-left: 2px solid var(--node-color, var(--border));
  transition: all 0.15s;
  display: inline-block;
}

.tree-name:hover {
  background: rgba(201,168,76,0.1);
}

.tree-name.tree-covenant {
  font-weight: 600;
}

.tree-name.collapsed + .tree-children {
  display: none;
}

.tree-children.collapsed {
  display: none;
}

.tree-expand {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  color: var(--accent);
  cursor: pointer;
  margin-left: 0.4rem;
  padding: 0.15rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 3px;
}

.tree-expand:hover {
  background: var(--accent);
  color: #fff;
}

/* ── Detail Panel ── */

.genealogy-detail {
  margin-top: 1rem;
  padding: 1.2rem 1.5rem;
  background: var(--card-bg, var(--bg));
  border: 1px solid var(--border);
  border-radius: 6px;
}

.detail-header {
  padding-left: 0.8rem;
  margin-bottom: 0.5rem;
}

.detail-header h2 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  margin: 0;
  color: var(--text);
}

.detail-role {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 0.75rem;
}

.detail-tribe {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-right: 0.75rem;
}

.detail-covenant {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
}

.detail-dates {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.detail-section {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  margin: 0.5rem 0;
  line-height: 1.6;
}

.detail-section strong {
  color: var(--text);
}

.detail-link {
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
}

.detail-link:hover {
  text-decoration: underline;
}

.detail-more {
  display: inline-block;
  margin-top: 0.75rem;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--accent);
  text-decoration: none;
}

.detail-more:hover {
  text-decoration: underline;
}

/* ── Typology page ─────────────────────────────────────────── */

.typology-filters {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.typology-filter-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.typology-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.typology-tab {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.3rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}

.typology-tab:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.typology-tab.active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.typology-card {
  cursor: pointer;
}

.typology-card-header {
  margin-bottom: 0.75rem;
}

.typology-pair {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.typology-figure {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.typology-figure--type {
  color: var(--orange);
  border-color: var(--orange);
  background: rgba(212, 148, 76, 0.08);
}

.typology-figure--antitype {
  color: var(--green);
  border-color: var(--green);
  background: rgba(76, 175, 125, 0.08);
}

.typology-arrow {
  font-family: var(--font-ui);
  font-size: 1rem;
  color: var(--text-muted);
}

.typology-card-footer {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.typology-conf-badge {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid;
}

.typology-conf--high {
  color: var(--green);
  border-color: var(--green);
  background: rgba(76, 175, 125, 0.1);
}

.typology-conf--medium {
  color: var(--orange);
  border-color: var(--orange);
  background: rgba(212, 148, 76, 0.1);
}

.typology-conf--low {
  color: var(--text-muted);
  border-color: var(--border);
  background: rgba(139, 144, 160, 0.08);
}

.typology-cat-badge {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 0.65rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--purple);
  color: var(--purple);
  background: rgba(155, 114, 207, 0.08);
}

.typology-verses {
  margin-bottom: 1rem;
}

.typology-verse-card {
  cursor: default;
}

.typology-verse-card:hover {
  border-color: var(--accent-dim);
}

.typology-verse-ref {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  display: inline-block;
  margin-bottom: 0.35rem;
}

.typology-verse-ref:hover {
  text-decoration: underline;
}

.typology-verse-text {
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.7;
}

/* ── Chapter Insights panel ───────────────────────────────── */

.chapter-insights {
  padding: 0.25rem 0;
}

/* ── Insight sections — study-margin style ─────────────────── */

.insight-section {
  --section-color: var(--accent);
}

.insight-section + .insight-section {
  border-top: 1px solid var(--border);
}

/* Section header — small dot + serif small-caps title */
.insight-section-header {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 0.5rem 0.3rem;
  cursor: pointer;
  user-select: none;
}

.insight-section-header:hover .insight-section-title {
  color: var(--text);
}

.insight-section-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--section-color);
  flex-shrink: 0;
  opacity: 0.85;
}

.insight-section-title {
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 400;
  font-variant: small-caps;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  transition: color var(--transition);
}

.insight-section-count {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  color: var(--text-muted);
  opacity: 0.6;
  margin-left: auto;
}

.insight-section-arrow {
  font-size: 0.55rem;
  color: var(--text-muted);
  opacity: 0.4;
  transition: transform 200ms ease;
  flex-shrink: 0;
}

.insight-section--closed .insight-section-arrow {
  transform: rotate(-90deg);
}

/* Section body */
.insight-section-body {
  overflow: hidden;
  max-height: 2000px;
  transition: max-height 300ms ease;
  padding: 0 0 0.35rem;
}

.insight-section--closed .insight-section-body {
  max-height: 0;
  padding-bottom: 0;
}

/* ── Insight rows — clean inline entries ───────────────────── */

.insight-row {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  flex-wrap: wrap;
  padding: 0.22rem 0.5rem 0.22rem 1.2rem;
  text-decoration: none;
  color: var(--text);
  transition: background var(--transition);
  cursor: default;
  font-family: var(--font-ui);
  font-size: 0.76rem;
  line-height: 1.55;
}

a.insight-row {
  cursor: pointer;
}

a.insight-row:hover,
.insight-row:hover {
  background: var(--bg-hover);
  border-radius: 3px;
}

.insight-row-name {
  font-family: var(--font-body);
  font-size: 0.84rem;
  font-weight: 400;
  color: var(--text);
}

a.insight-row .insight-row-name {
  color: var(--section-color, var(--accent));
}

a.insight-row:hover .insight-row-name {
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
}

.insight-row-label {
  display: flex;
  gap: 0.2rem;
  flex-shrink: 0;
}

.insight-row-verses {
  margin-left: auto;
  flex-shrink: 0;
}

/* Clickable verse ranges */
.insight-verses {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.1rem 0;
  transition: color var(--transition);
  opacity: 0.7;
}

.insight-verses:hover {
  color: var(--accent);
  opacity: 1;
}

/* Verse highlight when hovering insight ranges */
.verse-unit--insight-highlight {
  background: rgba(201, 162, 39, 0.1) !important;
  box-shadow: inset 2px 0 0 var(--accent);
  transition: background 150ms ease, box-shadow 150ms ease;
}

/* Small chips — e.g. theophany type, speaker type */
.insight-chip {
  font-family: var(--font-ui);
  font-size: 0.56rem;
  font-weight: 500;
  padding: 0.06rem 0.35rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  white-space: nowrap;
  vertical-align: 1px;
}

.insight-chip--divine {
  border-color: var(--accent);
  color: var(--accent);
}

.insight-chip--angelic {
  border-color: var(--purple);
  color: var(--purple);
}

/* Edge type labels (source / fulfilled / type / antitype) */
.insight-edge {
  font-family: var(--font-ui);
  font-size: 0.55rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.08rem 0.35rem;
  border-radius: 3px;
}

.insight-edge--source {
  background: rgba(91, 141, 217, 0.12);
  color: var(--blue);
}

.insight-edge--fulfill {
  background: rgba(76, 175, 125, 0.12);
  color: var(--green);
}

.insight-edge--type {
  background: rgba(217, 152, 60, 0.12);
  color: var(--orange);
}

.insight-edge--antitype {
  background: rgba(76, 175, 125, 0.12);
  color: var(--green);
}

/* ── Divider between insights and per-verse detail ─────────── */

.insight-divider {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.5rem 0;
  padding: 0 0.5rem;
}

.insight-divider::before,
.insight-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.insight-divider span {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-variant: small-caps;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  white-space: nowrap;
  opacity: 0.7;
}

/* Empty state */
.sidebar-empty {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  padding: 2rem 1rem;
  font-style: italic;
  opacity: 0.7;
}

/* ── Reader search highlight in chapter ───────────────────── */

.verse-unit--search-match mark {
  background: rgba(201, 162, 39, 0.35);
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

.verse-unit--search-dim {
  opacity: 0.3;
}

/* ── Parable cards ─────────────────────────────────────────── */

.parable-card {
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.parable-card:hover {
  border-color: var(--accent-dim);
}

.parable-verses-expand {
  max-height: 0;
  overflow: hidden;
  transition: max-height 400ms ease, padding 300ms ease, margin 300ms ease;
  margin-top: 0;
}

.parable-verses-expand.expanded {
  max-height: 2000px;
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.parable-verse-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.parable-verse-item {
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition);
}

.parable-verse-item:hover {
  background: var(--bg-hover);
}

/* ── Miracle cards ─────────────────────────────────────────── */

.miracle-card {
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.miracle-card:hover {
  border-color: var(--accent-dim);
}

.miracle-verses-expand {
  max-height: 0;
  overflow: hidden;
  transition: max-height 400ms ease, padding 300ms ease, margin 300ms ease;
  margin-top: 0;
}

.miracle-verses-expand.expanded {
  max-height: 2000px;
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.miracle-verse-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.miracle-verse-item {
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition);
}

.miracle-verse-item:hover {
  background: var(--bg-hover);
}

/* ── Covenant timeline ─────────────────────────────────────── */

.covenant-timeline {
  position: relative;
  padding-left: 2rem;
  max-width: 800px;
}

/* Vertical line */
.covenant-timeline::before {
  content: '';
  position: absolute;
  left: 0.55rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--green), var(--blue), var(--purple));
  border-radius: 1px;
}

.covenant-card-wrapper {
  position: relative;
  margin-bottom: 1.5rem;
}

.covenant-card-wrapper--last {
  margin-bottom: 0;
}

/* Timeline dot */
.covenant-timeline-dot {
  position: absolute;
  left: -1.55rem;
  top: 1.2rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: var(--accent);
  z-index: 1;
}

.covenant-card {
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

.covenant-card:hover {
  border-color: var(--accent-dim);
  box-shadow: 0 2px 12px rgba(201, 162, 39, 0.1);
}

.covenant-verses-expand {
  max-height: 0;
  overflow: hidden;
  transition: max-height 400ms ease, padding 300ms ease, margin 300ms ease;
  margin-top: 0;
}

.covenant-verses-expand.expanded {
  max-height: 2000px;
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.covenant-verse-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.covenant-verse-item {
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition);
}

.covenant-verse-item:hover {
  background: var(--bg-hover);
}

/* ── Hero gradient & pattern ──────────────────────────────── */

.hero {
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% 30%, rgba(201, 162, 39, 0.06) 0%, transparent 70%),
    radial-gradient(circle at 20% 80%, rgba(91, 141, 217, 0.04) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(155, 114, 207, 0.04) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

[data-theme="light"] .hero::before {
  background:
    radial-gradient(ellipse 80% 60% at 50% 30%, rgba(138, 109, 27, 0.06) 0%, transparent 70%),
    radial-gradient(circle at 20% 80%, rgba(58, 109, 181, 0.04) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(122, 82, 176, 0.04) 0%, transparent 50%);
}

.hero > * {
  position: relative;
  z-index: 1;
}

/* ── Skeleton loading for stat numbers ────────────────────── */

.home-stat-num--loading {
  display: inline-block;
  width: 3rem;
  height: 1.4rem;
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: 4px;
  vertical-align: middle;
}

@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Card hover glow ──────────────────────────────────────── */

.card {
  transition: border-color var(--transition), background var(--transition), box-shadow 300ms ease;
}

.home-card:hover,
.entity-card:hover,
.prophecy-card:hover {
  box-shadow:
    0 4px 20px rgba(201, 162, 39, 0.12),
    0 0 40px rgba(201, 162, 39, 0.06);
}

[data-theme="light"] .home-card:hover,
[data-theme="light"] .entity-card:hover,
[data-theme="light"] .prophecy-card:hover {
  box-shadow:
    0 4px 20px rgba(138, 109, 27, 0.1),
    0 0 30px rgba(138, 109, 27, 0.04);
}

/* ── Search bar polish ────────────────────────────────────── */

.search-bar {
  position: relative;
}

.search-bar-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
  pointer-events: none;
  opacity: 0.6;
  z-index: 1;
}

.search-bar input {
  padding-left: 2.5rem;
  transition: border-color var(--transition), box-shadow 300ms ease;
}

.search-bar input:focus {
  box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.12);
}

[data-theme="light"] .search-bar input:focus {
  box-shadow: 0 0 0 3px rgba(138, 109, 27, 0.1);
}

/* ── Section dividers ─────────────────────────────────────── */

.section-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 2.5rem 0 1rem;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.section-divider::before,
.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}

.section-divider-ornament {
  color: var(--accent);
  opacity: 0.5;
  font-size: 0.65rem;
}

/* ── Better empty states ──────────────────────────────────── */

.empty-state {
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  max-width: 500px;
  margin: 2rem auto;
}

.empty-state-icon {
  opacity: 0.35;
  filter: grayscale(0.5);
}

.empty-state p {
  max-width: 320px;
  margin: 0 auto;
}

.empty-state a {
  color: var(--accent);
  text-decoration: none;
}

.empty-state a:hover {
  text-decoration: underline;
}

/* ── Page transitions ─────────────────────────────────────── */

main {
  animation: page-enter 250ms ease-out;
}

@keyframes page-enter {
  0% {
    opacity: 0;
    transform: translateY(8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Smooth stat number appearance ────────────────────────── */

@keyframes stat-pop {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  60% {
    transform: scale(1.05);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.home-stat-num--loaded {
  animation: stat-pop 400ms ease-out;
}

/* ── Archaeology section (Place detail) ──────────────────── */

.arch-section {
  border-left: 3px solid var(--accent);
}

.arch-badge {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #fff;
  padding: 0.15em 0.55em;
  border-radius: 4px;
  line-height: 1.4;
}

.arch-badge--sm {
  font-size: 0.6rem;
  padding: 0.1em 0.4em;
  vertical-align: middle;
  margin-left: 0.35rem;
}

.arch-body {
  font-family: var(--font-body);
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.arch-field {
  margin-top: 0.75rem;
}

.arch-field-label {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.25rem;
}

.arch-citations {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--text-muted);
  border-left: 2px solid var(--border);
  padding: 0.5rem 0.75rem;
  margin-top: 0.75rem;
  background: var(--bg-panel);
  border-radius: 0 var(--radius) var(--radius) 0;
  white-space: pre-line;
}
