/* Bible Reading Experience — Pattern 03 (see design_guidelines.md).
   Layered on top of tokens.css / app.css / home.css. Uses the Home shell
   pattern (cream page with rounded top corners on the tab bar). */

.bible-shell {
  background: var(--color-cream-50);
  overflow: hidden auto;
  min-height: 100%;
  /* Safe-area guards for iPhone notch / Dynamic Island / Android system bars.
     Effective on both browser (env(safe-area-inset-*) resolves to 0) and
     Capacitor native (real device insets). */
  padding-top: env(safe-area-inset-top);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.bible-screen {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding-bottom: calc(6rem + env(safe-area-inset-bottom)); /* room for bottom tab bar + home indicator */
}

/* --- Hero band --- */
/* Build 2 Issue 8 — decorative Bible hero band removed. Keep the styles
   below in place (dormant) in case the hero returns in a future sprint;
   they're not applied by any current markup. Selector pill row now floats
   over the plain cream page top with no negative margin needed. */
.bible-hero { display: none; }
.bible-hero-brand,
.bible-hero-brand-mark,
.bible-hero-brand-name,
.bible-hero-bookmark { display: none; }

/* --- Selector pill row --- */
.bible-selectors {
  display: grid;
  grid-template-columns: 0.85fr 1.25fr 1.05fr;
  gap: 0.35rem;
  background: #fff;
  padding: 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(24, 53, 41, 0.1);
  box-shadow: 0 0.4rem 1rem rgba(24, 53, 41, 0.06);
  margin: max(1rem, env(safe-area-inset-top)) 1rem 0;
  position: relative;
  z-index: 2;
}
.bible-selector {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--color-forest-800);
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.5rem 1.15rem 0.5rem 0.7rem;
  border-radius: 999px;
  text-align: left;
  cursor: pointer;
  position: relative;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bible-selector::after {
  content: "";
  position: absolute;
  right: 0.85rem;
  top: 50%;
  width: 0.55rem;
  height: 0.55rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-70%) rotate(45deg);
  opacity: 0.65;
}
.bible-selector:hover { background: rgba(24, 53, 41, 0.04); }
.bible-selector:focus-visible { outline: 2px solid var(--color-forest-800); outline-offset: 2px; }

/* --- Chapter header --- */
.bible-chapter-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 1.4rem 0.25rem;
}
.bible-chapter-title {
  font-family: var(--font-serif, "Fraunces", "Playfair Display", serif);
  font-size: 2.35rem;
  line-height: 1.05;
  margin: 0;
  color: var(--color-forest-900);
  font-weight: 600;
}
.bible-chapter-subtitle {
  font-family: var(--font-serif, "Fraunces", "Playfair Display", serif);
  font-style: italic;
  color: rgba(24, 53, 41, 0.65);
  margin: 0.35rem 1.4rem 0.6rem;
  font-size: 1.02rem;
}
.bible-chapter-meta {
  display: flex; align-items: center; gap: 0.85rem;
  color: var(--color-forest-800);
  font-weight: 600;
  font-size: 0.95rem;
  padding-bottom: 0.35rem;
}
.bible-chapter-meta .icon-btn {
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: inherit;
  display: inline-flex;
  align-items: center;
}
.bible-chapter-meta .icon-btn svg { width: 1.2rem; height: 1.2rem; }

/* --- Verse list --- */
.bible-verses {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 0.75rem 1.15rem 1.5rem;
}
.bible-verse {
  position: relative;
  display: grid;
  grid-template-columns: 1.6rem 1fr auto;
  gap: 0.55rem;
  align-items: start;
  padding: 0.55rem 0.6rem 0.55rem 0.55rem;
  border-radius: 0.9rem;
  border: 1px solid transparent;
  border-left: 3px solid transparent;
  transition: background-color 120ms ease, border-color 120ms ease;
  cursor: pointer;
}
.bible-verse:hover { background: rgba(24, 53, 41, 0.03); }
.bible-verse.is-selected {
  border-color: rgba(24, 53, 41, 0.12);
  background: rgba(24, 53, 41, 0.04);
}
.bible-verse.has-highlight { border-left-color: var(--rooted-hl, #F6D67A); background: var(--rooted-hl-bg, #FFF3D0); }
.bible-verse-num {
  font-weight: 600;
  color: var(--color-forest-700, #2f5b3f);
  font-size: 1rem;
  padding-top: 0.15rem;
  text-align: right;
}
.bible-verse-text {
  color: #1f2a24;
  font-size: 1.05rem;
  line-height: 1.55;
  font-family: var(--font-serif, "Fraunces", "Playfair Display", serif);
  font-weight: 400;
}
/* Red Letter mode — words of Jesus rendered in a printed-Bible crimson.
   Elegant, non-neon; matches traditional Red Letter Bibles. */
.rooted-red-letter { color: #8B1E1E; }

.bible-settings-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--color-forest-800);
  padding: 0.1rem 0.35rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}
.bible-settings-btn svg { width: 1.2rem; height: 1.2rem; }
.bible-settings-btn:hover { color: var(--color-forest-900); }

.bible-settings-sheet .bible-picker-title { padding-bottom: 0.35rem; }
.bible-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 0.35rem;
  border-top: 1px solid rgba(24, 53, 41, 0.08);
}
.bible-settings-row:first-of-type { border-top: 0; }
.bible-settings-row-label { display: flex; flex-direction: column; gap: 0.15rem; }
.bible-settings-row-label span:first-child { font-weight: 600; color: var(--color-forest-900); font-size: 0.98rem; }
.bible-settings-row-label span:last-child { color: rgba(24, 53, 41, 0.6); font-size: 0.82rem; line-height: 1.35; }
.bible-settings-row-label small { color: rgba(24, 53, 41, 0.55); font-size: 0.75rem; }
.bible-toggle {
  appearance: none;
  width: 2.8rem;
  height: 1.55rem;
  border-radius: 999px;
  background: rgba(24, 53, 41, 0.18);
  position: relative;
  cursor: pointer;
  transition: background 160ms ease;
  border: 0;
  flex: 0 0 auto;
}
.bible-toggle::after {
  content: "";
  position: absolute;
  top: 0.13rem;
  left: 0.13rem;
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 50%;
  background: #fff;
  transition: transform 160ms ease;
  box-shadow: 0 0.1rem 0.35rem rgba(24, 53, 41, 0.25);
}
.bible-toggle[aria-checked="true"] { background: var(--color-forest-800); }
.bible-toggle[aria-checked="true"]::after { transform: translateX(1.25rem); }
.bible-toggle:disabled { opacity: 0.4; cursor: not-allowed; }
.bible-verse-kebab {
  align-self: start;
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(24, 53, 41, 0.55);
  padding: 0.15rem 0.35rem;
  cursor: pointer;
  display: none;
}
.bible-verse.is-selected .bible-verse-kebab,
.bible-verse.has-highlight .bible-verse-kebab { display: inline-flex; }

.bible-verse-note-indicator {
  display: inline-flex;
  align-items: center;
  color: var(--color-forest-800);
  margin-left: 0.35rem;
  opacity: 0.75;
}
.bible-verse-favorite-indicator { color: #B5822B; margin-left: 0.35rem; }

/* --- Floating action menu (verse actions) --- */
.bible-action-menu {
  position: fixed;
  right: 1rem;
  bottom: 12.5rem;
  z-index: 40;
  background: #fff;
  border-radius: 1rem;
  padding: 0.65rem 0.35rem;
  box-shadow: 0 1.2rem 2.4rem rgba(24, 53, 41, 0.22);
  border: 1px solid rgba(24, 53, 41, 0.08);
  min-width: 12.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.bible-action {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0.7rem 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-radius: 0.65rem;
  color: var(--color-forest-900);
  font-size: 0.98rem;
  font-weight: 500;
  cursor: pointer;
  width: 100%;
  text-align: left;
}
.bible-action:hover { background: rgba(24, 53, 41, 0.06); }
.bible-action svg { width: 1.25rem; height: 1.25rem; color: currentColor; }
.bible-action-cancel { border-top: 1px solid rgba(24, 53, 41, 0.08); margin-top: 0.25rem; padding-top: 0.75rem; justify-content: center; color: rgba(24, 53, 41, 0.65); font-weight: 500; }

/* --- Highlight palette (sub-menu) --- */
.bible-palette {
  position: fixed;
  right: 1rem;
  bottom: 12.5rem;
  z-index: 41;
  background: #fff;
  border-radius: 1rem;
  padding: 0.9rem;
  box-shadow: 0 1.2rem 2.4rem rgba(24, 53, 41, 0.22);
  border: 1px solid rgba(24, 53, 41, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 14rem;
}
.bible-palette h4 { margin: 0 0 0.35rem; font-size: 0.85rem; color: rgba(24, 53, 41, 0.7); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.bible-palette-swatch {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.5rem 0.6rem; border-radius: 0.6rem; cursor: pointer;
  border: 1px solid transparent; background: transparent;
  font-weight: 500; color: var(--color-forest-900); font-size: 0.95rem; text-align: left;
}
.bible-palette-swatch:hover { background: rgba(24, 53, 41, 0.05); }
.bible-palette-swatch .dot { width: 1.1rem; height: 1.1rem; border-radius: 999px; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08); }
.bible-palette-swatch.is-active { border-color: rgba(24, 53, 41, 0.2); background: rgba(24, 53, 41, 0.04); }
.bible-palette-remove {
  margin-top: 0.15rem;
  padding: 0.55rem 0.6rem;
  border-radius: 0.6rem;
  background: transparent;
  border: 1px solid rgba(24, 53, 41, 0.12);
  color: rgba(24, 53, 41, 0.75);
  cursor: pointer;
  font-weight: 500;
}

/* --- Audio player --- */
.bible-audio {
  position: sticky;
  bottom: 4.5rem;
  margin: auto 0.85rem 0;
  background: rgba(255, 250, 240, 0.98);
  border-radius: 1.1rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid rgba(24, 53, 41, 0.1);
  box-shadow: 0 0.6rem 1.4rem rgba(24, 53, 41, 0.1);
  display: grid;
  gap: 0.55rem;
}
.bible-audio-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto auto;
  align-items: center;
  gap: 0.6rem;
}
.bible-audio-thumb {
  width: 2.6rem; height: 2.6rem;
  border-radius: 999px;
  background:
    url("../assets/page1-login-cinematic.jpg") center / cover no-repeat;
  border: 1px solid rgba(24, 53, 41, 0.14);
}
.bible-audio-title { font-weight: 600; color: var(--color-forest-900); font-size: 0.95rem; line-height: 1.2; }
.bible-audio-sub { font-style: italic; color: rgba(24, 53, 41, 0.6); font-size: 0.82rem; margin-top: 0.1rem; }
.bible-audio-btn {
  appearance: none;
  background: #fff;
  border: 1px solid rgba(24, 53, 41, 0.14);
  color: var(--color-forest-900);
  width: 2.35rem; height: 2.35rem;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.bible-audio-btn.primary {
  width: 3rem; height: 3rem;
  background: var(--color-forest-800, #245140);
  color: #fff;
  border: none;
}
.bible-audio-btn svg { width: 1.05rem; height: 1.05rem; }
.bible-audio-btn.primary svg { width: 1.35rem; height: 1.35rem; }
.bible-audio-progress {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0.55rem;
  color: rgba(24, 53, 41, 0.6); font-size: 0.75rem;
}
.bible-audio-progress-bar { height: 4px; border-radius: 4px; background: rgba(24, 53, 41, 0.1); overflow: hidden; }
.bible-audio-progress-bar > span { display: block; height: 100%; background: var(--color-forest-800); width: var(--progress, 0%); transition: width 300ms linear; }

/* --- Selector sheet (modal picker) --- */
.bible-picker-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(24, 53, 41, 0.35);
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.bible-picker {
  background: var(--color-cream-50);
  width: 100%;
  max-width: 30rem;
  max-height: 78vh;
  border-radius: 1.4rem 1.4rem 0 0;
  padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.bible-picker-handle { width: 2.8rem; height: 0.35rem; border-radius: 999px; background: rgba(24, 53, 41, 0.15); margin: 0 auto 0.4rem; }
.bible-picker-title { text-align: center; font-weight: 600; color: var(--color-forest-900); font-size: 1.05rem; padding-bottom: 0.4rem; }
.bible-picker-list { overflow: auto; display: grid; gap: 0.25rem; }
.bible-picker-item {
  appearance: none;
  background: transparent; border: 0;
  padding: 0.8rem 0.85rem;
  text-align: left;
  border-radius: 0.7rem;
  font: inherit;
  color: var(--color-forest-900);
  cursor: pointer;
}
.bible-picker-item:hover { background: rgba(24, 53, 41, 0.06); }
.bible-picker-item.is-active {
  background: var(--color-forest-800);
  color: #fff;
}
.bible-picker-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.35rem;
}
.bible-picker-grid .bible-picker-item { text-align: center; padding: 0.65rem 0.35rem; font-weight: 600; }

/* --- Note editor sheet --- */
.bible-note-sheet .bible-picker-title { padding-bottom: 0.1rem; }
.bible-note-sheet textarea {
  width: 100%;
  min-height: 8rem;
  border-radius: 0.9rem;
  padding: 0.75rem;
  font: inherit;
  color: var(--color-forest-900);
  background: #fff;
  border: 1px solid rgba(24, 53, 41, 0.14);
  resize: vertical;
  margin-top: 0.5rem;
}
.bible-note-existing {
  margin-top: 0.75rem;
  display: grid;
  gap: 0.55rem;
}
.bible-note-existing article {
  background: #fff;
  border: 1px solid rgba(24, 53, 41, 0.1);
  padding: 0.65rem 0.75rem;
  border-radius: 0.75rem;
  color: rgba(24, 53, 41, 0.85);
  font-size: 0.92rem;
}
.bible-note-existing article header { display: flex; justify-content: space-between; font-size: 0.72rem; color: rgba(24, 53, 41, 0.55); margin-bottom: 0.3rem; }
.bible-note-existing button {
  appearance: none;
  background: transparent;
  border: 0;
  color: rgba(24, 53, 41, 0.55);
  cursor: pointer;
  font-size: 0.7rem;
  padding: 0;
}
.bible-note-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.bible-note-actions button {
  flex: 1;
  padding: 0.75rem 1rem;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  font: inherit;
}
.bible-note-save {
  background: var(--color-forest-800);
  color: #fff;
  border: none;
}
.bible-note-cancel {
  background: transparent;
  border: 1px solid rgba(24, 53, 41, 0.18);
  color: var(--color-forest-900);
}

/* --- Toast (share confirm etc.) --- */
.bible-toast {
  position: fixed;
  left: 50%;
  bottom: 6.5rem;
  transform: translateX(-50%);
  background: var(--color-forest-800);
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 80;
  box-shadow: 0 1rem 2rem rgba(24, 53, 41, 0.28);
}

/* --- Loading + empty states --- */
.bible-loading { padding: 4rem 1.5rem; text-align: center; color: rgba(24, 53, 41, 0.55); font-style: italic; }

/* Build 2 Issue 9 — persistent Bible playback controls bar. Sits between
   the chapter head and the verses so audio is always one tap away without
   scrolling. Play/pause on the left, cycling speed indicator on the right. */
.bible-playback {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
  margin: 0.35rem 1rem 0.6rem;
}
.bible-playback-play {
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 3rem;
  padding: 0 1.1rem;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--color-forest-700), var(--color-forest-900));
  color: var(--color-cream-50);
  font-weight: 700;
  font-size: 0.98rem;
  letter-spacing: 0.01em;
  box-shadow: 0 0.55rem 1.35rem rgba(24, 53, 41, 0.18);
  cursor: pointer;
}
.bible-playback-play svg { width: 1.05rem; height: 1.05rem; stroke: currentColor; fill: none; }
.bible-playback-play[data-audio-state="playing"] {
  background: linear-gradient(180deg, var(--color-clay-500), #7c4a30);
}
.bible-playback-speed {
  flex: 0 0 auto;
  min-width: 3.25rem;
  min-height: 3rem;
  padding: 0 0.95rem;
  border: 1px solid rgba(24, 53, 41, 0.14);
  border-radius: 999px;
  background: #fff;
  color: var(--color-forest-800);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  box-shadow: 0 0.35rem 0.9rem rgba(24, 53, 41, 0.08);
}
.bible-playback-speed:active { transform: translateY(1px); }
