:root {
  --bg: #f7f2e8;
  --bg-grad-top: #fbf6ea;
  --surface: #fffdf8;
  --panel: #fcfaf4;
  --header-bg: rgba(255, 253, 248, 0.95);
  --section-alt-bg: rgba(255, 255, 255, 0.4);
  --ink: #22313f;
  --muted: #5d6b78;
  --accent: #b06a3f;
  --accent-strong: #d98a56;
  --border: #e2d6c1;
  --shadow: 0 10px 30px rgba(34, 49, 63, 0.04);
  --warn: #b3402f;
  --water: #dce8ee;
  --river: #9fbccb;
  --fertile: rgba(140, 165, 90, 0.22);
}

:root:not([data-theme="dark"]) {
  --accent: #8e4f2e;
  --accent-strong: #6b351d;
}

:root[data-theme="dark"] {
  --bg: #171512;
  --bg-grad-top: #1d1a16;
  --surface: #211d18;
  --panel: #262019;
  --header-bg: rgba(29, 26, 22, 0.95);
  --section-alt-bg: rgba(255, 255, 255, 0.03);
  --ink: #ece3d4;
  --muted: #a99f8f;
  --border: #3a3229;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --warn: #e0765f;
  --water: #17242b;
  --river: #3b5967;
  --fertile: rgba(150, 175, 105, 0.14);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --bg: #171512;
    --bg-grad-top: #1d1a16;
    --surface: #211d18;
    --panel: #262019;
    --header-bg: rgba(29, 26, 22, 0.95);
    --section-alt-bg: rgba(255, 255, 255, 0.03);
    --ink: #ece3d4;
    --muted: #a99f8f;
    --accent: #b06a3f;
    --accent-strong: #d98a56;
    --border: #3a3229;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    --warn: #e0765f;
    --water: #17242b;
    --river: #3b5967;
    --fertile: rgba(150, 175, 105, 0.14);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, var(--bg-grad-top) 0%, var(--bg) 100%);
  line-height: 1.6;
}

img {
  max-width: 100%;
}

.container {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
}

.site-header {
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
}

.brand {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.2rem;
  color: var(--accent-strong);
  font-weight: 700;
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 1rem;
}

.nav-links a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
}

.hero {
  padding: 5rem 0 4rem;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 2rem;
  align-items: center;
}

.hero h1,
.page-hero h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.15;
  margin: 0 0 1rem;
}

.hero-copy,
.page-hero p,
.content-card p,
.feature-card p {
  color: var(--muted);
  font-size: 1.05rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.button {
  display: inline-block;
  padding: 0.8rem 1.2rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
}

.button.primary {
  background: var(--accent);
  color: white;
}

.button.secondary {
  background: transparent;
  color: var(--accent-strong);
  border: 1px solid var(--border);
}

.hero-panel {
  display: grid;
  gap: 1rem;
}

.stat-card,
.feature-card,
.content-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  box-shadow: var(--shadow);
}

.stat-card {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stat-card strong {
  font-size: 1.7rem;
  color: var(--accent-strong);
}

.section {
  padding: 2.5rem 0 3rem;
}

.section-alt {
  background: var(--section-alt-bg);
}

.section-heading {
  margin-bottom: 1.5rem;
}

.section-heading h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.7rem;
}

.feature-grid,
.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.feature-card,
.content-card {
  padding: 1.25rem;
}

.feature-card h3,
.content-card h2,
.content-card h3,
.timeline-list h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-family: Georgia, "Times New Roman", serif;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.meta-item {
  padding: 0.9rem 1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
}

.meta-label {
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.meta-value {
  font-weight: 600;
  color: var(--ink);
}

.feature-card a,
.content-card a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.page {
  padding: 2.5rem 0 3rem;
}

.page-hero {
  margin-bottom: 1.5rem;
}

.bullet-list {
  padding-left: 1.2rem;
  color: var(--muted);
}

.timeline-list {
  display: grid;
  gap: 1rem;
}

.timeline-list > div {
  padding: 0.9rem 1rem;
  border-left: 3px solid var(--accent);
  background: var(--panel);
  border-radius: 0.5rem;
}

.chapter-years {
  color: var(--muted);
  font-weight: 400;
}

.table-scroll {
  overflow-x: auto;
}

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

.data-table th,
.data-table td {
  text-align: left;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.data-table th {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.data-table tr:last-child td {
  border-bottom: none;
}

.word-study {
  padding: 1rem 1.1rem;
  border-left: 3px solid var(--accent);
  background: var(--panel);
  border-radius: 0.5rem;
  margin-bottom: 1rem;
}

.word-study h3 {
  margin: 0 0 0.4rem;
}

.say {
  font: inherit;
  font-size: 0.85em;
  line-height: 1;
  cursor: pointer;
  border: none;
  background: transparent;
  color: inherit;
  padding: 0 0.15em;
  margin-left: 0.2em;
  opacity: 0.6;
  vertical-align: baseline;
}

.say:hover,
.say:focus-visible {
  opacity: 1;
}

.word-study p {
  margin: 0.35rem 0;
}

.verse-list {
  display: grid;
  gap: 1rem;
}

.verse-list blockquote {
  margin: 0;
  padding: 0.9rem 1.1rem;
  border-left: 3px solid var(--accent);
  background: var(--panel);
  border-radius: 0.5rem;
}

.verse-list .reference {
  display: block;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.3rem;
}

.verse-list .note {
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer {
  padding: 1.7rem 0 2.3rem;
  border-top: 1px solid var(--border);
}

.footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  color: var(--muted);
}

.footer-row a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.nav-links {
  align-items: center;
}

.theme-toggle {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  line-height: 1;
}

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

.breadcrumb {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.breadcrumb a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.breadcrumb span {
  margin: 0 0.4rem;
  color: var(--muted);
}

.chapter-lead {
  font-size: 1.1rem;
  color: var(--ink);
  border-left: 3px solid var(--accent);
  padding-left: 0.9rem;
  margin-bottom: 1.25rem;
}

.chapter-lead .years {
  display: block;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.section-nav {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 1rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.section-nav a {
  flex: 1 1 45%;
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--surface);
  text-decoration: none;
  color: var(--ink);
}

.section-nav a.next {
  text-align: right;
}

.section-nav .direction {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.page-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.page-jump a {
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
}

.page-jump a:hover {
  border-color: var(--accent);
}

/* Splinter-tree lineage: a vertical progression down the biblical line with
   marked points where a tradition diverges. */
.lineage {
  list-style: none;
  margin: 0;
  padding: 0;
}

.lineage > li {
  position: relative;
  padding: 0 0 1.6rem 1.6rem;
  border-left: 2px solid var(--accent);
}

.lineage > li:last-child {
  border-left-color: transparent;
  padding-bottom: 0;
}

.lineage > li::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 0.35rem;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--surface);
}

.lineage > li.trunk::before {
  width: 18px;
  height: 18px;
  left: -10px;
}

.lineage .era {
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}

.lineage h3 {
  margin: 0.15rem 0 0.35rem;
  font-family: Georgia, "Times New Roman", serif;
}

.lineage p {
  margin: 0.35rem 0;
  color: var(--muted);
}

.divergence {
  border-left: 3px solid var(--warn);
  background: var(--panel);
  padding: 0.7rem 0.9rem;
  border-radius: 0.5rem;
  margin-top: 0.6rem;
  color: var(--ink);
}

.divergence .label {
  display: inline-block;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--warn);
  margin-bottom: 0.15rem;
}

.callout {
  border-left: 3px solid var(--warn);
  background: var(--panel);
  padding: 0.9rem 1.1rem;
  border-radius: 0.5rem;
}

/* Schematic maps (inline SVG, theme-aware). */
.map-figure {
  margin: 0;
}

.map-svg {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--surface);
}

.map-svg .land {
  fill: var(--panel);
}

.map-svg .water {
  fill: var(--water);
  stroke: var(--river);
  stroke-width: 1;
  stroke-linejoin: round;
}

.map-svg .isle {
  fill: var(--panel);
  stroke: var(--river);
  stroke-width: 1;
}

.map-svg .river {
  fill: none;
  stroke: var(--river);
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.map-svg .thin {
  stroke-width: 2;
}

.map-svg .fertile {
  fill: none;
  stroke: var(--fertile);
  stroke-width: 52;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.map-svg .label,
.map-svg .event,
.map-svg .region,
.map-svg .water-label,
.map-svg .route-label,
.map-svg .scale-text {
  paint-order: stroke;
  stroke: var(--panel);
  stroke-width: 3px;
  stroke-linejoin: round;
}

.map-svg .region {
  fill: var(--muted);
  font: 700 13px Georgia, "Times New Roman", serif;
  letter-spacing: 0.12em;
  opacity: 0.85;
}

.map-svg .water-label {
  fill: var(--river);
  font: italic 12px "Segoe UI", sans-serif;
}

.map-svg .minor {
  font-size: 10px;
}

.map-svg .place {
  fill: var(--accent);
  stroke: var(--surface);
  stroke-width: 1.5;
}

.map-svg .label {
  fill: var(--ink);
  font: 12px "Segoe UI", sans-serif;
}

.map-svg .event {
  fill: var(--muted);
  font: italic 10.5px "Segoe UI", sans-serif;
}

.map-svg .ruin {
  fill: none;
  stroke: var(--warn);
  stroke-width: 2.5;
  stroke-linecap: round;
}

.map-svg .scale-line {
  stroke: var(--muted);
  stroke-width: 1.2;
}

.map-svg .scale-text {
  fill: var(--muted);
  font: 10px "Segoe UI", sans-serif;
}

.map-svg .route-label {
  fill: var(--accent);
  font: italic 11px "Segoe UI", sans-serif;
}

.map-svg .peak {
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linejoin: round;
}

.map-svg .route {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-dasharray: 7 6;
  opacity: 0.85;
}

.map-svg.map-portrait {
  max-width: 620px;
  margin: 0 auto;
}

@media (max-width: 680px) {
  .map-figure {
    overflow-x: auto;
  }

  .map-svg {
    min-width: 620px;
  }
}

.map-svg .badge {
  fill: var(--accent);
  stroke: var(--surface);
  stroke-width: 2;
}

.map-svg .badge-text {
  fill: #fff;
  font: 700 12px "Segoe UI", sans-serif;
}

.map-caption {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 0.6rem;
}

.map-steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: grid;
  gap: 0.5rem;
}

.map-steps li {
  position: relative;
  padding-left: 2.2rem;
  color: var(--muted);
}

.map-steps li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.map-steps strong {
  color: var(--ink);
}

.search-wrap {
  margin-top: 1.25rem;
}

.search-wrap input {
  width: 100%;
  max-width: 420px;
  font: inherit;
  padding: 0.7rem 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
}

@media (max-width: 800px) {
  .hero-grid,
  .feature-grid,
  .cards-grid,
  .meta-grid {
    grid-template-columns: 1fr;
  }

  .footer-row {
    flex-direction: column;
    align-items: flex-start;
  }
}
