/* Site-wide styles shared by every page (extracted from base.html / bible_base.html). */
:root {
  --bg:      #eae6dc;
  --surface: #ffffff;
  --ink:     #000000;
  --ink2:    #333333;
  --brand:   #1c2b4a;
  --muted:   #9a9898;
  --hair:    rgba(28, 43, 74, 0.08);
  --hair2:   rgba(28, 43, 74, 0.16);
  --accent:  #3d5a96;
  --hover-1: rgba(28, 43, 74, 0.03);
  --hover-2: rgba(28, 43, 74, 0.05);
  --hover-3: rgba(28, 43, 74, 0.07);
  --hover-4: rgba(28, 43, 74, 0.09);
  --font-ui:    "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: "Newsreader", Georgia, "Times New Roman", serif;
  --font-mono:  "JetBrains Mono", ui-monospace, monospace;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
}

/* ── Header ──────────────────────────────────────────── */
.site-header {
  height: 56px;
  background: var(--bg);
  border-bottom: 1px solid var(--hair);
  display: flex;
  align-items: center;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  flex-shrink: 0;
}
.logo-wordmark {
  font-family: var(--font-ui);
  font-size: 14.5px;
  font-weight: 500;
  color: var(--brand);
  letter-spacing: -0.01em;
}

.header-primary-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 28px;
  flex-shrink: 0;
}
.header-nav-item {
  font-family: var(--font-ui);
  font-size: 13.5px;
  color: var(--ink2);
  padding: 6px 10px;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}
.header-nav-item:hover {
  background: var(--hover-2);
  color: var(--ink);
}

.header-spacer { flex: 1; }

.header-search-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--hair);
  width: 280px;
  flex-shrink: 0;
  color: var(--muted);
}
.header-search-form input {
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--ink);
  flex: 1;
  min-width: 0;
}
.header-search-form input::placeholder { color: var(--muted); }

.header-auth {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 12px;
  flex-shrink: 0;
}
.header-signin {
  font-family: var(--font-ui);
  font-size: 13.5px;
  color: var(--ink2);
  padding: 6px 10px;
  border-radius: 6px;
  text-decoration: none;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  line-height: 1;
}
.header-signin:hover {
  background: var(--hover-2);
  color: var(--ink);
}
.header-register {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  background: var(--brand);
  color: var(--bg);
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.12s;
  display: inline-flex;
  align-items: center;
  line-height: 1;
}
.header-register:hover {
  opacity: 0.82;
  color: var(--bg);
}

/* Mobile toggle */
.mobile-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--hair);
  border-radius: 6px;
  padding: 5px 8px;
  color: var(--ink2);
  cursor: pointer;
  margin-left: auto;
  line-height: 1;
}

/* Mobile menu */
.mobile-menu {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: var(--bg);
  border-bottom: 1px solid var(--hair);
  padding: 10px 16px 14px;
  position: relative;
  z-index: 99;
}
.mobile-menu.open { display: flex; }

.mobile-menu-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--hair);
  margin-bottom: 6px;
  color: var(--muted);
}
.mobile-menu-search input {
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--ink);
  flex: 1;
}
.mobile-menu-search input::placeholder { color: var(--muted); }

.mobile-nav-item {
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--ink2);
  padding: 8px 10px;
  border-radius: 6px;
  text-decoration: none;
  display: block;
  transition: background 0.12s;
}
.mobile-nav-item:hover { background: var(--hover-2); color: var(--ink); }

.mobile-menu-divider {
  height: 1px;
  background: var(--hair);
  margin: 4px 0;
}

@media (max-width: 991px) {
  .site-header .header-primary-nav,
  .site-header .header-search-form,
  .site-header .header-auth,
  .site-header .header-spacer {
    display: none;
  }
  .mobile-toggle { display: flex; align-items: center; }
}

/* ── Buttons ─────────────────────────────────────────── */
.btn-brown {
  background: var(--brand) !important;
  color: var(--bg) !important;
  border: none !important;
  font-family: var(--font-ui);
  font-weight: 500;
  transition: opacity 0.12s;
}
.btn-brown:hover, .btn-brown:focus {
  background: var(--brand) !important;
  color: var(--bg) !important;
  opacity: 0.82;
}
.btn-outline-brown {
  color: var(--ink2) !important;
  border-color: var(--hair2) !important;
  background: transparent !important;
  font-family: var(--font-ui);
  transition: background 0.12s, color 0.12s;
}
.btn-outline-brown:hover, .btn-outline-brown:focus {
  background: var(--hover-2) !important;
  color: var(--ink) !important;
  border-color: var(--hair2) !important;
}

.form-control:focus, .form-select:focus {
  border-color: var(--ink2);
  box-shadow: 0 0 0 0.2rem rgba(28, 26, 20, 0.10);
}

/* ── Footer ──────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--hair);
  padding: 40px 28px 32px;
  margin-top: 80px;
  font-family: var(--font-ui);
}
.site-footer-inner {
  max-width: 880px;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 40px;
}
.site-footer-brand .logo-wordmark { font-size: 14px; }
.site-footer-tagline {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 13.5px;
  color: var(--muted);
  margin-top: 8px;
  max-width: 220px;
  line-height: 1.5;
}
.site-footer-links {
  display: flex;
  gap: 48px;
  flex-shrink: 0;
}
.site-footer-col-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.site-footer-col a {
  display: block;
  font-size: 13.5px;
  color: var(--ink2);
  text-decoration: none;
  margin-bottom: 7px;
  transition: color 0.12s;
}
.site-footer-col a:hover { color: var(--ink); }
.site-footer-bottom {
  max-width: 880px;
  margin: 28px auto 0;
  padding-top: 20px;
  border-top: 1px solid var(--hair);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}
.site-footer-bottom a { color: var(--muted); text-decoration: none; }
.site-footer-bottom a:hover { color: var(--ink2); }

@media (max-width: 640px) {
  .site-footer-inner { flex-direction: column; gap: 28px; }
  .site-footer-links { gap: 32px; }
  .site-footer-bottom { flex-direction: column; gap: 6px; text-align: center; }
}

/* ── Reader pages: header scrolls away to leave room for the text ─── */
body.reader .site-header { position: relative; }

/* ── Bible typography ─────────────────────────────────── */
.bible-heading,
.chapter-number {
  font-family: var(--font-serif);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.bible-text {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--ink2);
}

.bible-text p { margin-bottom: 1.2rem; }

.bible-text sup {
  font-size: 0.65em;
  color: var(--muted);
  margin-right: 0.25em;
}

.bible-text .q1,
.bible-text .q2 { display: block; }

.bible-text .q1 { margin-left: 1.5rem; }

.bible-text .q2 {
  margin-left: 1rem;
  color: var(--ink2);
}

.bible-text .q1 + .q1,
.bible-text .q2 + .q2 { margin-top: 0.25rem; }

.bible-text .wj { color: #b00020; }

.bible-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

@media (max-width: 576px) {
  .bible-text { font-size: 1.05rem; }
  .bible-text .q1 { margin-left: 1rem; }
  .bible-text .q2 { margin-left: 2rem; }
  .bible-nav .btn { min-width: 6.5rem; }
}

/* ── My Notes (verse page study rail + reading page sidebar) ─────── */
.note-card {
  border: 1px solid var(--hair);
  border-radius: 9px;
  background: var(--surface);
  padding: 12px 14px;
  margin-bottom: 12px;
}
.note-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.note-ref {
  font-family: var(--font-ui);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.note-actions { display: flex; gap: 4px; flex-shrink: 0; }
.note-action {
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--muted);
  background: transparent;
  border: none;
  padding: 2px 6px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.note-action:hover { background: var(--hover-2); color: var(--ink); }
.note-action-danger:hover { color: #b00020; }
.note-body {
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--ink2);
}
.note-body p { margin-bottom: 0.6rem; }
.note-body p:last-child { margin-bottom: 0; }
.note-body ul, .note-body ol { padding-left: 1.2rem; margin-bottom: 0.6rem; }
.note-body blockquote {
  border-left: 2px solid var(--hair2);
  padding-left: 12px;
  margin: 0 0 0.6rem;
  color: var(--muted);
}
.note-body code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--hover-2);
  padding: 1px 4px;
  border-radius: 4px;
}

.note-editor { margin-bottom: 12px; }
.note-input {
  width: 100%;
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--hair2);
  border-radius: 9px;
  padding: 11px 13px;
  outline: none;
  resize: vertical;
  transition: border-color 0.12s;
}
.note-input:focus { border-color: var(--accent); }
.note-editor-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.note-hint {
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--muted);
  flex: 1;
  min-width: 0;
}
.note-save {
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--bg);
  background: var(--ink);
  border: none;
  border-radius: 7px;
  padding: 6px 14px;
  cursor: pointer;
  transition: opacity 0.12s;
}
.note-save:hover { opacity: 0.85; }
.note-save:disabled { opacity: 0.5; cursor: default; }
.note-error {
  font-family: var(--font-ui);
  font-size: 12.5px;
  color: #b00020;
  margin: 6px 0 0;
}
.note-add {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--ink2);
  background: transparent;
  border: 1px dashed var(--hair2);
  border-radius: 8px;
  padding: 9px 12px;
  width: 100%;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.note-add:hover { background: var(--hover-2); border-color: var(--muted); }
.note-empty {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--muted);
}

/* ── Study panel: the reader and the daily reading share this ───── */
.read-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 40px;
  align-items: start;
}
.read-passage { padding-bottom: 40px; }
.read-passage .bible-header {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--ink);
  margin: 1.8rem 0 0.9rem;
}

/* A verse is a click target: it scopes the panel beside it. */
.read-passage [data-verse-block] {
  cursor: pointer;
  border-radius: 3px;
  transition: background 0.12s;
}
.read-passage [data-verse-block]:hover { background: var(--hover-2); }
.read-passage [data-verse-block].verse-active { background: rgba(61, 90, 150, 0.12); }
/* A verse you've already written on */
.read-passage [data-verse-block].verse-noted sup[data-verse]::after {
  content: "•";
  color: var(--accent);
  margin-left: 1px;
}

/* ── Study panel ──────────────────────────────────────── */
.study-aside {
  position: sticky;
  top: 72px;
  max-height: calc(100vh - 92px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--hair);
  border-radius: 12px;
  overflow: hidden;
}
.study-tabs {
  display: flex;
  gap: 2px;
  padding: 6px;
  border-bottom: 1px solid var(--hair);
  flex-shrink: 0;
}
.study-tab {
  flex: 1;
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: 7px;
  padding: 8px 10px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.study-tab:hover { background: var(--hover-2); color: var(--ink2); }
.study-tab.active { background: var(--hover-3); color: var(--ink); }
.study-scope {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--hair);
  flex-shrink: 0;
}
.study-scope-ref {
  flex: 1;
  min-width: 0;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.study-clear {
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--muted);
  background: transparent;
  border: none;
  padding: 2px 6px;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
}
.study-clear:hover { background: var(--hover-2); color: var(--ink); }
.study-pane {
  overflow-y: auto;
  padding: 14px;
}
/* Scrolls away with the passage instead of being pinned to the viewport. The
   pane keeps its own cap so a long commentary can't run off the page. */
.study-aside.is-static {
  position: static;
  max-height: none;
}
.study-aside.is-static .study-pane { max-height: 75vh; }
.study-pane[hidden] { display: none; }

.panel-source { margin-bottom: 20px; }
.panel-source:last-child { margin-bottom: 0; }
.panel-source-select {
  width: 100%;
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--hair2);
  border-radius: 8px;
  padding: 7px 10px;
  margin-bottom: 12px;
  cursor: pointer;
}
.panel-source-select:focus { outline: none; border-color: var(--accent); }
.panel-source-meta {
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}
.panel-note { margin-bottom: 12px; }
.panel-note-title {
  font-family: var(--font-ui);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 3px;
}
.panel-note-body {
  font-family: var(--font-serif);
  font-size: 0.97rem;
  line-height: 1.65;
  color: var(--ink2);
}
.panel-note-body p { margin-bottom: 0.6rem; }
.panel-note-body p:last-child { margin-bottom: 0; }
.panel-overviews summary {
  font-family: var(--font-ui);
  font-size: 12.5px;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
  margin-bottom: 8px;
}
.panel-overviews summary::before { content: "▸ "; }
.panel-overviews[open] summary::before { content: "▾ "; }
.panel-hint {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--muted);
}

@media (max-width: 991.98px) {
  /* Stacked: read the passage first, the panel follows it. Tapping a verse
     scrolls the panel into view (static/js/study-panel.js). */
  .read-layout { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .study-aside { position: static; max-height: none; }
  .study-pane { max-height: 65vh; }
}
