/* Gnosis Bible — component styles layered on Tailwind (CDN). Light + dark via prefers-color-scheme. */

:root {
  --paper: #faf8f4;
  --ink: #1c1917;
  --muted: #78716c;
  --line: #e7e2d8;
  --card: #ffffff;
  --brand: #1f3360;
  --brand-hover: #172648;
  --accent: #b8862a;
  --accent-soft: #fbf0d2;
  --focus: #4767ae;
  --highlight-bg: #f9e7b5;
  --highlight-ink: #1c1917;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0e131d;
    --ink: #f5f5f4;
    --muted: #a8a29e;
    --line: rgb(255 255 255 / 0.08);
    --card: #141b28;
    --brand: #f3d58a;
    --brand-hover: #fbf0d2;
    --accent: #ebc25c;
    --accent-soft: rgb(235 194 92 / 0.12);
    --focus: #ebc25c;
    --highlight-bg: rgb(235 194 92 / 0.2);
    --highlight-ink: #fff7e0;
    color-scheme: dark;
  }
}

/* Always reserve room for the scrollbar, so the page doesn't shift sideways
   when its height changes (e.g. switching between the Old and New Testament lists). */
html { scrollbar-gutter: stable; }
body { font-feature-settings: 'cv11', 'ss01'; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

/* --- Shell ---------------------------------------------------------------- */
.logo-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.25rem; height: 2.25rem; border-radius: 0.7rem;
  background: linear-gradient(145deg, #2c4379, #172648);
  color: #f3d58a;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.12), 0 6px 16px -8px rgb(23 38 72 / 0.6);
}
.nav-link {
  padding: 0.45rem 0.8rem; border-radius: 999px; font-size: 0.875rem; font-weight: 500;
  color: var(--muted); transition: color .15s, background-color .15s;
}
.nav-link:hover { color: var(--ink); background: rgb(120 113 108 / 0.08); }
.nav-link.is-active { color: var(--ink); background: rgb(120 113 108 / 0.12); }
.menu-link { display: block; padding: 0.55rem 1rem; color: inherit; }
.menu-link:hover { background: rgb(120 113 108 / 0.08); }
details > summary::-webkit-details-marker { display: none; }

.auth-bg {
  background-image:
    radial-gradient(60rem 30rem at 50% -10%, rgb(243 213 138 / 0.25), transparent 70%),
    radial-gradient(40rem 30rem at 100% 100%, rgb(71 103 174 / 0.10), transparent 70%);
}
@media (prefers-color-scheme: dark) {
  .auth-bg {
    background-image:
      radial-gradient(60rem 30rem at 50% -10%, rgb(235 194 92 / 0.10), transparent 70%),
      radial-gradient(40rem 30rem at 100% 100%, rgb(71 103 174 / 0.12), transparent 70%);
  }
}

/* --- Surfaces & controls ---------------------------------------------------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  box-shadow: 0 1px 2px rgb(28 25 23 / 0.04), 0 8px 24px -12px rgb(28 25 23 / 0.10);
}
@media (prefers-color-scheme: dark) { .card { box-shadow: 0 1px 0 rgb(255 255 255 / 0.03) inset; } }

.field-label { display: block; font-size: 0.875rem; font-weight: 500; color: var(--ink); opacity: .85; }
.field.field {
  margin-top: 0.375rem; display: block; width: 100%;
  border-radius: 0.65rem; border: 1px solid var(--line);
  background: var(--card); color: var(--ink);
  font-size: 0.9375rem; padding: 0.6rem 0.8rem;
  box-shadow: 0 1px 1px rgb(28 25 23 / 0.03);
  transition: border-color .15s, box-shadow .15s;
}
.field.field:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px rgb(71 103 174 / 0.18); }
@media (prefers-color-scheme: dark) {
  .field.field { background: rgb(255 255 255 / 0.03); }
  .field.field:focus { box-shadow: 0 0 0 3px rgb(235 194 92 / 0.18); }
}
textarea.field.field { line-height: 1.6; }
.checkbox.checkbox {
  width: 1.05rem; height: 1.05rem; border-radius: 0.3rem; border-color: #a8a29e;
  color: var(--brand); background-color: transparent;
}
.checkbox.checkbox:focus { box-shadow: 0 0 0 3px rgb(71 103 174 / 0.2); }
@media (prefers-color-scheme: dark) { .checkbox.checkbox:checked { color: #ebc25c; } }

.btn-primary, .btn-secondary, .btn-ghost, .btn-danger {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  border-radius: 0.75rem; padding: 0.6rem 1.1rem;
  font-size: 0.875rem; font-weight: 600; line-height: 1.25rem;
  transition: background-color .15s, color .15s, border-color .15s, transform .05s, opacity .15s;
  cursor: pointer; white-space: nowrap;
}
.btn-primary:active, .btn-secondary:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 6px 18px -10px rgb(23 38 72 / 0.7); }
.btn-primary:hover { background: var(--brand-hover); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
@media (prefers-color-scheme: dark) { .btn-primary { color: #172648; box-shadow: none; } }
.btn-secondary { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.btn-secondary:hover { border-color: #a8a29e; }
.btn-ghost { color: var(--muted); padding-left: .75rem; padding-right: .75rem; }
.btn-ghost:hover { color: var(--ink); background: rgb(120 113 108 / 0.08); }
.btn-danger { background: transparent; color: #be123c; border: 1px solid rgb(190 18 60 / 0.25); }
.btn-danger:hover { background: rgb(190 18 60 / 0.06); }
@media (prefers-color-scheme: dark) { .btn-danger { color: #fda4af; border-color: rgb(253 164 175 / 0.25); } }

.link { color: #365295; font-weight: 500; }
.link:hover { color: #172648; text-decoration: underline; text-underline-offset: 3px; }
@media (prefers-color-scheme: dark) { .link { color: #ebc25c; } .link:hover { color: #fbf0d2; } }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.5rem; height: 2.5rem; border-radius: 999px; color: var(--muted);
  transition: color .15s, background-color .15s;
}
.icon-btn:hover:not(:disabled) { color: var(--ink); background: rgb(120 113 108 / 0.1); }
.icon-btn:disabled { opacity: .35; }

.segmented { display: inline-flex; padding: 3px; border-radius: 999px; background: rgb(120 113 108 / 0.1); }
.segmented button {
  padding: 0.4rem 0.95rem; border-radius: 999px; font-size: 0.8125rem; font-weight: 600; color: var(--muted);
  transition: all .15s;
}
.segmented button[aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgb(28 25 23 / 0.12); }
@media (prefers-color-scheme: dark) { .segmented button[aria-selected="true"] { background: #253044; } }

/* --- Builder --------------------------------------------------------------- */
.book-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  padding: 0.6rem 0.75rem; border-radius: 0.7rem; font-size: 0.875rem; text-align: left;
  color: var(--ink); border: 1px solid transparent;
  transition: background-color .12s, border-color .12s;
}
.book-btn:hover { background: rgb(120 113 108 / 0.07); }
.book-btn.is-active { background: var(--accent-soft); border-color: rgb(184 134 42 / 0.35); }
.book-btn.has-selection { font-weight: 600; }
.book-count {
  min-width: 1.4rem; padding: 0 0.4rem; border-radius: 999px; text-align: center;
  font-size: 0.7rem; font-weight: 700; line-height: 1.25rem;
  background: var(--brand); color: #fff;
}
@media (prefers-color-scheme: dark) { .book-count { color: #172648; } }

.chapter-chip {
  aspect-ratio: 1 / 1; border-radius: 0.65rem; font-size: 0.875rem; font-weight: 500;
  color: var(--ink); background: var(--card); border: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
  transition: background-color .1s, border-color .1s, color .1s, transform .05s;
  user-select: none;
}
.chapter-chip:hover { border-color: #a8a29e; }
.chapter-chip:active { transform: scale(0.96); }
.chapter-chip.is-selected { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
@media (prefers-color-scheme: dark) { .chapter-chip.is-selected { color: #172648; } }

.plan-row {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.55rem 0.4rem 0.55rem 0.85rem; border-radius: 0.8rem;
  background: rgb(120 113 108 / 0.06);
}

/* --- Player ---------------------------------------------------------------- */
.reading {
  font-family: Newsreader, ui-serif, Georgia, serif;
  font-size: clamp(1.2rem, 1.05rem + 0.5vw, 1.45rem);
  line-height: 1.75; color: var(--ink);
  max-width: 40rem;
}
.reading p + p { margin-top: 1.1em; }
.reading .sentence {
  border-radius: 0.3em; padding: 0.08em 0.1em; margin: 0 -0.1em;
  cursor: pointer; transition: background-color .35s ease, color .35s ease, opacity .35s ease;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.reading .sentence:hover { background: rgb(120 113 108 / 0.08); }
.reading .sentence.is-active { background: var(--highlight-bg); color: var(--highlight-ink); }
.reading-footer { margin-top: 2.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); font-family: Inter, system-ui, sans-serif; }

.skeleton {
  height: 1.05rem; border-radius: 0.4rem;
  background: linear-gradient(90deg, rgb(120 113 108 / 0.08), rgb(120 113 108 / 0.16), rgb(120 113 108 / 0.08));
  background-size: 200% 100%; animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.queue-item {
  display: flex; width: 100%; align-items: center; gap: 0.7rem;
  padding: 0.55rem 0.75rem; border-radius: 0.75rem; font-size: 0.875rem; text-align: left;
  color: var(--ink); transition: background-color .12s;
}
.queue-item:hover { background: rgb(120 113 108 / 0.07); }
.queue-item.is-current { background: var(--accent-soft); font-weight: 600; }
.queue-item.is-done { color: var(--muted); }
.q-num {
  flex: none; width: 1.75rem; height: 1.75rem; border-radius: 0.5rem;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 600; font-variant-numeric: tabular-nums;
  background: rgb(120 113 108 / 0.1); color: var(--muted);
}
.queue-item.is-current .q-num { background: var(--brand); color: #fff; }
@media (prefers-color-scheme: dark) { .queue-item.is-current .q-num { color: #172648; } }
.q-dot { flex: none; width: 0.5rem; height: 0.5rem; border-radius: 999px; background: rgb(120 113 108 / 0.3); }
.q-dot.is-ready { background: #10b981; }
.q-dot.is-error { background: #e11d48; }
.q-spin {
  flex: none; display: inline-block; width: 0.85rem; height: 0.85rem; border-radius: 999px;
  border: 2px solid rgb(120 113 108 / 0.3); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Focus mode (full screen): just the text, large, with the transport bar. */
body.is-focus > header,
body.is-focus .player-back,
body.is-focus .player-aside,
body.is-focus .reading-footer { display: none; }
body.is-focus { background: var(--paper); }
body.is-focus .player-grid { display: block; }
body.is-focus > main { max-width: none; padding-left: 0; padding-right: 0; }
body.is-focus .player-card {
  background: transparent; border-color: transparent; box-shadow: none;
  max-width: none; margin: 0; padding: 3rem clamp(1.25rem, 4vw, 4rem) 0;
}
body.is-focus #now-title { font-size: clamp(2.5rem, 1.8rem + 2.5vw, 4rem); }
body.is-focus .reading,
body.is-focus .reading.is-scripture {
  font-size: clamp(1.85rem, 1.25rem + 1.9vw, 3rem); line-height: 1.7; max-width: none;
}
/* Scripture: each verse on its own line, like paragraphs. */
body.is-focus .reading.is-scripture .sentence:not(.is-heading) { display: block; margin-bottom: 0.55em; }

.transport {
  position: fixed; inset: auto 0 0 0; z-index: 40;
  padding: 0.85rem 0 calc(0.85rem + env(safe-area-inset-bottom));
  background: rgb(250 248 244 / 0.88);
  border-top: 1px solid var(--line);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
}
@media (prefers-color-scheme: dark) { .transport { background: rgb(14 19 29 / 0.88); } }
.play-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 3.25rem; height: 3.25rem; border-radius: 999px;
  background: var(--brand); color: #fff;
  box-shadow: 0 10px 24px -10px rgb(23 38 72 / 0.8);
  transition: transform .1s, background-color .15s;
}
.play-btn:hover { background: var(--brand-hover); }
.play-btn:active { transform: scale(0.95); }
@media (prefers-color-scheme: dark) { .play-btn { color: #172648; box-shadow: none; } }
.play-btn .icon-play { margin-left: 3px; }

.scrubber { -webkit-appearance: none; appearance: none; height: 1rem; background: transparent; cursor: pointer; --progress: 0%; }
.scrubber::-webkit-slider-runnable-track {
  height: 4px; border-radius: 999px;
  background: linear-gradient(to right, var(--accent) var(--progress), rgb(120 113 108 / 0.2) var(--progress));
}
.scrubber::-moz-range-track { height: 4px; border-radius: 999px; background: rgb(120 113 108 / 0.2); }
.scrubber::-moz-range-progress { height: 4px; border-radius: 999px; background: var(--accent); }
.scrubber::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 999px;
  background: var(--card); border: 2px solid var(--accent); box-shadow: 0 1px 3px rgb(0 0 0 / .2);
}
.scrubber::-moz-range-thumb { width: 12px; height: 12px; border-radius: 999px; background: var(--card); border: 2px solid var(--accent); }

.speed-select.speed-select {
  border: 1px solid var(--line); background: transparent; color: var(--ink);
  border-radius: 999px; font-size: 0.8125rem; font-weight: 600; padding: 0.35rem 2rem 0.35rem 0.8rem;
}

/* --- Preferences ------------------------------------------------------------- */
.voice-option { position: relative; }
.voice-option input { position: absolute; opacity: 0; pointer-events: none; }
.voice-card {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.7rem 0.7rem 0.7rem 0.9rem;
  border: 1px solid var(--line); border-radius: 0.9rem; cursor: pointer;
  transition: border-color .12s, background-color .12s, box-shadow .12s;
}
.voice-card:hover { border-color: #a8a29e; }
.voice-option input:checked + .voice-card { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset; }
.voice-option input:focus-visible + .voice-card { outline: 2px solid var(--focus); outline-offset: 2px; }
.voice-avatar {
  flex: none; width: 2.25rem; height: 2.25rem; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: Newsreader, Georgia, serif; font-size: 1.05rem;
  background: rgb(120 113 108 / 0.1); color: var(--ink);
}
.sample-btn.is-playing { color: var(--accent); }

.stat { padding: 1rem 1.1rem; border-radius: 1rem; background: rgb(120 113 108 / 0.06); }
.badge {
  display: inline-flex; align-items: center; padding: 0.1rem 0.55rem; border-radius: 999px;
  font-size: 0.7rem; font-weight: 600; letter-spacing: .02em;
}
.badge-gold { background: var(--accent-soft); color: #946a22; }
.badge-gray { background: rgb(120 113 108 / 0.12); color: var(--muted); }
.badge-red  { background: rgb(225 29 72 / 0.1); color: #be123c; }
@media (prefers-color-scheme: dark) { .badge-gold { color: #f3d58a; } .badge-red { color: #fda4af; } }

.section-title { font-family: Newsreader, Georgia, serif; font-size: 1.5rem; color: var(--ink); }
.section-sub { margin-top: 0.25rem; font-size: 0.875rem; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

.field.field.field-search { margin-top: 0; padding-top: 0.5rem; padding-bottom: 0.5rem; padding-left: 2.25rem; }

/* Scripture readings */
.reading.is-scripture { font-size: clamp(1.15rem, 1rem + 0.45vw, 1.35rem); line-height: 1.85; }
.reading .sentence.is-heading { display: none; }
/* Psalm superscription: read aloud, shown smaller and in italics above verse 1. */
.reading .psalm-title { font-style: italic; font-size: 0.88em; opacity: 0.8; }
.verse-num {
  font-family: Inter, system-ui, sans-serif; font-size: 0.6em; font-weight: 600;
  color: var(--accent); margin-right: 0.2em; vertical-align: super; line-height: 0;
}
.q-kind { margin-left: 0.4rem; font-size: 0.7rem; font-weight: 500; color: var(--muted); }
.q-num.is-reading { background: var(--accent-soft); color: var(--accent); }

/* --- Admin ------------------------------------------------------------------ */
.segmented-link { display: inline-block; padding: .4rem .95rem; border-radius: 999px; font-size: .875rem; font-weight: 500; color: var(--muted); }
.segmented-link[aria-current="page"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgb(28 25 23 / 0.12); }
.admin-table { width: 100%; font-size: .875rem; border-collapse: collapse; }
.admin-table th { padding: .7rem 1rem; text-align: left; font-size: .7rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); }
.admin-table th.text-right { text-align: right; }
.admin-table td { padding: .8rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: 0; }
.credit-pill { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .7rem; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--accent-soft); color: var(--ink); }

/* --- Landing page --------------------------------------------------------- */
.landing-hero {
  background:
    radial-gradient(60rem 30rem at 85% 10%, rgb(243 213 138 / 0.14), transparent 60%),
    radial-gradient(50rem 30rem at 0% 100%, rgb(71 103 174 / 0.35), transparent 60%),
    linear-gradient(180deg, #24366b 0%, #172648 55%, #0f1a33 100%);
}
.landing-mark {
  display: inline-flex; align-items: center; justify-content: center; border-radius: 22%;
  background: linear-gradient(160deg, #2c4379, #0f1a33); color: #f3d58a;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.12), 0 8px 24px -10px rgb(15 26 51 / 0.6);
}
.landing-phone {
  display: block; width: 100%; height: auto; border-radius: 2.4rem;
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.14), 0 40px 80px -30px rgb(0 0 0 / 0.65);
}
.landing-glow {
  position: absolute; inset: 12% -18% 8%; border-radius: 50%;
  background: radial-gradient(closest-side, rgb(243 213 138 / 0.28), transparent); filter: blur(10px);
}
.landing-store {
  display: inline-flex; align-items: center; gap: .6rem; border-radius: .9rem; padding: .55rem 1.1rem;
  background: #000; color: #fff; box-shadow: 0 0 0 1px rgb(255 255 255 / 0.25);
}
.landing-store:hover { background: #111; }
.landing-dot {
  display: block; width: .65rem; height: .65rem; border-radius: 999px;
  background: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft);
}
@media (prefers-color-scheme: dark) { .landing-phone { box-shadow: 0 0 0 1px rgb(255 255 255 / 0.1), 0 30px 60px -30px rgb(0 0 0 / 0.8); } }

/* --- Email confirmation banner ------------------------------------------- */
.verify-banner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem;
  padding: .85rem 1rem; border-radius: .9rem;
  background: var(--accent-soft); border: 1px solid rgb(184 134 42 / 0.25); color: var(--ink);
}
