/* ============================================================================
   Bible Atlas — Ancient Manuscript Theme
   Warm parchment · Deep stone navbar · Gold & lapis accents
   ============================================================================ */

/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&display=swap');

/* ---------- Root Variables (warmer palette + contrast-safe) ---------- */
:root {
  --body-bg: #e9dfc6;       /* richer parchment — more contrast against white cards */
  --card-bg: #faf6ec;       /* warm cream-white — lifts off the body */
  --navbar-bg: #1a120a;     /* deeper mahogany */
  --primary: #1e3a6e;       /* lapis lazuli navy */
  --secondary: #b8913a;     /* richer antique gold (was muddy #9a7a2e) */
  --tertiary: #8b1a1a;      /* crimson */
  --text: #2e2418;          /* deeper ink, more contrast */
  --text-muted: #6b5c48;
  --border: #c2ab88;        /* stronger border for card definition */
  --shadow: rgba(30, 20, 10, 0.14);
  --glow: rgba(184, 145, 58, 0.22);
}

/* ---------- Animations ---------- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes gentlePulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.6; }
}

@keyframes map-pulse {
  0%   { transform: scale(1);   opacity: 1; }
  50%  { transform: scale(1.8); opacity: 0.4; }
  100% { transform: scale(2.5); opacity: 0; }
}

@keyframes highlight-flash {
  0%   { background: rgba(184, 145, 58, 0.3); }
  100% { background: transparent; }
}

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ---------- Body ---------- */
body {
  background: var(--body-bg) !important;
  color: var(--text) !important;
  font-family: 'Libre Baskerville', Georgia, serif !important;
  font-size: 0.92rem;
  line-height: 1.7;
  font-feature-settings: 'liga', 'kern';
  padding-bottom: 38px !important; /* room for fixed footer */
}

/* Parchment texture overlay */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='100' height='100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23noise)' opacity='0.045'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

/* Warm vignette */
body::after {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(ellipse at center, transparent 60%, rgba(44, 37, 32, 0.06) 100%);
  pointer-events: none;
  z-index: 0;
}

/* ---------- Focus Styles (accessibility) ---------- */
*:focus-visible {
  outline: 2px solid var(--secondary);
  outline-offset: 2px;
}

button:focus-visible,
.btn:focus-visible,
a:focus-visible {
  outline: 2px solid var(--secondary);
  outline-offset: 2px;
}

/* ---------- Navbar ---------- */
.navbar {
  background: var(--navbar-bg) !important;
  background-image: url('logo-concepts/concept4-refined.svg') !important;
  background-repeat: no-repeat !important;
  background-position: center center !important;
  background-size: contain !important;
  background-blend-mode: soft-light !important;
  border-bottom: none !important;
  font-family: 'Cinzel', serif !important;
  box-shadow: 0 2px 12px rgba(44, 37, 32, 0.3);
  position: sticky;
  top: 0;
  z-index: 1050;
}

/* Gold-to-crimson gradient border under navbar */
.navbar::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #8b1a1a, #b8913a, #b8913a, #8b1a1a);
}

.navbar-brand {
  color: #f5f0e8 !important;
  font-family: 'Cinzel', serif !important;
  font-weight: 700 !important;
  font-size: 1.15rem !important;
  letter-spacing: 1px;
}

.navbar-nav .nav-link {
  color: #c4b8a8 !important;
  font-family: 'Cinzel', serif !important;
  font-weight: 400;
  font-size: 0.82rem;
  letter-spacing: 0.5px;
  padding: 0.5rem 0.9rem !important;
  transition: color 0.2s, background 0.2s, transform 0.1s;
  border-radius: 4px;
}

.navbar-nav .nav-link:hover {
  color: #f5f0e8 !important;
  background: rgba(184, 145, 58, 0.18);
}

.navbar-nav .nav-link.active,
.navbar-nav .nav-item.active .nav-link {
  color: var(--navbar-bg) !important;
  background: linear-gradient(135deg, #c9a03a, #a88228) !important;
  font-weight: 600;
}

.navbar-toggler {
  border-color: rgba(184, 145, 58, 0.4) !important;
}

.navbar-toggler-icon {
  filter: invert(0.85);
}

/* ---------- Tab Content Fade In ---------- */
.tab-pane.active {
  animation: fadeIn 0.3s ease-out;
}

/* ---------- Headings ---------- */
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
  font-family: 'Cinzel', serif !important;
  color: var(--text);
}

/* ---------- Cards ---------- */
.bible-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 3px 12px var(--shadow);
  margin-bottom: 1rem;
  overflow: hidden;
  transition: box-shadow 0.2s;
}

.bible-card-header {
  padding: 12px 16px;
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(184, 145, 58, 0.06), rgba(139, 26, 26, 0.03));
}

.bible-card-body {
  padding: 16px;
}

.card, .bslib-card {
  background: var(--card-bg) !important;
  border: 1px solid var(--border) !important;
  border-radius: 10px !important;
  box-shadow: 0 3px 12px var(--shadow) !important;
}

.card-header {
  background: linear-gradient(135deg, rgba(184, 145, 58, 0.06), rgba(139, 26, 26, 0.03)) !important;
  border-bottom: 1px solid var(--border) !important;
  font-family: 'Cinzel', serif !important;
}

/* ---------- Map Layout ---------- */
.map-container {
  display: flex;
  height: calc(100vh - 130px);
  gap: 0;
  position: relative;
}

.map-pane {
  flex: 1;
  min-width: 0;
  position: relative;
}

.map-pane .leaflet-container {
  height: 100% !important;
  width: 100% !important;
  border-radius: 0;
}

.detail-panel {
  width: 380px;
  min-width: 380px;
  background: var(--card-bg);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  padding: 0;
}

.detail-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(30, 58, 110, 0.07), rgba(184, 145, 58, 0.08));
  position: sticky;
  top: 0;
  z-index: 10;
}

.detail-header h3 {
  margin: 0 0 6px 0;
  font-size: 1.2rem;
  color: var(--primary);
}

.detail-header .place-type {
  font-family: 'Libre Baskerville', serif;
  font-style: italic;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.detail-header .btn {
  color: var(--text);
  opacity: 0.6;
  transition: opacity 0.15s;
  font-size: 1.3rem;
  line-height: 1;
  padding: 2px 8px;
  border-radius: 4px;
}
.detail-header .btn:hover {
  opacity: 1;
  background: rgba(0,0,0,0.08);
}

.detail-body {
  padding: 20px;
}

/* ── Place connection hook ─────────────────────────────────────────────── */
.place-connection-hook {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  margin: 0 0 14px 0;
  background: linear-gradient(135deg, rgba(30,58,110,0.05) 0%, rgba(184,145,58,0.05) 100%);
  border: 1px solid var(--border);
  border-radius: 8px;
  border-left: 3px solid var(--secondary);
}
.pch-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.76rem;
  font-weight: 600;
  font-family: 'Cinzel', serif;
  letter-spacing: 0.03em;
  white-space: nowrap;
  line-height: 1;
  height: 24px;
}
.pch-pill .fa, .pch-pill [class*="fa-"] {
  font-size: 0.7rem;
  line-height: 1;
  display: flex;
  align-items: center;
}
.pch-events   { background: rgba(30,58,110,0.12); color: #1e3a6e; }
.pch-people   { background: rgba(184,145,58,0.15); color: #7a5c00; }
.pch-journeys { background: rgba(80,140,80,0.12); color: #2d5c2d; }
.pch-names {
  width: 100%;
  font-size: 0.76rem;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.3;
}
[data-theme="dark"] .pch-events   { background: rgba(100,130,200,0.15); color: #8fa8d8; }
[data-theme="dark"] .pch-people   { background: rgba(184,145,58,0.18); color: #c9a84c; }
[data-theme="dark"] .pch-journeys { background: rgba(100,180,100,0.15); color: #88bb88; }

.detail-section {
  margin-bottom: 18px;
}

.detail-section-title {
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--secondary);
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.detail-text {
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--text);
}

.detail-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  text-align: center;
  padding: 40px;
}

.detail-empty i {
  font-size: 3rem;
  margin-bottom: 16px;
  color: var(--border);
  animation: gentlePulse 3s ease-in-out infinite;
}

.detail-empty p {
  font-style: italic;
  font-size: 0.9rem;
}

/* ---------- Filter Bar ---------- */
.filter-bar {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  position: sticky;
  top: 56px;
  z-index: 100;
  background: rgba(248, 242, 232, 0.98);
}

.filter-bar label {
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 0;
}

.filter-bar .form-select,
.filter-bar .form-control {
  font-size: 0.85rem;
  max-width: 180px;
  background: var(--body-bg);
  border-color: var(--border);
  color: var(--text);
}

.filter-bar .form-select:focus,
.filter-bar .form-control:focus {
  border-color: var(--secondary);
  box-shadow: 0 0 0 2px rgba(184, 145, 58, 0.2);
}

/* ---------- Badges (contrast-safe) ---------- */
.era-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-family: 'Cinzel', serif;
  font-size: 0.68rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.5px;
  white-space: nowrap;
  text-shadow: 0 1px 1px rgba(0,0,0,0.2);
}

.type-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-family: 'Libre Baskerville', serif;
  font-size: 0.7rem;
  color: #fff;
  white-space: nowrap;
  text-shadow: 0 1px 1px rgba(0,0,0,0.2);
}

/* ---------- Scripture References ---------- */
.scripture-ref {
  display: inline-block;
  padding: 3px 10px;
  background: rgba(30, 58, 110, 0.08);
  border: 1px solid rgba(30, 58, 110, 0.15);
  border-radius: 4px;
  font-family: 'Libre Baskerville', serif;
  font-size: 0.78rem;
  font-style: italic;
  color: var(--primary);
  margin: 2px 3px;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}

.scripture-ref:hover {
  background: rgba(30, 58, 110, 0.16);
  border-color: rgba(30, 58, 110, 0.35);
  color: var(--primary);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(30, 58, 110, 0.12);
}

/* ---------- Inline Scripture Verse (expandable details block) ---------- */
.verse-inline-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.verse-inline {
  border-radius: 6px;
  overflow: hidden;
}
.verse-inline > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.verse-inline > summary::after {
  content: '\25B8';
  font-size: 0.65rem;
  color: var(--primary);
  opacity: 0.6;
  margin-left: 3px;
  transition: transform 0.15s;
}
.verse-inline[open] > summary::after {
  transform: rotate(90deg);
}
.verse-inline > summary::-webkit-details-marker { display: none; }
.verse-inline-text {
  padding: 7px 12px 9px;
  font-family: 'Libre Baskerville', serif;
  font-size: 0.78rem;
  font-style: italic;
  color: var(--text);
  line-height: 1.55;
  border: 1px solid rgba(30, 58, 110, 0.12);
  border-top: none;
  border-radius: 0 0 6px 6px;
  background: rgba(30, 58, 110, 0.04);
  animation: fadeIn 0.15s ease;
}
[data-theme="dark"] .verse-inline-text {
  background: rgba(184, 145, 58, 0.06);
  border-color: rgba(184, 145, 58, 0.15);
  color: #c8baa0;
}

/* ---------- People & Places Cards ---------- */
.place-card, .person-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s;
}

.place-card:hover, .person-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(60, 40, 20, 0.12), 0 0 0 1px var(--secondary);
  border-color: var(--secondary);
}

.place-card:active, .person-card:active {
  transform: translateY(-1px) scale(0.99);
}

.place-card-name, .person-card-name {
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 4px;
}

.place-card-info, .person-card-info {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
}

.place-card-desc, .person-card-desc {
  font-size: 0.82rem;
  color: var(--text);
  margin-top: 8px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- Card Grid ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  padding: 16px;
}

/* ---------- Journey Stop List ---------- */
.journey-stop {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s, padding-left 0.2s;
}

.journey-stop:hover {
  background: rgba(184, 145, 58, 0.06);
  padding-left: 4px;
}

.journey-stop:last-child {
  border-bottom: none;
}

.stop-number {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 0.85rem;
  box-shadow: 0 2px 6px rgba(30, 58, 110, 0.2);
}

.stop-content {
  flex: 1;
}

.stop-name {
  font-family: 'Cinzel', serif;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--primary);
  margin-bottom: 4px;
}

.stop-desc {
  font-size: 0.82rem;
  color: var(--text);
  line-height: 1.55;
}

.stop-ref {
  margin-top: 4px;
}

/* ---------- Timeline ---------- */
.timeline {
  position: relative;
  padding: 20px 0 20px 40px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 18px;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(to bottom, var(--secondary), var(--border), var(--secondary));
}

.timeline-item {
  position: relative;
  margin-bottom: 24px;
  padding-left: 24px;
  animation: fadeIn 0.4s ease-out;
}

.timeline-item::before {
  display: none;
}

.timeline-year {
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.timeline-title {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.timeline-desc {
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 6px;
}

.timeline-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------- People Profile ---------- */
.profile-header {
  text-align: center;
  padding: 30px 20px;
  background: linear-gradient(135deg, rgba(30, 58, 110, 0.07), rgba(184, 145, 58, 0.08));
  border-bottom: 1px solid var(--border);
}

.profile-name {
  font-family: 'Cinzel', serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}

.profile-role {
  font-family: 'Libre Baskerville', serif;
  font-style: italic;
  color: var(--secondary);
  font-size: 0.95rem;
  margin-bottom: 10px;
}

.profile-dates {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.profile-body {
  padding: 20px;
}

.profile-section {
  margin-bottom: 20px;
}

.profile-section-title {
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--secondary);
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

/* ---------- Form Controls ---------- */
.form-select, .form-control {
  background-color: var(--card-bg) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
  font-family: 'Libre Baskerville', serif !important;
  font-size: 0.88rem !important;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-select:focus, .form-control:focus {
  border-color: var(--secondary) !important;
  box-shadow: 0 0 0 3px rgba(184, 145, 58, 0.2) !important;
}

/* ---------- Buttons ---------- */
.btn-primary {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #fff !important;
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
  transition: all 0.2s;
}

.btn-primary:hover {
  background: #162d56 !important;
  border-color: #162d56 !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(30, 58, 110, 0.2);
}

.btn-primary:active {
  transform: scale(0.97);
}

.btn-outline-secondary {
  border-color: var(--border) !important;
  color: var(--text) !important;
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.btn-outline-secondary:hover {
  background: var(--secondary) !important;
  border-color: var(--secondary) !important;
  color: #fff !important;
  transform: translateY(-1px);
}

.btn-outline-secondary:active {
  transform: scale(0.97);
}

/* ---------- Tab Content Padding ---------- */
.tab-content-padded {
  padding: 20px;
}

/* ---------- Search Box ---------- */
.search-box {
  position: relative;
}

.search-box i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.search-box input {
  padding-left: 36px !important;
}

/* ---------- Journey Selector ---------- */
.journey-selector {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
}

/* Landing: 2-column card grid */
.journey-landing-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px;
  padding: 6px 16px 16px;
}

.journey-list-accent {
  width: 4px;
  min-width: 4px;
  border-radius: 2px;
  align-self: stretch;
  margin-top: 3px;
  flex-shrink: 0;
}

.journey-list-body {
  flex: 1;
  min-width: 0;
}

/* Active: compact horizontal chip strip */
.journey-chips-strip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 16px;
}

.journey-btn {
  padding: 6px 14px;
  border-radius: 20px;
  border: 2px solid var(--border);
  background: transparent;
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
}

.journey-btn:hover {
  border-color: var(--secondary);
  color: var(--secondary);
  transform: translateY(-1px);
}

.journey-btn:active {
  transform: scale(0.97);
}

.journey-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(30, 58, 110, 0.2);
}

/* ---------- Map Controls Override ---------- */
.leaflet-control-zoom a {
  background: var(--card-bg) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
  transition: all 0.15s;
}

.leaflet-control-zoom a:hover {
  background: var(--secondary) !important;
  color: #fff !important;
}

.leaflet-popup-content-wrapper {
  background: var(--card-bg) !important;
  color: var(--text) !important;
  border-radius: 10px !important;
  box-shadow: 0 6px 20px var(--shadow) !important;
  font-family: 'Libre Baskerville', serif !important;
}

.leaflet-popup-tip {
  background: var(--card-bg) !important;
}

.leaflet-popup-content {
  font-size: 0.85rem;
  line-height: 1.55;
  margin: 10px 14px !important;
  max-height: 220px;
  overflow-y: auto;
}

.popup-title {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 1rem;
  color: var(--primary);
  margin-bottom: 4px;
}

.popup-type {
  font-style: italic;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: 8px;
}

.popup-desc {
  font-size: 0.8rem;
  color: var(--text);
  line-height: 1.5;
}

/* ── Journey popup: finger-sized close button ────────────────────────── */
.journey-popup .leaflet-popup-content-wrapper {
  padding: 0 !important;
  overflow: hidden;
}
.journey-popup .leaflet-popup-content {
  margin: 0 !important;
  max-height: none;
  overflow: visible;
}

/* In-content close bar */
.popup-close-tap {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  background: rgba(0,0,0,0.04);
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 8px 12px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  min-height: 36px;          /* finger-sized touch target */
  box-sizing: border-box;
  letter-spacing: 0.05em;
  transition: background 0.15s, color 0.15s;
}
.popup-close-tap:hover,
.popup-close-tap:active {
  background: rgba(184,145,58,0.1);
  color: var(--secondary);
}
[data-theme="dark"] .popup-close-tap {
  background: rgba(255,255,255,0.04);
}
[data-theme="dark"] .popup-close-tap:hover {
  background: rgba(212,169,74,0.1);
}

/* Content area inside journey popup */
.journey-popup .leaflet-popup-content-wrapper .popup-title,
.journey-popup .leaflet-popup-content-wrapper .popup-type,
.journey-popup .leaflet-popup-content-wrapper .popup-desc {
  padding: 0;
}
.journey-popup .leaflet-popup-content-wrapper > .leaflet-popup-content > *:not(.popup-close-tap) {
  padding: 0 14px;
}
.journey-popup .leaflet-popup-content-wrapper .popup-title { padding-top: 10px; }
.journey-popup .leaflet-popup-content-wrapper .popup-desc  { padding-bottom: 12px; }

@media (max-width: 600px) {
  /* On mobile, make popup narrower and close bar more prominent */
  .journey-popup .leaflet-popup-content-wrapper {
    max-width: 230px !important;
  }
  .popup-close-tap {
    min-height: 42px;
    font-size: 0.9rem;
  }
}

/* ---------- Pulse Animation ---------- */
.marker-pulse {
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--secondary);
  animation: map-pulse 1.5s ease-out;
  pointer-events: none;
}

/* Leaflet circle-marker pulse ring for selected places */
@keyframes pulse-ring {
  0%   { transform: scale(1);   stroke-opacity: 0.9; stroke-width: 3; }
  50%  { transform: scale(1.5); stroke-opacity: 0.5; stroke-width: 4; }
  100% { transform: scale(2);   stroke-opacity: 0;   stroke-width: 2; }
}

.pulse-ring {
  animation: pulse-ring 1.2s ease-out 2;
  transform-origin: center;
  transform-box: fill-box;
}

/* ---------- Scrollbar Styling ---------- */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--body-bg);
}

::-webkit-scrollbar-thumb {
  background: #bfae96;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #9e8e76;
}

/* ---------- Legend ---------- */
.map-legend {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.78rem;
  box-shadow: 0 3px 12px var(--shadow);
}

.map-legend h5 {
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--secondary);
  margin: 0 0 8px 0;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}

.legend-item img {
  flex-shrink: 0;
}

.legend-item span {
  color: var(--text);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-line {
  width: 20px;
  height: 3px;
  flex-shrink: 0;
  border-radius: 2px;
}

/* ---------- Layer Toggle Buttons ---------- */
.layer-toggles {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-left: 24px;
}

.btn.layer-toggle {
  padding: 4px 12px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: transparent;
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.btn.layer-toggle:hover {
  border-color: var(--secondary);
  color: var(--text);
  background: rgba(184, 145, 58, 0.08);
  transform: translateY(-1px);
}

.btn.layer-toggle:active:not(.active) {
  transform: scale(0.97);
}

.btn.layer-toggle.active {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #fff !important;
  box-shadow: 0 2px 6px rgba(30, 58, 110, 0.2);
}

.btn.layer-toggle.active:hover {
  background: #162d56 !important;
  border-color: #162d56 !important;
  color: #fff !important;
}

/* ---------- Responsive ---------- */
@media (max-width: 992px) {
  .map-container {
    flex-direction: column;
    height: auto;
  }

  .map-pane {
    height: 50vh;
  }

  .detail-panel {
    width: 100%;
    min-width: 100%;
    border-left: none;
    border-top: 1px solid var(--border);
    max-height: 50vh;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    position: static;
  }

  .filter-bar .form-select,
  .filter-bar .form-control {
    max-width: 100%;
  }

  .layer-toggles {
    justify-content: flex-start;
    margin-left: 0 !important;
  }

  .tile-selector-overlay {
    flex-wrap: wrap;
    max-width: calc(100% - 20px);
  }

  .filter-bar-divider {
    display: none;
  }
}

@media (max-width: 576px) {
  /* Navbar — compact for 6 tabs */
  .navbar-brand {
    font-size: 0.9rem !important;
  }

  .navbar-nav .nav-link {
    font-size: 0.72rem;
    padding: 0.4rem 0.6rem !important;
    letter-spacing: 0;
  }

  .map-pane {
    height: 40vh;
  }

  .detail-panel {
    max-height: 60vh;
  }

  .journey-selector {
    gap: 4px;
  }

  .journey-btn {
    font-size: 0.7rem;
    padding: 4px 10px;
  }

  /* Tile overlay — compact on phone, hide labels */
  .tile-selector-overlay {
    top: 8px;
    right: 8px;
    padding: 3px 4px;
    gap: 2px;
  }

  .tile-btn {
    font-size: 0;       /* hide text labels on phone */
    padding: 5px 8px;
    gap: 0;
  }

  .tile-btn i {
    font-size: 0.8rem;  /* icon-only on phone */
  }

  .tile-btn.active {
    font-size: 0;
  }

  /* Layer toggles — smaller */
  .layer-toggle {
    font-size: 0.65rem;
    padding: 3px 8px;
  }

  /* Measure overlay — bottom-left, narrower */
  .measure-overlay {
    top: auto;
    bottom: 40px;
    left: 8px;
    max-width: 280px;
    padding: 10px 14px;
    font-size: 0.85rem;
  }

  .measure-stat-value {
    font-size: 0.82rem;
  }

  .measure-stats {
    gap: 6px;
  }
}

/* ---------- Footer note (old navbar placement - kept for compat) ---------- */
.app-footer {
  font-size: 0.7rem;
  color: #8a7a64;
  font-style: italic;
  display: none; /* moved to page footer */
}

/* ---------- Page-level footer bar — fixed at viewport bottom ---------- */
.app-footer-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 900;
  text-align: center;
  padding: 5px 16px;
  font-size: 0.68rem;
  color: var(--text-muted);
  font-style: italic;
  border-top: 1px solid var(--border);
  background: var(--card-bg);
  line-height: 1.6;
  box-shadow: 0 -2px 8px rgba(30,20,10,0.08);
}

.app-footer-bar a {
  color: var(--secondary);
  text-decoration: none;
}

.app-footer-bar a:hover {
  text-decoration: underline;
}

/* ---------- Tab padding helper ---------- */
.padded-tab {
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

/* ---------- Journey map layout ---------- */
.journey-layout {
  display: flex;
  height: calc(100vh - 140px);
}

.journey-map-pane {
  flex: 1;
  min-width: 0;
}

.journey-sidebar {
  width: 400px;
  min-width: 400px;
  overflow-y: auto;
  border-left: 1px solid var(--border);
  background: var(--card-bg);
}

@media (max-width: 992px) {
  .journey-layout {
    flex-direction: column;
    height: auto;
  }

  .journey-map-pane {
    height: 45vh;
  }

  .journey-sidebar {
    width: 100%;
    min-width: 100%;
    max-height: 50vh;
    border-left: none;
    border-top: 1px solid var(--border);
  }
}

/* ---------- People Grid ---------- */
.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 16px;
  padding: 16px;
}

@media (max-width: 768px) {
  .people-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Location Link ---------- */
.location-link {
  color: var(--primary);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
  transition: color 0.15s;
}

.location-link:hover {
  color: var(--secondary);
}

/* ============================================================================
   COMPONENTS — Cross-references, Era Headers, Global Search, etc.
   ============================================================================ */

/* ---------- Mini Timeline (detail panel & people profiles) ---------- */
.mini-timeline {
  position: relative;
  padding-left: 16px;
}

.mini-timeline::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.mini-timeline-item {
  display: flex;
  gap: 12px;
  padding: 8px 0;
}

.mini-timeline-item.clickable {
  cursor: pointer;
  border-radius: 6px;
  padding: 8px 6px;
  margin: 0 -6px;
  transition: background 0.15s ease;
}

.mini-timeline-item.clickable:hover {
  background: rgba(184, 145, 58, 0.1);
}

.mini-timeline-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
  position: relative;
  z-index: 1;
  margin-left: -11px;
  box-shadow: 0 0 0 2px var(--card-bg);
}

.mini-timeline-content {
  flex: 1;
  min-width: 0;
}

.mini-timeline-year {
  font-family: 'Cinzel', serif;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.mini-timeline-name {
  font-family: 'Cinzel', serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  margin: 2px 0;
}

.mini-timeline-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* ---------- Person Chips (detail panel & timeline) ---------- */
.person-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: rgba(30, 58, 110, 0.07);
  border: 1px solid rgba(30, 58, 110, 0.12);
  border-radius: 14px;
  font-size: 0.78rem;
  color: var(--primary);
  transition: all 0.2s;
}

.person-chip.clickable {
  cursor: pointer;
}

.person-chip.clickable:hover {
  background: rgba(30, 58, 110, 0.14);
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(30, 58, 110, 0.1);
}

.person-chip-name {
  font-family: 'Cinzel', serif;
  font-weight: 600;
  font-size: 0.8rem;
}

.person-chip-role {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ---------- Journey Chips (detail panel & people profiles) ---------- */
.journey-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 6px;
}

.journey-chip:hover {
  border-color: var(--secondary);
  box-shadow: 0 3px 10px var(--shadow);
  transform: translateY(-1px);
}

.journey-chip-color {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.8);
}

.journey-chip-name {
  font-family: 'Cinzel', serif;
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--text);
}

.journey-zoom-route {
  margin-top: 8px;
  font-family: Cinzel, serif;
  font-size: 0.75rem;
  color: var(--secondary) !important;
  background: transparent !important;
  border: 1.5px solid var(--secondary) !important;
  border-radius: 6px;
  padding: 4px 12px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.journey-zoom-route:hover {
  background: var(--secondary) !important;
  color: #fff !important;
}

.journey-chip-person {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ---------- Location Chips (people profiles) ---------- */
.location-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  background: rgba(30, 58, 110, 0.06);
  border: 1px solid rgba(30, 58, 110, 0.1);
  border-radius: 14px;
  font-size: 0.78rem;
  color: var(--primary);
  cursor: pointer;
  transition: all 0.2s;
}

.location-chip:hover {
  background: rgba(30, 58, 110, 0.14);
  border-color: var(--primary);
  transform: translateY(-1px);
}

/* ---------- Count Badges (people cards) ---------- */
.count-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  background: rgba(154, 122, 46, 0.12);
  border-radius: 10px;
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--secondary);
}

/* ---------- Era Headers (timeline) ---------- */
.era-header {
  position: relative;
  margin: 32px 0 24px -40px;
  padding-left: 0;
}

.era-header:first-child {
  margin-top: 0;
}

.era-header-bar {
  height: 4px;
  border-radius: 2px;
  margin-bottom: 12px;
}

.era-header-content {
  padding: 16px 20px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 3px 12px var(--shadow);
}

.era-header-title {
  font-family: 'Cinzel', serif !important;
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 6px 0;
}

.era-header-desc {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text);
  margin: 0;
}

/* ---------- Timeline dot override ---------- */
.timeline-dot {
  position: absolute;
  left: -28px;
  top: 6px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 3px solid var(--card-bg);
  z-index: 1;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.1);
}

/* ---------- Journey Stats Row ---------- */
.journey-stats-row {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.journey-stat {
  text-align: center;
  flex: 1;
}

.journey-stat-value {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.journey-stat-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ---------- Journey Distance on Stops ---------- */
.stop-distance {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
  font-style: italic;
}

/* ---------- Journey Button Distance Tag ---------- */
.journey-btn-dist {
  display: block;
  font-size: 0.65rem;
  font-weight: 400;
  opacity: 0.7;
  margin-top: 2px;
  font-family: 'Libre Baskerville', serif;
}

/* ---------- Play Button ---------- */
.play-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border: none;
  border-radius: 20px;
  color: #fff;
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.play-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px) scale(1.03);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.play-btn:active {
  transform: scale(0.97);
}

/* ---------- Active Stop Highlight ---------- */
.journey-stop.active-stop {
  background: rgba(184, 145, 58, 0.1);
  border-left: 3px solid var(--secondary);
  padding-left: 11px;
}

/* ---------- Global Search — icon-only until focused ---------- */
.global-search-container {
  position: relative;
}

/* Flex row: icon + input side by side */
.global-search-box {
  display: flex;
  align-items: center;
  gap: 0;
}

/* Icon is the visual handle — always visible */
.global-search-icon {
  color: rgba(184, 145, 58, 0.75);
  font-size: 0.88rem;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0 6px;
  z-index: 3;
  transition: color 0.15s;
  pointer-events: none;   /* clicks fall through to the input */
}
.global-search-box:focus-within .global-search-icon { color: #b8913a; }

/* Wrapper Shiny injects — zero out its spacing */
.global-search-box .shiny-input-container {
  margin: 0 !important;
  max-width: none !important;
}

/* Input: collapsed to 0 by default, expands on focus */
.global-search-box input {
  width: 0 !important;
  min-width: 0 !important;
  max-width: none !important;
  padding: 0 !important;
  border: 1px solid transparent !important;
  background: transparent !important;
  color: #f5f0e8 !important;
  font-size: 0.82rem !important;
  border-radius: 20px !important;
  height: 30px;
  outline: none;
  transition: width 0.22s ease, padding 0.18s, background 0.18s, border-color 0.18s;
}
.global-search-box:focus-within input {
  width: 200px !important;
  padding: 0 10px 0 8px !important;
  background: rgba(255,255,255,0.10) !important;
  border-color: rgba(184,145,58,0.4) !important;
}
.global-search-box input:focus {
  background: rgba(255,255,255,0.15) !important;
  border-color: #b8913a !important;
  box-shadow: 0 0 0 2px rgba(184,145,58,0.20) !important;
}
.global-search-box input::placeholder {
  color: rgba(184,145,58,0.5) !important;
  font-style: italic;
}

.search-results-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  width: 360px;
  max-height: 400px;
  overflow-y: auto;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(44, 37, 32, 0.18);
  z-index: 1100;
  margin-top: 4px;
  animation: fadeIn 0.2s ease-out;
}

.search-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid rgba(207, 192, 170, 0.3);
}

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

.search-result:hover {
  background: rgba(184, 145, 58, 0.08);
}

.search-result-type {
  font-family: 'Cinzel', serif;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--secondary);
  background: rgba(154, 122, 46, 0.1);
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

.search-result-name {
  font-family: 'Cinzel', serif;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text);
}

.search-result-info {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
  margin-left: auto;
  white-space: nowrap;
}

/* ---------- Highlight Flash Animation ---------- */
.highlight-flash {
  animation: highlight-flash 1.5s ease-out;
}

/* ---------- Navbar form control fix ---------- */
.navbar .form-group {
  margin-bottom: 0;
}

.navbar .shiny-input-container {
  margin-bottom: 0;
}

/* ============================================================================
   TILE SELECTOR (map overlay, upper-right)
   ============================================================================ */
.tile-selector-overlay {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 500;
  display: flex;
  gap: 4px;
  background: rgba(248, 242, 232, 0.92);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 6px;
  box-shadow: 0 2px 10px var(--shadow);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.tile-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: transparent;
  font-family: 'Cinzel', serif;
  font-size: 0.68rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.tile-btn:hover {
  background: rgba(184, 145, 58, 0.1);
  color: var(--text);
}

.tile-btn.active {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #fff !important;
  box-shadow: 0 2px 6px rgba(30, 58, 110, 0.2);
}

.tile-btn.active:hover {
  background: #162d56 !important;
  color: #fff !important;
}

.tile-btn i {
  font-size: 0.65rem;
}

.filter-bar-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 4px;
  align-self: center;
}

.measure-toggle {
  padding: 4px 10px;
}

/* ============================================================================
   MEASUREMENT TOOL
   ============================================================================ */
.crosshair-cursor,
.crosshair-cursor .leaflet-container {
  cursor: crosshair !important;
}

.crosshair-cursor .leaflet-marker-icon,
.crosshair-cursor .leaflet-marker-shadow {
  cursor: crosshair !important;
}

.measure-overlay {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 500;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  box-shadow: 0 4px 16px var(--shadow);
  max-width: 320px;
  animation: fadeIn 0.2s ease-out;
}

.measure-overlay-icon {
  font-size: 1.2rem;
  color: var(--secondary);
  margin-bottom: 6px;
}

.measure-overlay-title {
  font-family: 'Cinzel', serif;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text);
  margin-bottom: 4px;
}

.measure-overlay-text {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
}

.measure-results {
  max-width: 360px;
}

.measure-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 10px 0;
}

.measure-stat {
  text-align: center;
  padding: 8px;
  background: rgba(30, 58, 110, 0.05);
  border-radius: 8px;
}

.measure-stat-value {
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.measure-stat-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

.measure-context {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
  margin: 8px 0;
  line-height: 1.5;
}

.measure-reset {
  background: var(--body-bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  border-radius: 14px;
  padding: 3px 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.measure-reset:hover {
  border-color: var(--secondary);
  color: var(--text);
}

/* ============================================================================
   THEMATIC EXPLORATIONS
   ============================================================================ */

/* ---------- Theme Grid ---------- */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.theme-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 20px;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.theme-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 30px rgba(60, 40, 20, 0.12), 0 0 0 1px var(--secondary);
  border-color: var(--secondary);
}

.theme-card:active {
  transform: translateY(-2px) scale(0.99);
}

.theme-card-icon {
  font-size: 1.6rem;
  margin-bottom: 12px;
}

.theme-card-title {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  margin-bottom: 4px;
}

.theme-card-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 10px;
}

.theme-card-desc {
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.55;
  margin-bottom: 14px;
}

.theme-card-action {
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  font-weight: 600;
  transition: transform 0.2s;
}

.theme-card:hover .theme-card-action {
  transform: translateX(4px);
}

/* ---------- Exploration Layout ---------- */
.theme-exploration {
  height: calc(100vh - 130px);
  display: flex;
  flex-direction: column;
}

.theme-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
}

.theme-back-btn {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  border-radius: 14px;
  padding: 4px 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.theme-back-btn:hover {
  border-color: var(--secondary);
  color: var(--text);
}

.theme-topbar-title {
  font-family: 'Cinzel', serif;
  font-weight: 600;
  font-size: 0.9rem;
}

.theme-topbar-progress {
  margin-left: auto;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
}

.theme-progress-bar {
  height: 3px;
  background: var(--border);
}

.theme-progress-fill {
  height: 100%;
  border-radius: 0 2px 2px 0;
  transition: width 0.3s ease;
}

.theme-layout {
  display: flex;
  flex: 1;
  min-height: 0;
}

.theme-map-pane {
  flex: 1;
  min-width: 0;
}

.theme-map-pane .leaflet-container {
  height: 100% !important;
  width: 100% !important;
}

.theme-sidebar {
  width: 400px;
  min-width: 400px;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  background: var(--card-bg);
  overflow-y: auto;
}

/* ---------- Narrative ---------- */
.theme-narrative {
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.theme-narrative-header {
  margin-bottom: 12px;
}

.theme-step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #fff;
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.theme-narrative-title {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 4px 0;
}

.theme-narrative-place {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
}

.theme-narrative-text {
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 14px;
}

.theme-narrative-scripture {
  margin-bottom: 10px;
}

.theme-crosslink {
  margin-top: 8px;
}

.theme-crosslink-btn,
.detail-crosslink-btn {
  display: inline-flex;
  align-items: center;
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  color: var(--primary);
  text-decoration: none;
  padding: 4px 10px;
  border: 1px solid rgba(30, 58, 110, 0.2);
  border-radius: 14px;
  transition: all 0.2s;
}

.theme-crosslink-btn:hover,
.detail-crosslink-btn:hover {
  background: rgba(30, 58, 110, 0.08);
  border-color: var(--primary);
  color: var(--primary);
  text-decoration: none;
}

/* ---------- Navigation Buttons ---------- */
.theme-nav-buttons {
  display: flex;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}

.theme-nav-btn {
  font-family: 'Cinzel', serif;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 8px;
  padding: 8px 18px;
  transition: all 0.2s;
}

.theme-nav-btn.prev {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.theme-nav-btn.prev:hover {
  border-color: var(--text);
  color: var(--text);
}

.theme-nav-btn.next,
.theme-nav-btn.finish {
  color: #fff;
  border: none;
}

.theme-nav-btn.next:hover,
.theme-nav-btn.finish:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  color: #fff;
}

/* ---------- Stops List ---------- */
.theme-stops-list {
  padding: 16px 20px;
  flex: 1;
}

.theme-stops-title {
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--secondary);
  margin-bottom: 12px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.theme-stop-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.theme-stop-item:hover {
  background: rgba(184, 145, 58, 0.06);
}

.theme-stop-item.current {
  background: rgba(184, 145, 58, 0.1);
}

.theme-stop-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
  color: var(--text-muted);
  background: var(--card-bg);
  transition: all 0.2s;
}

.theme-stop-dot.visited,
.theme-stop-dot.current {
  color: #fff;
}

.theme-stop-dot.current {
  box-shadow: 0 0 0 3px rgba(184, 145, 58, 0.25);
}

.theme-stop-name {
  font-family: 'Cinzel', serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

.theme-stop-item.current .theme-stop-name {
  color: var(--primary);
}

/* ---------- Responsive — Themes ---------- */
@media (max-width: 992px) {
  .theme-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }

  .theme-exploration {
    height: auto;
    min-height: calc(100vh - 130px);
  }

  .theme-layout {
    flex-direction: column;
  }

  .theme-map-pane {
    height: 35vh;
    min-height: 250px;
  }

  .theme-sidebar {
    width: 100%;
    min-width: 100%;
    border-left: none;
    border-top: 1px solid var(--border);
    max-height: none;
    overflow-y: visible;
  }
}

@media (max-width: 576px) {
  .theme-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .theme-card {
    padding: 18px 16px;
  }

  .theme-card-icon {
    font-size: 1.3rem;
    margin-bottom: 8px;
  }

  .theme-card-title {
    font-size: 0.95rem;
  }

  .theme-card-desc {
    font-size: 0.82rem;
    -webkit-line-clamp: 3;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  /* Topbar — wraps cleanly */
  .theme-topbar {
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 12px;
  }

  .theme-back-btn {
    font-size: 0.7rem;
    padding: 3px 10px;
  }

  .theme-topbar-title {
    font-size: 0.78rem;
    order: 3;
    width: 100%;
  }

  .theme-topbar-progress {
    font-size: 0.72rem;
  }

  /* Map — shorter on phones */
  .theme-map-pane {
    height: 30vh;
    min-height: 200px;
  }

  /* Narrative — tighter */
  .theme-narrative {
    padding: 14px;
  }

  .theme-narrative-title {
    font-size: 0.95rem;
  }

  .theme-narrative-text {
    font-size: 0.85rem;
    line-height: 1.6;
  }

  .theme-step-badge {
    width: 24px;
    height: 24px;
    font-size: 0.75rem;
  }

  /* Nav buttons — stack vertically */
  .theme-nav-buttons {
    flex-direction: column;
    padding: 10px 14px;
    gap: 8px;
  }

  .theme-nav-btn {
    width: 100%;
    text-align: center;
    justify-content: center;
  }

  /* Stops list — compact */
  .theme-stops-list {
    padding: 12px 14px;
  }

  .theme-stop-item {
    padding: 5px 6px;
    gap: 8px;
  }

  .theme-stop-dot {
    width: 22px;
    height: 22px;
    font-size: 0.62rem;
  }

  .theme-stop-name {
    font-size: 0.78rem;
  }

  /* Cross-link */
  .theme-crosslink-btn {
    font-size: 0.7rem;
  }

  /* Global search dropdown — fit on phone */
  .search-results-dropdown {
    width: calc(100vw - 24px);
    max-width: 360px;
    right: -12px;
  }

  /* Padded tab — less padding on phone */
  .padded-tab {
    padding: 14px;
  }

  .scripture-modal {
    max-width: calc(100vw - 24px) !important;
    margin: 12px;
    max-height: 85vh;
  }
}

/* =========================================================================
   Scripture Modal — parchment-styled verse popup
   ========================================================================= */

@keyframes scripture-modal-in {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.scripture-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(30, 25, 18, 0.55);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  padding: 16px;
}

.scripture-modal-backdrop.visible {
  opacity: 1;
}

.scripture-modal-backdrop.visible .scripture-modal {
  animation: scripture-modal-in 0.25s ease forwards;
}

.scripture-modal {
  background: var(--card-bg, #f8f2e8);
  border: 1px solid var(--border, #cfc0aa);
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(30, 25, 18, 0.35), 0 0 0 1px rgba(184, 145, 58, 0.15);
  max-width: 560px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.scripture-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border, #cfc0aa);
  background: linear-gradient(135deg, rgba(30, 58, 110, 0.05), rgba(184, 145, 58, 0.05));
}

.scripture-modal-title {
  font-family: 'Cinzel', serif;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--primary, #1e3a6e);
}

.scripture-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted, #665a4a);
  cursor: pointer;
  padding: 0 4px;
  transition: color 0.15s;
}

.scripture-modal-close:hover {
  color: var(--tertiary, #8b1a1a);
}

.scripture-modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.scripture-modal-verse {
  font-family: 'Libre Baskerville', serif;
  font-size: 0.92rem;
  line-height: 1.8;
  color: var(--text, #3a3028);
  margin: 0 0 12px 0;
  text-indent: 1.5em;
}

.scripture-modal-verse:last-of-type {
  margin-bottom: 16px;
}

.scripture-modal-credit {
  font-family: 'Libre Baskerville', serif;
  font-style: italic;
  font-size: 0.75rem;
  color: var(--text-muted, #665a4a);
  text-align: right;
  padding-top: 12px;
  border-top: 1px solid var(--border, #cfc0aa);
}

.scripture-modal-broad {
  text-align: center;
  padding: 16px 0;
}

.scripture-modal-broad p {
  font-family: 'Libre Baskerville', serif;
  font-size: 0.88rem;
  color: var(--text-muted, #665a4a);
  margin: 0 0 16px 0;
}

.scripture-modal-link {
  display: inline-block;
  padding: 8px 20px;
  background: var(--primary, #1e3a6e);
  color: #fff !important;
  border-radius: 6px;
  font-family: 'Cinzel', serif;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s, transform 0.15s;
}

.scripture-modal-link:hover {
  background: var(--secondary, #9a7a2e);
  transform: translateY(-1px);
  text-decoration: none;
}

/* ---------- Dark Mode ---------- */
[data-theme="dark"] {
  --body-bg: #1a1714;
  --card-bg: #252220;
  --navbar-bg: #1a1714;
  --primary: #5b8fd9;
  --secondary: #d4a94a;
  --tertiary: #d45454;
  --text: #e0d8cc;
  --text-muted: #a09480;
  --border: #3a352e;
  --shadow: rgba(0, 0, 0, 0.3);
  --glow: rgba(212, 169, 74, 0.15);
}

[data-theme="dark"] body {
  background: var(--body-bg) !important;
  color: var(--text) !important;
}

[data-theme="dark"] .navbar {
  background: var(--navbar-bg) !important;
  border-bottom-color: var(--border) !important;
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
  background: #1e1c19 !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

[data-theme="dark"] .leaflet-container {
  background: #1a1714 !important;
}

[data-theme="dark"] .leaflet-popup-content-wrapper,
[data-theme="dark"] .leaflet-popup-tip {
  background: var(--card-bg) !important;
  color: var(--text) !important;
}

[data-theme="dark"] .leaflet-control-zoom a,
[data-theme="dark"] .leaflet-control-scale-line {
  background: var(--card-bg) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

[data-theme="dark"] .map-legend {
  background: var(--card-bg) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

[data-theme="dark"] .bible-card,
[data-theme="dark"] .person-card {
  background: var(--card-bg) !important;
  border-color: var(--border) !important;
}

[data-theme="dark"] .detail-panel {
  background: var(--card-bg) !important;
  border-color: var(--border) !important;
}

[data-theme="dark"] .filter-bar {
  background: var(--card-bg) !important;
  border-color: var(--border) !important;
}

[data-theme="dark"] .journey-sidebar {
  background: var(--card-bg) !important;
  border-color: var(--border) !important;
}

[data-theme="dark"] .scripture-modal {
  background: var(--card-bg) !important;
  color: var(--text) !important;
}

[data-theme="dark"] .scripture-modal-backdrop {
  background: rgba(0, 0, 0, 0.7) !important;
}

[data-theme="dark"] body::before {
  opacity: 0.02;
}

[data-theme="dark"] body::after {
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0, 0, 0, 0.4) 100%);
}

[data-theme="dark"] ::-webkit-scrollbar-track {
  background: #1a1714;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: #3a352e;
}

[data-theme="dark"] .search-results-dropdown {
  background: var(--card-bg) !important;
  border-color: var(--border) !important;
}

[data-theme="dark"] .search-result:hover {
  background: rgba(255, 255, 255, 0.05) !important;
}

[data-theme="dark"] .app-footer-bar {
  background: #100c06;
  border-color: rgba(255,255,255,0.1);
  color: var(--text-muted);
}

[data-theme="dark"] .journey-btn {
  background: var(--card-bg) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}

[data-theme="dark"] .layer-toggle {
  background: var(--card-bg) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}

[data-theme="dark"] .tile-btn {
  background: var(--card-bg) !important;
  color: var(--text) !important;
}

[data-theme="dark"] .era-header {
  background: var(--card-bg) !important;
}

[data-theme="dark"] .map-help-banner {
  background: linear-gradient(135deg, rgba(30,58,110,0.12), rgba(184,145,58,0.08));
  border-color: var(--border);
}

[data-theme="dark"] .loading-indicator::after {
  background: linear-gradient(90deg, transparent, var(--secondary), #e0d8cc, var(--secondary), transparent);
}

[data-theme="dark"] .keyboard-hint kbd {
  background: var(--card-bg);
  border-color: var(--border);
  box-shadow: 0 1px 0 var(--border);
}

/* ---------- Dark Mode Toggle ---------- */
.dark-mode-toggle {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.85rem;
  padding: 0;
}

.dark-mode-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
}

/* ---------- Era Jump Bar ---------- */
.era-jump-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 16px;
  background: var(--body-bg);
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.era-jump-btn {
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1.5px solid;
  background: transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.era-jump-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px var(--shadow);
}

/* ---------- Journey Progress Indicator ---------- */
.journey-progress-indicator {
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(30, 58, 110, 0.03), rgba(184, 145, 58, 0.03));
}

.journey-progress-bar {
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  overflow: hidden;
  margin: 6px 0;
}

.journey-progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.5s ease;
}

.journey-progress-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ---------- Copy Scripture Button ---------- */
.scripture-modal-copy {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 4px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.8rem;
  margin-right: 8px;
}

.scripture-modal-copy:hover {
  color: var(--text);
  border-color: var(--secondary);
}

.scripture-modal-copy.copied {
  color: #2e7d32;
  border-color: #2e7d32;
}
[data-theme="dark"] .scripture-modal-copy.copied {
  color: #66bb6a;
  border-color: #66bb6a;
}

/* ---------- Search Result Snippets ---------- */
.search-result-snippet {
  font-size: 0.72rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 280px;
  margin-top: 2px;
}

/* ---------- Place Photo ---------- */
.place-photo-container {
  width: 100%;
  max-height: 200px;
  overflow: hidden;
  border-radius: 6px;
  margin-bottom: 12px;
}

.place-photo-container img {
  width: 100%;
  object-fit: cover;
  max-height: 200px;
  display: block;
}

.place-photo-credit {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-align: right;
  margin-top: 4px;
}

/* ---------- Kingdom Year Slider ---------- */
.kingdom-year-display {
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  color: var(--primary);
  margin-top: 4px;
}

/* ---------- Loading Indicator ---------- */
@keyframes loading-slide {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(200%); }
}

.loading-indicator {
  display: none;
  position: fixed;
  top: 56px;
  left: 0;
  width: 100%;
  height: 3px;
  z-index: 9999;
  overflow: hidden;
}

.loading-indicator::after {
  content: '';
  display: block;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, var(--secondary), var(--primary), var(--secondary), transparent);
  animation: loading-slide 1.5s ease-in-out infinite;
}

.shiny-busy .loading-indicator {
  display: block;
}

/* ---------- Map Help Banner ---------- */
.map-help-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: linear-gradient(135deg, rgba(30,58,110,0.06), rgba(184,145,58,0.08));
  border: 1px solid var(--border);
  border-radius: 6px;
  margin: 8px 12px;
  font-size: 0.82rem;
  color: var(--text);
  animation: fadeIn 0.4s ease;
}

.map-help-banner .help-text {
  display: flex;
  align-items: center;
  gap: 8px;
}

.map-help-banner .help-text i {
  color: var(--secondary);
}

.map-help-banner .dismiss-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0 4px;
  line-height: 1;
}

.map-help-banner .dismiss-btn:hover {
  color: var(--text);
}

/* ---------- Keyboard Hint ---------- */
.keyboard-hint {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 6px 0;
  font-style: italic;
}

.keyboard-hint kbd {
  display: inline-block;
  padding: 1px 5px;
  font-size: 0.7rem;
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--text);
  background: var(--body-bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  box-shadow: 0 1px 0 var(--border);
}

/* ==========================================================================
   Round 2 — Mobile Responsive
   ========================================================================== */

/* --- Journey landing grid: single column on mobile --- */
@media (max-width: 576px) {
  .journey-landing-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Journey selector: horizontal scroll on mobile with 12 buttons --- */
@media (max-width: 768px) {
  .journey-chips-strip {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 8px;
  }
  .journey-chips-strip::-webkit-scrollbar { display: none; }
  .journey-selector {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 10px 12px;
    gap: 6px;
    scrollbar-width: none;     /* Firefox */
  }

  .journey-selector::-webkit-scrollbar {
    display: none;             /* Chrome/Safari */
  }

  .journey-btn {
    flex-shrink: 0;
    font-size: 0.72rem;
    padding: 5px 10px;
    white-space: nowrap;
  }

  .journey-btn-dist {
    font-size: 0.6rem;
  }
}

/* --- Keyboard hint: hide on touch devices / small screens --- */
@media (max-width: 992px) {
  .keyboard-hint {
    display: none;
  }
}

/* --- Loading indicator: adapt to variable navbar height --- */
@media (max-width: 576px) {
  .loading-indicator {
    top: 50px;
  }
}

/* --- Map help banner: tighter on mobile --- */
@media (max-width: 576px) {
  .map-help-banner {
    margin: 6px 8px;
    padding: 8px 12px;
    font-size: 0.76rem;
    gap: 8px;
  }

  .map-help-banner .help-text {
    gap: 6px;
  }
}

/* --- Place cards: badges and scripture refs on small screens --- */
@media (max-width: 576px) {
  .place-card .count-badge {
    font-size: 0.65rem;
    padding: 2px 5px;
  }

  .place-card .scripture-ref {
    font-size: 0.7rem;
    padding: 2px 6px;
  }
}

/* --- Journey sidebar: stop content on mobile --- */
@media (max-width: 992px) {
  .journey-sidebar .stop-content .location-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 0;
    min-height: 32px;   /* larger tap target */
  }
}

/* --- Person chips: bigger tap targets on touch --- */
@media (max-width: 768px) {
  .person-chip {
    padding: 4px 10px;
    font-size: 0.75rem;
    min-height: 28px;
  }

  .person-chip.clickable {
    min-height: 32px;
  }
}

/* --- Journey header: stack on very narrow --- */
@media (max-width: 576px) {
  .journey-header > div:first-child {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 10px;
  }

  .journey-stats-row {
    flex-wrap: wrap;
    gap: 8px;
  }

  .play-btn {
    align-self: flex-start;
  }
}

/* --- Journey stop: View on Map link touch target --- */
@media (max-width: 768px) {
  .journey-stop .location-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 0;
    min-height: 36px;
  }
}

/* --- Timeline items: ensure IDs don't break layout --- */
.timeline-item {
  scroll-margin-top: 80px;
}

/* --- Place card name+badge row on narrow --- */
@media (max-width: 576px) {
  .place-card > div:first-child {
    gap: 4px;
  }
}

/* ==========================================================================
   ROUND 3: Clustering, Temporal Map, Narrative Links, Journey Walkthrough
   ========================================================================== */

/* ---------- Marker Clustering ---------- */
.bible-cluster-wrapper { background: transparent !important; border: none !important; }
.bible-cluster {
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; font-family: 'Cinzel', serif; font-weight: 700;
  color: #3a3028; border: 2px solid rgba(154,122,46,0.6);
  box-shadow: 0 2px 8px rgba(60,40,20,0.2);
}
.bible-cluster-small  { width:36px; height:36px; font-size:0.8rem; background: linear-gradient(135deg,#f5e6b8,#e8d5a0); }
.bible-cluster-medium { width:44px; height:44px; font-size:0.9rem; background: linear-gradient(135deg,#e8d090,#d4b87a); }
.bible-cluster-large  { width:52px; height:52px; font-size:1rem;   background: linear-gradient(135deg,#d4b470,#c0a060); }

.cluster-toggle.active { background: var(--secondary) !important; color: #fff !important; }

/* ---------- Temporal Slider ---------- */
.temporal-slider-container {
  width: 100%;
  padding: 6px 16px;
  border-top: 1px solid var(--border);
}
.temporal-slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.temporal-slider-row .form-group {
  flex: 1;
  margin-bottom: 0;
}
.temporal-slider-row .irs { margin-top: 0 !important; margin-bottom: 0 !important; }
.temporal-play-btn {
  flex-shrink: 0;
  width: 34px; height: 34px;
  padding: 0;
  border: 2px solid var(--secondary);
  border-radius: 50%;
  background: transparent;
  color: var(--secondary);
  font-size: 0.85rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.temporal-play-btn:hover {
  background: var(--secondary);
  color: #fff;
}
.temporal-year-display {
  flex-shrink: 0;
  font-family: 'Cinzel', serif;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--primary);
  min-width: 90px;
  text-align: center;
}
.temporal-era-display {
  flex-shrink: 0;
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  font-weight: 600;
  min-width: 110px;
  text-align: right;
  transition: color 0.3s;
}

/* ---------- Era Waypoint Snap Buttons ---------- */
.era-waypoints {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 0 2px 0;
  flex-wrap: wrap;
}
.era-waypoints-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: 'Cinzel', serif;
  margin-right: 4px;
  flex-shrink: 0;
}
.era-wp-btn {
  font-size: 0.68rem;
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  font-family: 'Cinzel', serif;
  white-space: nowrap;
}
.era-wp-btn:hover {
  background: var(--secondary);
  color: #fff;
  border-color: var(--secondary);
}
[data-theme="dark"] .era-wp-btn {
  border-color: #4a3f2e;
  color: #9a8e72;
}
[data-theme="dark"] .era-wp-btn:hover {
  background: var(--secondary);
  color: #1a1a1a;
  border-color: var(--secondary);
}

/* ---------- Timeline Navigation Buttons ---------- */
.timeline-nav {
  display: flex; justify-content: space-between;
  margin-top: 10px; padding-top: 8px;
  border-top: 1px dashed var(--border);
}
.timeline-nav-btn {
  padding: 4px 10px; border: 1px solid var(--border);
  border-radius: 6px; background: transparent;
  font-size: 0.78rem; cursor: pointer; max-width: 48%;
  color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: all 0.2s;
}
.timeline-nav-btn:hover {
  background: rgba(184,145,58,0.08); border-color: var(--secondary);
  color: var(--text);
}
.timeline-nav-next { text-align: right; }

/* ---------- People Mini-Timeline Connectors ---------- */
.timeline-connector {
  padding: 4px 0 4px 22px;
}
.timeline-connector-text {
  font-size: 0.72rem; font-style: italic; color: var(--text-muted);
  border-left: 2px dashed var(--border); padding-left: 14px;
  display: block;
}

/* ---------- Journey Story Card Overlay ---------- */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.story-card-overlay {
  position: absolute; bottom: 20px; left: 20px; right: 20px;
  max-width: 480px; background: var(--card-bg);
  border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 8px 32px rgba(60,40,20,0.2); z-index: 800;
  animation: slideUp 0.4s ease-out;
  overflow: hidden;
}
.story-card-overlay.minimized .story-card-context,
.story-card-overlay.minimized .story-card-body,
.story-card-overlay.minimized .story-card-ticker {
  display: none;
}
.story-card-overlay.minimized .story-card-minimize i {
  transform: rotate(180deg);
}
.story-card-minimize {
  position: absolute; top: 8px; right: 8px;
  border: none; background: transparent; color: var(--text-muted);
  cursor: pointer; font-size: 0.85rem; z-index: 1;
  padding: 2px 6px; border-radius: 4px;
}
.story-card-minimize:hover { background: rgba(0,0,0,0.05); }
.story-card-context {
  padding: 10px 16px;
  background: rgba(184,145,58,0.04);
  border-bottom: 1px solid var(--border);
}
.story-card-header {
  padding: 10px 16px;
  display: flex; align-items: center; gap: 10px;
}
.story-card-badge {
  font-family: 'Cinzel', serif;
  font-size: 0.7rem; font-weight: 700;
  color: #fff; padding: 2px 8px; border-radius: 10px;
  white-space: nowrap;
}
.story-card-stop-name {
  font-family: 'Cinzel', serif;
  font-size: 0.95rem; font-weight: 600;
  color: var(--primary);
}
.story-card-body {
  padding: 0 16px 10px;
}
.story-card-desc {
  font-size: 0.82rem; color: var(--text);
  line-height: 1.5;
}
.story-card-ticker {
  display: flex; justify-content: space-around;
  padding: 8px 16px; background: rgba(184,145,58,0.06);
  border-top: 1px solid var(--border);
}
.ticker-stat {
  font-family: 'Cinzel', serif; font-size: 0.75rem;
  font-weight: 600; color: var(--secondary);
}
.story-card-nav {
  display: flex; justify-content: center; align-items: center;
  gap: 8px; padding: 8px 16px;
  border-top: 1px solid var(--border);
}
.story-card-nav-btn {
  padding: 5px 12px; border: 1px solid var(--border);
  border-radius: 6px; background: transparent;
  font-size: 0.78rem; cursor: pointer; color: var(--text);
  transition: all 0.2s;
}
.story-card-nav-btn:hover:not(:disabled) {
  background: rgba(184,145,58,0.08); border-color: var(--secondary);
}
.story-card-nav-btn:disabled {
  opacity: 0.4; cursor: default;
}
.story-card-play-btn {
  border: none !important;
  border-radius: 50%;
  width: 34px; height: 34px;
  padding: 0;
  display: flex; align-items: center; justify-content: center;
}

/* ---------- Speed Selector ---------- */
.speed-select {
  font-family: 'Libre Baskerville', serif;
  font-size: 0.75rem;
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
}

/* ---------- Dark Mode Overrides for Round 3 ---------- */
[data-theme="dark"] .bible-cluster {
  color: #e0d8cc;
  border-color: rgba(184,145,58,0.5);
}
[data-theme="dark"] .bible-cluster-small  { background: linear-gradient(135deg,#3a3228,#4a4030); }
[data-theme="dark"] .bible-cluster-medium { background: linear-gradient(135deg,#4a3e28,#5a4e38); }
[data-theme="dark"] .bible-cluster-large  { background: linear-gradient(135deg,#5a4828,#6a5840); }

[data-theme="dark"] .temporal-play-btn {
  border-color: var(--secondary); color: var(--secondary);
}
[data-theme="dark"] .temporal-play-btn:hover {
  background: var(--secondary); color: #1a1a1a;
}

[data-theme="dark"] .timeline-nav-btn {
  border-color: var(--border); color: var(--text-muted);
}
[data-theme="dark"] .timeline-nav-btn:hover {
  background: rgba(184,145,58,0.12); color: var(--text);
}

[data-theme="dark"] .story-card-overlay {
  background: var(--card-bg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
[data-theme="dark"] .story-card-ticker {
  background: rgba(184,145,58,0.08);
}
[data-theme="dark"] .story-card-nav-btn {
  border-color: var(--border); color: var(--text);
}
[data-theme="dark"] .speed-select {
  background: var(--card-bg); color: var(--text); border-color: var(--border);
}

/* ---------- Mobile: Story card full width ---------- */
@media (max-width: 768px) {
  .story-card-overlay {
    left: 8px; right: 8px; bottom: 8px;
    max-width: 100%;
  }
  .story-card-ticker {
    flex-wrap: wrap; gap: 4px;
    justify-content: center;
  }
  .temporal-slider-row {
    flex-wrap: wrap;
  }
  .temporal-slider-row .form-group {
    order: 2; flex-basis: 100%;
  }
  .temporal-play-btn { order: 1; }
  .temporal-year-display { order: 3; }
  .temporal-era-display { order: 4; }
}

/* ============================================================
   COMPREHENSIVE DARK MODE OVERRIDES
   Applied when JS sets data-theme="dark" on <html>
   ============================================================ */

/* 1. Root variable overrides */
[data-theme="dark"] {
  --body-bg:    #1a1510;
  --card-bg:    #221d18;
  --navbar-bg:  #0f0d0a;
  --primary:    #4a7ab5;
  --secondary:  #c9a84c;
  --tertiary:   #c0392b;
  --text:       #e8dcc8;
  --text-muted: #a09278;
  --border:     #3a3028;
  --shadow:     rgba(0, 0, 0, 0.4);
  --glow:       rgba(201, 168, 76, 0.2);
}

/* 2. Body */
[data-theme="dark"] body {
  background-color: var(--body-bg);
  color: var(--text);
}

/* 3. Parchment texture overlay — dim heavily in dark mode */
[data-theme="dark"] body::before {
  opacity: 0.02;
}

/* 4. Navbar */
[data-theme="dark"] .navbar,
[data-theme="dark"] .navbar-default,
[data-theme="dark"] nav.navbar {
  background-color: var(--navbar-bg) !important;
  border-bottom-color: var(--border) !important;
}
[data-theme="dark"] .navbar-brand,
[data-theme="dark"] .nav-link,
[data-theme="dark"] .navbar-nav .nav-link {
  color: var(--text) !important;
}
[data-theme="dark"] .navbar-nav .nav-link:hover,
[data-theme="dark"] .navbar-nav .nav-link.active {
  color: var(--secondary) !important;
}

/* 5. Cards and panels */
[data-theme="dark"] .card,
[data-theme="dark"] .bible-card,
[data-theme="dark"] .place-card,
[data-theme="dark"] .person-card,
[data-theme="dark"] .theme-card,
[data-theme="dark"] .detail-section,
[data-theme="dark"] .detail-panel,
[data-theme="dark"] .sidebar-panel,
[data-theme="dark"] .well,
[data-theme="dark"] .panel,
[data-theme="dark"] .panel-default,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .popover,
[data-theme="dark"] .dropdown-menu {
  background-color: var(--card-bg) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}

[data-theme="dark"] .card-header,
[data-theme="dark"] .panel-heading {
  background-color: rgba(255, 255, 255, 0.04) !important;
  border-bottom-color: var(--border) !important;
  color: var(--text) !important;
}

[data-theme="dark"] .card-body,
[data-theme="dark"] .panel-body {
  color: var(--text);
}

/* 6. Inputs, selects, textareas */
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="search"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="url"],
[data-theme="dark"] textarea,
[data-theme="dark"] select,
[data-theme="dark"] .form-control,
[data-theme="dark"] .selectize-input,
[data-theme="dark"] .selectize-dropdown {
  background-color: #2a2420 !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .selectize-input.focus {
  border-color: var(--secondary) !important;
  box-shadow: 0 0 0 3px var(--glow) !important;
}

[data-theme="dark"] .selectize-dropdown .option {
  background-color: #2a2420;
  color: var(--text);
}
[data-theme="dark"] .selectize-dropdown .option:hover,
[data-theme="dark"] .selectize-dropdown .option.active {
  background-color: rgba(201, 168, 76, 0.15);
  color: var(--text);
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
  color: var(--text-muted) !important;
  opacity: 0.7;
}

/* 7. Labels and form text */
[data-theme="dark"] label,
[data-theme="dark"] .control-label,
[data-theme="dark"] .form-label {
  color: var(--text) !important;
}

/* 8. Buttons */
[data-theme="dark"] .btn-default,
[data-theme="dark"] .btn-light,
[data-theme="dark"] .btn-outline-secondary {
  background-color: #2a2420;
  color: var(--text);
  border-color: var(--border);
}
[data-theme="dark"] .btn-default:hover,
[data-theme="dark"] .btn-light:hover,
[data-theme="dark"] .btn-outline-secondary:hover {
  background-color: rgba(201, 168, 76, 0.15);
  border-color: var(--secondary);
  color: var(--secondary);
}

[data-theme="dark"] .btn-primary {
  background-color: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
[data-theme="dark"] .btn-primary:hover {
  background-color: #3a6aa5;
  border-color: #3a6aa5;
}

/* 9. Tables */
[data-theme="dark"] table,
[data-theme="dark"] .table {
  color: var(--text) !important;
  border-color: var(--border) !important;
}
[data-theme="dark"] .table th {
  background-color: rgba(255, 255, 255, 0.05) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}
[data-theme="dark"] .table td {
  border-color: var(--border) !important;
  color: var(--text) !important;
}
[data-theme="dark"] .table-striped tbody tr:nth-of-type(odd) {
  background-color: rgba(255, 255, 255, 0.03) !important;
}
[data-theme="dark"] .table-hover tbody tr:hover {
  background-color: rgba(201, 168, 76, 0.08) !important;
}

/* 10. Headings and text */
[data-theme="dark"] h1, [data-theme="dark"] h2,
[data-theme="dark"] h3, [data-theme="dark"] h4,
[data-theme="dark"] h5, [data-theme="dark"] h6 {
  color: var(--text) !important;
}
[data-theme="dark"] p,
[data-theme="dark"] span,
[data-theme="dark"] li,
[data-theme="dark"] td,
[data-theme="dark"] th,
[data-theme="dark"] blockquote {
  color: var(--text);
}
[data-theme="dark"] .text-muted,
[data-theme="dark"] small {
  color: var(--text-muted) !important;
}

/* 11. Links */
[data-theme="dark"] a {
  color: var(--secondary);
}
[data-theme="dark"] a:hover {
  color: #e0c070;
}

/* 12. Tabs (Bootstrap nav-tabs / shiny tabsetPanel) */
[data-theme="dark"] .nav-tabs {
  border-bottom-color: var(--border);
}
[data-theme="dark"] .nav-tabs .nav-link {
  color: var(--text-muted);
  border-color: transparent;
}
[data-theme="dark"] .nav-tabs .nav-link:hover {
  color: var(--text);
  border-color: var(--border);
  background-color: rgba(255, 255, 255, 0.04);
}
[data-theme="dark"] .nav-tabs .nav-link.active {
  background-color: var(--card-bg);
  border-color: var(--border) var(--border) var(--card-bg);
  color: var(--secondary) !important;
}

/* 13. Shiny containers and notifications */
[data-theme="dark"] .shiny-input-container {
  color: var(--text);
}
[data-theme="dark"] .shiny-notification {
  background-color: var(--card-bg);
  color: var(--text);
  border-color: var(--border);
}

/* 14. Sliders */
[data-theme="dark"] .irs-bar,
[data-theme="dark"] .irs-bar-edge {
  background-color: var(--secondary) !important;
  border-color: var(--secondary) !important;
}
[data-theme="dark"] .irs-line {
  background-color: var(--border) !important;
}
[data-theme="dark"] .irs-from,
[data-theme="dark"] .irs-to,
[data-theme="dark"] .irs-single {
  background-color: var(--secondary) !important;
  color: #1a1510 !important;
}
[data-theme="dark"] .irs-handle {
  border-color: var(--secondary) !important;
}
[data-theme="dark"] .irs-grid-text {
  color: var(--text-muted) !important;
}
[data-theme="dark"] .irs-min,
[data-theme="dark"] .irs-max {
  background-color: #2a2420 !important;
  color: var(--text-muted) !important;
}

/* 15. Checkboxes and radio buttons */
[data-theme="dark"] .shiny-input-checkboxgroup label,
[data-theme="dark"] .shiny-input-radiogroup label {
  color: var(--text) !important;
}

/* 16. Detail sections / info and stat boxes */
[data-theme="dark"] .detail-section,
[data-theme="dark"] .info-box,
[data-theme="dark"] .stat-box,
[data-theme="dark"] .journey-segment,
[data-theme="dark"] .journey-selector-bar {
  background-color: var(--card-bg) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}

[data-theme="dark"] .journey-selector-bar button,
[data-theme="dark"] .journey-selector-bar .btn {
  background-color: #2a2420;
  color: var(--text-muted);
  border-color: var(--border);
}
[data-theme="dark"] .journey-selector-bar button.active,
[data-theme="dark"] .journey-selector-bar .btn.active {
  background-color: rgba(201, 168, 76, 0.2);
  color: var(--secondary);
  border-color: var(--secondary);
}

/* 17. Filter bar */
[data-theme="dark"] .filter-bar {
  background-color: rgba(255, 255, 255, 0.03) !important;
  border-color: var(--border) !important;
}
[data-theme="dark"] .filter-bar label,
[data-theme="dark"] .filter-bar .form-label {
  color: var(--text-muted) !important;
}

/* 18. Map panel background */
[data-theme="dark"] .map-layout {
  background-color: var(--body-bg);
}
[data-theme="dark"] .leaflet-container {
  background-color: #1a1510;
}

/* 19. Scrollbars */
[data-theme="dark"] ::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
[data-theme="dark"] ::-webkit-scrollbar-track {
  background: var(--card-bg);
}
[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: #4a3e2e;
  border-radius: 4px;
}
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: var(--secondary);
}

/* 20. Place, Person, Theme cards in dark */
[data-theme="dark"] .place-card,
[data-theme="dark"] .person-card,
[data-theme="dark"] .theme-card {
  background-color: var(--card-bg);
  border-color: var(--border);
  box-shadow: 0 2px 12px var(--shadow);
}
[data-theme="dark"] .place-card:hover,
[data-theme="dark"] .person-card:hover,
[data-theme="dark"] .theme-card:hover {
  border-color: var(--secondary);
  box-shadow: 0 4px 20px var(--glow);
}
[data-theme="dark"] .place-card h5,
[data-theme="dark"] .person-card h5,
[data-theme="dark"] .theme-card h5,
[data-theme="dark"] .place-card h4,
[data-theme="dark"] .person-card h4,
[data-theme="dark"] .theme-card h4 {
  color: var(--text) !important;
}
[data-theme="dark"] .place-card .card-text,
[data-theme="dark"] .person-card .card-text,
[data-theme="dark"] .theme-card .card-text {
  color: var(--text-muted);
}

/* 21. Bible verse display */
[data-theme="dark"] .verse-text {
  color: var(--text);
}
[data-theme="dark"] .verse-reference {
  color: var(--secondary);
}

/* 22. Breadcrumbs */
[data-theme="dark"] .breadcrumb {
  background-color: transparent;
}
[data-theme="dark"] .breadcrumb-item,
[data-theme="dark"] .breadcrumb-item a {
  color: var(--text-muted);
}
[data-theme="dark"] .breadcrumb-item.active {
  color: var(--text);
}
[data-theme="dark"] .breadcrumb-item + .breadcrumb-item::before {
  color: var(--border);
}

/* 23. Modal */
[data-theme="dark"] .modal-header {
  background-color: rgba(255, 255, 255, 0.04);
  border-bottom-color: var(--border);
  color: var(--text);
}
[data-theme="dark"] .modal-footer {
  border-top-color: var(--border);
}

/* 24. Alerts */
[data-theme="dark"] .alert {
  background-color: #2a2420;
  border-color: var(--border);
  color: var(--text);
}
[data-theme="dark"] .alert-info {
  background-color: rgba(74, 122, 181, 0.15);
  border-color: rgba(74, 122, 181, 0.4);
  color: #90b8e0;
}
[data-theme="dark"] .alert-warning {
  background-color: rgba(201, 168, 76, 0.15);
  border-color: rgba(201, 168, 76, 0.4);
  color: var(--secondary);
}
[data-theme="dark"] .alert-danger {
  background-color: rgba(192, 57, 43, 0.15);
  border-color: rgba(192, 57, 43, 0.4);
  color: #e06050;
}

/* 25. Progress bars */
[data-theme="dark"] .progress {
  background-color: #2a2420;
}
[data-theme="dark"] .progress-bar {
  background-color: var(--primary);
}

/* ============================================================
   MOBILE FIXES (@media max-width: 768px)
   ============================================================ */

@media (max-width: 768px) {

  /* Map layout: stack vertically */
  .map-layout {
    flex-direction: column !important;
  }

  /* Map pane: 60vh on mobile */
  .map-layout > .map-pane,
  .map-layout > [id*="map"] {
    height: 60vh !important;
    min-height: 60vh !important;
    flex: 0 0 60vh !important;
    width: 100% !important;
  }

  /* Detail panel: 40vh scrollable */
  .detail-panel {
    max-height: 40vh !important;
    height: 40vh !important;
    overflow-y: auto !important;
    width: 100% !important;
    flex: 0 0 40vh !important;
  }

  /* Journey selector bar: wrap */
  .journey-selector-bar {
    flex-wrap: wrap !important;
    gap: 4px !important;
  }
  .journey-selector-bar button,
  .journey-selector-bar .btn {
    flex: 1 1 auto;
    min-width: 80px;
    font-size: 0.75rem;
    padding: 4px 8px;
  }

  /* Filter bar: wrap */
  .filter-bar {
    flex-wrap: wrap !important;
    gap: 6px !important;
  }
  .filter-bar > * {
    flex: 1 1 140px;
  }

  /* Card grids: single column */
  .bible-card {
    grid-template-columns: 1fr !important;
  }
  .place-cards-grid {
    grid-template-columns: 1fr !important;
  }
  .person-cards-grid {
    grid-template-columns: 1fr !important;
  }
  .theme-grid {
    grid-template-columns: 1fr !important;
  }

  /* Theme layout: stack vertically */
  .theme-layout {
    flex-direction: column !important;
  }
  .theme-layout > .theme-sidebar,
  .theme-layout > .theme-map-pane {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 auto !important;
  }
  .theme-layout > .theme-map-pane {
    height: 55vh !important;
    min-height: 55vh !important;
  }

  /* Prevent horizontal overflow */
  html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }
  .container-fluid,
  .container {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  /* Reduce card padding */
  .card,
  .bible-card,
  .place-card,
  .person-card {
    padding: 12px !important;
  }

  /* Navbar brand */
  .navbar-brand {
    font-size: 1rem !important;
  }

  /* Modal: full width */
  .modal-dialog {
    margin: 8px !important;
    max-width: calc(100vw - 16px) !important;
  }
}

/* =========================================================================
   Journey Hero Card (featured Exodus on empty state)
   ========================================================================= */
.journey-hero {
  margin: 20px 20px 4px;
  padding: 20px 22px 18px;
  background: linear-gradient(135deg, rgba(30,58,110,0.06), rgba(184,145,58,0.06));
  border-radius: 12px;
  border-left: 5px solid var(--secondary);
  border: 1px solid var(--border);
}

.journey-hero-eyebrow {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--secondary);
  margin-bottom: 6px;
}

.journey-hero-title {
  font-family: 'Cinzel', serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 10px;
  line-height: 1.2;
}

.journey-hero-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0 0 14px;
}

.journey-hero-stats {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.journey-hero-stats span {
  display: flex;
  align-items: center;
}

.journey-hero-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 22px;
  border: 2px solid var(--primary);
  background: var(--primary);
  color: #fff;
  font-family: 'Cinzel', serif;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

.journey-hero-btn:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

.journey-list-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s;
  margin-bottom: 2px;
}

.journey-list-row:hover {
  background: rgba(30,58,110,0.06);
}

[data-theme="dark"] .journey-list-row:hover {
  background: rgba(255,255,255,0.06);
}

/* =========================================================================
   Journey Share Button
   ========================================================================= */
.journey-share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}

.journey-share-btn:hover {
  border-color: var(--secondary);
  color: var(--secondary);
  background: rgba(184,145,58,0.08);
}

/* =========================================================================
   Share / Copy Toast
   ========================================================================= */
.copy-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(60px);
  background: #2c2520;
  color: #faf7f0;
  padding: 9px 20px;
  border-radius: 24px;
  font-size: 0.82rem;
  font-weight: 600;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
  pointer-events: none;
  z-index: 9999;
  white-space: nowrap;
}

.copy-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* =========================================================================
   Onboarding Modal
   ========================================================================= */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30,20,10,0.65);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
  animation: obFadeIn 0.3s ease;
}

@keyframes obFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.onboarding-card {
  background: var(--card-bg, #faf7f0);
  border-radius: 16px;
  padding: 32px 36px 28px;
  max-width: 420px;
  width: calc(100vw - 40px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  position: relative;
  border: 1px solid var(--border, #d4c9b8);
}

.onboarding-logo {
  font-family: 'Cinzel', serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary, #1e3a6e);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.onboarding-steps {
  display: flex;
  gap: 6px;
  margin-bottom: 22px;
}

.onboarding-step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border, #d4c9b8);
  transition: background 0.2s;
}

.onboarding-step-dot.active {
  background: var(--secondary, #b8913a);
  width: 22px;
  border-radius: 4px;
}

.onboarding-step-title {
  font-family: 'Cinzel', serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary, #1e3a6e);
  margin-bottom: 10px;
}

.onboarding-step-body {
  font-size: 0.88rem;
  color: var(--text-muted, #7a6e5e);
  line-height: 1.6;
  margin-bottom: 24px;
  min-height: 70px;
}

.onboarding-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.onboarding-skip {
  font-size: 0.78rem;
  color: var(--text-muted, #7a6e5e);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  text-decoration: underline;
}

.onboarding-next {
  padding: 9px 22px;
  border-radius: 22px;
  background: var(--primary, #1e3a6e);
  color: #fff;
  border: none;
  font-family: 'Cinzel', serif;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
}

.onboarding-next:hover { opacity: 0.85; }

[data-theme="dark"] .onboarding-card {
  background: #2a2520;
  border-color: #3d3530;
}

[data-theme="dark"] .onboarding-logo,
[data-theme="dark"] .onboarding-step-title { color: #e8d9c0; }
[data-theme="dark"] .onboarding-step-body { color: #a09080; }

/* ---------- Country Context Card (Places tab) ---------- */
.country-context-card {
  background: linear-gradient(135deg, var(--card-bg) 0%, rgba(184, 145, 58, 0.06) 100%);
  border: 1px solid var(--border);
  border-left: 4px solid var(--secondary);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 18px;
  animation: fadeIn 0.3s ease;
}

.country-context-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.country-flag {
  font-size: 2rem;
  line-height: 1;
}

.country-context-title {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  line-height: 1.3;
}

.country-context-count {
  font-family: 'Libre Baskerville', serif;
  font-size: 0.78rem;
  color: var(--secondary);
  font-weight: 600;
}

.country-context-blurb {
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.65;
  margin: 6px 0 8px 0;
}

.country-context-sites {
  font-size: 0.82rem;
  color: var(--text-muted);
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.country-context-sites-label {
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

[data-theme="dark"] .country-context-card {
  background: linear-gradient(135deg, #2a2520 0%, rgba(184, 145, 58, 0.08) 100%);
  border-color: #3d3530;
  border-left-color: var(--secondary);
}

[data-theme="dark"] .country-context-title { color: #e8d9c0; }
[data-theme="dark"] .country-context-blurb { color: #b0a090; }
[data-theme="dark"] .country-context-sites { border-top-color: #3d3530; }
[data-theme="dark"] .country-context-count { color: #c9a84c; }

/* ==========================================================================
   Mobile Overhaul
   ========================================================================== */

/* Scripture tags: always look tappable (touch devices have no hover) */
.scripture-ref {
  border-bottom: 1.5px solid rgba(30, 58, 110, 0.25);
}

/* Clear filters button */
.filter-reset-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  font-family: 'Cinzel', serif;
  font-size: 0.68rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.filter-reset-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: rgba(30, 58, 110, 0.05);
}

/* ==========================================================================
   Stories — Guided Narrative Experiences
   ========================================================================== */

/* ── Tab wrapper ── */
.stories-tab {
  padding: 0;
  min-height: 100%;
}

/* ── Grid header ── */
.stories-grid-header {
  padding: 36px 32px 24px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, var(--card-bg) 0%, rgba(184,145,58,0.04) 100%);
}

.stories-grid-title {
  font-family: 'Cinzel', serif;
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 8px 0;
  letter-spacing: 0.03em;
}

.stories-grid-sub {
  font-family: 'Libre Baskerville', serif;
  font-size: 0.92rem;
  color: var(--text-muted);
  margin: 0;
  font-style: italic;
  max-width: 600px;
  line-height: 1.6;
}

/* ── Story card grid ── */
.stories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  padding: 28px 32px 40px;
}

/* ── Individual story card ── */
.story-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-top: 4px solid var(--story-accent, var(--secondary));
  border-radius: 12px;
  padding: 22px 24px 20px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
}

.story-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 60%, rgba(184,145,58,0.04) 100%);
  pointer-events: none;
}

.story-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(30,20,10,0.12);
  border-top-color: var(--story-accent, var(--secondary));
  border-color: color-mix(in srgb, var(--story-accent, var(--border)) 30%, var(--border));
}

.story-card-era {
  font-family: 'Cinzel', serif;
  font-size: 0.67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  /* Use text-muted for low-saturation accents (#e8a030 fails WCAG AA at this size) */
  color: var(--text-muted);
  margin-bottom: 2px;
}

.story-card-title {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
}

.story-card-sub {
  font-family: 'Libre Baskerville', serif;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.4;
}

.story-card-meta {
  display: flex;
  align-items: center;
  gap: 0;
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
  letter-spacing: 0.3px;
}

.story-card-blurb {
  font-family: 'Libre Baskerville', serif;
  font-size: 0.83rem;
  color: var(--text);
  line-height: 1.65;
  margin-top: 6px;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.story-card-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--story-accent, var(--secondary));
  transition: opacity 0.12s;
}

.story-card:hover .story-card-cta { opacity: 0.75; }

/* ── Player layout ── */
/* player_view is a flex column so header/footer are always visible */
.stories-player-view {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 56px); /* 56px = bslib navbar height */
  overflow: hidden;
}

.stories-player-body {
  display: flex;
  flex: 1;
  min-height: 0; /* allow flex child to shrink below content size */
  overflow: hidden;
}

.stories-player-text {
  flex: 0 0 55%;
  overflow-y: auto;
  padding: 28px 32px 32px;
  border-right: 1px solid var(--border);
}

.stories-player-map {
  flex: 1;
  position: relative;
}

.stories-player-map .leaflet-container,
.stories-player-map > div {
  height: 100% !important;
}

/* ── Player header ── */
.story-player-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 24px 0;
  border-bottom: 1px solid var(--border);
  background: var(--card-bg);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-wrap: wrap;
  row-gap: 8px;
}

.story-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px 13px;
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.13s;
  white-space: nowrap;
  flex-shrink: 0;
}

.story-back-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: rgba(30,58,110,0.05);
}

.story-header-info {
  flex: 1;
  min-width: 0;
}

.story-header-title {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.story-header-step {
  font-family: 'Libre Baskerville', serif;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.story-progress-bar {
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 10px;
  overflow: hidden;
}

.story-progress-fill {
  height: 100%;
  background: var(--story-accent, var(--secondary));
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* ── Step content ── */
.story-step-content {
  animation: fadeIn 0.25s ease;
}

.story-step-number {
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  border-left: 3px solid currentColor;
  padding-left: 8px;
  margin-bottom: 10px;
}

.story-step-title {
  font-family: 'Cinzel', serif;
  font-size: 1.22rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 14px 0;
  line-height: 1.3;
}

.story-step-text {
  font-family: 'Libre Baskerville', serif;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.8;
  margin: 0 0 20px 0;
}

.story-step-scripture {
  margin-bottom: 16px;
}

.story-step-people {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.story-person-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 11px;
  border-radius: 14px;
  background: rgba(30,58,110,0.08);
  border: 1px solid rgba(30,58,110,0.15);
  color: var(--primary);
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s;
}

.story-person-chip:hover {
  background: rgba(30,58,110,0.14);
}

.story-place-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 12px;
  background: rgba(139,26,26,0.07);
  border: 1px solid rgba(139,26,26,0.15);
  color: var(--tertiary);
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  font-weight: 600;
}

/* ── Player footer ── */
.story-player-footer {
  padding: 20px 32px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  background: var(--card-bg);
}

.story-dots {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 480px;
}

.story-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: background 0.18s, transform 0.18s;
}

.story-dot--active {
  background: var(--secondary);
  transform: scale(1.35);
}

.story-nav-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

.story-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 18px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  cursor: pointer;
  transition: all 0.13s;
}

.story-nav-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.story-nav-btn:not(:disabled):hover {
  background: rgba(30,58,110,0.06);
  border-color: var(--primary);
  color: var(--primary);
}

.story-nav-btn--primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.story-nav-btn--primary:not(:disabled):hover {
  background: rgba(30,58,110,0.85);
  color: #fff;
}

.story-autoplay-btn.active {
  background: rgba(184,145,58,0.1);
  border-color: var(--secondary);
  color: var(--secondary);
}

/* ── Dark mode ── */
[data-theme="dark"] .stories-grid-header {
  background: linear-gradient(135deg, #2a2520 0%, rgba(184,145,58,0.06) 100%);
  border-bottom-color: #3d3530;
}

[data-theme="dark"] .stories-grid-title { color: #e8d9c0; }
[data-theme="dark"] .stories-grid-sub   { color: #a09080; }

[data-theme="dark"] .story-card {
  background: #2a2520;
  border-color: #3d3530;
}

[data-theme="dark"] .story-card:hover {
  box-shadow: 0 8px 28px rgba(0,0,0,0.3);
}

[data-theme="dark"] .story-card-title  { color: #e8d9c0; }
[data-theme="dark"] .story-card-sub    { color: #9a8e7e; }
[data-theme="dark"] .story-card-blurb  { color: #b0a090; }
[data-theme="dark"] .story-card-meta   { color: #7a6e5e; }

[data-theme="dark"] .story-player-header,
[data-theme="dark"] .story-player-footer {
  background: #231e1a;
  border-color: #3d3530;
}

[data-theme="dark"] .story-header-title { color: #e8d9c0; }
[data-theme="dark"] .story-progress-bar { background: #3d3530; }

[data-theme="dark"] .story-step-title { color: #e8d9c0; }
[data-theme="dark"] .story-step-text  { color: #b0a090; }

[data-theme="dark"] .story-dot { background: #4a4038; }

[data-theme="dark"] .story-nav-btn {
  border-color: #4a4038;
  color: #c0b0a0;
}

[data-theme="dark"] .story-nav-btn:not(:disabled):hover {
  background: rgba(184,145,58,0.08);
  border-color: var(--secondary);
  color: var(--secondary);
}

[data-theme="dark"] .story-back-btn {
  border-color: #4a4038;
  color: #9a8e7e;
}

[data-theme="dark"] .story-back-btn:hover {
  background: rgba(184,145,58,0.08);
  border-color: var(--secondary);
  color: var(--secondary);
}

[data-theme="dark"] .story-person-chip {
  background: rgba(30,58,110,0.2);
  border-color: rgba(30,58,110,0.35);
}

[data-theme="dark"] .story-place-chip {
  background: rgba(139,26,26,0.18);
  border-color: rgba(139,26,26,0.3);
}

[data-theme="dark"] .stories-player-text {
  border-right-color: #3d3530;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .stories-grid {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .stories-grid-header { padding: 24px 16px 18px; }

  .stories-player-view {
    height: auto;
    overflow: visible;
  }

  .stories-player-body {
    flex-direction: column;
    height: auto;
    overflow: visible;
  }

  .stories-player-text {
    flex: unset;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 20px 18px;
    overflow-y: visible;
  }

  .stories-player-map {
    height: 300px;
    flex-shrink: 0;
  }

  .story-player-footer { padding: 16px 16px 20px; }
}

/* Empty state with reset action */
.empty-state-action {
  margin-top: 12px;
}
.empty-state-action button {
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(30, 58, 110, 0.06);
  color: var(--primary);
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.15s;
}
.empty-state-action button:hover {
  background: rgba(30, 58, 110, 0.12);
  border-color: var(--primary);
}

/* Dynamic viewport height */
@supports (height: 100dvh) {
  .map-container { height: calc(100dvh - 130px); }
  .journey-layout { height: calc(100dvh - 140px); }
}

/* ── Tablet (992px) enhancements ── */
@media (max-width: 992px) {
  .map-container {
    height: auto;
    min-height: calc(100vh - 100px);
  }

  /* Filter bar: horizontal scroll instead of wrapping */
  .filter-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 8px;
    padding: 8px 12px;
  }
  .filter-bar::-webkit-scrollbar { display: none; }
  .filter-bar .form-select,
  .filter-bar .form-control {
    min-width: 130px;
    max-width: 160px;
    flex-shrink: 0;
  }
  .filter-bar label { display: none; }
}

/* ── Phone (576px) ── */
@media (max-width: 576px) {
  /* Map + detail: full width stacked */
  .map-container { height: auto; min-height: calc(100vh - 80px); }
  .map-pane { height: 45vh; min-height: 280px; }
  .detail-panel {
    width: 100% !important;
    min-width: 0 !important;
    max-height: 55vh;
    border-radius: 12px 12px 0 0;
  }
  .detail-header { padding: 14px; }
  .detail-header h3 { font-size: 1rem; }
  .detail-body { padding: 14px; }

  /* Journey sidebar: full width */
  .journey-sidebar {
    width: 100% !important;
    min-width: 0 !important;
    max-height: 55vh;
  }
  .journey-map-pane { height: 40vh; min-height: 250px; }

  /* Filter bar: tighter */
  .filter-bar {
    padding: 6px 8px;
    gap: 6px;
    top: 46px;
  }
  .filter-bar .form-select {
    font-size: 0.78rem;
    min-width: 110px;
    max-width: 140px;
    padding: 0.3rem 0.5rem;
  }

  /* Cards */
  .people-grid { grid-template-columns: 1fr; padding: 10px; gap: 10px; }
  .card-grid { padding: 10px; gap: 10px; }

  /* Navbar */
  .navbar { padding: 0.3rem 0.5rem !important; }
  .navbar-brand { font-size: 0.85rem !important; }
  .navbar-nav .nav-link {
    font-size: 0.68rem;
    padding: 0.35rem 0.45rem !important;
  }
}

/* ── Journey hooks ──────────────────────────────────────────────────────── */
.journey-hook { font-size: 0.75rem; color: #8a7e6b; line-height: 1.4; margin: 0.2rem 0 0.6rem; font-style: italic; }

/* ── Start Here card ────────────────────────────────────────────────────── */
.journey-start-here { background: rgba(184,145,58,0.08); border: 1px solid rgba(184,145,58,0.2); border-radius: 8px; padding: 0.75rem 1rem; margin-bottom: 1rem; }
.journey-start-label { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.08em; color: #b8913a; font-weight: 600; margin-bottom: 0.3rem; }
.journey-start-text { font-size: 0.82rem; color: #c4b89a; line-height: 1.5; margin: 0; }
.journey-start-link { font-size: 0.78rem; color: #b8913a; cursor: pointer; text-decoration: none; display: inline-block; margin-top: 0.4rem; }
.journey-start-link:hover { text-decoration: underline; }

/* ── Related People chips ───────────────────────────────────────────────── */
.related-person-chip {
  display: inline-block;
  padding: 4px 12px;
  background: rgba(184,145,58,0.1);
  border: 1px solid rgba(184,145,58,0.25);
  border-radius: 16px;
  font-size: 0.78rem;
  color: #b8913a;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}
.related-person-chip:hover {
  background: rgba(184,145,58,0.2);
  border-color: #b8913a;
}

/* ── Disconnect overlay ─────────────────────────────────────────────────── */
#shiny-disconnected-overlay {
  background: #2c2520ee !important;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: system-ui, sans-serif;
  z-index: 99998 !important;
}
#shiny-disconnected-overlay::before {
  content: 'Connection lost';
  font-size: 1.4rem;
  font-weight: 600;
  color: #b8913a;
  margin-bottom: 0.5rem;
}
#shiny-disconnected-overlay::after {
  content: 'Attempting to reconnect\2026';
  font-size: 0.9rem;
  color: #e8dcc8;
  opacity: 0.7;
}

/* ── Accessibility ──────────────────────────────────────────────────────── */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.skip-to-content {
  position: absolute; top: -100%; left: 16px; z-index: 100000;
  padding: 8px 16px; background: #b8913a; color: #2c2520;
  border-radius: 0 0 6px 6px; font-weight: 600; font-size: 0.9rem;
  text-decoration: none; transition: top 0.2s ease;
}
.skip-to-content:focus { top: 0; }

/* ── Mobile tap targets (44px minimum per WCAG 2.5.5) ──────────────────── */
@media (max-width: 767.98px) {
  .nav-pills .nav-link, .nav-tabs .nav-link { min-height: 44px; padding: 10px 16px; }
  .navbar-nav .nav-link { min-height: 44px; }
  .btn, .btn-sm { min-height: 44px; }
  .dropdown-item { min-height: 44px; padding: 10px 16px; }
  .leaflet-control-zoom a { width: 44px !important; height: 44px !important; line-height: 44px !important; }
  .form-check-input { width: 20px; height: 20px; }
  .form-check-label { min-height: 44px; display: flex; align-items: center; }
}

/* ── Cross-site Terranalytics switcher ─────────────────────────────────────── */
.pm-switcher { position: relative; }
.pm-trigger {
  background: none; border: 1px solid #c5baa8; color: #7a6e5e;
  padding: 0.3rem 0.7rem; border-radius: 6px; font-size: 0.78rem;
  cursor: pointer; font-family: 'Cinzel', serif;
}
.pm-trigger:hover { border-color: #1e3a6e; color: #3a3028; }
.pm-dropdown {
  display: none; position: absolute; right: 0; top: calc(100% + 6px);
  background: #eae2d4; border: 1px solid #c5baa8; border-radius: 8px;
  padding: 0.5rem; min-width: 220px; z-index: 1200;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}
.pm-dropdown::before { content: ''; position: absolute; top: -10px; left: 0; right: 0; height: 10px; }
.pm-switcher:hover .pm-dropdown,
.pm-switcher:focus-within .pm-dropdown { display: block; }
.pm-row {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.5rem 0.6rem; border-radius: 6px;
  text-decoration: none; color: #5a5044; font-size: 0.82rem;
}
.pm-row:hover { background: #ddd5c7; color: #3a3028; }
.pm-current { background: rgba(30,58,110,0.08); color: #1e3a6e !important; }
.pm-row-text { display: flex; flex-direction: column; }
.pm-name { font-weight: 600; font-family: 'Cinzel', serif; }
.pm-sub { font-size: 0.7rem; color: #7a6e5e; }
.pm-divider { border-color: #c5baa8; margin: 0.3rem 0; }
[data-theme="dark"] .pm-trigger { border-color: #3e3a34; color: #94a3b8; }
[data-theme="dark"] .pm-trigger:hover { border-color: #b8913a; color: #e8dcc8; }
[data-theme="dark"] .pm-dropdown { background: #221d18; border-color: #3e3a34; box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
[data-theme="dark"] .pm-row { color: #94a3b8; }
[data-theme="dark"] .pm-row:hover { background: #2a2520; color: #e8dcc8; }
[data-theme="dark"] .pm-current { background: rgba(184,145,58,0.08); color: #b8913a !important; }
[data-theme="dark"] .pm-sub { color: #64748b; }

/* ============================================================================
   MOBILE RESPONSIVENESS FIXES — 375px (iPhone SE) pass
   ============================================================================ */

/* ── Journey playback: play/pause/step buttons — 44px tap targets ── */
@media (max-width: 767.98px) {
  .story-card-nav-btn {
    min-height: 44px;
    padding: 10px 16px;
    font-size: 0.82rem;
  }
  .story-card-play-btn {
    width: 44px !important;
    height: 44px !important;
  }
  .play-btn {
    min-height: 44px;
    padding: 10px 20px;
  }
  .temporal-play-btn {
    width: 44px !important;
    height: 44px !important;
  }
  /* Journey selector buttons */
  .journey-btn {
    min-height: 44px;
  }
  /* Era jump buttons */
  .era-jump-btn {
    min-height: 44px;
    padding: 10px 14px;
  }
}

/* ── Journey map: ensure sidebar doesn't clip at 375px ── */
@media (max-width: 576px) {
  .journey-sidebar {
    min-height: 200px;
    overflow-x: hidden;
    max-width: calc(100vw - 20px);
  }
  /* Story card overlay: shrink padding for 375px */
  .story-card-overlay {
    left: 4px !important;
    right: 4px !important;
    bottom: 4px !important;
  }
  .story-card-body { padding: 0 12px 8px; }
  .story-card-header { padding: 8px 12px; }
  .story-card-context { padding: 8px 12px; }
  .story-card-ticker { padding: 6px 12px; }
  .story-card-nav { padding: 6px 12px; gap: 6px; }
}

/* ── Timeline: event cards stack properly ── */
@media (max-width: 576px) {
  .timeline {
    padding-left: 28px;
  }
  .timeline::before {
    left: 10px;
  }
  .timeline-item {
    padding-left: 18px;
  }
  .timeline-dot {
    left: -20px;
    width: 12px;
    height: 12px;
  }
  .era-header {
    margin-left: -28px;
  }
  .timeline-title { font-size: 0.88rem; }
  .timeline-desc  { font-size: 0.8rem; }
}

/* ── Map sidebar panel: limit overflow at 375px ── */
@media (max-width: 576px) {
  .detail-panel {
    overflow-x: hidden;
  }
  .detail-header h3 { font-size: 0.95rem; }
}

/* ── Global search dropdown: fix for 375px ── */
@media (max-width: 400px) {
  .search-results-dropdown {
    width: calc(100vw - 16px) !important;
    right: -8px !important;
  }
  .global-search-box input:focus {
    width: 100% !important;
  }
}

/* ── Scripture modal: fit 375px perfectly ── */
@media (max-width: 400px) {
  .scripture-modal {
    max-width: calc(100vw - 16px) !important;
    margin: 8px !important;
  }
  .scripture-modal-header { padding: 12px 14px; }
  .scripture-modal-body  { padding: 14px; }
  .scripture-modal-title { font-size: 0.9rem; }
}

/* ── Filter bar inputs: min font-size 16px on iOS prevents zoom ── */
@media (max-width: 767.98px) {
  .filter-bar .form-select,
  .filter-bar .form-control,
  .hz-float-search input,
  input[type="text"],
  input[type="search"] {
    font-size: 16px !important;
  }
}

/* ── People grid: tighter on 375px ── */
@media (max-width: 400px) {
  .people-grid {
    padding: 8px;
    gap: 8px;
  }
  .place-card, .person-card {
    padding: 12px !important;
  }
  .place-card-name, .person-card-name {
    font-size: 0.88rem;
  }
}
@media (max-width: 900px) { .pm-switcher { display: none; } }

/* ── Mobile fixes Round 2 — 375px/768px gaps (March 2026) ───────────── */
@media (max-width: 768px) {
  .journey-sidebar { width: 100% !important; min-width: 0 !important; max-width: calc(100vw - 20px) !important; }
  .theme-sidebar { width: 100% !important; min-width: 0 !important; max-width: calc(100vw - 20px) !important; }
}
@media (max-width: 600px) {
  .detail-panel { width: 100% !important; min-width: 0 !important; }
}
@media (max-width: 576px) {
  .global-search-box input { width: calc(100vw - 120px) !important; max-width: 200px; }
  .search-results-dropdown { width: calc(100vw - 16px) !important; max-width: none !important; }
  .journey-btn { max-width: 100% !important; }
  .theme-description { max-width: 100% !important; }
  .filter-bar .form-select, .filter-bar .form-control { flex: 1 1 100% !important; max-width: 100% !important; }
}

/* ============================================================================
   Doctrine Threads
   ============================================================================ */

/* ---------- Thread Grid ---------- */
.thread-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.thread-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s;
}

.thread-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 30px rgba(60, 40, 20, 0.12), 0 0 0 1px var(--secondary);
  border-color: var(--secondary);
}

.thread-card:active {
  transform: translateY(-2px) scale(0.99);
}

.thread-card-icon {
  font-size: 1.4rem;
  margin-bottom: 6px;
}

.thread-card-title {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}

.thread-card-subtitle {
  font-size: 0.8rem;
  color: var(--secondary);
  font-style: italic;
  margin-top: 2px;
}

.thread-card-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 8px 0 6px;
}

.thread-card-desc {
  font-size: 0.85rem;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
}

/* ---------- Thread Detail ---------- */
.thread-detail {
  animation: fadeIn 0.3s ease-out;
}

.thread-header {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
}

/* ---------- Thread Connection Chips ---------- */
.thread-connection-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border: 1px solid;
  border-radius: 16px;
  font-size: 0.78rem;
  font-family: 'Cinzel', serif;
  cursor: pointer;
  background: transparent;
  transition: background 0.2s, transform 0.15s;
}

.thread-connection-chip:hover {
  background: rgba(154, 122, 46, 0.08);
  transform: translateY(-1px);
}

/* ---------- Thread Timeline ---------- */
.thread-timeline {
  position: relative;
  padding-left: 0;
}

.thread-stop {
  display: flex;
  gap: 16px;
  position: relative;
  padding-bottom: 24px;
}

.thread-stop:last-child {
  padding-bottom: 0;
}

.thread-stop-line {
  width: 2px;
  position: relative;
  flex-shrink: 0;
  margin-left: 5px;
  min-height: 100%;
}

.thread-stop-content {
  flex: 1;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

.thread-stop-era {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 6px;
}

.thread-stop-title {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 6px;
}

.thread-stop-content .scripture-ref {
  margin-bottom: 8px;
}

.thread-stop-narrative {
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.7;
  margin-top: 8px;
}

/* ---------- Thread Responsive ---------- */
@media (max-width: 992px) {
  .thread-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
}

@media (max-width: 576px) {
  .thread-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .thread-card {
    padding: 16px;
  }
  .thread-card-title {
    font-size: 0.92rem;
  }
  .thread-stop {
    gap: 10px;
  }
  .thread-stop-content {
    padding: 12px;
  }
}

/* ---------- Thread Dark Mode ---------- */
[data-theme="dark"] .thread-card {
  background-color: var(--card-bg);
  border-color: var(--border);
}

[data-theme="dark"] .thread-card:hover {
  border-color: var(--secondary);
  box-shadow: 0 4px 20px var(--glow);
}

[data-theme="dark"] .thread-stop-content {
  background: var(--card-bg);
  border-color: var(--border);
}

[data-theme="dark"] .thread-header {
  background: var(--card-bg);
  border-color: var(--border);
}

[data-theme="dark"] .thread-connection-chip:hover {
  background: rgba(184, 145, 58, 0.12);
}

/* ============================================================================
   Character Arcs
   ============================================================================ */

/* ---------- Arc Grid ---------- */
.arc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}

.arc-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s;
}

.arc-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 30px rgba(60, 40, 20, 0.12), 0 0 0 1px var(--secondary);
  border-color: var(--secondary);
}

.arc-card:active {
  transform: translateY(-2px) scale(0.99);
}

.arc-card-icon {
  font-size: 1.4rem;
}

.arc-card-name {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}

.arc-card-subtitle {
  font-size: 0.8rem;
  color: var(--secondary);
  font-style: italic;
  margin-top: 2px;
}

.arc-card-summary {
  font-size: 0.85rem;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
}

/* ---------- Arc Detail ---------- */
.arc-detail {
  animation: fadeIn 0.3s ease-out;
}

.arc-header {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
}

/* ---------- Arc Timeline ---------- */
.arc-timeline {
  position: relative;
  padding-left: 0;
}

.arc-phase {
  display: flex;
  gap: 16px;
  position: relative;
  padding-bottom: 24px;
}

.arc-phase:last-child {
  padding-bottom: 0;
}

.arc-line {
  width: 2px;
  position: relative;
  flex-shrink: 0;
  margin-left: 5px;
  min-height: 100%;
}

.arc-phase-content {
  flex: 1;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  transition: box-shadow 0.2s;
}

/* Turning point highlight */
.arc-phase-turning .arc-phase-content {
  border-color: var(--secondary);
  box-shadow: 0 0 12px rgba(184, 145, 58, 0.15), inset 0 0 0 1px rgba(184, 145, 58, 0.1);
}

.arc-phase-era {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #fff;
}

.arc-phase-title {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 6px;
}

/* Trait chip */
.arc-trait {
  display: inline-block;
  padding: 3px 10px;
  border: 1px solid;
  border-radius: 14px;
  font-size: 0.76rem;
  font-style: italic;
  margin-bottom: 8px;
}

.arc-phase-content .scripture-ref {
  margin-bottom: 8px;
}

.arc-phase-narrative {
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.7;
  margin-top: 8px;
}

/* ---------- Reflection Callout ---------- */
.arc-reflection {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-left: 4px solid var(--secondary);
  border-radius: 10px;
  padding: 20px;
  margin-top: 24px;
}

/* ---------- Arc Responsive ---------- */
@media (max-width: 992px) {
  .arc-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  }
}

@media (max-width: 576px) {
  .arc-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .arc-card {
    padding: 16px;
  }
  .arc-card-name {
    font-size: 0.92rem;
  }
  .arc-phase {
    gap: 10px;
  }
  .arc-phase-content {
    padding: 12px;
  }
}

/* ---------- Arc Dark Mode ---------- */
[data-theme="dark"] .arc-card {
  background-color: var(--card-bg);
  border-color: var(--border);
}

[data-theme="dark"] .arc-card:hover {
  border-color: var(--secondary);
  box-shadow: 0 4px 20px var(--glow);
}

[data-theme="dark"] .arc-phase-content {
  background: var(--card-bg);
  border-color: var(--border);
}

[data-theme="dark"] .arc-phase-turning .arc-phase-content {
  border-color: var(--secondary);
  box-shadow: 0 0 16px rgba(184, 145, 58, 0.2), inset 0 0 0 1px rgba(184, 145, 58, 0.15);
}

[data-theme="dark"] .arc-header {
  background: var(--card-bg);
  border-color: var(--border);
}

[data-theme="dark"] .arc-reflection {
  background: var(--card-bg);
  border-color: var(--border);
  border-left-color: var(--secondary);
}

/* ============================================================================
   MOBILE PHASES 1–5 (April 2026)
   Phase 1: Bottom nav · Phase 2: Scrollable hamburger · Phase 3: Journey
   controls · Phase 4: Temporal slider full-row · Phase 5: Drag handle
   ============================================================================ */

/* ── Phase 1: Mobile Bottom Navigation ──────────────────────────────────── */

.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1100;
  background: #2c2520;
  border-top: 2px solid rgba(184, 145, 58, 0.45);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.35);
}

@media (max-width: 768px) {
  .mobile-bottom-nav {
    display: flex;
    align-items: stretch;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .mobile-bottom-nav::-webkit-scrollbar { display: none; }
  /* Push page content above the bottom nav */
  .tab-content {
    padding-bottom: calc(62px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

.mobile-nav-btn {
  flex: 0 0 auto;
  min-width: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 6px 10px;
  background: none;
  border: none;
  border-top: 2px solid transparent;
  color: rgba(197, 186, 168, 0.55);
  font-family: 'Cinzel', serif;
  font-size: 0.62rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  min-height: 54px;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.mobile-nav-btn i {
  font-size: 1.2rem;
  transition: transform 0.15s;
  line-height: 1;
}

.mobile-nav-btn span {
  line-height: 1;
  display: block;
}

.mobile-nav-btn.active {
  color: #c9a84c;
  border-top-color: #c9a84c;
}

.mobile-nav-btn.active i {
  transform: translateY(-1px);
}

.mobile-nav-btn:active i {
  transform: scale(0.88);
}

[data-theme="dark"] .mobile-bottom-nav {
  background: #14110e;
  border-top-color: rgba(201, 168, 76, 0.35);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.6);
}

/* ── Phase 2: Scrollable navbar hamburger collapse ───────────────────────── */

@media (max-width: 991.98px) {
  .navbar-collapse.show,
  .navbar-collapse.collapsing {
    max-height: calc(80dvh - 56px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(184, 145, 58, 0.4) transparent;
  }
  .navbar-collapse.show::-webkit-scrollbar {
    width: 4px;
  }
  .navbar-collapse.show::-webkit-scrollbar-track {
    background: transparent;
  }
  .navbar-collapse.show::-webkit-scrollbar-thumb {
    background: rgba(184, 145, 58, 0.4);
    border-radius: 2px;
  }
}

/* ── Phase 3: Journey controls row — prev / speed / play / next ──────────── */

.journey-controls-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.journey-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.82rem;
  transition: all 0.15s;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.journey-nav-btn:hover {
  border-color: var(--secondary);
  color: var(--secondary);
  background: rgba(184, 145, 58, 0.1);
}

.journey-nav-btn:active {
  transform: scale(0.9);
}

[data-theme="dark"] .journey-nav-btn {
  border-color: var(--border);
  color: var(--text-muted);
}

[data-theme="dark"] .journey-nav-btn:hover {
  background: rgba(201, 168, 76, 0.12);
  border-color: var(--secondary);
  color: var(--secondary);
}

@media (max-width: 768px) {
  .journey-controls-row {
    justify-content: center;
    gap: 10px;
    padding: 10px 16px;
    margin-top: 0;
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    /* Pull out of parent padding so bg spans full width */
    margin-left: -20px;
    margin-right: -20px;
  }

  .journey-nav-btn {
    width: 44px;
    height: 44px;
    font-size: 1rem;
  }

  .speed-select {
    max-width: 96px;
    font-size: 0.78rem;
  }

  .play-btn {
    flex: 0 0 auto;
  }
}

[data-theme="dark"] .journey-controls-row {
  background: var(--card-bg);
  border-bottom-color: var(--border);
}

/* ── Phase 4: Map filter bar — temporal slider breaks to its own full row ─── */

@media (max-width: 768px) {
  .filter-bar {
    flex-wrap: wrap !important;
  }

  .temporal-slider-container {
    order: 999;
    flex: 0 0 100% !important;
    width: 100% !important;
    min-width: 0 !important;
    border-top: 1px solid var(--border);
    padding-top: 6px;
    margin-top: 4px;
  }

  .temporal-slider-row {
    width: 100%;
    gap: 6px;
  }

  /* Give the ion range slider full width on mobile */
  .temporal-slider-row .shiny-input-container {
    flex: 1 1 0%;
    min-width: 0;
  }
}

/* ── Phase 5: Map detail panel drag handle (shows content is scrollable) ─── */

@media (max-width: 768px) {
  .detail-panel {
    border-radius: 16px 16px 0 0 !important;
  }

  .detail-panel::before {
    content: '';
    display: block;
    width: 38px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 10px auto 2px;
    opacity: 0.9;
    flex-shrink: 0;
  }
}

[data-theme="dark"] .detail-panel::before {
  background: rgba(255, 255, 255, 0.15);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Summit Landing Page — Atmospheric Hero + Journey Cards
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Hero banner — warm parchment, Peaky Blinders vine ───────────────────── */
.summit-hero {
  margin: -1rem -1rem 0;
  padding: 3.2rem 2rem 2.8rem;
  background:
    radial-gradient(ellipse at 18% 70%, rgba(155, 85, 15, 0.18) 0%, transparent 50%),
    radial-gradient(ellipse at 82% 25%, rgba(95, 20, 25, 0.14) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 110%, rgba(175, 125, 45, 0.12) 0%, transparent 40%),
    linear-gradient(158deg, #f6ecda 0%, #ede0be 42%, #f3e7cd 100%);
  position: relative;
  overflow: hidden;
  border-bottom: 2px solid #c9a84c;
  border-top: none;
}
/* Parchment grain */
.summit-hero::before {
  content: '';
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.055'/%3E%3C/svg%3E");
  pointer-events: none;
}
/* Compass-rose watermark — warm amber against parchment */
.summit-hero::after {
  content: '\2742';
  position: absolute;
  right: 5%;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10rem;
  color: rgba(170, 115, 35, 0.09);
  font-family: sans-serif;
  pointer-events: none;
  user-select: none;
}
.summit-hero-inner {
  position: relative;
  z-index: 1;
  max-width: 700px;
}
.summit-hero-wordmark {
  font-family: 'Cinzel', 'Palatino Linotype', serif;
  font-size: 2.8rem;
  font-weight: 700;
  color: #1c0e06;
  letter-spacing: 0.1em;
  line-height: 1;
  margin-bottom: 0.7rem;
  text-shadow: 0 1px 4px rgba(170, 115, 30, 0.22);
}
.summit-hero-tagline {
  font-family: 'Libre Baskerville', 'Georgia', serif;
  font-style: italic;
  font-size: 1.05rem;
  color: #4a2c10;
  line-height: 1.5;
  margin-bottom: 1.25rem;
  max-width: 480px;
}
.summit-hero-scope {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  font-size: 0.72rem;
  color: #7a5030;
  margin-bottom: 1.6rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 600;
  padding-top: 0.7rem;
  border-top: 1px solid rgba(175, 115, 35, 0.25);
}
.summit-hero-scope span {
  display: flex;
  align-items: center;
  gap: 4px;
}
.summit-hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.summit-hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 22px;
  border-radius: 24px;
  border: none;
  background: linear-gradient(135deg, #7c2030, #5c1520);
  color: #f6ecda;
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background 0.18s, transform 0.1s, box-shadow 0.18s;
  box-shadow: 0 3px 14px rgba(100, 20, 30, 0.28);
}
.summit-hero-cta:hover {
  background: linear-gradient(135deg, #9c2838, #7c2030);
  transform: translateY(-1px);
  box-shadow: 0 5px 20px rgba(100, 20, 30, 0.38);
}
.summit-hero-ghost {
  display: inline-flex;
  align-items: center;
  padding: 10px 18px;
  border-radius: 24px;
  border: 1.5px solid rgba(100, 50, 10, 0.32);
  background: transparent;
  color: #5c3010;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.summit-hero-ghost:hover {
  border-color: #7c2030;
  color: #7c2030;
  background: rgba(100, 20, 30, 0.06);
}

/* Dark mode — keep atmospheric dark for dark-mode users */
[data-theme="dark"] .summit-hero {
  background:
    radial-gradient(ellipse at 25% 0%,  rgba(30,58,110,0.45) 0%,  transparent 55%),
    radial-gradient(ellipse at 80% 90%, rgba(139,26,26,0.30) 0%,  transparent 50%),
    radial-gradient(ellipse at 55% 10%, rgba(184,145,58,0.28) 0%,  transparent 55%),
    linear-gradient(170deg, #0c1624 0%, #1a1208 45%, #251a0c 100%);
  border-bottom-color: rgba(184,145,58,0.22);
}
[data-theme="dark"] .summit-hero::before { background-image: none; }
[data-theme="dark"] .summit-hero::after  { color: rgba(184,145,58,0.06); }
[data-theme="dark"] .summit-hero-wordmark {
  color: #c9a84c;
  text-shadow: 0 0 40px rgba(201,168,76,0.35);
}
[data-theme="dark"] .summit-hero-tagline { color: #d4c9b0; }
[data-theme="dark"] .summit-hero-scope   {
  color: #9a8e72;
  border-top-color: rgba(255,255,255,0.08);
}
[data-theme="dark"] .summit-hero-scope span { color: #9a8472; }
[data-theme="dark"] .summit-hero-cta {
  background: linear-gradient(135deg, #b8913a, #9a7730);
  color: #1a1208;
  box-shadow: 0 3px 14px rgba(184,145,58,0.3);
}
[data-theme="dark"] .summit-hero-cta:hover {
  background: linear-gradient(135deg, #c9a84c, #b8913a);
  box-shadow: 0 5px 20px rgba(201,168,76,0.4);
}
[data-theme="dark"] .summit-hero-ghost {
  border-color: rgba(184,145,58,0.4);
  color: #c9a84c;
}
[data-theme="dark"] .summit-hero-ghost:hover {
  border-color: rgba(184,145,58,0.7);
  background: rgba(184,145,58,0.08);
  color: #c9a84c;
}

/* ── Section head ──────────────────────────────────────────────────────────── */
.sjc-section {
  padding: 0 4px;
}
.sjc-section-head {
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary, #1e3a6e);
  padding: 1.4rem 0 0.75rem;
  display: flex;
  align-items: center;
  gap: 7px;
  border-top: 1px solid rgba(184,145,58,0.12);
  margin-top: 0.5rem;
}

/* ── Journey cards grid ────────────────────────────────────────────────────── */
.sjc-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding-bottom: 1.5rem;
}
.sjc {
  border-radius: 8px;
  border: 1px solid var(--border, #c2ab88);
  box-shadow: 0 2px 8px var(--shadow);
  background: var(--bs-body-bg, #faf7f0);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  display: flex;
  flex-direction: column;
}
.sjc:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
  border-color: var(--jcolor, #b8913a);
}
.sjc-bar {
  height: 7px;
  background: var(--jcolor, #b8913a);
  flex-shrink: 0;
  border-radius: 8px 8px 0 0;
}
.sjc-body {
  padding: 13px 14px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.sjc-badge {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--jcolor, #b8913a);
  margin-bottom: 6px;
}
.sjc-name {
  font-family: 'Cinzel', serif;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--primary, #1e3a6e);
  line-height: 1.25;
  margin-bottom: 3px;
}
.sjc-person {
  font-size: 0.7rem;
  color: var(--text-muted, #9a8e72);
  margin-bottom: 7px;
  display: flex;
  align-items: center;
  gap: 3px;
}
.sjc-hook {
  font-size: 0.76rem;
  color: var(--text, #3a3028);
  line-height: 1.45;
  margin: 0 0 auto;
  padding-bottom: 10px;
  /* two-line clamp */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sjc-stats {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.68rem;
  color: var(--text-muted, #9a8e72);
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid rgba(0,0,0,0.06);
}
.sjc-sep { opacity: 0.4; }

/* Featured: full-width, taller, hook not clamped */
.sjc-featured {
  grid-column: 1 / -1;
}
.sjc-featured .sjc-bar { height: 10px; }
.sjc-featured .sjc-body { padding: 18px 20px 16px; }
.sjc-featured .sjc-name { font-size: 1.15rem; margin-bottom: 5px; }
.sjc-featured .sjc-hook {
  -webkit-line-clamp: unset;
  overflow: visible;
  font-size: 0.83rem;
}

/* Dark mode */
[data-theme="dark"] .sjc {
  background: #1a1208;
  border-color: rgba(255,255,255,0.1);
}
[data-theme="dark"] .sjc:hover {
  border-color: var(--jcolor, #b8913a);
  box-shadow: 0 6px 24px rgba(0,0,0,0.45);
}
[data-theme="dark"] .sjc-name { color: #e8dcc8; }
[data-theme="dark"] .sjc-hook { color: #c4b89a; }
[data-theme="dark"] .sjc-stats { border-top-color: rgba(255,255,255,0.08); }

/* Responsive: 2 columns on tablet, 1 on phone */
@media (max-width: 768px) {
  .summit-hero { padding: 2.2rem 1.25rem 2rem; margin: -1rem -0.75rem 0; }
  .summit-hero-wordmark { font-size: 2rem; }
  .summit-hero-tagline { font-size: 0.92rem; }
  .summit-hero::after { display: none; }
  .sjc-grid { grid-template-columns: repeat(2, 1fr); }
  .sjc-featured { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
  .sjc-grid { grid-template-columns: 1fr; }
}

/* ============================================================================
   Study Paths — on-ramp cards on Journeys landing
   ============================================================================ */
.sp-section {
  max-width: 960px;
  margin: 0 auto 0.5rem;
  padding: 1.2rem 1rem 0.5rem;
}
.sp-section-head {
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted, #9a8e72);
  margin-bottom: 0.8rem;
  display: flex;
  align-items: center;
  gap: 6px;
}
.sp-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.65rem;
}
.sp-card {
  background: var(--card-bg, #faf7f0);
  border: 1px solid var(--border, #d4c9b8);
  border-top: 3px solid var(--spcolor, #b8913a);
  border-radius: 8px;
  padding: 14px 14px 12px;
  cursor: pointer;
  transition: box-shadow 0.18s, transform 0.18s, border-color 0.18s;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sp-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  transform: translateY(-2px);
  border-color: var(--spcolor, #b8913a);
}
.sp-icon {
  font-size: 1.25rem;
  color: var(--spcolor, #b8913a);
  margin-bottom: 2px;
}
.sp-label {
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary, #1e3a6e);
  line-height: 1.25;
}
.sp-desc {
  font-size: 0.72rem;
  color: var(--text-muted, #9a8e72);
  line-height: 1.45;
  margin: 0;
}

/* Dark mode */
[data-theme="dark"] .sp-card {
  background: #1a1208;
  border-color: rgba(255,255,255,0.08);
}
[data-theme="dark"] .sp-card:hover {
  border-color: var(--spcolor, #b8913a);
  box-shadow: 0 4px 18px rgba(0,0,0,0.4);
}
[data-theme="dark"] .sp-label { color: #e8dcc8; }
[data-theme="dark"] .sp-desc  { color: #9a8472; }

/* Responsive */
@media (max-width: 768px) {
  .sp-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .sp-grid { grid-template-columns: 1fr; }
}

/* ============================================================================
   Global Book Filter — navbar selectInput
   ============================================================================ */
.global-book-filter {
  display: flex;
  align-items: center;
  gap: 5px;
}
.global-book-icon {
  color: var(--secondary, #b8913a);
  font-size: 0.75rem;
  opacity: 0.85;
  flex-shrink: 0;
}
.global-book-filter .selectize-input,
.global-book-filter .form-select,
.global-book-filter select {
  background: rgba(255,255,255,0.08) !important;
  border: 1px solid rgba(184,145,58,0.4) !important;
  color: #e8dcc8 !important;
  font-size: 0.72rem !important;
  padding: 3px 22px 3px 8px !important;
  border-radius: 5px !important;
  cursor: pointer;
  min-height: unset !important;
  height: 28px !important;
}
.global-book-filter .selectize-input.focus,
.global-book-filter select:focus {
  border-color: var(--secondary, #b8913a) !important;
  box-shadow: 0 0 0 2px rgba(184,145,58,0.2) !important;
  outline: none !important;
}
/* Hide the label shiny generates for the selectInput */
.global-book-filter label { display: none !important; }

/* ============================================================================
   Study Mega-Tab — inner navset_tab styling
   ============================================================================ */
.study-inner-tabs > .nav-tabs {
  border-bottom: 2px solid var(--border, #d4c9b8);
  background: var(--card-bg, #faf7f0);
  padding: 0 1rem;
  margin-bottom: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.study-inner-tabs > .nav-tabs::-webkit-scrollbar { display: none; }
.study-inner-tabs > .nav-tabs .nav-link {
  font-family: 'Cinzel', serif;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted, #9a8e72);
  border: none;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  padding: 10px 16px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: color 0.18s, border-color 0.18s;
}
.study-inner-tabs > .nav-tabs .nav-link:hover {
  color: var(--primary, #1e3a6e);
  border-bottom-color: rgba(184,145,58,0.35);
  background: transparent;
}
.study-inner-tabs > .nav-tabs .nav-link.active {
  color: var(--primary, #1e3a6e) !important;
  border-bottom-color: var(--secondary, #b8913a) !important;
  background: transparent !important;
  font-weight: 700;
}
.study-inner-tabs > .tab-content {
  padding: 0;
}

/* Dark mode */
[data-theme="dark"] .study-inner-tabs > .nav-tabs {
  background: #1a1208;
  border-bottom-color: rgba(255,255,255,0.1);
}
[data-theme="dark"] .study-inner-tabs > .nav-tabs .nav-link {
  color: var(--text-muted, #9a8472);
}
[data-theme="dark"] .study-inner-tabs > .nav-tabs .nav-link:hover {
  color: #e8dcc8;
  border-bottom-color: rgba(184,145,58,0.45);
}
[data-theme="dark"] .study-inner-tabs > .nav-tabs .nav-link.active {
  color: var(--secondary, #b8913a) !important;
  border-bottom-color: var(--secondary, #b8913a) !important;
}

/* ============================================================================
   Timeline — Chart / List view toggle
   ============================================================================ */
.tl-view-toggle {
  display: flex;
  gap: 0;
  padding: 0.6rem 1rem 0;
  border-bottom: 1px solid var(--border, #d4c9b8);
  background: var(--card-bg, #faf7f0);
}
.tl-view-btn {
  padding: 6px 18px;
  border: 1px solid var(--border, #d4c9b8);
  background: transparent;
  color: var(--text-muted, #9a8e72);
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.tl-view-btn:first-child {
  border-radius: 6px 0 0 6px;
  border-right: none;
}
.tl-view-btn:last-child {
  border-radius: 0 6px 6px 0;
}
.tl-view-btn.active {
  background: var(--primary, #1e3a6e);
  color: #fff;
  border-color: var(--primary, #1e3a6e);
}
.tl-view-btn:hover:not(.active) {
  background: rgba(30,58,110,0.07);
  color: var(--primary, #1e3a6e);
}
.tl-chart-wrap {
  padding: 0.5rem 0.5rem 0;
  background: var(--card-bg, #faf7f0);
}
.tl-chart-wrap .js-plotly-plot {
  border-radius: 6px;
}

/* Dark mode */
[data-theme="dark"] .tl-view-toggle {
  background: #1a1208;
  border-bottom-color: rgba(255,255,255,0.1);
}
[data-theme="dark"] .tl-view-btn {
  border-color: rgba(255,255,255,0.15);
  color: #9a8472;
}
[data-theme="dark"] .tl-view-btn.active {
  background: var(--secondary, #b8913a);
  border-color: var(--secondary, #b8913a);
  color: #1a1208;
}
[data-theme="dark"] .tl-chart-wrap {
  background: #1a1208;
}

/* ============================================================================
   HOME TAB — Summit Front Door
   ============================================================================ */

/* ── Hero ─────────────────────────────────────────────────────────────────── */
.home-hero {
  min-height: 68vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(184,145,58,0.10) 0%, transparent 65%),
    var(--body-bg);
  border-bottom: 1px solid var(--border);
  padding: 3rem 1rem 2.5rem;
}

.home-hero-inner {
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

/* Brand */
.home-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 2.5rem;
  text-align: center;
}
.home-brand-logo {
  height: 52px;
  width: auto;
  margin-bottom: 0.6rem;
  filter: drop-shadow(0 2px 6px rgba(184,145,58,0.25));
}
.home-brand-title {
  font-family: 'Cinzel', serif;
  font-size: 2.8rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.06em;
  margin: 0 0 0.4rem;
  line-height: 1;
  text-shadow: 0 1px 3px rgba(30,20,10,0.12);
}
.home-brand-tagline {
  font-family: 'Libre Baskerville', serif;
  font-style: italic;
  font-size: 1.05rem;
  color: var(--text-muted);
  margin: 0;
  letter-spacing: 0.01em;
}

/* Search box */
.home-search-area {
  width: 100%;
  max-width: 560px;
  position: relative;
  margin-bottom: 0.5rem;
}
.home-search-box {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 4px 18px rgba(30,20,10,0.10), 0 1px 4px rgba(30,20,10,0.07);
  transition: box-shadow 0.2s, border-color 0.2s;
}
.home-search-box:focus-within {
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(184,145,58,0.15), 0 4px 18px rgba(30,20,10,0.12);
}
.home-search-icon {
  position: absolute;
  left: 1.1rem;
  color: var(--text-muted);
  font-size: 1rem;
  pointer-events: none;
}
.home-search-input {
  width: 100%;
  border: none !important;
  outline: none !important;
  background: transparent !important;
  padding: 0.85rem 1rem 0.85rem 2.85rem !important;
  font-family: 'Libre Baskerville', serif !important;
  font-size: 1rem !important;
  color: var(--text) !important;
  border-radius: 12px !important;
  box-shadow: none !important;
}
.home-search-input::placeholder {
  color: var(--text-muted);
  font-style: italic;
}

/* Search results panel */
.home-results-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(30,20,10,0.15);
  z-index: 200;
  overflow: hidden;
  animation: fadeIn 0.15s ease;
}
.home-result-card {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0 0.5rem;
  padding: 0.6rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid rgba(194,171,136,0.25);
  transition: background 0.12s;
  position: relative;
}
.home-result-card:last-child { border-bottom: none; }
.home-result-card:hover { background: rgba(184,145,58,0.06); }

.home-result-type {
  font-family: 'Cinzel', serif;
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 1px 6px;
  border-radius: 3px;
  flex-shrink: 0;
}
.home-result-type--place   { background: #dbeafe; color: #1e40af; }
.home-result-type--person  { background: #dcfce7; color: #166534; }
.home-result-type--event   { background: #fce7f3; color: #9d174d; }
.home-result-type--journey { background: #fef3c7; color: #92400e; }

.home-result-name {
  font-family: 'Libre Baskerville', serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}
.home-result-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
}
.home-result-desc {
  width: 100%;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-top: 1px;
  padding-right: 1.4rem;
}
.home-result-arrow {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--secondary);
  font-size: 0.85rem;
  opacity: 0.6;
  transition: opacity 0.12s, transform 0.12s;
}
.home-result-card:hover .home-result-arrow {
  opacity: 1;
  transform: translateY(-50%) translateX(3px);
}
.home-result-empty {
  padding: 0.85rem 1rem;
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
}

/* Sparks divider */
.home-sparks-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.7rem;
  font-family: 'Cinzel', serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 1.5rem 0 0.9rem;
  width: 100%;
  max-width: 560px;
}
.home-sparks-line {
  flex: 1;
  height: 1px;
  background: var(--border);
  display: block;
}

/* Spark chips */
.home-sparks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  max-width: 560px;
  width: 100%;
}
.home-spark {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.38rem 0.75rem 0.38rem 0.6rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: 'Libre Baskerville', serif;
  font-size: 0.78rem;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.12s;
  white-space: nowrap;
}
.home-spark:hover {
  background: rgba(184,145,58,0.08);
  border-color: var(--secondary);
  box-shadow: 0 2px 8px rgba(184,145,58,0.12);
  transform: translateY(-1px);
}
.home-spark:active { transform: translateY(0); }
.home-spark-icon {
  font-size: 0.7rem;
  opacity: 0.7;
}
.home-spark--journey .home-spark-icon { color: #92400e; }
.home-spark--place   .home-spark-icon { color: #1e3a6e; }
.home-spark--person  .home-spark-icon { color: #166534; }
.home-spark--arc     .home-spark-icon { color: #6d28d9; }
.home-spark--shadow  .home-spark-icon { color: #9d174d; }
.home-spark--thread  .home-spark-icon { color: #b8913a; }
.home-spark-label {
  font-size: 0.78rem;
}
.home-spark-arrow {
  font-size: 0.65rem;
  color: var(--secondary);
  opacity: 0;
  margin-left: 1px;
  transition: opacity 0.12s, transform 0.12s;
}
.home-spark:hover .home-spark-arrow {
  opacity: 1;
  transform: translateX(2px);
}

/* ── Stats strip ──────────────────────────────────────────────────────────── */
.home-stats-strip {
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 1.5rem;
}
.home-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0;
  max-width: 760px;
  margin: 0 auto;
}
.home-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.35rem 1.4rem;
  border-right: 1px solid var(--border);
}
.home-stat:last-child { border-right: none; }
.home-stat-n {
  font-family: 'Cinzel', serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--secondary);
  line-height: 1.1;
}
.home-stat-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-family: 'Cinzel', serif;
  margin-top: 1px;
}

/* ── Summit Originals — Pillar 4 ─────────────────────────────────────────── */
.home-originals {
  max-width: 900px;
  margin: 2.5rem auto 0;
  padding: 0 1.5rem;
}
.home-originals-hdr {
  text-align: center;
  margin-bottom: 2rem;
}
.home-originals-eyebrow {
  font-family: 'Cinzel', serif;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--secondary);
  display: block;
  margin-bottom: 0.4rem;
}
.home-originals-title {
  font-family: 'Cinzel', serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

/* Each original block: two columns — text left, preview right */
.home-original-block {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 1.25rem;
  box-shadow: 0 2px 12px var(--shadow);
  transition: box-shadow 0.18s;
}
.home-original-block:hover { box-shadow: 0 6px 28px var(--shadow); }

.home-original-text {
  padding: 1.6rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  border-right: 1px solid var(--border);
}
.home-original-badge {
  font-family: 'Cinzel', serif;
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  padding: 2px 8px;
  border-radius: 3px;
  display: inline-block;
  align-self: flex-start;
}
.home-original--journey .home-original-badge { background: #fef3c7; color: #92400e; }
.home-original--shadows .home-original-badge { background: #fce7f3; color: #9d174d; }
.home-original--map     .home-original-badge { background: #dbeafe; color: #1e40af; }

.home-original-name {
  font-family: 'Cinzel', serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  line-height: 1.35;
}
.home-original-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.65;
  flex: 1;
  margin: 0;
}
.home-original-btn {
  align-self: flex-start;
  background: none;
  border: 1px solid var(--secondary);
  color: var(--secondary);
  font-family: 'Libre Baskerville', serif;
  font-size: 0.76rem;
  padding: 0.3rem 0.8rem;
  border-radius: 5px;
  cursor: pointer;
  margin-top: 0.3rem;
  transition: background 0.15s, color 0.15s;
}
.home-original-btn:hover { background: var(--secondary); color: #fff; }

/* Preview column */
.home-original-preview {
  padding: 1.4rem 1.25rem;
  background: rgba(0,0,0,0.02);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Journey preview ── */
.journey-preview { width: 100%; }
.journey-preview-label {
  font-family: 'Cinzel', serif;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #92400e;
  margin-bottom: 0.85rem;
}
.journey-preview-route {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
}
.jp-stop {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.18rem 0;
  position: relative;
}
.jp-stop::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 0;
  bottom: 0;
  width: 1.5px;
  background: rgba(184,145,58,0.25);
}
.jp-stop:first-child::before { top: 50%; }
.jp-stop:last-child::before  { bottom: 50%; }
.jp-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid var(--secondary);
  background: var(--card-bg);
  flex-shrink: 0;
  z-index: 1;
  transition: background 0.15s;
}
.jp-stop:first-child .jp-dot { background: var(--secondary); }
.jp-name {
  font-size: 0.73rem;
  color: var(--text);
  font-family: 'Libre Baskerville', serif;
}

/* ── Shadow preview ── */
.shadow-preview { width: 100%; }
.shadow-preview-hdr {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.sp-ot {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: #92400e;
  white-space: nowrap;
}
.sp-nt {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
}
.sp-arrow-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  min-width: 0;
}
.sp-line {
  flex: 1;
  height: 1.5px;
  background: linear-gradient(to right, #92400e, var(--primary));
  display: block;
}
.sp-arrow-head {
  color: var(--primary);
  font-size: 0.9rem;
  line-height: 1;
}
.sp-row {
  display: grid;
  grid-template-columns: 1fr 12px 1fr;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0;
  border-bottom: 1px solid rgba(194,171,136,0.2);
}
.sp-row:last-child { border-bottom: none; }
.sp-ot-val {
  font-size: 0.66rem;
  color: #7c4a1e;
  line-height: 1.35;
  font-style: italic;
}
.sp-nt-val {
  font-size: 0.66rem;
  color: #1e3a6e;
  line-height: 1.35;
  font-style: italic;
}
.sp-connector {
  display: block;
  width: 1px;
  height: 100%;
  background: var(--border);
  margin: 0 auto;
}

/* ── Era preview ── */
.era-preview { width: 100%; }
.era-preview-range {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: 'Cinzel', serif;
  font-size: 0.6rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  letter-spacing: 0.03em;
}
.era-range-dash {
  flex: 1;
  height: 1px;
  background: var(--border);
  margin: 0 0.5rem;
  display: block;
}
.era-preview-bar {
  display: flex;
  height: 34px;
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 0.65rem;
  border: 1px solid var(--border);
}
.era-seg {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border-right: 1px solid rgba(255,255,255,0.2);
}
.era-seg:last-child { border-right: none; }
.era-seg span {
  font-size: 0.48rem;
  font-family: 'Cinzel', serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: rgba(255,255,255,0.85);
  white-space: nowrap;
  writing-mode: horizontal-tb;
}
.era-s1 { background: #795548; }
.era-s2 { background: #b8913a; }
.era-s3 { background: #e65100; }
.era-s4 { background: #2e7d32; }
.era-s5 { background: #6a1b9a; }
.era-s6 { background: #1565c0; }

.era-preview-facts {
  display: flex;
  gap: 0.75rem;
  font-size: 0.65rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.era-preview-facts span {
  display: flex;
  align-items: center;
  gap: 3px;
}

/* dark mode */
[data-theme="dark"] .home-original-block  { background: #2a1f14; }
[data-theme="dark"] .home-original-preview { background: rgba(0,0,0,0.15); }
[data-theme="dark"] .home-original--journey .home-original-badge { background: #451a03; color: #fde68a; }
[data-theme="dark"] .home-original--shadows .home-original-badge { background: #500724; color: #fbcfe8; }
[data-theme="dark"] .home-original--map     .home-original-badge { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .sp-ot-val { color: #fde68a; }
[data-theme="dark"] .sp-nt-val { color: #93c5fd; }

/* Responsive */
@media (max-width: 680px) {
  .home-original-block { grid-template-columns: 1fr; }
  .home-original-text  { border-right: none; border-bottom: 1px solid var(--border); }
}

/* ── Today in Biblical History ────────────────────────────────────────────── */
.home-today-wrap {
  max-width: 760px;
  margin: 2.5rem auto 0;
  padding: 0 1.5rem;
}
.home-today {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-left: 4px solid var(--secondary);
  border-radius: 8px;
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  box-shadow: 0 2px 10px var(--shadow);
  animation: fadeIn 0.3s ease;
}
.home-today-eyebrow {
  font-family: 'Cinzel', serif;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--secondary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.home-today-icon { font-size: 0.75rem; }
.home-today-body { display: flex; flex-direction: column; gap: 0.15rem; }
.home-today-date {
  font-size: 0.7rem;
  font-family: 'Cinzel', serif;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}
.home-today-name {
  font-family: 'Libre Baskerville', serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
}
.home-today-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-top: 0.2rem;
}
.home-today-ref {
  font-size: 0.72rem;
  font-style: italic;
  color: var(--primary);
  margin-top: 0.1rem;
}
.home-today-btn {
  align-self: flex-start;
  background: none;
  border: 1px solid var(--secondary);
  color: var(--secondary);
  font-family: 'Libre Baskerville', serif;
  font-size: 0.76rem;
  padding: 0.3rem 0.75rem;
  border-radius: 5px;
  cursor: pointer;
  margin-top: 0.4rem;
  transition: background 0.15s, color 0.15s;
}
.home-today-btn:hover {
  background: var(--secondary);
  color: #fff;
}

/* ── Feature cards ────────────────────────────────────────────────────────── */
.home-features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  max-width: 900px;
  margin: 2.5rem auto 3rem;
  padding: 0 1.5rem;
}
.home-feature-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  box-shadow: 0 2px 10px var(--shadow);
  transition: box-shadow 0.18s, transform 0.18s;
}
.home-feature-card:hover {
  box-shadow: 0 6px 24px var(--shadow);
  transform: translateY(-3px);
}
.home-feature-icon {
  font-size: 1.4rem;
  margin-bottom: 0.15rem;
}
.home-feature--journeys .home-feature-icon { color: #92400e; }
.home-feature--shadows  .home-feature-icon { color: #9d174d; }
.home-feature--map      .home-feature-icon { color: var(--primary); }

.home-feature-title {
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  line-height: 1.3;
}
.home-feature-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.6;
  flex: 1;
  margin: 0;
}
.home-feature-btn {
  align-self: flex-start;
  background: none;
  border: 1px solid var(--secondary);
  color: var(--secondary);
  font-family: 'Libre Baskerville', serif;
  font-size: 0.76rem;
  padding: 0.3rem 0.75rem;
  border-radius: 5px;
  cursor: pointer;
  margin-top: 0.2rem;
  transition: background 0.15s, color 0.15s;
}
.home-feature-btn:hover {
  background: var(--secondary);
  color: #fff;
}

/* Verse result type */
.home-result-type--verse {
  background: #f3e8ff;
  color: #6b21a8;
}
[data-theme="dark"] .home-result-type--verse { background: #3b0764; color: #d8b4fe; }

/* ── Scripture modal — Connected section ─────────────────────────────────── */
.scripture-connected {
  border-top: 1px solid var(--border);
  padding: 0.85rem 1.1rem 0.9rem;
  background: rgba(184,145,58,0.04);
}
.scripture-connected-label {
  font-family: 'Cinzel', serif;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.55rem;
}
.scripture-connected-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.sc-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-family: 'Libre Baskerville', serif;
  cursor: pointer;
  border: 1px solid transparent;
  transition: filter 0.13s, transform 0.12s;
}
.sc-chip:hover { filter: brightness(0.88); transform: translateY(-1px); }
.sc-chip--place   { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }
.sc-chip--person  { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.sc-chip--event   { background: #fce7f3; color: #9d174d; border-color: #fbcfe8; }
.sc-chip--journey { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.sc-chip--thread_title { background: #ede9fe; color: #5b21b6; border-color: #ddd6fe; }

[data-theme="dark"] .sc-chip--place   { background: #1e3a5f; color: #93c5fd; border-color: #1e40af; }
[data-theme="dark"] .sc-chip--person  { background: #14532d; color: #86efac; border-color: #166534; }
[data-theme="dark"] .sc-chip--event   { background: #500724; color: #fbcfe8; border-color: #9d174d; }
[data-theme="dark"] .sc-chip--journey { background: #451a03; color: #fde68a; border-color: #92400e; }
[data-theme="dark"] .sc-chip--thread_title { background: #2e1065; color: #ddd6fe; border-color: #5b21b6; }

/* ── Dark mode overrides ──────────────────────────────────────────────────── */
[data-theme="dark"] .home-hero {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(184,145,58,0.08) 0%, transparent 65%),
    #1a1208;
}
[data-theme="dark"] .home-result-type--place   { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .home-result-type--person  { background: #14532d; color: #86efac; }
[data-theme="dark"] .home-result-type--event   { background: #500724; color: #fbcfe8; }
[data-theme="dark"] .home-result-type--journey { background: #451a03; color: #fde68a; }
[data-theme="dark"] .home-search-box {
  background: #2a1f14;
  border-color: #4a3828;
}
[data-theme="dark"] .home-search-box:focus-within {
  border-color: var(--secondary);
}
[data-theme="dark"] .home-results-panel {
  background: #2a1f14;
  border-color: #4a3828;
}
[data-theme="dark"] .home-result-card:hover { background: rgba(184,145,58,0.08); }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  .home-features {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .home-brand-title { font-size: 2.1rem; }
  .home-stats { gap: 0; }
  .home-stat { padding: 0.3rem 0.9rem; }
  .home-stat-n { font-size: 1.1rem; }
}
@media (max-width: 480px) {
  .home-hero { padding: 2rem 1rem 1.5rem; }
  .home-spark { font-size: 0.72rem; padding: 0.32rem 0.65rem 0.32rem 0.55rem; }
  .home-brand-tagline { font-size: 0.9rem; }
}

/* ============================================================
   PILLAR 5 — PERSONALIZATION
   Bookmark buttons · History / Starred panels · Notes
   ============================================================ */

/* ── Bookmark star button (on person + journey profile headers) ─────────── */
.bm-btn {
  background: none;
  border: 1.5px solid transparent;
  color: var(--text-muted);
  font-size: 1.05rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease, transform 0.13s ease;
  flex-shrink: 0;
}
.bm-btn:hover {
  color: var(--secondary);
  border-color: var(--secondary);
  background: rgba(184,145,58,0.07);
  transform: scale(1.1);
}
.bm-btn--active {
  color: var(--secondary) !important;
  border-color: rgba(184,145,58,0.4) !important;
  background: rgba(184,145,58,0.1) !important;
}
[data-theme="dark"] .bm-btn { color: #8a7a68; }
[data-theme="dark"] .bm-btn:hover,
[data-theme="dark"] .bm-btn--active { color: var(--secondary); }

/* ── Persist section on Home ────────────────────────────────────────────── */
.home-persist-section {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
}
.home-persist-hdr {
  text-align: center;
  padding: 2.5rem 0 1.5rem;
  border-top: 1px solid var(--border);
  margin-bottom: 0.5rem;
}
.home-persist-title {
  font-family: 'Cinzel', 'Garamond', serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.04em;
  margin: 0 0 0.4rem;
}
.home-persist-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0;
  font-style: italic;
}
.home-persist-panels {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Empty state inside panels */
.persist-panel--empty {
  opacity: 0.75;
}
.persist-empty-state {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 18px 16px;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.5;
  font-style: italic;
}
.persist-empty-icon {
  font-size: 1rem;
  opacity: 0.4;
  flex-shrink: 0;
  margin-top: 2px;
}

/* ── Persist panel (shared: history + bookmarks) ───────────────────────── */
.persist-panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 6px rgba(0,0,0,0.05);
}

.persist-panel-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border, #e0d8cc);
}
[data-theme="dark"] .persist-panel-hdr { border-color: var(--border, #3a3530); }

.persist-panel-title {
  font-family: 'Cinzel', 'Garamond', serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--secondary, #b8913a);
  display: flex;
  align-items: center;
  gap: 7px;
}
.persist-panel-title .fa {
  font-size: 0.75rem;
  opacity: 0.85;
}

.persist-clear-btn {
  background: none;
  border: none;
  color: var(--text-muted, #94a3b8);
  font-size: 0.65rem;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.15s;
}
.persist-clear-btn:hover { color: var(--text); }
[data-theme="dark"] .persist-clear-btn:hover { color: var(--text); }

.persist-items {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 12px 16px 14px;
}

/* ── Individual persist item ───────────────────────────────────────────── */
.persist-item {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--body-bg, #f5f0e8);
  border: 1px solid var(--border, #e0d8cc);
  border-radius: 8px;
  padding: 8px 10px 8px 8px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.18s, background 0.18s, transform 0.12s;
  min-width: 140px;
  max-width: 200px;
  position: relative;
}
.persist-item:hover {
  border-color: var(--secondary, #b8913a);
  background: rgba(184,145,58,0.06);
  transform: translateY(-1px);
}
[data-theme="dark"] .persist-item {
  background: #1e1c18;
  border-color: var(--border);
}
[data-theme="dark"] .persist-item:hover {
  border-color: var(--secondary);
  background: rgba(212,169,74,0.08);
}

.persist-item-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  flex-shrink: 0;
}
.persist-item-icon--person  { background: rgba(100,180,100,0.15); color: #5aaa5a; }
.persist-item-icon--place   { background: rgba(255,190,70,0.15);  color: #d4960e; }
.persist-item-icon--event   { background: rgba(100,160,240,0.15); color: #4a90d8; }
.persist-item-icon--journey { background: rgba(230,130,80,0.15);  color: #d46a30; }
.persist-item-icon--thread  { background: rgba(180,100,220,0.15); color: #9a50cc; }
.persist-item-icon--shadow  { background: rgba(150,120,200,0.15); color: #8060b8; }
.persist-item-icon--arc     { background: rgba(80,200,200,0.15);  color: #30a8a8; }
.persist-item-icon--theme   { background: rgba(200,160,80,0.15);  color: #c09030; }

.persist-item-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}
.persist-item-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}
.persist-item-type {
  font-size: 0.65rem;
  color: var(--text-muted, #94a3b8);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}
.persist-item-arrow {
  color: var(--text-muted, #b0a898);
  font-size: 0.7rem;
  flex-shrink: 0;
  margin-left: 2px;
  opacity: 0.6;
}
.persist-item:hover .persist-item-arrow { opacity: 1; color: var(--secondary, #b8913a); }

/* Remove-bookmark (×) button inside bookmarks panel */
.persist-unbookmark {
  position: absolute;
  top: 3px;
  right: 4px;
  background: none;
  border: none;
  color: var(--text-muted, #94a3b8);
  font-size: 0.75rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
}
.persist-item:hover .persist-unbookmark { opacity: 1; }
.persist-unbookmark:hover { color: #dc2626; }

/* ── Notes textarea on profiles ─────────────────────────────────────────── */
.profile-notes-wrap {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.profile-notes-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted, #94a3b8);
  margin-bottom: 7px;
}
.profile-notes-input {
  width: 100%;
  box-sizing: border-box;
  min-height: 78px;
  background: var(--body-bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 0.8rem;
  line-height: 1.5;
  padding: 8px 10px;
  resize: vertical;
  transition: border-color 0.18s;
}
.profile-notes-input:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(184,145,58,0.12);
}
.profile-notes-input::placeholder { color: var(--text-muted); opacity: 0.65; }
[data-theme="dark"] .profile-notes-input:focus {
  box-shadow: 0 0 0 3px rgba(212,169,74,0.12);
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .persist-item { min-width: 120px; max-width: 160px; }
  .home-persist-section { padding: 0 1rem 2.5rem; }
}

/* ============================================================================
   MOBILE COMPREHENSIVE SWEEP — May 2026
   Proactive audit: touch targets, z-index layering, height cascades
   ============================================================================ */

/* ── Fix 1: @supports dvh override must not clobber stacked layout ───────── */
/* The @supports (height:100dvh) block at line ~4364 applies unconditionally,
   overriding the @media ≤992px { height:auto } rule on all modern phones.
   This anchor restores auto-height for stacked (tablet/phone) mode. */
@media (max-width: 992px) {
  .journey-layout { height: auto !important; }
}

/* ── Fix 2: Copy / share toast floats above the mobile bottom nav ────────── */
/* Default bottom:28px is hidden behind the 62px fixed bottom nav on phones. */
@media (max-width: 768px) {
  .copy-toast {
    bottom: calc(68px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

/* ── Fix 3: Story card minimize button — 44px tap target ────────────────── */
/* Current padding:2px 6px → effective ~10px hit area. Untappable on mobile. */
@media (max-width: 767.98px) {
  .story-card-minimize {
    width: 44px !important;
    height: 44px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    top: 0 !important;
    right: 0 !important;
  }
}

/* ── Fix 4: Scripture modal close / copy buttons — 44px tap targets ──────── */
@media (max-width: 767.98px) {
  .scripture-modal-close {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
  }
  .scripture-modal-copy {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
  }
  /* Header needs to allow the taller close/copy buttons */
  .scripture-modal-header {
    padding: 10px 16px;
  }
}

/* ── Fix 5: Bookmark button — 44px tap target ───────────────────────────── */
/* Current padding:4px 8px → ~22px effective height. */
@media (max-width: 767.98px) {
  .bm-btn {
    min-width: 44px !important;
    min-height: 44px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
}

/* ── Fix 6: Journey hero CTA button — 44px tap target ───────────────────── */
@media (max-width: 767.98px) {
  .journey-hero-btn {
    min-height: 44px;
    padding: 10px 22px;
  }
  /* Journey list rows need adequate touch area */
  .journey-list-row {
    min-height: 48px;
  }
  /* Journey selector bar <button> (not .btn) — explicit min-height */
  .journey-selector-bar button {
    min-height: 44px !important;
  }
}

/* ── Fix 7: Related-person chips and thread chips — 44px tap targets ──────── */
@media (max-width: 767.98px) {
  .related-person-chip {
    min-height: 44px;
    padding: 10px 16px;
    display: inline-flex;
    align-items: center;
  }
  .thread-connection-chip {
    min-height: 44px;
    padding: 10px 16px;
    display: inline-flex;
    align-items: center;
  }
}

/* ── Fix 8: Scripture ref chips inline — comfortable tap area ───────────── */
/* Full 44px would break inline flow; use 36px as a reasonable middle ground */
@media (max-width: 767.98px) {
  .scripture-ref {
    padding: 6px 12px;
    font-size: 0.8rem;
  }
}

/* ── Fix 9: Global .btn min-height override — don't apply to compact rows ── */
/* The WCAG 44px rule is too aggressive for dense data rows on mobile.
   Exclude these specific contexts from the blanket min-height:44px rule. */
@media (max-width: 767.98px) {
  .filter-bar .btn,
  .filter-bar .btn-sm,
  .journey-controls-row .btn,
  .story-card-nav .story-card-nav-btn {
    min-height: unset;
  }
}

/* ── Fix 10: Journey map pane — small improvement to usable map height ────── */
/* On very small phones (≤400px), give a touch more map real estate */
@media (max-width: 400px) {
  .journey-map-pane { height: 44vh; min-height: 260px; }
  .journey-sidebar  { max-height: 45vh; }
}

/* ── Fix 11: Popup close tap button — always above bottom nav ────────────── */
/* Already sized at 36px / 42px on mobile — ensure it doesn't clip */
@media (max-width: 768px) {
  .popup-close-tap {
    min-height: 44px !important;
  }
}

/* ── Fix 12: Home spark chips on smallest screens ────────────────────────── */
@media (max-width: 400px) {
  .home-spark {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
  }
}

/* ── Fix 13: People / place profile header close button ─────────────────── */
/* The × close button in profile-header uses inline style — add class target */
@media (max-width: 767.98px) {
  .profile-header .btn,
  .profile-header button {
    min-width: 44px !important;
    min-height: 44px !important;
  }
}

/* ── Fix 14: Journey map zoom controls above bottom nav ─────────────────── */
/* Leaflet zoom controls default to bottom-right; on mobile they may clip */
@media (max-width: 768px) {
  .leaflet-bottom.leaflet-right {
    bottom: calc(68px + env(safe-area-inset-bottom, 0px)) !important;
  }
  .leaflet-bottom.leaflet-left {
    bottom: calc(68px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

/* ============================================================================
   MOBILE UX OVERHAUL — May 2026
   Map bottom sheet · Study tab scroll · Swipe journey · Touch targets ·
   Typography clamp · Single-column grids · Navbar search hide
   ============================================================================ */

/* ── Map tab: bottom sheet panel on mobile ─────────────────────────────────
   The detail panel slides up from the bottom as a fixed sheet instead of
   squishing the map to ~30% height. The map stays full-height behind it.   */
@media (max-width: 767.98px) {
  /* Map layout: let it be full height — panel floats over it */
  .map-layout {
    position: relative !important;
    flex-direction: row !important; /* keep side-by-side so map fills */
    height: calc(100dvh - 120px) !important;
  }

  /* Map pane: full height, full width */
  .map-layout > .map-pane,
  .map-layout > [id*="map"] {
    height: 100% !important;
    min-height: 100% !important;
    flex: 1 1 100% !important;
    width: 100% !important;
  }

  /* Detail panel: fixed bottom sheet */
  .detail-panel {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    min-width: 0 !important;
    height: 60vh !important;
    max-height: 60vh !important;
    flex: none !important;
    border-radius: 12px 12px 0 0 !important;
    border-left: none !important;
    border-top: 1px solid var(--border) !important;
    z-index: 500 !important;
    overflow-y: auto !important;
    /* Slide-up animation when shown */
    transform: translateY(0);
    transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  }

  /* When hidden, slide completely off-screen downward */
  .detail-panel.hidden {
    transform: translateY(100%) !important;
  }

  /* Drag handle pill above content */
  .detail-panel::before {
    content: '' !important;
    display: block !important;
    width: 38px !important;
    height: 4px !important;
    background: var(--border) !important;
    border-radius: 2px !important;
    margin: 10px auto 4px !important;
    opacity: 0.9 !important;
    flex-shrink: 0 !important;
  }
}

/* Dark mode drag handle */
[data-theme="dark"] .detail-panel::before {
  background: rgba(255, 255, 255, 0.18) !important;
}

/* Close button injected into the detail panel header on mobile */
.detail-panel-close-btn {
  display: none;
}
@media (max-width: 767.98px) {
  .detail-panel-close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(0,0,0,0.06);
    border-radius: 50%;
    font-size: 1rem;
    cursor: pointer;
    color: var(--text-muted);
    flex-shrink: 0;
    margin-left: auto;
  }
  .detail-panel-close-btn:hover {
    background: rgba(0,0,0,0.12);
  }
}

/* ── Study tab inner tabs: scroll-snap, hide scrollbar ──────────────────── */
/* Already has overflow-x:auto + scrollbar-width:none in base CSS.
   Reinforce with touch momentum, white-space, and scroll-snap on mobile.    */
@media (max-width: 767.98px) {
  .study-inner-tabs > .nav-tabs {
    overflow-x: auto !important;
    white-space: nowrap !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    flex-wrap: nowrap !important;
    scroll-snap-type: x mandatory;
  }
  .study-inner-tabs > .nav-tabs::-webkit-scrollbar {
    display: none !important;
  }
  .study-inner-tabs > .nav-tabs .nav-link {
    scroll-snap-align: start;
    flex-shrink: 0;
  }
}

/* ── Journey playback: stop cards readable on mobile ────────────────────── */
@media (max-width: 767.98px) {
  .story-card-desc {
    font-size: 1rem !important;
    line-height: 1.6 !important;
  }
  .story-card-overlay {
    padding-bottom: 0;
  }
  .story-card-body {
    padding: 0 1.25rem 0.75rem !important;
  }
  .story-card-header,
  .story-card-context {
    padding: 0.75rem 1.25rem !important;
  }
  .story-card-ticker {
    padding: 0.5rem 1.25rem !important;
  }
  .story-card-nav {
    padding: 0.5rem 1.25rem !important;
  }
}

/* ── People and Places cards: single column below 600px ─────────────────── */
@media (max-width: 599.98px) {
  .people-grid,
  .person-cards-grid,
  .place-cards-grid,
  .card-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ── Navbar: hide search input on mobile (< 768px) ──────────────────────── */
/* Search is accessible via global content; the collapsed navbar search
   causes layout issues on small screens.                                     */
@media (max-width: 767.98px) {
  .global-search-container,
  .global-search-box {
    display: none !important;
  }
}

/* ── Touch targets: 44px minimum for small interactive elements ─────────── */
@media (max-width: 767.98px) {
  /* Era badges and type badges used as interactive filters */
  .era-badge,
  .type-badge {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  /* Scripture tags / refs */
  .scripture-ref,
  .scripture-tag {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  /* Thread stop nodes (the dot/line element) */
  .thread-stop-line {
    min-height: 44px;
  }

  /* Thread stop content rows — make the whole row tappable area */
  .thread-stop {
    min-height: 44px;
  }
}

/* ── Typography: clamp headings inside .padded-tab on mobile ────────────── */
@media (max-width: 767.98px) {
  .padded-tab h2,
  .padded-tab h3 {
    font-size: clamp(1.1rem, 4vw, 1.5rem) !important;
  }
}

/* ── Arc-card and shadow-card grids: single column below 600px ──────────── */
@media (max-width: 599.98px) {
  .arc-grid {
    grid-template-columns: 1fr !important;
  }
  /* shadow-card: used in themed content areas — force single col */
  .shadow-card-grid,
  [class*="shadow-card-grid"] {
    grid-template-columns: 1fr !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   HOME TAB ENHANCEMENTS (stats strip dark, verse, recent, features, dyk)
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Dark stats strip override ───────────────────────────────────────────── */
.home-stats-strip--dark {
  background: #2c2520;
  border-top: none;
  border-bottom: none;
  padding: 0.9rem 1.5rem;
}
.home-stats--gold {
  gap: 0;
}
.home-stat--gold {
  border-right: 1px solid #5a4a3a;
  padding: 0.35rem 1.6rem;
}
.home-stat--gold:last-child { border-right: none; }
.home-stat-n--gold {
  font-family: 'Cinzel', serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: #c9a24a;
  line-height: 1.1;
}
.home-stat-label--gold {
  font-family: 'Cinzel', serif;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #a08060;
  margin-top: 2px;
}
@media (max-width: 540px) {
  .home-stats--gold { flex-wrap: wrap; }
  .home-stat--gold  { flex: 0 0 50%; border-right: none; border-bottom: 1px solid #5a4a3a; padding: 0.45rem 0; text-align: center; }
  .home-stat--gold:nth-child(odd) { border-right: 1px solid #5a4a3a; }
}

/* ── Section wrappers ────────────────────────────────────────────────────── */
.home-section-wrap {
  max-width: 900px;
  margin: 2rem auto 0;
  padding: 0 1.5rem;
}
.home-section-hdr { margin-bottom: 1rem; }
.home-section-title {
  font-family: 'Cinzel', serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── Today's Verse card ──────────────────────────────────────────────────── */
.home-verse-wrap {
  max-width: 720px;
  margin: 2.2rem auto 0;
  padding: 0 1.5rem;
}
.home-verse-card {
  background: linear-gradient(135deg, #1e3a6e 0%, #162d57 100%);
  border-radius: 12px;
  padding: 2rem 2rem 1.5rem;
  color: #e8dfc8;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(30,58,110,0.25);
}
.home-verse-card::before {
  content: '\201C';
  position: absolute;
  top: -0.3rem;
  left: 1.2rem;
  font-family: 'Cinzel', serif;
  font-size: 7rem;
  color: rgba(255,255,255,0.07);
  line-height: 1;
  pointer-events: none;
}
.home-verse-eyebrow {
  font-family: 'Cinzel', serif;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #c9a24a;
  margin-bottom: 0.9rem;
  display: flex;
  align-items: center;
}
.home-verse-text {
  font-family: 'Libre Baskerville', serif;
  font-size: 1.1rem;
  line-height: 1.75;
  color: #f0e8d0;
  font-style: italic;
  margin-bottom: 0.85rem;
  position: relative;
  z-index: 1;
}
.home-verse-text q { quotes: none; }
.home-verse-ref {
  font-family: 'Cinzel', serif;
  font-size: 0.82rem;
  font-weight: 700;
  color: #c9a24a;
  margin-bottom: 1.1rem;
}
.home-verse-btn {
  background: rgba(201,162,74,0.15);
  border: 1px solid rgba(201,162,74,0.5);
  color: #c9a24a;
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 0.4rem 1rem;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.home-verse-btn:hover {
  background: rgba(201,162,74,0.3);
  color: #f0d070;
}
[data-theme="dark"] .home-verse-card { background: linear-gradient(135deg, #0e1e40 0%, #08122c 100%); }

/* ── Continue Exploring / recent cards ────────────────────────────────────── */
.home-recent-empty {
  color: var(--text-muted);
  font-size: 0.88rem;
  padding: 0.75rem 0;
}
.home-recent-cards {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.home-recent-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.9rem;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.15s;
  text-align: left;
  width: 100%;
}
.home-recent-card:hover {
  box-shadow: 0 3px 14px var(--shadow);
  transform: translateX(3px);
}
.home-recent-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  flex-shrink: 0;
  background: var(--body-bg);
  color: var(--secondary);
}
.home-recent-body { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.home-recent-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  font-family: 'Libre Baskerville', serif;
}
.home-recent-type {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  font-family: 'Cinzel', serif;
}
.home-recent-type--person  { color: #1e3a6e; }
.home-recent-type--place   { color: #92400e; }
.home-recent-type--journey { color: #6d28d9; }
.home-recent-type--event   { color: #065f46; }
.home-recent-arrow {
  color: var(--text-muted);
  font-size: 0.9rem;
  opacity: 0.5;
}

/* ── Feature cards with badges ───────────────────────────────────────────── */
.home-feature-card-top {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.home-feature-badge {
  font-family: 'Cinzel', serif;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  background: var(--body-bg);
  border: 1px solid var(--border);
  color: var(--secondary);
  padding: 1px 7px;
  border-radius: 20px;
  white-space: nowrap;
}
.home-feature--arcs   .home-feature-icon { color: #6d28d9; }
.home-feature--themes .home-feature-icon { color: #065f46; }
.home-feature--people .home-feature-icon { color: var(--tertiary); }

/* ── Did You Know card ────────────────────────────────────────────────────── */
.home-dyk-wrap {
  max-width: 720px;
  margin: 2rem auto 0;
  padding: 0 1.5rem;
}
.home-dyk-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-left: 4px solid var(--secondary);
  border-radius: 8px;
  padding: 1.1rem 1.4rem;
  box-shadow: 0 2px 8px var(--shadow);
}
.home-dyk-eyebrow {
  font-family: 'Cinzel', serif;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--secondary);
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
}
.home-dyk-text {
  font-family: 'Libre Baskerville', serif;
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--text);
}
[data-theme="dark"] .home-dyk-card {
  background: var(--card-bg);
  border-color: var(--border);
  border-left-color: #c9a24a;
}

/* ── Reading Plans Tab ─────────────────────────────────────────────────────── */
.reading-wrap {
  max-width: 960px;
  margin: 0 auto;
}

/* Header */
.reading-hdr {
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1.25rem;
}
.reading-title {
  font-family: 'Cinzel', serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 0.3rem;
  display: flex;
  align-items: center;
}
.reading-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 0;
}

/* Plan selection grid */
.reading-plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.1rem;
  margin-bottom: 2rem;
}
.reading-plan-card {
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 1.2rem 1.1rem 1rem;
  cursor: pointer;
  transition: box-shadow 0.18s, transform 0.18s, border-color 0.18s;
  position: relative;
  overflow: hidden;
}
.reading-plan-card:hover {
  box-shadow: 0 6px 22px var(--shadow);
  transform: translateY(-3px);
}
.reading-plan-card--active {
  box-shadow: 0 4px 18px var(--shadow);
}
.reading-plan-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.7rem;
}
.reading-plan-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}
.reading-plan-icon--sm {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  font-size: 0.78rem;
}
.reading-plan-progress-badge {
  font-family: 'Cinzel', serif;
  font-size: 0.65rem;
  font-weight: 700;
  color: #fff;
  padding: 2px 8px;
  border-radius: 20px;
}
.reading-plan-name {
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 0.25rem;
  line-height: 1.3;
}
.reading-plan-duration {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
  display: flex;
  align-items: center;
}
.reading-plan-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0 0 0.75rem;
}
.reading-plan-bar-wrap { margin-top: 0.5rem; }
.reading-plan-bar {
  height: 5px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 4px;
}
.reading-plan-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}
.reading-plan-bar-label {
  font-size: 0.67rem;
  color: var(--text-muted);
  font-family: 'Cinzel', serif;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Active plan view */
.reading-plan-view {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 3px 16px var(--shadow);
  margin-bottom: 2rem;
}
.reading-plan-view-hdr {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.2rem;
  border-bottom: 1px solid var(--border);
  background: var(--body-bg);
}
.reading-back-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-family: 'Cinzel', serif;
  padding: 0.3rem 0.8rem;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  transition: background 0.15s;
}
.reading-back-btn:hover { background: var(--border); }
.reading-plan-view-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: 'Cinzel', serif;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
}

/* Progress bar */
.reading-progress-wrap {
  padding: 0.85rem 1.4rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
.reading-progress-label { margin-bottom: 0.4rem; }
.reading-progress-text {
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--secondary);
}
.reading-progress-bar {
  height: 7px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.reading-progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

/* Today's reading */
.reading-today-wrap { padding: 1.4rem; }
.reading-today-hdr {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 1.1rem;
  flex-wrap: wrap;
}
.reading-today-day-badge {
  font-family: 'Cinzel', serif;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #fff;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.reading-today-title {
  font-family: 'Cinzel', serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.reading-today-title--cont {
  font-style: italic;
  opacity: 0.7;
}

/* Passage tags */
.reading-passages {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}
.reading-passage-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--body-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.75rem;
  font-family: 'Libre Baskerville', serif;
  font-size: 0.82rem;
  color: var(--primary);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.reading-passage-tag:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.reading-passage-tag:hover .reading-passage-arrow { opacity: 1; }
.reading-passage-arrow { opacity: 0.4; transition: opacity 0.15s; }
.reading-passages--note { flex-direction: column; }
.reading-passage-note {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  line-height: 1.5;
}

/* Actions */
.reading-actions { margin-bottom: 0.5rem; }
.reading-mark-btn {
  border: none;
  color: #fff;
  font-family: 'Cinzel', serif;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 0.5rem 1.25rem;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  transition: opacity 0.15s, transform 0.12s;
}
.reading-mark-btn:hover { opacity: 0.88; transform: translateY(-1px); }
.reading-day-done {
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  font-weight: 700;
  color: #16a34a;
  display: inline-flex;
  align-items: center;
}

/* Navigation */
.reading-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.4rem;
  border-top: 1px solid var(--border);
  background: var(--body-bg);
}
.reading-nav-btn {
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: 'Cinzel', serif;
  font-size: 0.76rem;
  padding: 0.4rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background 0.15s;
}
.reading-nav-btn:hover:not(:disabled) { background: var(--secondary); color: #fff; border-color: var(--secondary); }
.reading-nav-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.reading-nav-indicator {
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Dark mode adjustments for reading plans */
[data-theme="dark"] .reading-plan-card,
[data-theme="dark"] .reading-plan-view { background: var(--card-bg); border-color: var(--border); }
[data-theme="dark"] .reading-plan-view-hdr,
[data-theme="dark"] .reading-nav { background: rgba(0,0,0,0.15); }

/* Mobile: single-column plan grid */
@media (max-width: 599.98px) {
  .reading-plan-grid { grid-template-columns: 1fr; }
  .reading-today-hdr { flex-direction: column; align-items: flex-start; }
  .reading-nav { flex-wrap: wrap; gap: 0.5rem; justify-content: center; }
}

/* ── Connections Tab ────────────────────────────────────────────────── */

/* Stats bar — flex row above the network/list views */
.connections-stats-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--body-bg);
  font-size: 0.88rem;
  color: var(--text-muted);
  min-height: 40px;
}

/* Filter button strip */
.connections-filter-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

/* Individual filter pill button */
.connections-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--card-bg);
  color: var(--text-muted);
  font-family: "Libre Baskerville", serif;
  font-size: 0.78rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s, opacity 0.15s;
  opacity: 0.55;
  white-space: nowrap;
}

.connections-filter-btn.active {
  opacity: 1;
  background: var(--body-bg);
  color: var(--text);
  border-color: var(--secondary);
}

.connections-filter-btn:hover {
  opacity: 0.85;
}

/* Colored dot inside filter pill */
.conn-type-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Network / List toggle buttons */
.connections-view-toggle {
  display: inline-flex;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
}

.connections-view-btn {
  padding: 5px 14px;
  background: var(--card-bg);
  border: none;
  color: var(--text-muted);
  font-family: "Libre Baskerville", serif;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  border-right: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.connections-view-btn:last-child {
  border-right: none;
}

.connections-view-btn.active {
  background: var(--primary);
  color: #fff;
}

.connections-view-btn:hover:not(.active) {
  background: var(--body-bg);
  color: var(--text);
}

/* Hoverable list rows in the list view */
.connections-list-wrap .connections-list-row {
  cursor: pointer;
  transition: background 0.1s;
}

.connections-list-wrap .connections-list-row:hover {
  background: rgba(184, 145, 58, 0.08) !important;
}

/* DataTable overrides for the connections list */
.connections-dt.dataTable thead th {
  font-family: "Cinzel", serif;
  font-size: 0.78rem;
  color: var(--primary);
  background: var(--card-bg);
  border-bottom: 2px solid var(--border);
  padding: 8px 10px;
}

.connections-dt.dataTable tbody tr {
  transition: background 0.1s;
}

.connections-dt.dataTable tbody tr:hover {
  background: rgba(184, 145, 58, 0.07) !important;
}

/* Hint overlay in network view */
.connections-hint {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(44, 37, 32, 0.72);
  color: rgba(245, 240, 232, 0.9);
  font-size: 0.75rem;
  font-family: "Libre Baskerville", serif;
  padding: 4px 14px;
  border-radius: 999px;
  pointer-events: none;
  white-space: nowrap;
}

/* Network wrap */
.connections-network-wrap {
  background: var(--body-bg);
}

/* Dark mode overrides */
[data-theme="dark"] .connections-stats-bar {
  background: var(--body-bg);
  border-color: var(--border);
}
[data-theme="dark"] .connections-filter-btn {
  background: var(--card-bg);
  border-color: var(--border);
}
[data-theme="dark"] .connections-filter-btn.active {
  background: rgba(184, 145, 58, 0.15);
}
[data-theme="dark"] .connections-view-btn {
  background: var(--card-bg);
  color: var(--text-muted);
}
[data-theme="dark"] .connections-view-btn.active {
  background: var(--primary);
  color: #fff;
}
[data-theme="dark"] .connections-dt.dataTable thead th {
  background: var(--card-bg);
}

/* Mobile responsive */
@media (max-width: 767.98px) {
  .connections-stats-bar {
    font-size: 0.82rem;
    padding: 0.5rem 0.75rem;
  }
  .connections-filter-btn {
    font-size: 0.72rem;
    padding: 3px 9px;
  }
  .connections-view-btn {
    font-size: 0.76rem;
    padding: 4px 10px;
  }
  .connections-hint {
    display: none;
  }
}

/* ============================================================================
   OVERHAUL — Arcs Plotly Trajectory + Phase Cards Grid
   ============================================================================ */
.arc-phase-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.arc-phase-card {
  background: var(--card-bg);
  border-radius: 8px;
  padding: 14px;
  transition: transform 0.15s;
  animation: fadeIn 0.3s ease-out;
}
.arc-phase-card:hover { transform: translateY(-2px); }
.arc-phase-card-turning {
  background: rgba(184,145,58,0.06);
  box-shadow: 0 0 0 1px rgba(184,145,58,0.2);
}
.arc-phase-card-title {
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.arc-phase-card-narrative {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ============================================================================
   OVERHAUL — Parallels Synoptic Viewer
   ============================================================================ */
.synoptic-viewer {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin: 20px 0;
}
.synoptic-column {
  background: var(--card-bg);
  border-radius: 10px;
  padding: 16px;
  border: 1px solid var(--border);
}
.synoptic-column-header {
  padding-bottom: 10px;
  margin-bottom: 12px;
}
.synoptic-book-name {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.synoptic-ref { margin-top: 4px; }
.synoptic-passage-block { margin-top: 12px; }
.synoptic-passage-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}
.synoptic-details-list { display: flex; flex-direction: column; gap: 6px; }
.synoptic-detail-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text);
  line-height: 1.5;
}
.synoptic-bullet {
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-top: 6px;
}

/* OT-NT two-column viewer */
.ot-nt-viewer {
  display: flex;
  gap: 0;
  margin: 20px 0;
  align-items: stretch;
}
.ot-nt-panel {
  flex: 1;
  background: var(--card-bg);
  border-radius: 10px;
  padding: 18px;
  border: 1px solid var(--border);
}
.ot-nt-panel-label {
  font-family: 'Cinzel', serif;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 8px;
}
.ot-nt-book {
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  font-weight: 600;
}
.ot-nt-connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  min-width: 60px;
}
.ot-nt-arrow {
  font-size: 1.5rem;
  color: var(--secondary);
}
.ot-nt-connector-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 4px;
}
@media (max-width: 600px) {
  .ot-nt-viewer { flex-direction: column; gap: 8px; }
  .ot-nt-connector { flex-direction: row; padding: 8px 0; min-width: unset; }
  .synoptic-viewer { grid-template-columns: 1fr; }
}

/* ============================================================================
   OVERHAUL — Shadows Visual Split Panel
   ============================================================================ */
.shadow-split-panel {
  display: flex;
  gap: 0;
  margin: 20px 0;
  align-items: stretch;
}
.shadow-split-side {
  flex: 1;
  background: var(--card-bg);
  border-radius: 10px;
  padding: 20px;
  border: 1px solid var(--border);
}
.shadow-split-ot { border-left: 3px solid #b8913a; }
.shadow-split-nt { border-left: 3px solid #1565c0; }
.shadow-split-label {
  display: flex;
  align-items: center;
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}
.shadow-split-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
  font-size: 0.7rem;
}
.shadow-split-icon-ot {
  background: rgba(184,145,58,0.15);
  color: #b8913a;
}
.shadow-split-icon-nt {
  background: rgba(21,101,192,0.12);
  color: #1565c0;
}
.shadow-split-name {
  font-family: 'Cinzel', serif;
  font-size: 1.05rem;
  color: var(--text);
  margin: 0 0 6px;
}
.shadow-split-scripture { margin-bottom: 8px; }
.shadow-split-summary {
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 12px;
}
.shadow-split-elements { margin-top: 8px; }
.shadow-split-elements-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}
.shadow-key-element {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.5;
}
.shadow-element-bullet {
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-top: 6px;
}
.shadow-element-bullet-ot { background: #b8913a; }
.shadow-element-bullet-nt { background: #1565c0; }

.shadow-split-connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  min-width: 70px;
}
.shadow-connector-line {
  width: 2px;
  flex: 1;
  background: var(--border);
  min-height: 20px;
}
.shadow-connector-arrow {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(184,145,58,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--secondary);
}
.shadow-connector-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-style: italic;
  margin: 4px 0;
  white-space: nowrap;
}

.shadow-parallels-section { margin-top: 24px; }
.shadow-parallel-points {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.shadow-parallel-point {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.shadow-parallel-number {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}
.shadow-parallel-text {
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.6;
}

.shadow-depth-callout {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-top: 24px;
  padding: 16px;
  background: rgba(184,145,58,0.08);
  border: 1px solid rgba(184,145,58,0.25);
  border-radius: 10px;
}
.shadow-depth-icon {
  flex-shrink: 0;
  color: #b8913a;
  font-size: 1.1rem;
  margin-top: 2px;
}
.shadow-depth-label {
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--secondary);
  margin-bottom: 4px;
}
.shadow-depth-text {
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.7;
  margin: 0;
  font-style: italic;
}

@media (max-width: 600px) {
  .shadow-split-panel { flex-direction: column; gap: 8px; }
  .shadow-split-connector { flex-direction: row; padding: 8px 0; min-width: unset; }
  .shadow-connector-line { width: auto; height: 2px; min-height: unset; min-width: 20px; }
}

/* ============================================================================
   OVERHAUL — Threads Enhanced Timeline with Bridges
   ============================================================================ */
.thread-timeline-enhanced {
  padding-left: 20px;
  margin-top: 20px;
}
.thread-stop-enhanced {
  display: flex;
  gap: 16px;
  position: relative;
  padding-bottom: 8px;
}
.thread-stop-key {
  /* subtle glow for key verse */
}
.thread-vline {
  position: relative;
  width: 2px;
  flex-shrink: 0;
  min-height: 60px;
}
.thread-node {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid;
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
}
.thread-node-key {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.thread-stop-body {
  flex: 1;
  padding-bottom: 12px;
}
.thread-key-verse-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid;
  margin-bottom: 6px;
}
.thread-stop-era-badge {
  display: inline-block;
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: 10px;
  color: #fff;
  margin-bottom: 4px;
}
.thread-stop-title-text {
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.thread-stop-narrative-text {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-top: 4px;
}
.thread-bridge {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 0 4px 7px;
  margin-left: 0;
}
.thread-bridge-line {
  width: 2px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.4;
}
.thread-bridge-text {
  font-size: 0.76rem;
  font-style: italic;
  opacity: 0.7;
  line-height: 1.4;
}
.thread-span-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.76rem;
  color: var(--text-muted);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px 10px;
}
.thread-card-span {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ============================================================================
   NEW — Scripture Reader
   ============================================================================ */
.scripture-reader { padding-bottom: 2rem; }
.reader-header {
  text-align: center;
  margin-bottom: 16px;
}
.reader-search-bar {
  max-width: 600px;
  margin: 0 auto 20px;
}
.reader-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 6px 14px;
}
.reader-search-input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 0.85rem;
  outline: none;
}
.reader-search-input::placeholder { color: var(--text-muted); opacity: 0.7; }
.reader-search-btn {
  border: none;
  background: var(--secondary);
  color: #fff;
  padding: 4px 14px;
  border-radius: 16px;
  font-size: 0.78rem;
  cursor: pointer;
  font-weight: 600;
}
.reader-search-btn:hover { opacity: 0.9; }

.reader-layout {
  display: grid;
  grid-template-columns: 200px 1fr 220px;
  gap: 16px;
  min-height: 500px;
}
@media (max-width: 900px) {
  .reader-layout { grid-template-columns: 1fr; min-height: unset; }
  .reader-nav-panel { max-height: 300px; }
  .reader-xref-panel { max-height: 300px; }
}

.reader-nav-panel {
  background: var(--card-bg);
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 12px;
  overflow-y: auto;
  max-height: 600px;
}
.reader-nav-title {
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--secondary);
  margin-bottom: 10px;
}
.reader-testament-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 12px 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.reader-book-item {
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text);
  transition: background 0.15s;
}
.reader-book-item:hover { background: rgba(184,145,58,0.08); }
.reader-book-active {
  background: rgba(30,58,110,0.1) !important;
  font-weight: 600;
}
.reader-book-empty {
  color: var(--text-muted);
  opacity: 0.5;
  cursor: default;
}
.reader-book-count {
  font-size: 0.68rem;
  background: rgba(184,145,58,0.15);
  color: var(--secondary);
  padding: 1px 6px;
  border-radius: 8px;
}

.reader-main-panel {
  background: var(--card-bg);
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 20px;
  min-height: 400px;
}

.reader-welcome {
  text-align: center;
  padding: 40px 20px;
}
.reader-quick-ref {
  display: inline-block;
  padding: 6px 14px;
  background: rgba(30,58,110,0.08);
  border-radius: 16px;
  font-size: 0.8rem;
  color: var(--primary);
  cursor: pointer;
  transition: background 0.15s;
}
.reader-quick-ref:hover { background: rgba(30,58,110,0.15); }

.reader-parchment {
  background: linear-gradient(to bottom, rgba(250,247,240,0.5), rgba(245,240,232,0.8));
  border-radius: 8px;
  padding: 24px;
  border: 1px solid var(--border);
  min-height: 200px;
}
.reader-verse-text {
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 0.92rem;
  color: var(--text);
  line-height: 1.9;
}
.reader-verse-placeholder { text-align: center; padding: 20px; }

.reader-passage-header {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
}
.reader-passage-ref {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary);
}

.reader-results-header {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.reader-result-card {
  padding: 12px;
  background: rgba(184,145,58,0.04);
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.reader-result-card:hover { background: rgba(184,145,58,0.1); }
.reader-result-ref {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 4px;
}
.reader-result-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.reader-book-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.reader-xref-panel {
  background: var(--card-bg);
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 12px;
  overflow-y: auto;
  max-height: 600px;
}
.reader-xref-title {
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--secondary);
  margin-bottom: 12px;
}
.reader-xref-section-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 10px 0 6px;
}
.reader-xref-chip {
  display: flex;
  align-items: center;
  padding: 6px 10px;
  background: rgba(30,58,110,0.06);
  border-radius: 6px;
  font-size: 0.78rem;
  color: var(--text);
  cursor: pointer;
  margin-bottom: 4px;
  transition: background 0.15s;
}
.reader-xref-chip:hover { background: rgba(30,58,110,0.12); }

/* ============================================================================
   NEW — Prophecy Fulfillment Tracker
   ============================================================================ */
.prophecy-stats-header {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  padding: 14px;
  background: var(--card-bg);
  border-radius: 10px;
  border: 1px solid var(--border);
}
.prophecy-stat-block { text-align: center; min-width: 80px; }
.prophecy-stat-number {
  font-family: 'Cinzel', serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
}
.prophecy-stat-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.prophecy-progress-bar {
  flex: 1;
  min-width: 180px;
  height: 24px;
  background: rgba(184,145,58,0.1);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
}
.prophecy-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #2e7d32, #4caf50);
  border-radius: 12px;
  transition: width 0.5s ease;
}
.prophecy-progress-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text);
}

.prophecy-view-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  justify-content: center;
}
.prophecy-view-tab {
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  padding: 6px 14px;
  border-radius: 18px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.15s;
}
.prophecy-view-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.prophecy-cat-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 16px;
}
.prophecy-cat-pill {
  border: 1px solid;
  background: transparent;
  padding: 4px 12px;
  border-radius: 14px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 500;
}
.prophecy-cat-pill.active {
  color: #fff !important;
}

.prophecy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}
.prophecy-card {
  background: var(--card-bg);
  border-radius: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  animation: fadeIn 0.3s ease-out;
}
.prophecy-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow);
}
.prophecy-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.prophecy-card-cat-badge {
  display: inline-flex;
  align-items: center;
  color: #fff;
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}
.prophecy-card-conf {
  font-size: 0.72rem;
  font-weight: 600;
}
.prophecy-card-title {
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}
.prophecy-card-refs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.prophecy-card-ot-ref { color: #b8913a; }
.prophecy-card-nt-ref { color: #1565c0; }
.prophecy-card-arrow { color: var(--text-muted); }

/* Prophecy Timeline */
.prophecy-timeline {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.prophecy-timeline-item {
  display: grid;
  grid-template-columns: 1fr 40px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  background: var(--card-bg);
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.prophecy-timeline-item:hover { background: rgba(184,145,58,0.06); }
.prophecy-timeline-ot { text-align: right; }
.prophecy-timeline-nt { text-align: left; }
.prophecy-timeline-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}
.prophecy-tl-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.prophecy-tl-line {
  width: 2px;
  height: 100%;
  background: var(--border);
  position: absolute;
  top: 50%;
}
.prophecy-tl-year {
  font-size: 0.72rem;
  font-weight: 600;
}
.prophecy-tl-ref {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.prophecy-tl-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 600px) {
  .prophecy-timeline-item { grid-template-columns: 1fr; text-align: left; }
  .prophecy-timeline-ot { text-align: left; }
  .prophecy-timeline-center { display: none; }
}

/* Prophecy Detail */
.prophecy-detail-header {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}
.prophecy-detail-title {
  font-family: 'Cinzel', serif;
  font-size: 1.2rem;
  color: var(--text);
  width: 100%;
  margin: 8px 0 0;
}
.prophecy-conf-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 10px;
  border: 1px solid;
}
.prophecy-detail-split {
  display: flex;
  gap: 0;
  margin: 20px 0;
  align-items: stretch;
}
.prophecy-detail-panel {
  flex: 1;
  background: var(--card-bg);
  border-radius: 10px;
  padding: 20px;
  border: 1px solid var(--border);
}
.prophecy-panel-ot { border-top: 3px solid #b8913a; }
.prophecy-panel-nt { border-top: 3px solid #1565c0; }
.prophecy-panel-label {
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
  color: var(--text-muted);
}
.prophecy-panel-ref { margin-bottom: 4px; }
.prophecy-panel-year {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.prophecy-panel-text {
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.8;
  border-left: 3px solid var(--border);
  padding-left: 14px;
  margin: 0;
  font-style: italic;
}
.prophecy-detail-connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  min-width: 70px;
}
.prophecy-connector-arrow { margin-bottom: 4px; }
.prophecy-connector-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-align: center;
  font-style: italic;
}
@media (max-width: 600px) {
  .prophecy-detail-split { flex-direction: column; gap: 8px; }
  .prophecy-detail-connector { flex-direction: row; padding: 8px 0; min-width: unset; }
}

/* ============================================================================
   Bookmarks Panel & Toast
   ============================================================================ */
.bm-count-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #dc2626;
  color: #fff;
  font-size: 0.6rem;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.bm-panel {
  position: fixed;
  top: 0;
  right: -340px;
  width: 320px;
  height: 100vh;
  background: var(--card-bg);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 20px var(--shadow);
  z-index: 10000;
  transition: right 0.3s ease;
  display: flex;
  flex-direction: column;
}
.bm-panel-open { right: 0; }
.bm-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
.bm-panel-close {
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
}
.bm-panel-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}
.bm-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 0.82rem;
}
.bm-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  margin-bottom: 4px;
}
.bm-item:hover { background: rgba(184,145,58,0.08); }
.bm-item-icon {
  color: var(--secondary);
  font-size: 0.85rem;
  flex-shrink: 0;
}
.bm-item-content { flex: 1; min-width: 0; }
.bm-item-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bm-item-type {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: capitalize;
}
.bm-item-remove {
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}
.bm-item:hover .bm-item-remove { opacity: 1; }
.bm-clear-row {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  text-align: center;
}
.bm-clear-btn {
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
}
.bm-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--card-bg);
  border: 1px solid var(--secondary);
  color: var(--text);
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 0.8rem;
  z-index: 10001;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  box-shadow: 0 4px 16px var(--shadow);
}
.bm-toast-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
/* Navbar bookmark button needs position:relative for badge */
.dark-mode-toggle { position: relative; }

/* ============================================================================
   DARK MODE — Complete Coverage
   ============================================================================ */
/* Scripture tags */
[data-theme="dark"] .scripture-ref {
  background: rgba(212,169,74,0.1);
  border-color: rgba(212,169,74,0.3);
  color: #d4a94a;
}
/* Badge backgrounds */
[data-theme="dark"] .era-badge,
[data-theme="dark"] .type-badge {
  opacity: 0.85;
}
/* Study inner tabs */
[data-theme="dark"] .study-inner-tabs .nav-link {
  color: var(--text-muted) !important;
}
[data-theme="dark"] .study-inner-tabs .nav-link.active {
  color: var(--secondary) !important;
  border-bottom-color: var(--secondary) !important;
  background: transparent !important;
}
/* Cards for all new modules */
[data-theme="dark"] .arc-card,
[data-theme="dark"] .arc-phase-card,
[data-theme="dark"] .parallel-card,
[data-theme="dark"] .shadow-card,
[data-theme="dark"] .thread-card,
[data-theme="dark"] .prophecy-card,
[data-theme="dark"] .reader-result-card {
  background: var(--card-bg) !important;
  border-color: var(--border) !important;
}
[data-theme="dark"] .arc-card:hover,
[data-theme="dark"] .parallel-card:hover,
[data-theme="dark"] .shadow-card:hover,
[data-theme="dark"] .thread-card:hover,
[data-theme="dark"] .prophecy-card:hover,
[data-theme="dark"] .reader-result-card:hover {
  background: #2c2620 !important;
}
/* Split panels */
[data-theme="dark"] .shadow-split-side,
[data-theme="dark"] .prophecy-detail-panel,
[data-theme="dark"] .synoptic-column,
[data-theme="dark"] .ot-nt-panel {
  background: var(--card-bg) !important;
  border-color: var(--border) !important;
}
/* Depth callout */
[data-theme="dark"] .shadow-depth-callout {
  background: rgba(212,169,74,0.08);
  border-color: rgba(212,169,74,0.2);
}
/* Reader panels */
[data-theme="dark"] .reader-nav-panel,
[data-theme="dark"] .reader-main-panel,
[data-theme="dark"] .reader-xref-panel {
  background: var(--card-bg) !important;
  border-color: var(--border) !important;
}
[data-theme="dark"] .reader-parchment {
  background: linear-gradient(to bottom, rgba(37,34,32,0.5), rgba(37,34,32,0.8));
  border-color: var(--border);
}
[data-theme="dark"] .reader-search-box {
  background: var(--card-bg);
  border-color: var(--border);
}
[data-theme="dark"] .reader-search-input {
  color: var(--text);
}
/* Prophecy stats */
[data-theme="dark"] .prophecy-stats-header {
  background: var(--card-bg) !important;
  border-color: var(--border) !important;
}
[data-theme="dark"] .prophecy-progress-bar {
  background: rgba(212,169,74,0.08);
}
/* Bookmarks panel */
[data-theme="dark"] .bm-panel {
  background: var(--card-bg);
  border-color: var(--border);
}
[data-theme="dark"] .bm-toast {
  background: var(--card-bg);
  border-color: var(--secondary);
}
/* Pills & tabs */
[data-theme="dark"] .parallel-category-pill,
[data-theme="dark"] .shadow-category-pill,
[data-theme="dark"] .prophecy-view-tab {
  background: var(--card-bg);
  border-color: var(--border);
  color: var(--text);
}
[data-theme="dark"] .parallel-category-pill.active,
[data-theme="dark"] .shadow-category-pill.active {
  background: var(--primary);
  color: #fff;
}
/* Thread bridge text */
[data-theme="dark"] .thread-bridge-text { opacity: 0.5; }
/* Arc phase turning */
[data-theme="dark"] .arc-phase-card-turning {
  background: rgba(212,169,74,0.06);
  box-shadow: 0 0 0 1px rgba(212,169,74,0.15);
}
/* Quick refs in reader */
[data-theme="dark"] .reader-quick-ref {
  background: rgba(91,143,217,0.1);
  color: var(--primary);
}
/* Prophecy timeline */
[data-theme="dark"] .prophecy-timeline-item {
  background: var(--card-bg);
  border-color: var(--border);
}
/* Bookmarks dark */
[data-theme="dark"] .bm-item:hover {
  background: rgba(212,169,74,0.06);
}
/* Home feature cards (if any) */
[data-theme="dark"] .home-feature-card {
  background: var(--card-bg) !important;
  border-color: var(--border) !important;
}
/* Tab content background */
[data-theme="dark"] .tab-content,
[data-theme="dark"] .tab-pane {
  background: transparent !important;
}
/* Broader badge & pill coverage */
[data-theme="dark"] .count-badge {
  background: rgba(255,255,255,0.06);
  color: var(--text-muted);
}
/* Reflection box */
[data-theme="dark"] .arc-reflection {
  background: rgba(212,169,74,0.06);
  border-color: rgba(212,169,74,0.15);
}
/* Focus ring in dark mode */
[data-theme="dark"] .reader-search-input:focus {
  outline: none;
}
[data-theme="dark"] .reader-search-box:focus-within {
  border-color: var(--secondary);
  box-shadow: 0 0 0 2px rgba(212,169,74,0.12);
}
/* Parallel question box */
[data-theme="dark"] .parallel-question {
  background: rgba(212,169,74,0.06);
  border-color: rgba(212,169,74,0.15);
}
/* Global form inputs */
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="search"],
[data-theme="dark"] textarea {
  background: #1e1c19 !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}
[data-theme="dark"] input:focus,
[data-theme="dark"] textarea:focus {
  border-color: var(--secondary) !important;
  box-shadow: 0 0 0 2px rgba(212,169,74,0.1) !important;
}
