:root {
  --bg: #fbf7ef;
  --surface: #ffffff;
  --text: #2a2420;
  --muted: #6f655c;
  --line: #e6dccb;
  --accent: #7a3e1d;
  --accent-soft: #f3e7d8;
  --vnum: #a0643c;
  --reader-size: 20px;
  --serif: "Literata", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #171412; --surface: #211d1a; --text: #ece4d8; --muted: #a59a8d;
    --line: #362f29; --accent: #e3a173; --accent-soft: #2e241d; --vnum: #c98a5f;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #171412; --surface: #211d1a; --text: #ece4d8; --muted: #a59a8d;
  --line: #362f29; --accent: #e3a173; --accent-soft: #2e241d; --vnum: #c98a5f;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); line-height: 1.6; }
a { color: var(--accent); }
img { display: block; }

.site-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px max(16px, calc((100% - 1100px) / 2));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-family: var(--serif); font-weight: 600; font-size: 1.1rem; }
.site-header nav { display: flex; align-items: center; gap: 4px; }
.site-header nav a { color: var(--text); text-decoration: none; padding: 6px 10px; border-radius: 8px; font-size: .95rem; }
.site-header nav a:hover { background: var(--accent-soft); }
.theme-toggle { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 8px; width: 34px; height: 34px; cursor: pointer; font-size: 1rem; }
@media (max-width: 560px) {
  .brand span { font-size: .95rem; }
  .site-header nav a[href="/about/"], .site-header nav a[href="/developers/"] { display: none; }
  .site-header nav a[href="/search/"] { display: none; }
  .brand { min-width: 0; line-height: 1.2; }
  .site-header nav a { padding: 6px 7px; }
}
@media (max-width: 340px) {
  .brand span { display: none; }
}

.site-footer { border-top: 1px solid var(--line); margin-top: 64px; padding: 28px 16px 40px; text-align: center; color: var(--muted); font-size: .9rem; }
.site-footer p { margin: 4px 0; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; margin-top: 12px !important; }

/* Topics, FAQ */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips a { padding: 7px 14px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); text-decoration: none; font-size: .92rem; }
.chips a:hover { border-color: var(--accent); }
.home-topics { margin: 0 0 40px; }
.home-topics h2 { font-family: var(--serif); font-size: 1.4rem; margin: 0 0 14px; }
.topic-page h1 { font-family: var(--serif); font-size: clamp(2rem, 6vw, 2.6rem); margin: 12px 0 10px; line-height: 1.15; }
.topic-page h2 { font-family: var(--serif); font-size: 1.3rem; margin-top: 36px; }
.lede-sm { color: var(--muted); font-size: 1.1rem; margin: 0 0 20px; }
.topic-list { list-style: none; padding: 0; margin: 0; counter-reset: t; }
.topic-list li { padding: 18px 0; border-bottom: 1px solid var(--line); }
.topic-list p { margin: 6px 0 0; font-family: var(--serif); font-size: 1.15rem; line-height: 1.6; }
.topic-ref { font-weight: 600; text-decoration: none; font-size: .95rem; }
.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.topic-card { display: flex; flex-direction: column; gap: 2px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); text-decoration: none; color: var(--text); }
.topic-card:hover { border-color: var(--accent); }
.topic-card strong { font-family: var(--serif); font-size: 1.15rem; }
.topic-card span { color: var(--muted); font-size: .85rem; }
.verse-topics { margin: -12px 0 28px; font-size: .92rem; color: var(--muted); }
.faq { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); margin: 10px 0; }
.faq summary { padding: 14px 18px; cursor: pointer; font-weight: 600; }
.faq p { margin: 0; padding: 0 18px 16px; }

.narrow { max-width: 720px; margin: 0 auto; padding: 0 16px; }
.btn { display: inline-block; padding: 11px 20px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); text-decoration: none; font-weight: 500; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--bg); }

/* Home */
.home { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.hero { text-align: center; padding: 72px 0 40px; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .8rem; font-weight: 600; color: var(--accent); margin: 0 0 12px; }
.hero h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(2.2rem, 6vw, 3.6rem); line-height: 1.12; margin: 0 auto 18px; max-width: 14ch; }
.lede { font-size: 1.15rem; color: var(--muted); max-width: 60ch; margin: 0 auto 28px; }
.cta { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.stats { color: var(--muted); font-size: .9rem; margin-top: 22px; }
.featured { margin: 24px auto 56px; max-width: 760px; }
.featured blockquote { margin: 0; padding: 36px 32px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; text-align: center; }
.featured p { font-family: var(--serif); font-size: clamp(1.25rem, 3vw, 1.6rem); line-height: 1.5; margin: 0 0 14px; }
.featured cite { font-style: normal; font-weight: 600; font-size: .9rem; }
.pillars { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; margin-bottom: 40px; }
.pillars div { padding: 24px; border-top: 3px solid var(--accent); background: var(--surface); border-radius: 0 0 14px 14px; }
.pillars h2 { font-family: var(--serif); font-size: 1.25rem; margin: 0 0 8px; }
.pillars p { margin: 0; color: var(--muted); }
.samples { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.sample { display: flex; flex-direction: column; gap: 6px; padding: 20px 24px; border: 1px solid var(--line); border-radius: 14px; text-decoration: none; color: var(--text); font-family: var(--serif); }
.sample:hover { border-color: var(--accent); }
.sample .ref { font-family: var(--sans); font-size: .8rem; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: .06em; }

/* Library */
.library { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.page-head { padding: 40px 0 16px; }
.page-head h1 { font-family: var(--serif); font-size: clamp(1.9rem, 5vw, 2.6rem); margin: 0 0 6px; }
.page-head p { color: var(--muted); margin: 0 0 16px; }
.filter, .search-form input { width: 100%; max-width: 420px; padding: 12px 14px; font: inherit; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); }
.search-form input { max-width: none; }
.testament h2 { font-family: var(--serif); font-size: 1.4rem; margin: 28px 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.book-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; align-items: start; }
.book { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.book summary { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; cursor: pointer; list-style: none; font-weight: 500; }
.book summary::-webkit-details-marker { display: none; }
.book[open] summary { border-bottom: 1px solid var(--line); }
.book .count { color: var(--muted); font-size: .85rem; font-weight: 400; }
.ch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 6px; padding: 12px; }
.ch-grid a { text-align: center; padding: 8px 0; border-radius: 8px; background: var(--accent-soft); text-decoration: none; font-size: .9rem; }
.ch-grid a:hover { background: var(--accent); color: var(--bg); }
.book.hidden { display: none; }

/* Reader */
.reader { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.reader-bar { display: flex; justify-content: space-between; gap: 10px; padding: 16px 0; flex-wrap: wrap; }
.jump { display: flex; gap: 8px; flex: 1; min-width: 0; }
.jump select { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); min-width: 0; }
.jump-book { flex: 1; max-width: 220px; }
.size-controls { display: flex; gap: 6px; }
.size-controls button { font: inherit; font-size: .85rem; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); cursor: pointer; }
.chapter h1 { font-family: var(--serif); text-align: center; margin: 24px 0 32px; display: flex; flex-direction: column; gap: 4px; }
.chapter .book-name { font-size: clamp(2rem, 6vw, 2.8rem); font-weight: 600; color: inherit; text-decoration: none; }
.chapter .book-name:hover { color: var(--accent); }
.vnum a { color: inherit; text-decoration: none; }
.vnum a:hover { text-decoration: underline; }

/* Breadcrumbs, verse pages, book pages */
.crumbs { font-size: .85rem; color: var(--muted); padding: 24px 0 0; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }
.crumbs span[aria-hidden] { margin: 0 4px; }
.verse-page h1, .book-page h1 { font-family: var(--serif); font-size: clamp(2rem, 6vw, 2.8rem); margin: 12px 0 18px; line-height: 1.15; }
.verse-big { margin: 0; padding: 28px 28px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 0 16px 16px 0; font-family: var(--serif); font-size: clamp(1.3rem, 3.4vw, 1.65rem); line-height: 1.55; }
.verse-cite { color: var(--muted); font-size: .9rem; margin: 10px 0 0; }
.verse-note { margin: 18px 0 0; padding: 12px 16px; background: var(--accent-soft); border-radius: 10px; font-size: .95rem; }
.verse-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 24px 0 32px; }
.verse-actions .btn { font: inherit; font-weight: 500; cursor: pointer; }
.context { display: grid; gap: 12px; }
.ctx { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--text); font-family: var(--serif); }
.ctx:hover { border-color: var(--accent); }
.ctx .ref { font-family: var(--sans); font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.book-meta { color: var(--muted); margin: 0 0 20px; }
.book-opening { margin: 0 0 28px; padding: 22px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.book-opening p { font-family: var(--serif); font-size: 1.25rem; margin: 0 0 8px; }
.book-opening cite { font-style: normal; font-weight: 600; font-size: .85rem; }
.book-page h2 { font-family: var(--serif); font-size: 1.3rem; }
.ch-grid.big { padding: 0; margin-bottom: 24px; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); }
.ch-grid.big a { padding: 12px 0; font-size: 1rem; }
.chapter .ch-num { font-family: var(--sans); font-size: .85rem; font-weight: 600; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); }
.text { font-family: var(--serif); font-size: var(--reader-size); line-height: 1.85; margin: 0; }
/* One verse per line; continuation lines indent past the verse number. */
.verse { display: block; margin: 0 -10px .55em; padding: 2px 10px 2px calc(10px + 1.4em); text-indent: -1.4em; border-radius: 8px; scroll-margin-top: 90px; cursor: pointer; transition: background-color .15s; }
.poetry .verse { margin-bottom: .8em; }
.verse:hover { background: color-mix(in srgb, var(--accent-soft) 60%, transparent); }
.verse.selected { background: var(--accent-soft); }
.cbadge { display: inline-block; text-indent: 0; margin-left: .4em; padding: 0 .5em; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-family: var(--sans); font-size: .6em; font-weight: 600; line-height: 1.7; vertical-align: .2em; }
.comment-hint { text-align: center; color: var(--muted); font-size: .85rem; margin: -18px 0 24px; }

/* Comments panel */
.cp { position: fixed; z-index: 30; right: 0; top: 0; bottom: 0; width: min(420px, 100%); display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--line); box-shadow: -12px 0 32px rgba(0,0,0,.12); transform: translateX(100%); transition: transform .2s ease; }
.cp.open { transform: none; }
.cp-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.cp-head h2 { margin: 0; font-family: var(--serif); font-size: 1.2rem; }
.cp-close { border: 0; background: none; color: var(--muted); font-size: 1.6rem; line-height: 1; cursor: pointer; padding: 4px 8px; }
.cp-body { flex: 1; overflow-y: auto; padding: 16px 18px; }
.cp-verse { margin: 0 0 18px; padding: 12px 14px; border-left: 3px solid var(--accent); background: var(--bg); font-family: var(--serif); white-space: pre-line; border-radius: 0 8px 8px 0; }
.cp-list { list-style: none; margin: 0; padding: 0; }
.cp-list li { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cp-vote { flex: none; display: flex; flex-direction: column; align-items: center; min-width: 44px; padding: 6px 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; }
.cp-vote:hover:not(:disabled) { border-color: var(--accent); }
.cp-vote.voted { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); cursor: default; }
.cp-vote .arrow { font-size: .8rem; line-height: 1; }
.cp-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.cp-meta { color: var(--muted); font-size: .8rem; margin-top: 4px; }
.cp-empty, .cp-status { color: var(--muted); font-size: .92rem; }
.cp-report { border: 0; background: none; padding: 0; font: inherit; color: var(--muted); text-decoration: underline; cursor: pointer; }
.cp-report:hover { color: #b42318; }
.cp-form { border-top: 1px solid var(--line); padding: 14px 18px 18px; }
.cp-form textarea { width: 100%; min-height: 90px; resize: vertical; padding: 10px 12px; font: inherit; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); }
.cp-form .row { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 8px; }
.cp-form .row span { color: var(--muted); font-size: .82rem; }
.cp-form button { font: inherit; font-weight: 600; padding: 9px 18px; border: 0; border-radius: 10px; background: var(--accent); color: var(--bg); cursor: pointer; }
.cp-form button:disabled { opacity: .6; cursor: default; }
.cp-error { color: #b42318; font-size: .85rem; margin: 8px 0 0; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
@media (max-width: 560px) {
  .cp { top: auto; height: 82vh; width: 100%; border-left: 0; border-top: 1px solid var(--line); border-radius: 16px 16px 0 0; transform: translateY(100%); box-shadow: 0 -12px 32px rgba(0,0,0,.15); }
}
.verse:target { background: var(--accent-soft); border-radius: 4px; box-shadow: 0 0 0 3px var(--accent-soft); }
.vnum { font-family: var(--sans); font-size: .58em; font-weight: 600; color: var(--vnum); margin: 0 .3em 0 .15em; vertical-align: .55em; line-height: 0; }
.fn-ref { font-family: var(--sans); font-size: .6em; vertical-align: .6em; line-height: 0; text-decoration: none; margin-left: 1px; font-weight: 600; }
.omitted { color: var(--muted); }
.footnotes { margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--line); font-size: .92rem; color: var(--muted); }
.footnotes h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .12em; margin: 0 0 10px; }
.footnotes ol { list-style: none; padding: 0; margin: 0; }
.footnotes li { margin: 6px 0; scroll-margin-top: 90px; }
.footnotes li:target { color: var(--text); }
.fn-back { font-weight: 600; text-decoration: none; margin-right: 4px; }
.fn-verse { font-weight: 600; color: var(--text); margin-right: 4px; }
.chapter-nav { display: flex; justify-content: space-between; gap: 12px; margin: 48px 0 0; }
.chapter-nav a { padding: 12px 18px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; background: var(--surface); }
.chapter-nav a:hover { border-color: var(--accent); }

/* Search + prose */
.results { list-style: none; padding: 0; margin: 8px 0 0; }
.results li { padding: 14px 0; border-bottom: 1px solid var(--line); }
.results a { font-weight: 600; text-decoration: none; font-size: .9rem; }
.results p { margin: 4px 0 0; font-family: var(--serif); font-size: 1.05rem; }
.results mark { background: var(--accent-soft); color: inherit; padding: 0 2px; border-radius: 3px; }
.search-status { color: var(--muted); font-size: .9rem; }
.prose { padding-top: 40px; }
.prose h1 { font-family: var(--serif); font-size: clamp(1.9rem, 5vw, 2.5rem); line-height: 1.2; }
.prose h2 { font-family: var(--serif); margin-top: 32px; }
.prose p { font-size: 1.05rem; }
.prose h3 { margin-top: 24px; }
.dev pre { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; overflow-x: auto; font-size: .85rem; line-height: 1.5; }
.dev pre.attribution { white-space: pre-wrap; }
.dev code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; }
.downloads { list-style: none; padding: 0; display: grid; gap: 10px; }
.downloads a { display: flex; flex-direction: column; padding: 14px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); text-decoration: none; }
.downloads a:hover { border-color: var(--accent); }
.downloads span { color: var(--muted); font-size: .9rem; }
.endpoints { width: 100%; border-collapse: collapse; font-size: .92rem; }
.endpoints td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.endpoints td:first-child { white-space: nowrap; }
@media (max-width: 560px) { .endpoints td:first-child { white-space: normal; word-break: break-all; } }
