/* ============================================
   Bible interlinear reader
   ============================================ */

.bible-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 0;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== TOC sidebar ===== */
.bible-toc {
  position: sticky;
  top: 90px;
  align-self: start;
  height: calc(100vh - 90px);
  overflow-y: auto;
  padding: 24px 20px 24px 12px;
  border-right: 1px solid var(--border);
  font-size: 13px;
  box-sizing: border-box;
}

.bible-toc-header {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 12px;
  padding: 0 8px;
}

.bible-toc ol { list-style: none; padding: 0; margin: 0; }

.bible-toc a {
  display: block;
  padding: 4px 10px;
  color: var(--text-muted);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color 0.15s, background 0.15s;
}
.bible-toc a:hover {
  color: var(--text);
  background: var(--panel);
  border-left-color: var(--border-hover);
  text-decoration: none;
}

/* ===== Main reading column ===== */
.bible-main {
  padding: 32px 0 80px 40px;
  max-width: 980px;
  min-width: 0;
}

.bible-hero {
  padding: 32px 0 40px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}
.bible-hero .bible-meta {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 12px;
}
.bible-hero h1 {
  font-family: var(--serif);
  font-size: clamp(44px, 5.5vw, 72px);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.025em;
  margin: 0 0 16px;
}
.bible-hero p {
  color: var(--text-muted);
  margin: 0;
  max-width: 60ch;
  line-height: 1.65;
}
.bible-hero-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}

/* ===== Chapter block ===== */
.bible-chapter { margin-bottom: 64px; scroll-margin-top: 80px; content-visibility: auto; contain-intrinsic-size: 1px 2400px; }
.bible-chapter h2 {
  font-family: var(--serif);
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 700;
  margin: 0 0 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.02em;
}

.bible-verses { list-style: none; padding: 0; margin: 0; }

.bible-verse {
  display: grid;
  grid-template-columns: 32px 1fr;
  column-gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 80px;
}
.bible-verse:target { background: rgba(122, 162, 247, 0.08); }
.bible-verse .verse-num {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 700;
  padding-top: 6px;
  text-align: right;
  user-select: none;
}

/* ===== Interlinear words ===== */
.ilt-words {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 16px;
  align-items: flex-start;
}
.bible-lang-heb .ilt-words { direction: rtl; }
.bible-lang-heb .ilt-words .w { direction: rtl; }

.w {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 4px 6px;
  min-width: 0;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.1s;
}
.w:hover,
.w.is-active { background: var(--panel); }
.w.is-highlight { background: rgba(122, 162, 247, 0.14); }

.w-orig {
  font-family: "Amiri", "Scheherazade New", "Noto Naskh Arabic", "SBL Hebrew",
               "SBL BibLit", "SBL Greek", "Times New Roman", serif;
  font-size: 22px;
  line-height: 1.25;
  color: var(--text);
  white-space: nowrap;
}
.bible-lang-grk .w-orig {
  font-family: "SBL Greek", "SBL BibLit", "Gentium Plus", "Cardo", "Times New Roman", serif;
  font-size: 20px;
}
.w-trans {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--text-dim);
  font-style: italic;
  margin-top: 2px;
  white-space: nowrap;
}
.w-gloss {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
  white-space: nowrap;
}

/* ===== Side panel — lexical card ===== */
.bible-panel {
  position: fixed;
  top: 90px;
  right: 0;
  bottom: 0;
  width: min(440px, 100vw);
  background: var(--panel);
  border-left: 1px solid var(--border);
  z-index: 40;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.22s ease;
  box-shadow: -20px 0 40px rgba(0, 0, 0, 0.4);
}
.bible-panel.is-open { transform: translateX(0); }

.bible-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.bible-panel-header h3 {
  font-family: "Amiri", "SBL Greek", "SBL BibLit", "Times New Roman", serif;
  font-size: 28px;
  line-height: 1.15;
  margin: 0 0 4px;
  color: var(--text);
  direction: ltr;
  unicode-bidi: isolate;
}
.bible-panel-header .panel-meta {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-top: 6px;
}
.bible-panel-close {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  flex: 0 0 auto;
}
.bible-panel-close:hover { color: var(--text); }

.bible-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 32px;
  font-size: 14px;
  line-height: 1.6;
}

.panel-section { margin-bottom: 24px; }
.panel-section-label {
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 8px;
}
.panel-section-content { color: var(--text); }
.panel-section-content em { color: var(--accent); font-style: italic; }

.panel-grid {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 4px 12px;
  font-size: 13px;
  margin-top: 4px;
}
.panel-grid dt {
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 10px;
  font-weight: 600;
  padding-top: 2px;
}
.panel-grid dd { margin: 0; color: var(--text); }

.concordance-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 3px;
}
.concordance-list li {
  border-bottom: 1px solid var(--border);
  padding: 8px 12px;
  font-size: 13px;
}
.concordance-list li:last-child { border-bottom: none; }
.concordance-list a {
  color: var(--text);
  text-decoration: none;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.concordance-list a:hover { color: var(--accent); }
.concordance-ref {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 11px;
  color: var(--text-dim);
  flex: 0 0 auto;
}
.concordance-count {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.bible-loading {
  text-align: center;
  padding: 40px 0;
  color: var(--text-muted);
  font-size: 14px;
}

/* ===== Responsive ===== */
@media (max-width: 960px) {
  .bible-layout {
    grid-template-columns: 1fr;
    padding: 0 16px;
  }
  .bible-toc {
    position: static;
    height: auto;
    max-height: 260px;
    padding: 16px 12px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .bible-main {
    padding: 20px 0 60px 0;
  }
  .ilt-words { gap: 12px 12px; }
  .w-orig { font-size: 20px; }
  .bible-panel {
    top: 0;
    width: 100vw;
    z-index: 110;
  }
}
