/* VerseWell — clean, calm, readable. Mobile-first. */
:root {
  --bg: #f7f5f0;
  --bg-soft: #fffdf9;
  --surface: #ffffff;
  --text: #26241f;
  --muted: #7a7367;
  --accent: #6b5b3e;
  --accent-soft: #efe9dd;
  --border: #e3ddd0;
  --intro-bg: #faf6ee;
  --link: #4a6b8a;
  --shadow: 0 1px 3px rgba(40, 34, 22, 0.07);
  --radius: 10px;
}
html[data-theme="dark"] {
  --bg: #16140f;
  --bg-soft: #1c1915;
  --surface: #221e18;
  --text: #e8e2d6;
  --muted: #9d9484;
  --accent: #cbb27f;
  --accent-soft: #2e2820;
  --border: #38322a;
  --intro-bg: #24201a;
  --link: #8fb0cc;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.55;
  transition: background 0.25s, color 0.25s;
}

/* ---------- header / nav ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 16px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.brand { font-size: 1.3rem; font-weight: 700; color: var(--accent); text-decoration: none; letter-spacing: -0.02em; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
#version-switcher {
  font: inherit; padding: 6px 10px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--bg-soft); color: var(--text); max-width: 46vw;
}
#theme-toggle {
  font: inherit; font-size: 1.05rem; line-height: 1; padding: 6px 10px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-soft); color: var(--text); cursor: pointer;
}
.tabs {
  display: flex; gap: 4px; padding: 0 16px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.tabs a {
  padding: 8px 14px; text-decoration: none; color: var(--muted);
  border-bottom: 2px solid transparent; font-weight: 600; font-size: 0.95rem;
}
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- layout ---------- */
#view { max-width: 700px; margin: 0 auto; padding: 20px 16px 64px; }
.muted { color: var(--muted); }
.loading { text-align: center; padding: 40px 0; }
.error-box {
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid #b0563e;
  border-radius: var(--radius); padding: 14px 16px; margin: 16px 0;
}
h1 { font-size: 1.6rem; letter-spacing: -0.02em; margin: 8px 0 4px; }
h2 { font-size: 1.15rem; margin: 28px 0 10px; color: var(--accent); }
a { color: var(--link); }

/* ---------- home ---------- */
.lede { color: var(--muted); margin-top: 0; }
.version-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0 28px; }
.version-card {
  display: block; text-decoration: none; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow); color: var(--text);
}
.version-card:hover { border-color: var(--accent); }
.version-card .code { font-weight: 700; color: var(--accent); font-size: 1.05rem; }
.version-card .name { font-size: 0.85rem; color: var(--muted); margin-top: 2px; line-height: 1.3; }
.version-card .badges { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
  font-size: 0.68rem; font-weight: 600; padding: 2px 7px; border-radius: 20px;
  background: var(--accent-soft); color: var(--accent); text-transform: uppercase; letter-spacing: 0.03em;
}
.book-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.book-grid a {
  display: block; text-align: center; padding: 10px 6px; text-decoration: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); font-size: 0.88rem; font-weight: 500;
}
.book-grid a:hover { border-color: var(--accent); color: var(--accent); }
.chapter-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-top: 12px; }
.chapter-grid a {
  display: block; text-align: center; padding: 10px 0; text-decoration: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); font-weight: 600;
}
.chapter-grid a:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- reader ---------- */
.reader-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.reader-head h1 { margin: 4px 0 0; }
.reader-sub { color: var(--muted); font-size: 0.9rem; }
.chapter-nav { display: flex; gap: 10px; margin: 16px 0; }
.chapter-nav a {
  flex: 1; text-align: center; padding: 10px; text-decoration: none; font-weight: 600;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text);
}
.chapter-nav a:hover { border-color: var(--accent); }
.chapter-nav a.disabled { opacity: 0.35; pointer-events: none; }

.reader-body {
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  font-size: 1.13rem; line-height: 1.78;
}
.section-intro {
  background: var(--intro-bg); border: 1px solid var(--border); border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0; padding: 14px 16px; margin: 18px 0 22px;
  font-size: 0.98rem; line-height: 1.6; color: var(--text);
}
.section-intro .intro-label {
  display: block; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 8px;
}
.verse { margin: 0 0 10px; }
.verse-num {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.68em; font-weight: 700; color: var(--muted);
  vertical-align: super; margin-right: 5px; user-select: none;
}
.fn-marker {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.68em; vertical-align: super; margin-left: 1px;
  background: none; border: none; padding: 0 1px; cursor: pointer;
  color: var(--link); font-weight: 700; text-decoration: underline dotted;
}
.fn-marker.open { color: var(--accent); }
/* Inline footnote panel: expands in place at its verse (no bottom list).
 * Visually echoes the section-intro callout so notes read as a distinct
 * block, separate from body verse text. */
.fn-inline-panel {
  margin: 4px 0 14px 18px; padding: 10px 14px 2px;
  background: var(--intro-bg); border: 1px solid var(--border); border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.88rem; line-height: 1.55;
}
.fn-item { font-size: 0.85rem; line-height: 1.5; margin: 0 0 10px; color: var(--muted); }
.fn-inline-panel .fn-item { color: var(--text); }
.fn-item .fn-ref { font-weight: 700; color: var(--accent); }

/* ---------- search ---------- */
.search-bar { display: flex; gap: 8px; margin: 16px 0 20px; }
.search-bar input {
  flex: 1; font: inherit; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface); color: var(--text);
}
.search-bar button {
  font: inherit; font-weight: 600; padding: 12px 18px; border: none; border-radius: var(--radius);
  background: var(--accent); color: var(--bg); cursor: pointer;
}
.result-item {
  display: block; text-decoration: none; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 10px; color: var(--text); box-shadow: var(--shadow);
}
.result-item:hover { border-color: var(--accent); }
.result-item .ref { font-weight: 700; color: var(--accent); font-size: 0.85rem; }
.result-item .text { margin-top: 3px; font-size: 0.95rem; line-height: 1.5; }
.result-item mark { background: var(--accent-soft); color: var(--accent); padding: 0 1px; border-radius: 2px; }

/* ---------- docs ---------- */
.doc-endpoint { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin: 14px 0; }
.doc-endpoint code.method {
  font-weight: 700; color: var(--bg); background: var(--accent);
  padding: 2px 8px; border-radius: 5px; font-size: 0.8rem; margin-right: 8px;
}
.doc-endpoint .path { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.9rem; word-break: break-all; }
pre {
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; overflow-x: auto; font-size: 0.8rem; line-height: 1.45;
}
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.doc-table th, .doc-table td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.doc-table th { color: var(--accent); }

.site-footer {
  border-top: 1px solid var(--border); padding: 20px 16px 32px;
  text-align: center; font-size: 0.8rem; color: var(--muted);
  max-width: 700px; margin: 0 auto;
}

@media (min-width: 560px) {
  .version-grid { grid-template-columns: repeat(3, 1fr); }
  .book-grid { grid-template-columns: repeat(4, 1fr); }
  .chapter-grid { grid-template-columns: repeat(8, 1fr); }
  .reader-body { font-size: 1.18rem; }
}

