/* KJV Bible App — custom styles (no framework) */

*, *::before, *::after {
  box-sizing: border-box;
}

:root {
  --text: #1a1a1a;
  --text-muted: #6b7280;
  --link: #1a6fb5;
  --link-hover: #0d4f82;
  --border: #e5e7eb;
  --bg: #fff;
  --bg-subtle: #f9fafb;
  --radius: 4px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, monospace;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1rem;
  line-height: 1.6;
  font-size: 1rem;
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }

/* ─── Header & search ─────────────────────────────────────────────── */

header {
  padding: 0.75rem 0 0.5rem;
}

header nav {
  margin-bottom: 0.5rem;
}

header nav a {
  font-weight: 700;
  font-size: 1.1rem;
}

header form {
  width: 100%;
}

.search-bar {
  display: flex;
  gap: 0.4rem;
  align-items: flex-start;
  width: 100%;
}

.search-input-wrap {
  flex: 1 1 0%;
  min-width: 0;
  position: relative;
}

.search-bar input[type="search"] {
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  background: var(--bg);
  color: var(--text);
}

.search-bar input[type="search"]:focus {
  border-color: var(--link);
  box-shadow: 0 0 0 2px rgba(26, 111, 181, 0.15);
}

.search-bar button {
  flex: 0 0 auto;
  font: inherit;
  font-size: 0.95rem;
  padding: 0.45rem 1rem;
  background: var(--link);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
}

.search-bar button:hover {
  background: var(--link-hover);
}

/* ─── Autocomplete dropdown ──────────────────────────────────────── */

.autocomplete-list {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  max-height: 240px;
  overflow-y: auto;
}

.autocomplete-item {
  padding: 0.45rem 0.65rem;
  cursor: pointer;
}

.autocomplete-item:hover,
.autocomplete-item.active {
  background: #e8f0fe;
  color: var(--link);
}

/* ─── Main content ────────────────────────────────────────────────── */

main {
  padding-top: 0.25rem;
}

h2 {
  font-size: 1.35rem;
  margin: 0.75rem 0 0.35rem;
  line-height: 1.3;
}

h2 small {
  font-weight: 400;
  font-size: 0.75em;
  color: var(--text-muted);
}

/* ─── Passage rendering ───────────────────────────────────────────── */

.passage {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.passage:last-child {
  border-bottom: none;
}

.passage-text {
  margin: 0.25rem 0 0.4rem;
  line-height: 1.75;
}

.passage-text sup {
  color: var(--text-muted);
  font-size: 0.7em;
  font-weight: 600;
  margin-right: 0.1em;
  vertical-align: super;
}

.passage-footer {
  font-size: 0.9rem;
}

/* ─── Home page help ──────────────────────────────────────────────── */

section ul {
  padding-left: 1.5rem;
}

section li {
  margin-bottom: 0.25rem;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-subtle);
  padding: 0.15em 0.35em;
  border-radius: 3px;
}

/* ─── Chapter grid ────────────────────────────────────────────────── */

.book-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

.book-link {
  display: inline-block;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  white-space: nowrap;
  text-decoration: none;
}

.book-link:hover {
  background: var(--link);
  color: #fff;
  text-decoration: none;
}

.chapter-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.chapter-link {
  display: inline-block;
  min-width: 2.2rem;
  text-align: center;
  padding: 0.25rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.chapter-link:hover {
  background: var(--link);
  color: #fff;
  text-decoration: none;
}

/* ─── Not found ──────────────────────────────────────────────────── */

.not-found-msg {
  color: var(--text-muted);
  font-style: italic;
}

/* ─── Suggestions ────────────────────────────────────────────────── */

.suggestions {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.85rem;
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

/* ─── Vector search results ──────────────────────────────────────── */

.vector-results {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.6rem 0.85rem;
    margin-bottom: 1rem;
    font-size: 0.93rem;
}

.vector-results-header {
    margin-bottom: 0.35rem;
    color: var(--text-muted);
}

.vector-result {
    padding: 0.3rem 0;
}

.vector-result + .vector-result {
    border-top: 1px solid var(--border);
}

/* ─── Search highlights ──────────────────────────────────────────── */

.search-result mark {
  background: #fef3c7;
  color: inherit;
  padding: 0.05em 0.1em;
  border-radius: 2px;
}

/* ─── Search results ──────────────────────────────────────────────── */

.search-result {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.search-result:last-child {
  border-bottom: none;
}

/* ─── Chapter navigation ──────────────────────────────────────────── */

.chapter-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

/* ─── Footer ──────────────────────────────────────────────────────── */

footer {
  margin-top: 2rem;
  padding: 0.75rem 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

#search-sentinel {
  padding: 1rem 0;
  text-align: center;
  color: var(--text-muted);
}
