/* The source DOM stays intact for pronunciation, study tools and provenance. */
body.bible-fluent-reader:not(.dual-mode) .chapter-panel .verse > .verse-english,
body.bible-fluent-reader:not(.dual-mode) .web-only-verse { display: none !important; }
body.bible-fluent-reader.hide-translit #main-content .chapter-panel :is(.tl, .arr-tl),
body.bible-fluent-reader.hide-translit .reader-line-transliteration { display: none !important; }
.reader-lines { display: none; }
body.bible-fluent-reader:is(.hide-gloss, .dual-mode, .line-by-line) #main-content .verse > .word-flow { display: none !important; }
body.bible-fluent-reader:is(.hide-gloss, .dual-mode, .line-by-line) .verse > .reader-lines {
  display: block; grid-area: hebrew; min-width: 0; max-width: 100%;
}
.reader-line { text-align: start; line-height: 1.65; overflow-wrap: anywhere; }
body.bible-fluent-reader.line-by-line .verse > .reader-lines {
  grid-column: 1 / -1; padding-inline: 3em; box-sizing: border-box;
}
body.line-by-line .reader-line { text-align: center; text-align-last: center; }
.reader-line-hebrew { font-size: 1.8125em; color: var(--hw, var(--ink)); }
.reader-line-transliteration { font-size: calc(var(--t0) * 1.1); color: var(--ink-light); margin-top: .35em; }
.reader-line-gloss { font-size: calc(var(--t0) * 1); color: var(--gloss); margin-top: .35em; }
body:not(.line-by-line) .reader-line-gloss { display: none; }
.reader-tier-token {
  display: inline; appearance: none; padding: 0; margin: 0; border: 0; border-radius: 2px;
  background: transparent; color: inherit; font: inherit; line-height: inherit;
  text-align: inherit; vertical-align: baseline; max-inline-size: 100%;
  white-space: normal; overflow-wrap: anywhere; cursor: pointer;
}
.reader-line-hebrew .reader-tier-token { direction: rtl; unicode-bidi: isolate; }
.reader-line-transliteration .reader-tier-token, .reader-line-gloss .reader-tier-token { direction: ltr; unicode-bidi: isolate; }
.reader-tier-token:hover, .reader-tier-token.reader-related { background: var(--hover-wash); }
.reader-tier-token:focus-visible { outline: 2px solid var(--here); outline-offset: 2px; }
.reader-tier-token.sacc::before, .reader-lines .sacc::before { content: none; }
html.sw-teamim .reader-line-hebrew { font-family: 'Keter YG Medium', serif; }
html.sw-teamim .reader-line-hebrew .tm-paseq::before { content: '\2009\05C0'; }
html.sw-teamim .reader-line-hebrew .tm-maqqef::before { content: '\05BE'; }
body.bible-fluent-reader.dual-mode .verse.bible-verse-layout {
  grid-template-columns: max-content minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas: 'marker hebrew english'; column-gap: 1em !important;
}
body.bible-fluent-reader.dual-mode .bible-verse-layout > .verse-english { padding-inline-start: 1em; border-inline-start: 1px solid var(--rule-light); }
/* The fixed light-theme prose color is too dark against the dark paper. */
body.bible-fluent-reader.dual-mode.dark-mode .web-verse-text { color: var(--ink-light); }
@media (max-width: 650px) {
  body.bible-fluent-reader.dual-mode .verse.bible-verse-layout {
    grid-template-columns: max-content minmax(0, 1fr);
    grid-template-areas: 'marker hebrew' '. english'; row-gap: .65em !important;
  }
  body.bible-fluent-reader.dual-mode .bible-verse-layout > .verse-english { padding-inline-start: 0; border: 0; }
}

/* Position the label beside the first Hebrew line without shifting its center. */
body.bible-fluent-reader.line-by-line .verse.bible-verse-layout { position: relative; }
body.bible-fluent-reader.line-by-line .verse > .verse-num {
  position: absolute; grid-area: auto; left: var(--reader-marker-left, 0px); top: var(--reader-marker-top, 0px);
}
body.dark-mode :is(.book-title, .book-title-en, .ornament) { color: var(--bible-chapter-title-color); }
/* Preserve the existing parenthesized Tanakh numbers and their opacity. */
body.bible-fluent-reader.dark-mode #main-content .verse-num,
body.bible-fluent-reader.dark-mode #main-content .verse-num .verse-num-arabic { color: #E8E3DC !important; opacity: 1 !important; }
body.bible-fluent-reader.dark-mode #main-content .verse-num .verse-num-hebrew,
body.bible-fluent-reader.dark-mode #main-content .bible-verse-layout[data-bible-volume="nt"] .verse-num .verse-num-arabic,
body.bible-fluent-reader.dark-mode #main-content .english-verse-number { color: var(--bible-chapter-title-color) !important; }

/* Resolve the em tier through calc so Blink's relative-font floor does not
   enlarge only the gloss at the newly supported smallest text sizes. */
body.bible-fluent-reader #main-content .word-flow .gl { font-size: calc(var(--t0) * 1) !important; }
/* At the extended upper range, a long Hebrew unit or chapter
   title must wrap inside the reader instead of running outside the phone. */
body.bible-fluent-reader #main-content .word-flow .word-unit > .hw {
  white-space: normal; overflow-wrap: anywhere;
}
body.bible-fluent-reader #main-book-title { overflow-wrap: anywhere; }

/* Source punctuation is display-only, independent of vowels and cantillation. */
.oshb-marked-unit {
  display: inline-flex; direction: rtl; align-items: flex-start;
  max-inline-size: 100%; min-inline-size: 0;
}
.oshb-source-marks {
  display: inline; direction: rtl; unicode-bidi: isolate; white-space: nowrap;
  font-size: 1.8125em; line-height: 1.5; color: var(--hw, var(--ink));
}
.oshb-parashah { font-size: .65em; margin-inline-start: .5em; color: var(--ink-light); }
.reader-line-hebrew .oshb-source-marks { font-size: inherit; line-height: inherit; }
html.sw-teamim .oshb-source-marks { font-family: 'Keter YG Medium', serif; }

.reader-marked-token {
  display: inline-flex; direction: rtl; align-items: flex-end;
  max-inline-size: 100%;
}
.reader-marked-token > .reader-tier-token { min-inline-size: 0; }

.oshb-marked-unit > .oshb-source-word { flex-shrink: 1; }

/* BibleTextSize scales this explicit Scripture baseline independently of
   inherited em contexts: 33.6 / 48 / 72px at 70 / 100 / 150%. */
body.bible-fluent-reader #page { --scripture-hebrew-size: 48px; }
body.bible-fluent-reader #main-content .chapter-panel .verse .word-flow .hw {
  font-size: var(--scripture-hebrew-size) !important;
  font-family: 'Keter YG Medium', serif !important;
}
body.bible-fluent-reader .reader-line-hebrew,
body.bible-fluent-reader .word-flow .oshb-source-marks {
  font-size: var(--scripture-hebrew-size);
  font-family: 'Keter YG Medium', serif !important;
}
body.bible-fluent-reader .reader-line-hebrew :is(.reader-tier-token, .oshb-source-marks) {
  font-family: 'Keter YG Medium', serif !important;
}

/* Reserve the former Hebrew advance, capped by the existing available width.
   This changes neither word spacing nor margins/padding, and leaves natural
   reflow available for long units at larger Aa settings. */
body.bible-fluent-reader .word-flow :is(.word-unit, .oshb-qere-column, .oshb-maqqef-combined, .oshb-ketiv) {
  --hebrew-column-floor: 0px;
  min-inline-size: min(var(--hebrew-column-floor, 0px), 100%) !important;
}

/* Keep Sof Pasuq with its last Hebrew word, without a separate punctuation
   gap. The source marks and parent word retain their normal word-group gap. */
body.bible-fluent-reader .hebrew-verse-ending {
  display: inline-block; white-space: nowrap; direction: rtl;
  unicode-bidi: isolate; margin: 0; padding: 0;
}
/* The inner column centres its Hebrew letters only. Punctuation has its own
   RTL block at the final letter; the outer unit reserves measured overflow. */
body.bible-fluent-reader .word-flow .hebrew-verse-ending { position: relative; }
body.bible-fluent-reader .word-flow .hebrew-verse-ending > .oshb-source-marks {
  position: absolute; right: 100%; top: 0;
  display: inline-flex; direction: rtl; align-items: baseline; text-align: right;
  inline-size: max-content; min-inline-size: 0;
  margin: 0; padding: 0; gap: 0;
}
body.bible-fluent-reader .word-flow .verse-ending-unit {
  display: inline-flex; direction: rtl; align-items: flex-start;
  vertical-align: top; box-sizing: border-box; min-inline-size: 0; max-inline-size: 100%;
  padding-inline-end: var(--verse-ending-clearance, 0px);
}
body.bible-fluent-reader .word-flow .verse-ending-unit > .oshb-source-word { flex-shrink: 1; }
body.bible-fluent-reader .word-flow .hw .oshb-source-marks {
  font-size: inherit; line-height: inherit;
}
body.bible-fluent-reader .chapter-panel .oshb-marked-unit > .oshb-source-marks,
body.bible-fluent-reader .chapter-panel .reader-marked-token > .oshb-source-marks {
  margin-inline: 0;
  padding-inline: 0;
}
