/* ==========================================================================
   Scripture — style.css
   Mobile-first PWA styling. Light/dark via a .dark class on <html>.
   Serif for scripture, system UI for chrome. iPhone safe-area aware.
   ========================================================================== */

:root {
  --bg: #f4f1ea;
  --surface: #ffffff;
  --surface-2: #efece3;
  --text: #1f2430;
  --muted: #6b7280;
  --border: #e2ddd0;
  --primary: #2b3a67;
  --primary-ink: #ffffff;
  --accent: #b8860b;
  --link: #2b5fa8;
  --good: #2e7d52;
  --behind: #b4462f;
  --shadow: 0 1px 3px rgba(20, 24, 40, .08), 0 4px 16px rgba(20, 24, 40, .05);
  --serif: Georgia, 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Times New Roman', serif;
  --ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --topbar-h: 52px;
  --nav-h: 60px;
  --maxw: 720px;
}

html.dark {
  --bg: #12161f;
  --surface: #1b2130;
  --surface-2: #232b3d;
  --text: #e7e9f0;
  --muted: #9aa3b6;
  --border: #2c3547;
  --primary: #4661a8;
  --primary-ink: #ffffff;
  --accent: #e0b64a;
  --link: #8fb4f0;
  --good: #5bcb8f;
  --behind: #e2795f;
  --shadow: 0 1px 3px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--ui);
  background: var(--bg);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}

/* ---- layout: fixed top bar + scroll area + fixed bottom nav ---- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: calc(var(--topbar-h) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  display: flex; align-items: center; justify-content: space-between;
  padding-left: 14px; padding-right: 10px;
  background: var(--primary); color: var(--primary-ink);
  z-index: 30;
}
.view {
  max-width: var(--maxw); margin: 0 auto;
  padding: calc(var(--topbar-h) + env(safe-area-inset-top) + 12px) 16px
           calc(var(--nav-h) + env(safe-area-inset-bottom) + 24px);
}
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex; background: var(--surface); border-top: 1px solid var(--border);
  z-index: 30;
}

/* ---- top bar contents ---- */
.brand { display: flex; align-items: center; gap: 7px; background: none; border: 0; color: inherit;
  font-size: 1.05rem; font-weight: 650; letter-spacing: .2px; cursor: pointer; padding: 6px 2px; }
.brand-mark { color: var(--accent); font-size: 1.05rem; }
.top-actions { display: flex; align-items: center; gap: 4px; }
.progress-badge { display: flex; gap: 8px; margin-right: 4px; }
.pb-item { font-size: .82rem; opacity: .95; white-space: nowrap; }
.icon-btn { background: rgba(255,255,255,.12); border: 0; color: inherit; width: 36px; height: 36px;
  border-radius: 9px; font-size: 1.1rem; cursor: pointer; display: grid; place-items: center; }
.icon-btn:active { transform: scale(.94); }

/* ---- bottom nav buttons ---- */
.nav-btn { flex: 1; background: none; border: 0; color: var(--muted); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px; cursor: pointer; font-family: inherit; padding: 6px 0; }
.nav-icon { font-size: 1.25rem; line-height: 1; filter: grayscale(.3); }
.nav-label { font-size: .68rem; letter-spacing: .2px; }
.nav-btn.active { color: var(--primary); }
html.dark .nav-btn.active { color: var(--accent); }
.nav-btn.active .nav-icon { filter: none; transform: translateY(-1px); }

/* ---- generic elements ---- */
h1, h2, h3, h4 { line-height: 1.25; }
.tab-title { font-size: 1.5rem; margin: 4px 0 14px; }
.muted { color: var(--muted); }
a { color: var(--link); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card h2 { margin: 0 0 8px; font-size: 1.15rem; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.field-label { font-size: .9rem; color: var(--muted); }

.btn { font-family: inherit; font-size: .95rem; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); padding: 10px 14px; border-radius: 10px; cursor: pointer; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--primary); color: var(--primary-ink); border-color: transparent; font-weight: 600; }
.btn.ghost { background: transparent; }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: .45; cursor: default; }
.btn.back { margin-bottom: 10px; }
.link { background: none; border: 0; color: var(--link); cursor: pointer; font: inherit; padding: 0; }

.sel { font-family: inherit; font-size: .9rem; padding: 8px 10px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.date-input { font-family: inherit; padding: 8px 10px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); }

.spinner { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 24px 4px; justify-content: center; }
.spinner-dot { width: 16px; height: 16px; border: 3px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.notice { padding: 14px; border-radius: 10px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.notice-error { color: var(--behind); }

.toast { position: fixed; left: 50%; transform: translateX(-50%) translateY(20px);
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 14px); background: #111826; color: #fff;
  padding: 10px 16px; border-radius: 999px; font-size: .88rem; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 50; }
.toast.show { opacity: .96; transform: translateX(-50%) translateY(0); }

/* ==========================================================================
   READ TAB
   ========================================================================== */
.reader-header { margin-bottom: 8px; }
.reader-controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.translation-sel { flex: 1 1 auto; min-width: 140px; max-width: 100%; }
.bookchap { display: flex; gap: 8px; flex: 1 1 auto; }
.book-sel { flex: 2; min-width: 0; }
.chap-sel { flex: 1; min-width: 0; }
.sel-static { padding: 8px 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); }

.chap-nav { display: flex; justify-content: space-between; gap: 10px; margin: 10px 0; }
.chap-nav .btn { flex: 1; }
.chap-nav.bottom { margin-top: 22px; }

.chapter-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0 6px; }
.chapter-title { font-family: var(--serif); font-size: 1.6rem; margin: 0; }
.read-toggle { white-space: nowrap; }
.read-toggle.done { background: var(--good); color: #fff; border-color: transparent; }

/* Scripture body */
.scripture { font-family: var(--serif); }
.reader-heading { font-family: var(--serif); font-weight: 600; font-size: 1.05rem; color: var(--muted);
  margin: 20px 0 6px; font-style: italic; }
.prose { font-size: 1.16rem; line-height: 1.85; margin: 0 0 2px; text-align: left; color: var(--text); }
.v { }
.vn { font-family: var(--ui); font-size: .62em; font-weight: 700; color: var(--accent);
  vertical-align: super; line-height: 0; margin: 0 3px 0 2px; }
html.large-text .prose { font-size: 1.34rem; line-height: 2.0; }

/* Commentary drawer (collapsed by default) */
.drawer { margin-top: 24px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); }
.drawer-toggle { width: 100%; display: flex; align-items: center; gap: 8px; background: var(--surface-2);
  border: 0; padding: 13px 14px; font-family: inherit; font-size: .98rem; color: var(--text); cursor: pointer; text-align: left; }
.drawer-toggle .chev { color: var(--accent); font-size: .9rem; width: 14px; }
.drawer-hint { margin-left: auto; font-size: .72rem; color: var(--muted); }
.drawer-panel { display: none; }
.drawer.open .drawer-panel { display: block; }

.commentary-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 10px; border-bottom: 1px solid var(--border); }
.ctab { white-space: nowrap; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 7px 12px; border-radius: 999px; font-size: .82rem; cursor: pointer; font-family: inherit; }
.ctab.active { background: var(--primary); color: var(--primary-ink); border-color: transparent; }
.ctab.disabled { opacity: .5; cursor: default; }
.commentary-content { padding: 4px 14px 16px; }
.commentary-body { font-size: .98rem; line-height: 1.6; }
.commentary-intro p { font-style: italic; color: var(--muted); }
.commentary-block { margin: 12px 0; }
.commentary-vlabel { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); font-weight: 700; margin-bottom: 2px; }
.commentary-block p { margin: 6px 0; }
.attribution { margin-top: 16px; font-size: .74rem; color: var(--muted); border-top: 1px dashed var(--border); padding-top: 8px; }

/* ==========================================================================
   PLAN TAB
   ========================================================================== */
.plan-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.plan-head h2 { margin: 0; }
.sched-badge { font-size: .78rem; padding: 4px 10px; border-radius: 999px; white-space: nowrap; font-weight: 600; }
.sched-badge.ontrack { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good); }
.sched-badge.ahead { background: color-mix(in srgb, var(--good) 20%, transparent); color: var(--good); }
.sched-badge.behind { background: color-mix(in srgb, var(--behind) 18%, transparent); color: var(--behind); }
.todays-head { display: flex; align-items: baseline; justify-content: space-between; margin: 16px 0 6px; }
.todays-head h3 { margin: 0; }
.day-done { color: var(--good); font-size: .82rem; font-weight: 600; }
.plan-list { display: flex; flex-direction: column; gap: 2px; }
.plan-row { display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-bottom: 1px solid var(--border); }
.plan-row.read .plan-ref { color: var(--muted); text-decoration: line-through; }
.checkbox { width: 30px; height: 30px; border-radius: 8px; border: 2px solid var(--border); background: var(--surface);
  cursor: pointer; font-size: .95rem; color: #fff; display: grid; place-items: center; flex: none; }
.checkbox.checked { background: var(--good); border-color: var(--good); }
.plan-ref { font-size: 1.05rem; font-family: var(--serif); }
.plan-tools { margin-top: 14px; }
.plan-tools summary { cursor: pointer; color: var(--muted); font-size: .9rem; }
.straight-card .btn { margin-top: 4px; }

/* ==========================================================================
   LIBRARY TAB
   ========================================================================== */
.lib-sub { margin-top: -8px; }
.lib-search { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 1rem; margin-bottom: 16px; }
.lib-group { margin-bottom: 18px; }
.lib-cat { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 8px; }
.lib-item { width: 100%; text-align: left; display: flex; align-items: center; gap: 10px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin-bottom: 8px; cursor: pointer; font-family: inherit; color: var(--text); }
.lib-item:active { transform: scale(.995); }
.lib-item-title { font-size: 1.02rem; font-weight: 550; flex: 1; }
.lib-item-meta { font-size: .78rem; color: var(--muted); }
.lib-item.soon { opacity: .7; cursor: default; }
.lib-badge { font-size: .64rem; text-transform: uppercase; letter-spacing: .05em; background: var(--surface-2);
  color: var(--muted); padding: 3px 7px; border-radius: 999px; border: 1px solid var(--border); }
.search-result { width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; cursor: pointer; font-family: inherit; color: var(--text); display: block; }
.sr-doc { font-weight: 600; font-size: .95rem; margin-bottom: 3px; }
.sr-snip { font-size: .85rem; color: var(--muted); line-height: 1.45; }
mark { background: color-mix(in srgb, var(--accent) 40%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }

/* Document reader */
.doc-title { font-family: var(--serif); font-size: 1.7rem; margin: 4px 0 2px; }
.doc-sub { color: var(--muted); margin: 0 0 2px; font-style: italic; }
.doc-meta { font-size: .82rem; color: var(--muted); margin: 0 0 14px; }
.doc-toc { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-bottom: 18px; max-height: 320px; overflow: auto; }
.toc-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 6px; }
.toc-list { display: flex; flex-direction: column; }
.toc-link { text-align: left; background: none; border: 0; color: var(--link); padding: 5px 2px; cursor: pointer; font-family: inherit; font-size: .92rem; border-bottom: 1px solid transparent; }
.doc-body { font-family: var(--serif); }
.doc-section { padding: 8px 0 4px; scroll-margin-top: calc(var(--topbar-h) + 16px); }
.doc-section-title { font-size: 1.1rem; margin: 14px 0 6px; }
.doc-section p { font-size: 1.08rem; line-height: 1.7; margin: 8px 0; }
html.large-text .doc-section p { font-size: 1.24rem; line-height: 1.85; }
.doc-section.flash { animation: flash 1.6s ease; }
@keyframes flash { 0%, 20% { background: color-mix(in srgb, var(--accent) 22%, transparent); } 100% { background: transparent; } }

/* ==========================================================================
   PLACEHOLDERS / SETTINGS / ABOUT
   ========================================================================== */
.placeholder { text-align: center; padding: 60px 20px; }
.ph-icon { font-size: 3rem; margin-bottom: 8px; }
.placeholder h1 { margin: 4px 0; }
.ph-tag { display: inline-block; margin-top: 14px; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em;
  background: var(--surface-2); color: var(--muted); padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border); }

.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.setting-row:last-child { border-bottom: 0; }
.setting-label { font-weight: 550; }
.setting-desc { font-size: .82rem; }
.switch { position: relative; width: 48px; height: 28px; flex: none; }
.switch-input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch-slider { position: absolute; inset: 0; background: var(--border); border-radius: 999px; transition: background .2s; }
.switch-slider::before { content: ''; position: absolute; width: 22px; height: 22px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch-input:checked + .switch-slider { background: var(--primary); }
.switch-input:checked + .switch-slider::before { transform: translateX(20px); }

.about h3 { margin: 16px 0 4px; font-size: 1rem; }
.about p { line-height: 1.55; margin: 6px 0; }

/* ==========================================================================
   STUDY (interlinear in Read + lexicon tab)
   ========================================================================== */
.study-bar { display: flex; align-items: center; gap: 10px; margin: 8px 0 2px; flex-wrap: wrap; }
.study-toggle { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--border);
  background: var(--surface); color: var(--muted); padding: 6px 12px; border-radius: 999px;
  font-family: inherit; font-size: .84rem; cursor: pointer; }
.study-toggle .st-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--border); }
.study-toggle.on { color: var(--primary); border-color: color-mix(in srgb, var(--primary) 45%, transparent); }
html.dark .study-toggle.on { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.study-toggle.on .st-dot { background: var(--good); }
.display-seg { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.seg-btn { border: 0; background: var(--surface); color: var(--muted); font-family: inherit; font-size: .8rem;
  padding: 6px 12px; cursor: pointer; }
.seg-btn.active { background: var(--primary); color: var(--primary-ink); }
.study-note { margin-top: 14px; font-style: italic; }

/* interlinear body */
.interlinear { margin-top: 6px; }
.il-verse { display: block; margin: 2px 0; }
.mode-line .il-verse { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 4px 10px; margin: 10px 0; }
.il-verse .vn { font-family: var(--ui); font-size: .62rem; font-weight: 700; color: var(--accent);
  vertical-align: super; margin-right: 4px; }
.il-word { font-family: inherit; border: 0; background: none; cursor: pointer; padding: 1px 2px;
  border-radius: 4px; color: var(--text); }
.il-word:active { background: var(--surface-2); }

/* tap mode: flows like an English translation, each chunk tappable */
.mode-tap .il-word { display: inline; font-family: var(--serif); font-size: 1.12rem; line-height: 1.9; }
.mode-tap .il-word .il-en { border-bottom: 1px dotted color-mix(in srgb, var(--accent) 55%, transparent); }
html.large-text .mode-tap .il-word { font-size: 1.3rem; }

/* interlinear line mode: original / translit / gloss stacked per word */
.mode-line .il-word { display: inline-flex; flex-direction: column; align-items: center; text-align: center;
  padding: 4px 6px; border: 1px solid transparent; }
.mode-line .il-word:hover { border-color: var(--border); }
.mode-line .il-orig { font-family: var(--serif); font-size: 1.24rem; color: var(--text); }
.mode-line .il-tr { font-size: .7rem; color: var(--accent); font-style: italic; }
.mode-line .il-gloss { font-size: .78rem; color: var(--muted); max-width: 12ch; }
.interlinear[dir="rtl"] .il-verse { direction: rtl; }

/* word popup (bottom sheet) */
.study-popup-overlay { position: fixed; inset: 0; background: rgba(10,14,22,.55); z-index: 60; }
.study-popup { position: fixed; left: 0; right: 0; bottom: 0; z-index: 61; background: var(--surface);
  border-top-left-radius: 18px; border-top-right-radius: 18px; padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  max-width: var(--maxw); margin: 0 auto; box-shadow: 0 -8px 30px rgba(0,0,0,.3); animation: sheet .2s ease; max-height: 80vh; overflow: auto; }
@keyframes sheet { from { transform: translateY(30px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }
.popup-close { position: absolute; top: 10px; right: 12px; border: 0; background: none; font-size: 1.6rem;
  color: var(--muted); cursor: pointer; line-height: 1; }
.popup-head { display: flex; align-items: baseline; gap: 12px; padding-right: 30px; }
.popup-orig { font-family: var(--serif); font-size: 2rem; }
.popup-tr { font-style: italic; color: var(--accent); font-size: 1.05rem; }
.popup-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0; }
.popup-strong { font-weight: 700; color: var(--link); background: var(--surface-2); border: 1px solid var(--border);
  padding: 3px 9px; border-radius: 999px; font-size: .82rem; cursor: pointer; }
.popup-morph { font-size: .88rem; color: var(--text); }
.popup-gloss { font-family: var(--serif); font-size: 1.05rem; margin: 6px 0; }
.popup-lex { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 6px; }
.lex-lemma { font-family: var(--serif); font-size: 1.2rem; }
.lex-lemma.rtl { direction: rtl; }
.lex-shortgloss { color: var(--muted); margin: 2px 0 6px; }
.lex-def { font-size: .92rem; line-height: 1.55; }

/* Study tab */
.lex-results { margin-top: 8px; }
.lex-result { width: 100%; text-align: left; display: flex; align-items: baseline; gap: 10px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; padding: 11px 13px; margin-bottom: 7px; cursor: pointer; font-family: inherit; color: var(--text); }
.lr-strong { font-weight: 700; color: var(--accent); font-size: .82rem; min-width: 3.4em; }
.lr-lemma { font-family: var(--serif); font-size: 1.12rem; }
.lr-gloss { color: var(--muted); font-size: .86rem; flex: 1; }
.lex-detail { padding: 4px 0; }
.lex-strong-badge { font-size: .78rem; font-weight: 700; color: var(--accent); letter-spacing: .04em; }
.lex-lemma.big { font-size: 2rem; margin: 4px 0; }
.lex-tr { font-style: italic; color: var(--accent); }
.lex-pos { font-size: .82rem; margin: 4px 0; }
.lex-refs-h { font-size: .9rem; margin: 16px 0 6px; }
.lex-refs { display: flex; flex-wrap: wrap; gap: 8px; }
.ref-chip { background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 5px 11px;
  font-size: .82rem; cursor: pointer; color: var(--link); font-family: inherit; }
.study-foot { margin-top: 24px; }

/* ==========================================================================
   HISTORY TAB (Studies + Church Fathers + Historical Documents)
   ========================================================================== */
.hist-seg { display: flex; gap: 6px; overflow-x: auto; margin: 4px 0 14px; }
.hist-seg .seg-btn { white-space: nowrap; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); padding: 8px 14px; border-radius: 999px; font-size: .88rem; }
.hist-seg .seg-btn.active { background: var(--primary); color: var(--primary-ink); border-color: transparent; }

.topic-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 560px) { .topic-grid { grid-template-columns: 1fr 1fr; } }
.topic-card { text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px 16px; cursor: pointer; font-family: inherit; color: var(--text); box-shadow: var(--shadow); }
.topic-card:active { transform: scale(.99); }
.topic-era { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); font-weight: 700; }
.topic-title { font-family: var(--serif); font-size: 1.12rem; margin: 3px 0 5px; }
.topic-teaser { font-size: .88rem; color: var(--muted); line-height: 1.45; }

/* document intro (Church Fathers) */
.doc-intro { font-size: .95rem; line-height: 1.6; color: var(--muted); background: var(--surface-2);
  border-left: 3px solid var(--accent); padding: 10px 14px; border-radius: 0 8px 8px 0; margin: 4px 0 14px; }

/* article view */
.article-title { font-family: var(--serif); font-size: 1.7rem; margin: 6px 0 2px; }
.article-era { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); font-weight: 700; margin: 0 0 8px; }
.article-h { font-family: var(--ui); text-transform: uppercase; letter-spacing: .08em; font-size: .76rem;
  color: var(--accent); font-weight: 700; margin: 24px 0 8px; border-top: 1px solid var(--border); padding-top: 14px; }
.article-p { font-family: var(--serif); font-size: 1.08rem; line-height: 1.7; margin: 8px 0; }
html.large-text .article-p { font-size: 1.22rem; }
.figure-list { display: flex; flex-direction: column; gap: 6px; }
.figure { line-height: 1.5; }
.figure-name { font-weight: 650; }
.figure-note { color: var(--muted); }
.timeline { display: flex; flex-direction: column; }
.tl-row { display: flex; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.tl-date { flex: none; min-width: 6.5em; font-weight: 700; color: var(--accent); font-size: .9rem; }
.tl-event { line-height: 1.5; }
.scripture-conn { margin: 10px 0; padding-left: 12px; border-left: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.scripture-ref { display: inline-block; font-family: var(--serif); font-weight: 600; font-size: 1.02rem; }
.scripture-ref.link { color: var(--link); background: none; border: 0; cursor: pointer; padding: 0; font-family: var(--serif); }
.conn-note { margin: 3px 0 0; line-height: 1.55; }
.further-list { display: flex; flex-direction: column; gap: 6px; }
.further-link { text-align: left; font-size: .95rem; }
button.further-link { background: none; border: 0; color: var(--link); cursor: pointer; font-family: inherit; padding: 2px 0; }
a.further-link { color: var(--link); }
.ai-note { margin-top: 22px; }

/* ==========================================================================
   PRAY TAB (Daily Office)
   ========================================================================== */
.office-tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; }
.office-tab { white-space: nowrap; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); padding: 8px 14px; border-radius: 999px; font-size: .9rem; cursor: pointer; font-family: inherit; }
.office-tab.active { background: var(--primary); color: var(--primary-ink); border-color: transparent; }
.office-tab.soon { opacity: .5; cursor: default; }
.soon-dot { font-size: .72em; opacity: .8; }

.office-header { text-align: center; margin: 6px 0 14px; }
.office-title { font-family: var(--serif); font-size: 1.7rem; margin: 0; }
.office-date { color: var(--muted); font-size: .9rem; margin: 4px 0 10px; }
.office-status { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.prayer-streak, .prayed-dot { font-size: .76rem; padding: 4px 10px; border-radius: 999px; background: var(--surface-2);
  border: 1px solid var(--border); color: var(--muted); }
.prayer-streak { color: var(--accent); }
.prayed-dot.on { color: var(--good); border-color: color-mix(in srgb, var(--good) 40%, transparent); }

.office-options { margin-bottom: 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.office-options summary { cursor: pointer; padding: 10px 14px; font-size: .88rem; color: var(--muted); }
.options-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; padding: 4px 14px 14px; }
.opt { display: flex; align-items: center; gap: 8px; font-size: .88rem; cursor: pointer; }
.opt input { width: 18px; height: 18px; }

/* the liturgy — calm, centered reading measure */
.office-body { max-width: 40rem; margin: 0 auto; }
.office-rubric { font-family: var(--ui); font-style: italic; color: var(--muted); font-size: .82rem;
  line-height: 1.5; margin: 16px 0 6px; text-align: center; }
.office-say { font-family: var(--serif); font-size: 1.12rem; line-height: 1.7; margin: 8px 0; }
html.large-text .office-say { font-size: 1.3rem; line-height: 1.85; }
.office-lines { font-family: var(--serif); margin: 10px 0; }
.office-line { font-size: 1.08rem; line-height: 1.65; padding: 1px 0 1px 18px; text-indent: -18px; }
.office-line.serif { padding-left: 0; text-indent: 0; }
html.large-text .office-line { font-size: 1.22rem; }
.office-h { font-family: var(--ui); text-transform: uppercase; letter-spacing: .08em; font-size: .74rem;
  color: var(--accent); font-weight: 700; margin: 26px 0 8px; text-align: center; border-top: 1px solid var(--border); padding-top: 16px; }

.office-canticle { margin: 16px 0; }
.canticle-head { text-align: center; margin-bottom: 6px; }
.canticle-title { font-family: var(--serif); font-style: italic; font-size: 1.05rem; }
.canticle-src { display: block; font-size: .72rem; color: var(--muted); }
.office-canticle.alt { border-left: 2px solid var(--border); padding-left: 12px; }

.office-insert { margin: 10px 0; }
.psalm-label { font-family: var(--serif); font-weight: 600; font-size: 1.05rem; margin: 12px 0 2px; }
.lesson-ref { font-family: var(--serif); font-style: italic; color: var(--muted); margin: 2px 0 4px; }
.office-scripture { font-family: var(--serif); font-size: 1.1rem; line-height: 1.75; margin: 2px 0 8px; }
html.large-text .office-scripture { font-size: 1.26rem; }
.collect-title { font-style: italic; font-size: .9rem; margin: 4px 0 2px; }
.collect-picker { margin-top: 10px; }
.collect-picker .sel { width: 100%; }
.office-creed .office-say { margin: 4px 0; }

.office-foot { max-width: 40rem; margin: 26px auto 0; }
.btn.primary.done { background: var(--good); }
.about-office { margin-top: 16px; }
.about-office summary { cursor: pointer; color: var(--muted); font-size: .86rem; }
.about-office p { font-size: .82rem; line-height: 1.5; color: var(--muted); margin-top: 8px; }
