:root {
  --bg: #f7f5ef;
  --surface: #fffdf8;
  --surface-2: #efe9dc;
  --text: #24211c;
  --muted: #70695f;
  --border: #d8d0c1;
  --accent: #6d4f2c;
  --accent-dark: #4f391f;
  --accent-soft: #e7dbc9;
  --success: #496443;
  --shadow: 0 14px 40px rgba(60, 48, 32, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Georgia, 'Times New Roman', serif;
  background: var(--bg);
  color: var(--text);
}
button, select, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
p { line-height: 1.65; }
h1, h2, h3 { text-wrap: balance; }
h1 { font-size: clamp(2.15rem, 6vw, 4.55rem); line-height: 1.03; max-width: 920px; margin: 14px 0 18px; font-weight: 600; }
h2 { font-size: clamp(1.55rem, 3vw, 2.25rem); line-height: 1.15; margin: 0; }
h3 { font-size: 1.08rem; line-height: 1.3; margin: 0; }

.site-shell { max-width: 1180px; margin: 0 auto; padding: 0 22px 64px; }
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: 0 -22px;
  background: rgba(247,245,239,.94);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 22px;
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
.brand-wrap { display: flex; flex-direction: column; gap: 3px; }
.brand {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-weight: 700;
  font-size: 1.18rem;
}
.tagline { color: var(--muted); font-size: .78rem; }
.nav { display: flex; flex-wrap: wrap; gap: 8px; }
.nav button, .pill, .ghost, .primary {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 14px;
  background: var(--surface);
  color: var(--text);
}
.nav button.active, .pill.active, .primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.nav button:hover, .pill:hover, .ghost:hover { border-color: var(--accent); }

.screen { display: none; padding-top: 30px; }
.screen.active { display: block; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: .13em;
  font-size: .72rem;
  color: var(--accent);
  font-weight: 700;
}
.muted { color: var(--muted); }
.tag {
  display: inline-flex;
  align-items: center;
  font-size: .72rem;
  line-height: 1;
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  margin: 4px 0 20px;
  flex-wrap: wrap;
}
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 24px; }
.primary, .ghost { border-radius: 12px; padding: 11px 16px; }
.primary:hover { background: var(--accent-dark); }

.hero {
  margin-top: 8px;
  padding: 48px;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: linear-gradient(135deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow);
}
.hero p { max-width: 790px; font-size: 1.08rem; }
.feature-grid, .theme-grid, .compare-grid { display: grid; gap: 16px; }
.feature-grid { grid-template-columns: repeat(3, 1fr); margin-top: 22px; }
.theme-grid { grid-template-columns: repeat(3, 1fr); }
.compare-grid { grid-template-columns: repeat(2, 1fr); }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px;
}
.card h2 { margin-top: 8px; font-size: 1.35rem; }
.card p { color: var(--muted); margin-bottom: 0; }
.callout {
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 16px 16px 0;
  padding: 20px;
  margin: 28px 0;
}
.callout h2 { margin-top: 7px; font-size: 1.45rem; }
.home-callout { margin-top: 22px; }

.reader-controls {
  display: grid;
  grid-template-columns: 1.2fr .8fr .8fr;
  gap: 12px;
  margin-bottom: 24px;
}
label { font-size: .82rem; color: var(--muted); }
select {
  width: 100%;
  margin-top: 5px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--text);
}
select:disabled { opacity: .7; }
.reader-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(360px, .96fr);
  gap: 26px;
  align-items: start;
}
.scripture-panel {
  min-width: 0;
  padding: 6px 0 50px;
}
.chapter-title { font-size: clamp(2.35rem, 5vw, 3.7rem); margin-bottom: 8px; }
.verse-list { display: flex; flex-direction: column; gap: 7px; margin-top: 18px; }
.verse {
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  line-height: 1.72;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.verse:hover { background: var(--surface); border-color: var(--border); transform: translateX(2px); }
.verse.active { background: var(--accent-soft); border-color: var(--accent); }
.verse-num {
  color: var(--accent);
  font-size: .72rem;
  font-weight: 700;
  margin-right: 8px;
  vertical-align: super;
}
.study-panel {
  position: sticky;
  top: 90px;
  max-height: calc(100vh - 112px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px;
  box-shadow: var(--shadow);
}
.study-heading { display: flex; justify-content: space-between; gap: 12px; }
.study-heading h2 { margin-top: 4px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 7px; margin: 16px 0 20px; }
.pill { padding: 7px 10px; font-size: .78rem; }
.study-section-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 10px;
  margin-bottom: 18px;
}
.study-section-head h3 { margin-top: 5px; font-size: 1.2rem; }
.source {
  border-left: 3px solid var(--accent);
  padding: 2px 0 2px 14px;
  margin: 0 0 22px;
}
.source-topline { display: flex; justify-content: space-between; align-items: start; gap: 10px; flex-wrap: wrap; }
.source-meta { color: var(--muted); font-size: .78rem; line-height: 1.45; margin-top: 3px; }
.verification-badge {
  flex: 0 0 auto;
  color: var(--success);
  background: #edf3ea;
  border: 1px solid #cfdcc9;
  border-radius: 999px;
  padding: 4px 7px;
  font-size: .68rem;
}
.source p { margin: 9px 0 8px; }
.source-link {
  color: var(--accent);
  border: 0;
  background: transparent;
  padding: 0;
  text-decoration: underline;
  font-size: .86rem;
}
.reference-list { display: flex; flex-direction: column; gap: 7px; margin-top: 14px; }
.ref-button {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: 11px 12px;
  color: var(--text);
}
.ref-button:hover { border-color: var(--accent); background: #fbf7ef; }
.ref-meta { display: block; color: var(--muted); font-size: .7rem; margin-top: 3px; }
.cross-ref-local strong::after { content: ' ↗'; color: var(--accent); }
.study-note {
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: .76rem;
  line-height: 1.55;
}
.loading-state, .error-state, .empty-state {
  border: 1px dashed var(--border);
  border-radius: 14px;
  padding: 18px;
  color: var(--muted);
  background: #fbf8f1;
}
.error-state { color: #7d3832; border-color: #d9b4ae; }
.empty-state h3 { color: var(--text); margin-bottom: 7px; }
.empty-state p { margin: 0; }

.topic-header {
  border: 1px solid var(--border);
  border-radius: 24px;
  background: linear-gradient(135deg, var(--surface), var(--surface-2));
  padding: 34px;
  box-shadow: var(--shadow);
}
.topic-header h1 { margin-bottom: 10px; }
.theme-definition { max-width: 760px; font-size: 1.08rem; }
.theme-tags { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 16px; }
.theme-overview { margin-top: 20px; }
.theme-section { margin-top: 42px; }
.theme-section > h2 { margin-top: 7px; }
.timeline { margin-top: 22px; border-left: 2px solid var(--border); padding-left: 22px; }
.timeline-item { position: relative; padding: 0 0 25px; }
.timeline-item::before {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  left: -28px;
  top: 5px;
}
.timeline-item p { color: var(--muted); margin: 5px 0 0; }

.footer {
  border-top: 1px solid var(--border);
  margin-top: 48px;
  padding: 24px 0;
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.55;
}

@media (max-width: 900px) {
  .feature-grid, .theme-grid, .compare-grid, .reader-layout { grid-template-columns: 1fr; }
  .reader-controls { grid-template-columns: 1fr; }
  .study-panel { position: static; max-height: none; overflow: visible; }
  .hero { padding: 32px 23px; }
  .topic-header { padding: 26px 22px; }
}

@media (max-width: 560px) {
  .site-shell { padding-left: 15px; padding-right: 15px; }
  .site-header { margin-left: -15px; margin-right: -15px; }
  .header-inner { padding: 12px 15px; }
  .tagline { display: none; }
  .nav { width: 100%; }
  .nav button { flex: 1; padding-left: 8px; padding-right: 8px; font-size: .78rem; }
  .hero { border-radius: 20px; }
  .study-panel { padding: 16px; }
  .verse { padding: 12px 10px; }
}
