/* ── The Hebrew rail · RTL overlay ───────────────────────────────
   The shell sets dir="rtl" on
   <html> when :reading/lang is :he — that alone mirrors flex rows,
   text flow, and scrollbar side natively. This overlay handles what
   the dir attribute cannot: LTR islands (code, data, Latin), and
   the physical-property stragglers in the high-traffic partials.

   STAGED by design (D13): generic islands + reader-surface flips
   first; remaining partials get their flips with the visual pass.
   Never mirror Hebrew content areas — they were always RTL. */

/* ── LTR islands — data that must not mirror ── */
[dir=rtl] code,
[dir=rtl] kbd,
[dir=rtl] pre,
[dir=rtl] .rd-morph-code,
[dir=rtl] .wb-receipt-model,
[dir=rtl] .rd-translit {
  direction: ltr;
  unicode-bidi: isolate;
}

/* Numbers, refs, and mixed-run cells: isolate so bidi doesn't
   reorder "1,197,042" or "Gen 1:1"-shaped data inside RTL chrome. */
[dir=rtl] .rd-kv-value,
[dir=rtl] .wb-stat-value {
  unicode-bidi: isolate;
}

/* English-fallback prose (Strong's glosses/senses awaiting B.1b-he)
   inside RTL chrome: plaintext lets each run take its own direction
   from its first strong character, so quotes and parens stop
   jumping ends ("a firstfruit" stays intact). Verified sighting:
   the word-mini hero gloss on בראשית. */
[dir=rtl] .rd-mw-hero,
[dir=rtl] .rd-mw-gloss,
[dir=rtl] .rd-mw-peer-gloss,
[dir=rtl] .rd-mw-pos-gloss {
  unicode-bidi: plaintext;
}

/* Verse translation lines (the reader band + the verse profile's
   translation slot + the mini's translation rows): an English
   translation inside RTL chrome otherwise renders its PHRASE ORDER
   backwards ("the earth … In the beginning created God" — Scott's
   Gen 1:1 sighting). plaintext gives each line its own direction
   from its first strong character — English lines read LTR, a
   future Hebrew/Aramaic line reads RTL, CJK falls back LTR. */
[dir=rtl] .pf-trans-text,
[dir=rtl] .pf-trans-body,
[dir=rtl] .rd-translation-text {
  unicode-bidi: plaintext;
  text-align: start;
}

/* Study prose + commentary text: the study channel is EN until
   HE-B renders it (known, queued); commentary shows originals for
   :he readers but EN for translator-notes and other langs. Either
   way each paragraph takes its own direction. */
[dir=rtl] .rd-study-prose,
[dir=rtl] .rd-panel-commentary-text {
  unicode-bidi: plaintext;
  text-align: start;
}

/* Word-profile prose blocks + cluster-card bodies + instances'
   English translation cells — same disease, wider organs. With
   text-align: start, alignment follows each paragraph's resolved
   direction (English paragraphs read LTR-left, Hebrew RTL-right).
   These are EN-content-awaiting-HE-B surfaces; the rule is correct
   both before and after those campaigns land. */
[dir=rtl] .wb-fac-summary,
[dir=rtl] .wb-fac-negative-note,
[dir=rtl] .wb-fac-cl-body,
[dir=rtl] .wb-help-body,
[dir=rtl] .wb-help-prose,
[dir=rtl] .wb-finding-body,
[dir=rtl] .wb-inst-cell-en {
  unicode-bidi: plaintext;
  text-align: start;
}

/* ── Chrome text alignment ──
   Most chrome uses flex (auto-mirrors). Explicit text-align: left
   in labels reads as "start" intent — flip the common label/cell
   classes on the reader surface. */
[dir=rtl] .rd-panel-kv-label,
[dir=rtl] .rd-panel-section-head,
[dir=rtl] .wb-fi-col-head {
  text-align: right;
}

/* THE DIRECTION-PIN TRAP (caught by Scott, 2026-07-22): logical
   inset properties resolve against the ELEMENT'S OWN direction —
   and .rd-help / .rd-translit-legend pin `direction: ltr` for
   their English bodies, so inset-inline-end re-resolves to right:0
   on them regardless of the page being RTL. Popups that pin their
   own direction need PHYSICAL overrides here, keyed on the page. */
[dir=rtl] .rd-help,
[dir=rtl] .rd-translit-legend {
  right: auto;
  left: 0;
}

/* Accent borders, absolute-positioned rails, and the remaining
   physical-property flips land with the visual pass — one partial
   at a time, verified on screen, never guessed. */
