/* Fonts: the same set as the other pivotalapps readers (licenses in fonts/). */
@font-face { font-family: 'Taamey Frank'; src: url('fonts/TaameyFrankCLM-Medium.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Noto Serif Hebrew'; src: url('fonts/NotoSerifHebrew.ttf') format('truetype'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Keter YG'; src: url('fonts/KeterYG-Medium.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Shofar'; src: url('fonts/ShofarRegular.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Cardo'; src: url('fonts/Cardo-Regular.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Frank Ruhl Libre'; src: url('fonts/FrankRuhlLibre.ttf') format('truetype'); font-weight: 300 900; font-display: swap; }
@font-face { font-family: 'David Libre'; src: url('fonts/DavidLibre-Regular.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'SBL Hebrew'; src: url('fonts/SBL_Hbrw.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Ezra SIL'; src: url('fonts/EzraSIL.ttf') format('truetype'); font-display: swap; size-adjust: 86%; }

:root {
  --bg: #f3efe4; --paper: #fbf9f3; --ink: #1c1a16; --mute: #7d7668; --line: #e2dccc;
  --gold: #8a6a1f; --blue: #2f5f8f; --targ: #2f6b4f; --accent: #1f5f73; --mark: #e8d9a866; --chipbg: #ece7d8;
  --tabbg: #f3efe4ee; --stage: #f6f1e3; --hot: #ffe9a8;
  --hfont: 'Taamey Frank', 'SBL Hebrew', 'Noto Serif Hebrew', 'Times New Roman', serif;
  --fs: 22px;
  color-scheme: light;
}
:root[data-font="sbl"] { --hfont: 'SBL Hebrew', 'Taamey Frank', serif; }
:root[data-font="noto"] { --hfont: 'Noto Serif Hebrew', 'SBL Hebrew', serif; }
:root[data-font="keter"] { --hfont: 'Keter YG', 'SBL Hebrew', serif; }
:root[data-font="shofar"] { --hfont: 'Shofar', 'SBL Hebrew', serif; }
:root[data-font="cardo"] { --hfont: 'Cardo', 'SBL Hebrew', serif; }
:root[data-font="frankruhl"] { --hfont: 'Frank Ruhl Libre', 'SBL Hebrew', serif; }
:root[data-font="frank"] { --hfont: 'Taamey Frank', 'SBL Hebrew', serif; }
:root[data-font="ezra"] { --hfont: 'Ezra SIL', 'SBL Hebrew', serif; }
:root[data-font="david"] { --hfont: 'David Libre', 'SBL Hebrew', serif; }
:root[data-theme="dark"] {
  --bg: #161a22; --paper: #1d2129; --ink: #e9e3d3; --mute: #978f7e; --line: #2e3340;
  --gold: #d6b25a; --blue: #8fb6dc; --targ: #8cc9a8; --accent: #8ec9d8; --mark: #5a4e2a66; --chipbg: #272c36; --tabbg: #161a22ee; --stage: #232834; --hot: #4a4120;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161a22; --paper: #1d2129; --ink: #e9e3d3; --mute: #978f7e; --line: #2e3340;
    --gold: #d6b25a; --blue: #8fb6dc; --targ: #8cc9a8; --accent: #8ec9d8; --mark: #5a4e2a66; --chipbg: #272c36; --tabbg: #161a22ee; --stage: #232834; --hot: #4a4120;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 15px/1.45 -apple-system, 'Segoe UI', Roboto, 'Noto Sans Hebrew', sans-serif; padding: env(safe-area-inset-top, 0px) 0 calc(70px + env(safe-area-inset-bottom, 0px)); min-height: 100vh; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--blue); }
.ltr { direction: ltr; unicode-bidi: isolate; text-align: left; }
main, #top { max-width: 780px; margin: 0 auto; padding-inline: 16px; }
#top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-block: 12px 4px; flex-wrap: wrap; }
#top h1 { margin: 0; font-family: var(--hfont); color: var(--accent); font-size: 28px; font-weight: normal; }
#top .sub { color: var(--mute); font-size: 13px; }
.view { display: none; } .view.on { display: block; }

.card { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; margin: 12px 0; display: block; color: inherit; text-decoration: none; }
.card h3 { margin: 0 0 10px; font-size: 16px; color: var(--accent); display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.card h3 small { color: var(--mute); font-weight: 400; font-size: 12px; }
.fine { color: var(--mute); font-size: 12px; line-height: 1.6; }
.btn { border: 1px solid var(--line); background: var(--chipbg); border-radius: 10px; padding: 9px 14px; }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.row-label { display: block; color: var(--mute); font-size: 12.5px; margin: 14px 0 6px; }
.seg { display: flex; background: var(--chipbg); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { flex: 1; padding: 8px 4px; border-radius: 8px; font-size: 13.5px; background: none; border: 0; }
.seg button.on { background: var(--paper); box-shadow: 0 1px 3px #0002; font-weight: 600; }
.fonts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.fonts button { background: var(--chipbg); border: 0; border-radius: 10px; padding: 6px 8px 7px; text-align: center; }
.fonts button.on { background: var(--ink); color: var(--bg); }
.fonts button b { display: block; font-weight: normal; font-size: 22px; line-height: 1.6; }
.fonts button small { display: block; font-size: 11px; opacity: .7; }
.size { display: flex; align-items: center; gap: 10px; }
.size button { background: var(--chipbg); border: 0; border-radius: 10px; padding: 7px 16px; font-family: var(--hfont); font-size: 18px; }
.size span { min-width: 3em; text-align: center; color: var(--mute); }

/* the book tab */
.partcard { display: flex; align-items: center; gap: 14px; }
.partcard .nm { font-family: var(--hfont); font-size: 24px; flex: 1; min-width: 0; line-height: 1.2; }
.partcard .nm small { display: block; font-family: -apple-system, 'Segoe UI', Roboto, sans-serif; font-size: 12.5px; color: var(--mute); margin-top: 3px; line-height: 1.4; }
.partcard .go { color: var(--mute); font-size: 20px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 6px; }
.cell { display: flex; align-items: center; justify-content: center; height: 44px; border-radius: 10px; background: var(--chipbg); color: var(--ink); text-decoration: none; font-family: var(--hfont); font-size: 20px; border: 1px solid transparent; }
.cell.done { background: color-mix(in srgb, var(--targ) 22%, var(--chipbg)); color: var(--targ); }
.cell.now { border-color: var(--accent); }
.secrow { display: flex; gap: 10px; align-items: center; padding: 9px 2px; border-top: 1px solid var(--line); text-decoration: none; color: inherit; }
.secrow .num { flex: 0 0 2.4em; font-family: var(--hfont); font-size: 18px; color: var(--gold); }
.secrow .nm { font-family: var(--hfont); font-size: 20px; flex: 1; min-width: 0; line-height: 1.3; }
.secrow .nm small { display: block; font-family: -apple-system, 'Segoe UI', Roboto, sans-serif; font-size: 13px; color: var(--mute); line-height: 1.45; margin-top: 2px; }
.secrow .go { color: var(--mute); }
.back { margin-top: 8px; }

/* a chapter / a prophecy */
.chead { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.chead.foot { margin-top: 14px; justify-content: space-between; }
.chead .nav { font-size: 13px; text-decoration: none; color: var(--blue); white-space: nowrap; padding: 4px 8px; border-radius: 8px; background: var(--chipbg); }
h2.sec { font-family: var(--hfont); font-size: 26px; margin: 0; font-weight: normal; line-height: 1.3; text-align: center; flex: 1; }
.meta { color: var(--mute); font-size: 13px; margin-top: 4px; text-align: center; }
.meta a { color: var(--blue); text-decoration: none; }
.links { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 4px; }
.links a { font-size: 12.5px; text-decoration: none; padding: 4px 10px; border-radius: 8px; background: var(--chipbg); border: 1px solid var(--line); color: var(--blue); }
.flow { margin-top: 12px; }
.chmark { color: var(--gold); font-size: 13px; margin: 18px 0 6px; text-align: center; }
.chmark a { color: inherit; text-decoration: none; }
.btn.mark { width: 100%; margin-top: 14px; padding: 12px; font-size: 16px; }
.chapter.done .btn.mark { color: var(--targ); }
.loading { text-align: center; color: var(--mute); padding: 40px 0; }

/* a verse */
.vs { display: flex; gap: .6em; align-items: baseline; flex-wrap: wrap; padding: .35em .5em; margin: .2em -.5em; border-radius: 10px; scroll-margin-top: 12px; transition: background .5s; }
.vs .vn { flex: 0 0 auto; font-family: var(--hfont); font-size: calc(var(--fs) * .7); color: var(--gold); min-width: 1.5em; text-align: center; }
.vs .vt { flex: 1 1 20em; font-family: var(--hfont); font-size: calc(var(--fs) * 1.08); line-height: 1.9; color: var(--ink); }
.vs .en { flex-basis: 100%; font-family: Georgia, 'Times New Roman', serif; font-size: calc(var(--fs) * .72); line-height: 1.55; color: var(--ink); opacity: .85; padding-inline-start: 2.3em; }
.vs.flash { background: var(--hot); }
.vs + .vs { border-top: 1px dotted var(--line); }

/* a comment — text column, and on wide screens the stage list beside it */
.cm { margin: .4em 0 1.2em; padding-inline-start: .9em; border-inline-start: 3px solid var(--line); }
.cm.nevuah, .cm.sheela { border-inline-start-color: var(--accent); }
.cmt { font-family: var(--hfont); font-size: calc(var(--fs) * .88); line-height: 1.8; text-align: justify; word-spacing: .04em; }
.cmt p { margin: 0 0 .6em; }
.cmt .dh { font-weight: bold; color: var(--accent); }
.cmt .intro { font-size: calc(var(--fs) * .92); }
.cml { font-family: -apple-system, 'Segoe UI', Roboto, sans-serif; font-size: 12px; color: var(--accent); margin-bottom: .3em; letter-spacing: .02em; }
.cml.q { color: var(--gold); }
mark.o { background: var(--mark); color: inherit; border-radius: 4px; padding: 0 .15em; cursor: pointer; box-shadow: 0 1px 0 var(--gold); }
.cm .links { margin: 2px 0 0; }

/* the stage lists */
.stages { background: var(--stage); border: 1px solid var(--line); border-radius: 12px; margin: 0 0 .8em; overflow: hidden; }
.stages .tg { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px; background: none; border: 0; padding: 8px 12px; text-align: start; color: var(--accent); font-size: 13.5px; font-weight: 600; }
.stages .tg small { color: var(--mute); font-weight: 400; }
.stages .sb { display: none; padding: 0 10px 8px; }
.stages.open .sb { display: block; }
.sl + .sl { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; }
.slt { font-family: var(--hfont); font-size: 17px; color: var(--ink); margin: 2px 0 6px; line-height: 1.4; }
.st { display: flex; gap: 8px; align-items: flex-start; padding: 6px 4px; border-radius: 8px; text-decoration: none; color: inherit; }
a.st:hover, .st.hot { background: var(--hot); }
.st .on { flex: 0 0 auto; min-width: 2.4em; max-width: 6.5em; font-family: var(--hfont); font-size: 15px; color: var(--gold); line-height: 1.5; text-align: center; background: var(--chipbg); border-radius: 6px; padding: 1px 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st .sbody { flex: 1; min-width: 0; }
.st .slb { display: block; font-size: 13.5px; line-height: 1.45; color: var(--ink); }
.st .sv { display: block; font-family: var(--hfont); font-size: 16.5px; line-height: 1.65; color: var(--ink); opacity: .9; margin-top: 2px; }
.st .sv b { font-weight: bold; color: var(--accent); }
.st .sr { display: block; font-size: 11.5px; color: var(--mute); margin-top: 1px; }
.pars { background: var(--stage); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; margin-top: 10px; }
@media (min-width: 900px) {
  main, #top { max-width: 1120px; }
  .cm.has-st { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
  .cm.has-st .cmt { grid-column: 1; }
  .cm.has-st .stages { grid-column: 2; grid-row: 1; position: sticky; top: 10px; margin: 0; }
  .stages .sb { display: block; }
  .stages .tg { pointer-events: none; }
  .stages .tg small::after { content: ''; }
  .stages .tg small { display: none; }
  .card.chapter { padding: 18px 26px; }
}

#tabs { position: fixed; bottom: 0; inset-inline: 0; display: flex; background: var(--tabbg); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); z-index: 10; }
#tabs button { flex: 1; background: none; border: 0; padding: 8px 0 9px; color: var(--mute); font-size: 12px; display: flex; flex-direction: column; align-items: center; gap: 1px; }
#tabs button .i { font-size: 19px; }
#tabs button.on { color: var(--accent); }
#toast { position: fixed; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: .2s; background: var(--ink); color: var(--bg); padding: 9px 14px; border-radius: 12px; display: flex; gap: 12px; align-items: center; z-index: 20; }
#toast.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#toast button { background: none; border: 0; color: var(--bg); font-weight: 700; text-decoration: underline; }

/* English UI: Latin headings in a Latin serif; the Hebrew text keeps its font. */
:root[lang="en"] #top h1, :root[lang="en"] h2.sec, :root[lang="en"] .partcard .nm, :root[lang="en"] .secrow .nm { font-family: Georgia, 'Times New Roman', var(--hfont), serif; }
:root[lang="en"] .secrow .num, :root[lang="en"] .st .on, :root[lang="en"] .cell { font-family: Georgia, serif; font-size: 15px; }
:root[lang="en"] .secrow .nm { font-size: 17px; }
:root[lang="en"] .partcard .nm { font-size: 20px; }
:root[lang="en"] .st .slb, :root[lang="en"] .slt { direction: rtl; text-align: right; font-family: var(--hfont); }
:root[lang="en"] .cmt, :root[lang="en"] .vs .vt { direction: rtl; }
