/* Daily Devotional — modeled on the quiet, airy reading view of the ESV Bible app */
:root {
  --paper: #f8f8f7;
  --surface: #ffffff;
  --ink: #232323;
  --ink-soft: #5f5f5f;
  --ink-faint: #8e8e8e;
  --rule: #e7e7e5;
  --accent: #5f9db3;          /* ESV-app teal blue */
  --accent-strong: #3f7f96;
  --accent-ink: #ffffff;
  --accent-soft: #e8f2f5;
  --gold: #b49b62;
  --ok: #4f8a6c;
  --serif: "Source Serif 4", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: "Source Sans 3", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --text-size: 21px;
  --gutter: 30px;
  --tabbar-h: 66px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121212; --surface: #1c1c1c; --ink: #e9e9e7; --ink-soft: #b3b3b0; --ink-faint: #7d7d7a;
    --rule: #2c2c2b; --accent: #7cb8cc; --accent-strong: #9acbdb; --accent-ink: #0d1a1f; --accent-soft: #1d2d33;
    --gold: #c9b07a; --ok: #82c3a1; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #121212; --surface: #1c1c1c; --ink: #e9e9e7; --ink-soft: #b3b3b0; --ink-faint: #7d7d7a;
  --rule: #2c2c2b; --accent: #7cb8cc; --accent-strong: #9acbdb; --accent-ink: #0d1a1f; --accent-soft: #1d2d33;
  --gold: #c9b07a; --ok: #82c3a1; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--sans); line-height: 1.5;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 20px);
}
a { color: var(--accent-strong); }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: 44px 1fr 44px; align-items: center;
  background: var(--paper); border-bottom: 1px solid var(--rule);
  padding: calc(env(safe-area-inset-top) + 8px) 12px 8px;
}
.mark { width: 26px; height: 26px; position: relative; justify-self: start; margin-left: 6px; }
.mark::before, .mark::after { content: ""; position: absolute; background: var(--gold); border-radius: 1px; }
.mark::before { left: 11.5px; top: 1px; width: 3px; height: 24px; }
.mark::after { left: 4px; top: 7.5px; width: 18px; height: 3px; }
.title-wrap { display: flex; align-items: center; justify-content: center; gap: 2px; position: relative; min-width: 0; }
.title-btn {
  display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; cursor: pointer;
  color: var(--accent); font-family: var(--sans); font-weight: 600; font-size: 20px; padding: 6px 4px; white-space: nowrap;
}
.nav-arrow {
  border: 0; background: none; cursor: pointer; color: var(--ink-faint); font-size: 26px; line-height: 1;
  width: 32px; height: 36px; border-radius: 8px;
}
.nav-arrow:hover { color: var(--accent); }
#datePicker { position: absolute; left: 50%; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; padding: 0; }
.icon-btn {
  background: none; border: 0; padding: 8px; border-radius: 8px; cursor: pointer; color: var(--ink-soft);
  min-width: 40px; min-height: 40px; display: grid; place-items: center; line-height: 1;
}
.dots { justify-self: end; }
.title-btn:focus-visible, .icon-btn:focus-visible, .nav-arrow:focus-visible, .btn:focus-visible, .tabbar button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.today-link {
  display: block; margin: 10px auto 0; border: 1px solid var(--rule); background: var(--surface); color: var(--accent-strong);
  border-radius: 99px; padding: 4px 14px; font-size: 13px; font-weight: 600; cursor: pointer;
}

main { max-width: 680px; margin: 0 auto; padding: 0 20px; }
.panel { padding-top: 22px; }

.eyebrow {
  font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-faint);
  margin: 0 0 6px;
}
.page-title { font-family: var(--serif); font-weight: 400; font-size: 32px; line-height: 1.15; margin: 0 0 8px; }
.lede { color: var(--ink-soft); margin: 0 0 20px; font-size: 15.5px; }

/* ---------- Passages ---------- */
.toc { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 8px; padding: 0; list-style: none; }
.toc a { text-decoration: none; color: var(--accent); font-weight: 600; font-size: 15px; }

.passage { padding: 26px 0 10px; scroll-margin-top: 80px; }
.passage + .passage { border-top: 1px solid var(--rule); }
.passage-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.passage-ref { font-family: var(--sans); font-size: 20px; font-weight: 600; color: var(--accent); margin: 0; }
.passage-kind { font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-faint); white-space: nowrap; }
.passage-tools { display: flex; gap: 16px; flex-wrap: wrap; margin: 2px 0 14px; }
.chip-btn {
  border: 0; background: none; padding: 2px 0; font-size: 14px; font-weight: 600;
  color: var(--ink-faint); cursor: pointer; text-decoration: none;
}
.chip-btn:hover { color: var(--accent); }
.chip-btn.done { color: var(--accent); }

details.passage > summary { list-style: none; cursor: pointer; }
details.passage > summary::-webkit-details-marker { display: none; }
details.passage > summary .passage-ref::after {
  content: ""; display: inline-block; width: 8px; height: 8px; margin-left: 8px; vertical-align: 3px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .15s;
}
details.passage[open] > summary .passage-ref::after { transform: rotate(45deg); vertical-align: 5px; }

/* ---------- Scripture text (ESV API HTML) ---------- */
.scripture {
  font-family: var(--serif); font-size: var(--text-size); line-height: 1.7; color: var(--ink);
  padding-left: var(--gutter); font-optical-sizing: auto;
}
.scripture h2, .scripture h3 {
  font-family: var(--sans); font-size: .76em; font-weight: 600; color: var(--ink);
  margin: 1.5em 0 .3em calc(var(--gutter) * -1); line-height: 1.35;
}
.scripture h2.extra_text { display: none; }
.scripture h4, .scripture .psalm-book, .scripture .psalm-acrostic-title {
  font-family: var(--sans); font-size: .66em; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-faint);
  margin: 1.4em 0 .3em calc(var(--gutter) * -1); font-weight: 600;
}
.scripture .psalm-title, .scripture h4.psalm-title { font-family: var(--serif); font-style: italic; text-transform: none; letter-spacing: 0; font-size: .9em; font-weight: 400; color: var(--ink-soft); margin-left: 0; }
.scripture p { margin: 0 0 .9em; position: relative; }
.scripture .chapter-num {
  font-family: var(--serif); font-weight: 400; color: var(--ink); font-size: 2.7em; line-height: .82;
  float: left; margin: .08em .18em 0 calc(var(--gutter) * -1 + 2px);
}
.scripture .verse-num {
  font-family: var(--sans); font-size: .62em; font-weight: 400; color: var(--ink-soft);
  vertical-align: .55em; line-height: 0; margin-right: .2em;
}
.scripture .small-caps, .scripture .divine-name { font-variant: small-caps; letter-spacing: .02em; }
.scripture .selah { font-style: italic; color: var(--ink-soft); }
.scripture .woc { color: inherit; }

/* Poetry: hanging indents like a printed ESV, verse numbers out in the gutter */
.scripture .block-indent { margin: 0 0 .9em; }
.scripture .line {
  display: block; position: relative;
  padding-left: 3.4em; text-indent: -3.4em;
}
.scripture .line.indent { text-indent: -2.3em; }
.scripture .line.indent-2 { text-indent: -1.3em; }
.scripture .block-indent br, .scripture .line + br { display: none; }
.scripture .line .verse-num, .scripture .line .chapter-num-inline {
  position: absolute; left: calc(var(--gutter) * -1); top: .95em; text-indent: 0;
  vertical-align: baseline; font-size: .6em; line-height: 1;
}
.scripture .line .chapter-num { position: static; }
.scripture .begin-line-group + .line, .scripture .line-group { margin-top: .6em; }
.scripture .footnote, .scripture .footnotes, .scripture .crossref { display: none; }
.copyright-note { font-family: var(--sans); font-size: 12px; color: var(--ink-faint); margin-top: 28px; }
.hide-verse-nums .scripture .verse-num { display: none; }
.hide-headings .scripture h2, .hide-headings .scripture h3 { display: none; }

.notice {
  border: 1px solid var(--rule); background: var(--surface); border-radius: 10px; padding: 14px 16px; margin: 8px 0 16px;
  font-size: 15px; color: var(--ink-soft); font-family: var(--sans); line-height: 1.5;
}
.scripture .notice { margin-left: calc(var(--gutter) * -1); }
.notice strong { color: var(--ink); }
.skeleton { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--rule), var(--surface), var(--rule)); background-size: 200% 100%; animation: shimmer 1.2s infinite; margin: 12px 0; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Psalms row ---------- */
.psalm-row { display: flex; gap: 8px; margin: 0 0 6px; }
.psalm-pill {
  flex: 1 1 0; min-width: 0; text-align: center; padding: 10px 2px 8px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--rule); text-decoration: none; color: var(--ink);
}
.psalm-pill b { display: block; font-family: var(--serif); font-weight: 400; font-size: 25px; line-height: 1.1; }
.psalm-pill small { font-size: 10px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-faint); }
.psalm-pill.read { border-color: var(--accent); background: var(--accent-soft); }
.psalm-pill.read b { color: var(--accent-strong); }

/* ---------- Operation World ---------- */
.ow-frame { background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; min-height: 240px; }
.ow-web-widget { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn {
  border: 1px solid transparent; border-radius: 10px; padding: 10px 16px; font-weight: 600; font-size: 15px;
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: var(--surface); border-color: var(--rule); color: var(--ink); }
.btn.danger { background: none; color: #b0453f; border-color: var(--rule); }

/* ---------- Prayer list ---------- */
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 10px; overflow: hidden; background: var(--surface); margin-bottom: 14px; }
.seg button { border: 0; background: none; padding: 8px 14px; font-weight: 600; font-size: 14px; color: var(--ink-soft); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.req-list { list-style: none; margin: 0; padding: 0; }
.req {
  border-bottom: 1px solid var(--rule); padding: 16px 0 14px;
  display: grid; grid-template-columns: auto 1fr auto; gap: 4px 14px; align-items: start;
}
.req-check {
  width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--ink-faint); background: none; cursor: pointer; margin-top: 3px;
  display: grid; place-items: center; color: transparent; font-size: 14px; font-weight: 700;
}
.req-check.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.req-title { font-family: var(--serif); font-size: 20px; font-weight: 400; line-height: 1.35; margin: 0; overflow-wrap: anywhere; }
.req-notes { grid-column: 2 / 4; margin: 2px 0 0; color: var(--ink-soft); font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; }
.req-meta { grid-column: 2 / 4; display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 12.5px; color: var(--ink-faint); margin-top: 4px; align-items: center; }
.tag { font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.req-actions { display: flex; gap: 0; }
.req-actions .icon-btn { font-size: 16px; min-width: 34px; min-height: 34px; padding: 4px; color: var(--ink-faint); }
.req.answered .req-title { color: var(--ink-soft); }
.answered-badge { color: var(--ok); font-weight: 600; }
.empty { text-align: center; color: var(--ink-faint); padding: 32px 8px; font-family: var(--serif); font-size: 19px; }
.prayed-summary { font-size: 14px; color: var(--ink-soft); margin: -4px 0 6px; }
.fab {
  position: fixed; right: 18px; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px); z-index: 25;
  border: 0; border-radius: 99px; padding: 13px 20px; background: var(--accent); color: var(--accent-ink);
  font-weight: 600; font-size: 15px; box-shadow: 0 4px 14px rgba(0,0,0,.16); cursor: pointer;
}

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface); border-top: 1px solid var(--rule);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button {
  background: none; border: 0; cursor: pointer; height: var(--tabbar-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--ink-faint); font-size: 12px; font-weight: 500;
}
.tabbar svg { width: 27px; height: 27px; }
.tabbar button[aria-selected="true"] { color: var(--accent); }

/* ---------- Dialogs ---------- */
dialog { border: 0; padding: 0; background: transparent; color: var(--ink); max-width: 520px; width: calc(100% - 24px); }
dialog::backdrop { background: rgba(0,0,0,.4); }
.sheet { background: var(--surface); border-radius: 16px; padding: 20px; }
.sheet h2 { font-family: var(--serif); font-weight: 400; font-size: 25px; margin: 0 0 14px; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; }
.field.row { display: flex; align-items: center; justify-content: space-between; }
.field.row > span { margin: 0; }
.field small { display: block; color: var(--ink-faint); margin-top: 6px; font-size: 12.5px; }
.field em { font-weight: 400; color: var(--ink-faint); }
input[type="text"], input[type="password"], input:not([type]), textarea, select {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: var(--paper);
  border: 1px solid var(--rule); border-radius: 10px; padding: 10px 12px;
}
textarea { resize: vertical; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--accent); }
.sheet-actions { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.sheet-actions .spacer { flex: 1; }
.file-btn { cursor: pointer; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 84px);
  background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 600; z-index: 40;
}

@media (max-width: 380px) {
  .title-btn { font-size: 18px; }
  :root { --gutter: 26px; }
}
.title-wrap.no-date .nav-arrow { visibility: hidden; }
.scripture .chapter-head {
  font-family: var(--serif); font-size: 2.4em; line-height: 1; color: var(--ink);
  margin: .1em 0 .15em calc(var(--gutter) * -1 + 2px);
}

/* ---------- Listen ---------- */
.chip-btn.listen { display: inline-flex; align-items: center; gap: 5px; color: var(--accent-strong); }
.listen-all {
  display: inline-flex; align-items: center; gap: 8px; margin: 10px 0 14px;
  border: 1px solid var(--rule); background: var(--surface); color: var(--accent-strong);
  border-radius: 99px; padding: 8px 16px 8px 13px; font-weight: 600; font-size: 15px; cursor: pointer;
}
.listen-all:hover { border-color: var(--accent); }
.player {
  position: fixed; left: 0; right: 0; z-index: 29;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--rule);
  box-shadow: 0 -4px 14px rgba(0,0,0,.06);
}
.pl-seek { height: 14px; margin-top: -7px; cursor: pointer; position: relative; }
.pl-seek::before { content: ""; position: absolute; left: 0; right: 0; top: 6px; height: 3px; background: var(--rule); }
.pl-progress { position: absolute; left: 0; top: 6px; height: 3px; background: var(--accent); width: 0; }
.pl-row { display: flex; align-items: center; gap: 4px; padding: 2px 10px 8px 18px; max-width: 760px; margin: 0 auto; }
.pl-info { flex: 1; min-width: 0; }
.pl-title { font-family: var(--serif); font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-sub { font-size: 12.5px; color: var(--ink-faint); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-btn { border: 0; background: none; color: var(--ink-soft); width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; flex: none; }
.pl-btn:disabled { opacity: .35; cursor: default; }
.pl-btn.main { background: var(--accent); color: var(--accent-ink); width: 44px; height: 44px; }
body.has-player { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 90px); }
body.has-player .fab { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 86px); }

/* ---------- Prayers (The Practice of Piety) ---------- */
.tabbar { grid-template-columns: repeat(5, 1fr); }
.tabbar button { font-size: 11.5px; }
.prayer-text { font-family: var(--serif); font-size: var(--text-size); line-height: 1.7; margin-top: 6px; }
.prayer-text p { margin: 0 0 1em; text-indent: 1.2em; }
.prayer-text p:first-child { text-indent: 0; }
.prayer-text p:first-child::first-letter { font-size: 2.6em; float: left; line-height: .85; margin: .06em .1em 0 0; color: var(--accent-strong); }
.prayer-text .rubric { font-style: italic; color: var(--ink-soft); font-size: .88em; text-indent: 0; }
.prayer-text .sref { font-family: var(--sans); font-size: .62em; color: var(--ink-faint); white-space: normal; }
.back-link { border: 0; background: none; color: var(--accent-strong); font-weight: 600; font-size: 15px; padding: 4px 0; margin: 0 0 10px; cursor: pointer; }
.list-head { font-family: var(--serif); font-weight: 400; font-size: 24px; margin: 34px 0 6px; padding-top: 22px; border-top: 1px solid var(--rule); }
.prayer-group h3 { font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-faint); margin: 18px 0 4px; }
.prayer-group ul { list-style: none; margin: 0; padding: 0; }
.prayer-link {
  display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--rule); background: none;
  padding: 11px 0; font-family: var(--serif); font-size: 18px; color: var(--ink); cursor: pointer;
}
.prayer-link:hover, .prayer-link.current { color: var(--accent-strong); }

/* Prayer book switch + BCP office */
.source-switch { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; background: var(--surface); margin: 0 0 20px; }
.source-switch button { border: 0; background: none; padding: 10px 10px; font-weight: 600; font-size: 14.5px; line-height: 1.3; color: var(--ink-soft); cursor: pointer; text-wrap: balance; }
.source-switch em { font-style: italic; }
.source-switch button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.office-item { padding: 18px 0 4px; border-top: 1px solid var(--rule); }
.office-item h3 { font-family: var(--sans); font-size: 15px; font-weight: 600; color: var(--accent-strong); margin: 0 0 8px; }
.office-item.collect h3 { font-family: var(--serif); font-weight: 400; font-size: 20px; color: var(--ink); }
.office-label { font-size: 11.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-faint); margin: 0 0 4px; }
.prayer-text.bcp p:first-child::first-letter { font-size: inherit; float: none; margin: 0; color: inherit; line-height: inherit; }
.prayer-text.bcp p { text-indent: 0; }
details.prayer-group summary { list-style: none; cursor: pointer; border-bottom: 1px solid var(--rule); }
details.prayer-group summary::-webkit-details-marker { display: none; }
details.prayer-group summary h3 { display: flex; justify-content: space-between; margin: 14px 0 10px; }
details.prayer-group summary h3::after { content: "+"; font-size: 18px; color: var(--ink-faint); letter-spacing: 0; }
details.prayer-group[open] summary h3::after { content: "–"; }
details.prayer-group .count { margin-left: auto; margin-right: 12px; color: var(--ink-faint); font-weight: 400; }

/* BSB: one verse per line, number in the gutter, wrapped lines flush with the text */
.scripture .bsb-text .line { padding-left: 0; text-indent: 0; margin-bottom: .35em; }
.scripture .bsb-text .line .verse-num { top: .7em; }
