:root {
  --ink: #2b2420;
  --paper: #faf6ef;
  --accent: #7a3b2e;
  --line: #d9cdb8;
  --muted: #6b5f4f;
  font-size: 17px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.6;
}

header {
  text-align: center;
  padding: 2.5rem 1rem 1.5rem;
  border-bottom: 1px solid var(--line);
}

header h1 {
  margin: 0 0 0.4rem;
  font-size: 1.9rem;
  letter-spacing: 0.02em;
  color: var(--accent);
}

.tagline {
  margin: 0 auto;
  max-width: 34rem;
  color: var(--muted);
  font-style: italic;
}

main {
  max-width: 42rem;
  margin: 0 auto;
  padding: 1.5rem 1.2rem 4rem;
}

.search-box {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.2rem;
  margin-bottom: 2rem;
}

.search-box label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
  color: var(--muted);
}

#ref-input {
  width: 100%;
  padding: 0.6rem;
  font-size: 1rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: inherit;
  margin-bottom: 0.7rem;
}

#search-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  font-family: inherit;
}

#search-btn:hover { opacity: 0.9; }

.hint {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0.7rem 0 0;
}

.hidden { display: none; }

#not-found {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.2rem;
}

#copy-request-btn {
  background: #fff;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-size: 0.95rem;
  cursor: pointer;
  font-family: inherit;
}

#copy-request-btn:hover { background: #f6f1e6; }

#copy-request-hint {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.6rem;
}

.result h2 {
  color: var(--accent);
  border-bottom: 2px solid var(--line);
  padding-bottom: 0.3rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.copy-link-btn {
  background: #fff;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 0.15rem 0.6rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-family: Arial, sans-serif;
  text-transform: none;
  letter-spacing: normal;
  cursor: pointer;
  white-space: nowrap;
}

.copy-link-btn:hover { background: #f6f1e6; }

.header-copy-link { font-size: 0.75rem; }

.browse-filter {
  width: 100%;
  padding: 0.5rem 0.6rem;
  font-size: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: Arial, sans-serif;
  margin-top: 0.8rem;
}

.browse-list {
  margin-top: 0.6rem;
  border-top: 1px solid var(--line);
  padding-top: 0.2rem;
  max-height: 22rem;
  overflow-y: auto;
}

.browse-group { padding: 0.4rem 0; }

.browse-book {
  margin: 0.6rem 0 0.1rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-family: Arial, sans-serif;
}

.browse-group .source-list { margin: 0; }

.browse-group li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.browse-link {
  color: var(--accent);
  font-weight: bold;
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
}

.topics-box .browse-list {
  max-height: none;
  border-top: none;
  padding-top: 0.4rem;
}

.topics-box li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.topic-question {
  color: var(--muted);
  font-style: italic;
  margin-top: -0.5rem;
}

.word-link-planned {
  color: var(--muted);
  border-bottom-color: var(--muted);
  font-weight: normal;
}

.planned-tag {
  display: inline-block;
  font-size: 0.65rem;
  font-family: Arial, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0.05rem 0.35rem;
  margin-left: 0.4rem;
  vertical-align: middle;
}

.section-divider {
  margin-top: 3rem;
  text-align: center;
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border: none;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 0.6rem 0;
}

.result h3 {
  margin-top: 2rem;
  color: var(--accent);
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.text-block {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  padding: 1rem 1.2rem;
  border-radius: 4px;
  margin: 0.8rem 0;
}

.text-block .lang {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.original {
  font-family: "SBL Hebrew", "Times New Roman", serif;
  direction: rtl;
  font-size: 1.15rem;
  margin: 0.2rem 0 0.6rem;
}

.greek-text {
  font-style: italic;
  margin: 0.2rem 0 0.6rem;
}

.source-list {
  list-style: none;
  padding: 0;
}

.source-list li {
  padding: 0.6rem 0;
  border-bottom: 1px dashed var(--line);
}

.source-list li:last-child { border-bottom: none; }

.source-list .tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: bold;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 3px;
  padding: 0.05rem 0.4rem;
  margin-right: 0.5rem;
  font-family: Arial, sans-serif;
}

.synthesis {
  background: #f3ece0;
  border: 1px solid var(--line);
  padding: 1rem 1.2rem;
  border-radius: 4px;
}

.common-misreading {
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  padding: 1rem 1.2rem;
  border-radius: 4px;
  font-style: italic;
}

.confidence {
  display: inline-block;
  font-size: 0.68rem;
  font-family: Arial, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  margin-right: 0.3rem;
  cursor: help;
}

.confidence-well-attested { background: #e4efe1; color: #3d6b34; border: 1px solid #b9d4b0; }
.confidence-debated { background: #f7ecd6; color: #8a5a1e; border: 1px solid #e6c98a; }
.confidence-speculative { background: #f5e0dc; color: #93392a; border: 1px solid #e3b3a8; }

.confidence-note {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  font-style: italic;
  margin-top: 0.2rem;
}

.glossary-link {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted var(--accent);
}

.key-terms {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.7rem 1rem;
  margin: 1rem 0;
  font-size: 0.92rem;
}

.key-terms .lang { display: block; margin-bottom: 0.3rem; }

.related-passage-link {
  color: var(--accent);
  font-weight: bold;
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
  cursor: pointer;
}

.citation-link {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted var(--accent);
}

.cross-ref-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.cross-ref-versions {
  font-size: 0.8rem;
  font-family: Arial, sans-serif;
  white-space: nowrap;
}

.cross-ref-versions a {
  color: var(--accent);
  text-decoration: none;
}

.live-text {
  margin-top: 0.5rem;
  padding: 0.6rem 0.8rem;
  background: #f6f1e6;
  border-left: 3px solid var(--accent);
  border-radius: 3px;
  font-size: 0.92rem;
}

.live-text .original {
  font-size: 1rem;
}

.live-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-family: Arial, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #fff;
  background: var(--accent);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  margin-bottom: 0.3rem;
}

footer {
  text-align: center;
  padding: 1.5rem 1rem 2.5rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.donate-note { margin-top: 0.4rem; }

.donate-placeholder {
  border-bottom: 1px dashed var(--muted);
  cursor: help;
}

.global-search {
  position: relative;
  max-width: 30rem;
  margin: 1rem auto 0;
}

#global-search-input {
  width: 100%;
  padding: 0.6rem 0.8rem;
  font-size: 0.95rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: inherit;
  background: #fff;
}

.global-search-results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 0.3rem);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  max-height: 20rem;
  overflow-y: auto;
  z-index: 50;
  text-align: left;
}

.global-search-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.5rem 0.8rem;
  background: none;
  border: none;
  border-bottom: 1px dashed var(--line);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--ink);
  text-align: left;
}

.global-search-item:last-child { border-bottom: none; }
.global-search-item:hover { background: #f6f1e6; }

.global-search-type {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-family: Arial, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 3px;
  padding: 0.05rem 0.35rem;
}

.global-search-empty {
  padding: 0.6rem 0.8rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.top-nav {
  margin-top: 0.8rem;
}

.top-nav a {
  color: var(--accent);
  font-size: 0.85rem;
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
}

.tabs {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tab-btn {
  background: none;
  border: 1px solid var(--line);
  border-bottom: none;
  color: var(--muted);
  font-family: Arial, sans-serif;
  font-size: 0.85rem;
  padding: 0.4rem 0.9rem;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  text-decoration: none;
}

.tab-btn:hover { color: var(--accent); }

.tab-btn.active {
  color: var(--accent);
  font-weight: bold;
  background: var(--paper);
  border-color: var(--line);
}

.toc-toggle {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 40;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.5rem 0.9rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-family: Arial, sans-serif;
  cursor: pointer;
  display: none;
}

.toc {
  position: fixed;
  top: 6rem;
  left: 1.2rem;
  width: 230px;
  max-height: calc(100vh - 8rem);
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
  font-family: Arial, sans-serif;
  font-size: 0.85rem;
  z-index: 30;
}

.toc-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-bottom: 0.8rem;
  margin-bottom: 0.8rem;
  border-bottom: 1px solid var(--line);
}

.toc-static-link {
  color: var(--accent);
  font-weight: bold;
  text-decoration: none;
}

.toc-static-link:hover { text-decoration: underline; }

.toc-title {
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 0.6rem;
}

.toc ul { list-style: none; padding: 0; margin: 0; }
.toc li { margin: 0.15rem 0; }
.toc li.toc-top { margin-top: 0.7rem; font-weight: bold; }
.toc li.toc-top:first-child { margin-top: 0; }

.toc a {
  color: var(--ink);
  text-decoration: none;
  display: block;
  padding: 0.2rem 0 0.2rem 0.5rem;
  border-left: 2px solid transparent;
}

.toc a:hover,
.toc a.active {
  color: var(--accent);
  border-left-color: var(--accent);
}

.toc.hidden,
.toc-toggle.hidden {
  display: none;
}

@media (max-width: 1179px) {
  .toc-toggle:not(.hidden) { display: block; }

  .toc:not(.hidden) {
    top: 0;
    left: 0;
    width: 260px;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
    transform: translateX(-110%);
    transition: transform 0.2s ease;
    padding-top: 4rem;
  }

  .toc.open:not(.hidden) { transform: translateX(0); }
}

/* Word for Word (interlinear) — optional wordForWord field */
.wfw { margin: 0.4rem 0 1rem; }
.wfw-verse { margin: 0.8rem 0; }
.wfw-verse .lang { display: block; font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.3rem; }
.wfw-row { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem 0.4rem; }
.wfw-word { display: flex; flex-direction: column; align-items: center; text-align: center; min-width: 4.2rem; padding: 0.45rem 0.55rem; background: #fff; border: 1px solid var(--line); border-radius: 4px; cursor: help; }
.wfw-word.has-variant { border-bottom: 2px dotted var(--accent); }
.wfw-greek { font-size: 1.15rem; line-height: 1.3; }
.wfw-translit { font-size: 0.75rem; font-style: italic; color: var(--muted); }
.wfw-gloss { font-size: 0.9rem; font-weight: 600; margin-top: 0.2rem; }
.wfw-strongs { font-size: 0.72rem; color: var(--muted); margin-top: 0.15rem; text-decoration: none; }
a.wfw-strongs { color: var(--accent); border-bottom: 1px solid transparent; }
a.wfw-strongs:hover { border-bottom-color: var(--accent); }
.wfw-note { font-size: 0.82rem; color: var(--muted); margin-top: 0.6rem; }

/* First in the Septuagint */
.lxx-first table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); }
.lxx-first th, .lxx-first td { text-align: left; padding: 0.4rem 0.7rem; border-bottom: 1px solid var(--line); font-size: 0.92rem; }
.lxx-first th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.lxx-lemma { font-size: 1.05rem; }
.lxx-count { color: var(--muted); font-variant-numeric: tabular-nums; }
.lxx-common { opacity: 0.55; }
.lxx-none { color: var(--muted); font-style: italic; }
.lxx-flag { font-size: 0.7rem; border: 1px solid var(--accent); color: var(--accent); border-radius: 3px; padding: 0 0.3rem; cursor: help; }
.lxx-unclear { font-size: 0.85rem; color: var(--muted); margin-top: 0.4rem; }

/* Editor review queue (only with ?review=1) */
.review-badge { font-size: 0.7rem; font-weight: normal; border: 1px solid var(--accent); color: var(--accent); border-radius: 3px; padding: 0 0.4rem; margin-left: 0.4rem; }
.review-queue { padding-left: 1.2rem; }
.review-item { margin-bottom: 0.9rem; }
.review-where { font-family: monospace; font-size: 0.8rem; color: var(--muted); }
.review-item p { margin: 0.2rem 0; font-size: 0.92rem; }
mark.review-mark { background: #f6e3a1; padding: 0 0.1em; border-bottom: 2px solid #c9a227; }
