/* Cave Adullam Media — Bible reader styles */

/* ---- Selector panels (book / chapter popovers) ---- */
.bible-panel {
  margin-top: 16px;
  background: #fff;
  border: 1px solid #e7e5e4;
  border-radius: 20px;
  box-shadow: 0 16px 40px rgb(0 0 0 / 0.10);
  padding: 20px;
  max-height: 60vh;
  overflow-y: auto;
}

/* ---- Passage ---- */
#passageWrap { padding-bottom: 96px; } /* keep final verses above the fixed nav */

.bible-verse {
  position: relative;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 7px 12px 7px 8px;
  margin: 0 -8px;
  border-radius: 12px;
  border-left: 3px solid transparent;
  font-size: 17px;
  line-height: 1.75;
  color: #1c1917;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}

.verse-number {
  flex-shrink: 0;
  min-width: 26px;
  height: 26px;
  margin-top: 3px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  color: #a8a29e;
  background: transparent;
  transition: background-color .15s ease, color .15s ease;
}
.verse-number:focus-visible {
  outline: 2px solid #1c1917;
  outline-offset: 1px;
}

/* Verses with related messages: faint always-visible indicator (works on touch) */
.bible-verse.has-messages {
  background: #fafaf9;
  border-left-color: #d6d3d1;
}
.bible-verse.has-messages .verse-number {
  background: #f5f5f4;
  color: #57534e;
}

.verse-msg-hint {
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #a8a29e;
  opacity: 0;
  transition: opacity .15s ease;
  pointer-events: none;
}

/* Hover (cursor devices): strengthen */
@media (hover: hover) and (pointer: fine) {
  .bible-verse:hover { background: #f5f5f4; }
  .bible-verse.has-messages:hover {
    background: #efedeb;
    border-left-color: #78716c;
  }
  .bible-verse.has-messages:hover .verse-msg-hint { opacity: 1; }
}

/* Selected verse / range */
.bible-verse.selected {
  background: #e7e5e4;
  border-left-color: #1c1917;
}
.bible-verse.selected .verse-number {
  background: #1c1917;
  color: #fff;
}

/* ---- Related messages drawer ---- */
.bible-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgb(0 0 0 / 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
  z-index: 55;
}

.bible-drawer {
  position: fixed;
  z-index: 60;
  background: #fff;
  display: flex;
  flex-direction: column;
  box-shadow: -12px 0 40px rgb(0 0 0 / 0.12);
}

/* Desktop / wide: right-side drawer */
@media (min-width: 768px) {
  .bible-drawer {
    top: 0;
    right: 0;
    height: 100dvh;
    width: min(420px, 92vw);
    border-left: 1px solid #e7e5e4;
    transform: translateX(102%);
    transition: transform .3s ease;
  }
  .bible-drawer.open { transform: translateX(0); }
  .bible-drawer-overlay { display: none; }
}

/* Mobile / narrow: bottom sheet */
@media (max-width: 767.98px) {
  .bible-drawer {
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 82dvh;
    border-top: 1px solid #e7e5e4;
    border-radius: 24px 24px 0 0;
    transform: translateY(105%);
    transition: transform .3s ease;
    box-shadow: 0 -12px 40px rgb(0 0 0 / 0.18);
  }
  .bible-drawer.open { transform: translateY(0); }
  .bible-drawer-overlay.open {
    opacity: 1;
    pointer-events: auto;
  }
}

.drawer-message {
  display: flex;
  gap: 12px;
  padding: 10px;
  border: 1px solid #e7e5e4;
  border-radius: 16px;
  background: #fff;
  transition: box-shadow .2s ease;
}
.drawer-message:hover { box-shadow: 0 4px 14px rgb(0 0 0 / 0.08); }
.drawer-message:focus-visible { outline: 2px solid #1c1917; outline-offset: 2px; }

.drawer-thumb {
  display: block;
  width: 84px;
  aspect-ratio: 16 / 10;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
}

/* ---- Fixed bottom navigation ---- */
.bible-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: rgb(255 255 255 / 0.94);
  backdrop-filter: blur(8px);
  border-top: 1px solid #e7e5e4;
  box-shadow: 0 -6px 24px rgb(0 0 0 / 0.06);
}
@media (min-width: 640px) {
  .bible-bottom-nav { left: 80px; } /* clear the icon rail (sm to below 2xl) */
}
@media (min-width: 1536px) {
  .bible-bottom-nav { left: 16rem; } /* clear the full 2xl sidebar */
}

.bnav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  min-height: 40px;
  border-radius: 12px;
  border: 1px solid #d6d3d1;
  background: #fff;
  font-size: 12.5px;
  font-weight: 600;
  color: #1c1917;
  white-space: nowrap;
  transition: background-color .15s ease, box-shadow .15s ease;
}
.bnav-btn:hover { background: #f5f5f4; box-shadow: 0 2px 8px rgb(0 0 0 / 0.06); }
.bnav-btn:focus-visible { outline: 2px solid #1c1917; outline-offset: 2px; }
.bnav-btn.disabled { opacity: .4; pointer-events: none; }

@media (max-width: 640px) {
  .bnav-label { display: none; }       /* icons only on small screens */
  .bnav-btn { padding: 9px 11px; }
  #bnavCurrent { display: none; }
}

/* ---- Autocomplete ---- */
#bibleSuggest li[aria-selected="true"] > * ,
#bibleSuggest li[aria-selected="true"] { background: #f5f5f4; }

/* Passage loading state */
#passageContainer.loading { opacity: .45; transition: opacity .15s ease; }

/* ---- Dark reading theme ---- */
html.dark .bible-panel {
  background: #171717;
  border-color: #2a2a2a;
  box-shadow: 0 18px 48px rgb(0 0 0 / .42);
}

html.dark #passageWrap {
  color: #e7e7e7;
}

html.dark .bible-verse {
  color: #e7e7e7;
}

html.dark .verse-number {
  color: #8f8f8f;
}

html.dark .verse-number:focus-visible {
  outline-color: #e7e7e7;
}

html.dark .bible-verse.has-messages {
  background: rgb(255 255 255 / .04);
  border-left-color: #3a3a3a;
}

html.dark .bible-verse.has-messages .verse-number {
  background: rgb(255 255 255 / .06);
  color: #b5b5b5;
}

html.dark .verse-msg-hint { color: #8f8f8f; }

@media (hover: hover) and (pointer: fine) {
  html.dark .bible-verse:hover { background: rgb(255 255 255 / .07); }
  html.dark .bible-verse.has-messages:hover {
    background: rgb(255 255 255 / .09);
    border-left-color: #8a8a8a;
  }
}

html.dark .bible-verse.selected {
  background: rgb(255 255 255 / .13);
  border-left-color: #e7e7e7;
}

html.dark .bible-verse.selected .verse-number {
  background: #e7e7e7;
  color: #111111;
}

html.dark .bible-drawer-overlay { background: rgb(0 0 0 / .7); }
html.dark .bible-drawer {
  background: #151515;
  box-shadow: -14px 0 44px rgb(0 0 0 / .5);
}

@media (min-width: 768px) {
  html.dark .bible-drawer { border-left-color: #2a2a2a; }
}

@media (max-width: 767.98px) {
  html.dark .bible-drawer {
    border-top-color: #2a2a2a;
    box-shadow: 0 -14px 44px rgb(0 0 0 / .55);
  }
}

html.dark .drawer-message {
  border-color: #2a2a2a;
  background: #1c1c1c;
}
html.dark .drawer-message:hover { box-shadow: 0 4px 18px rgb(0 0 0 / .38); }
html.dark .drawer-message:focus-visible { outline-color: #e7e7e7; }

html.dark .bible-bottom-nav {
  background: rgb(13 13 13 / .94);
  border-top-color: #2a2a2a;
  box-shadow: 0 -8px 28px rgb(0 0 0 / .35);
}

html.dark .bnav-btn {
  border-color: #404040;
  background: #1c1c1c;
  color: #e7e7e7;
}
html.dark .bnav-btn:hover { background: #2a2a2a; box-shadow: 0 2px 10px rgb(0 0 0 / .3); }
html.dark .bnav-btn:focus-visible { outline-color: #e7e7e7; }

html.dark #bibleSuggest li[aria-selected="true"] > *,
html.dark #bibleSuggest li[aria-selected="true"] { background: #2a2a2a; }
