/*
 * Copyright 2026 NX1X. Licensed under the Apache License, Version 2.0.
 *
 * Loaded only on the /he/ tree, after styles.css. Almost everything in
 * styles.css already uses logical properties (inset-inline-*, margin-inline,
 * padding-inline, text-align: start) and needs no override at all: this file
 * is deliberately small, and holds only the handful of things dir="rtl" does
 * not flip for us. See docs/I18N.md for the reasoning behind each rule.
 */

/* Numbers and version strings (e.g. "1.9.5-beta.2+port.5") sit inside Hebrew
   sentences. The Unicode bidi algorithm usually gets a lone run of digits
   right on its own, but a version string mixes digits with "." and "-",
   which are weak/neutral characters that can pick up the paragraph's
   direction at the edges. Isolating them keeps the string itself always
   left to right, wherever the algorithm places it in the RTL sentence. */
[data-openmila-version],
.gh-stars,
code {
  unicode-bidi: isolate;
}

/* Code blocks, and any table whose feature rows are (per docs/I18N.md) kept
   in English rather than translated: shell commands, file paths and the
   parity tables read left to right regardless of the page's own direction.
   Marked explicitly with dir="ltr" in the Hebrew HTML itself (semantic, and
   what governs punctuation and bidi reordering); dir="ltr" alone leaves
   text-align at the inherited "start", which under the page's own
   dir="rtl" would still mean "right". This re-anchors it to the edge the
   element's own dir="ltr" implies. */
.codeblock,
pre,
table[dir="ltr"],
table[dir="ltr"] th,
table[dir="ltr"] td,
table[dir="ltr"] caption {
  text-align: start;
}

/* copy.js appends its button after the <code>; with the code block itself
   forced ltr, the button's own inset-inline-end already lands at the
   visual end of that ltr block, which is correct on its own and needs no
   override here. */

/* The docs table of contents numbers each entry with counter(toc) "1.",
   "2." etc: Hebrew technical writing keeps Western Arabic numerals for a
   list like this (see docs/I18N.md), so the counter itself is unchanged.
   Only the gap between the number and the link text needs to read as a
   gap on the correct side, which padding-inline-end already gives it
   under dir="rtl" with no change needed here.
*/

/* The hamburger icon's three bars and the back-to-top button's up-arrow are
   direction-neutral shapes (a stack of horizontal lines, an arrow pointing
   up); .nav-toggle-bar's centering (margin-inline: auto) and
   .back-to-top's position (inset-block-end / inset-inline-end) already
   mirror correctly under dir="rtl" with no override.
*/
