/* Right-to-left pages (locales.json "dir": "rtl", e.g. Arabic). Loaded by Base.astro after every other stylesheet,
   only on RTL pages. The design system already uses logical properties (margin-inline, inset-inline, border-inline…);
   this file mirrors the few physical left/right details that remain and sets Arabic typography. */

/* ---------- Arabic typography (self-hosted Noto Sans Arabic as 'Zafgo Arabic', fonts.css) ---------- */
html:lang(ar) {
  --f-display: "Zafgo Arabic", "Commissioner", "Noto Sans", system-ui, sans-serif;
  --f-body: "Zafgo Arabic", "Noto Sans", system-ui, sans-serif;
}
/* letter-spacing breaks the joined Arabic script; tight Latin display leading clips Arabic ascenders/descenders */
html:lang(ar) body *:not(input):not(.au__code) { letter-spacing: 0 !important; }
html:lang(ar) :is(h1, h2, h3, h4, .display, .ac-h1) { line-height: 1.35; }
html:lang(ar) body { line-height: 1.7; }
html:lang(ar) :is(em, i, cite) { font-style: normal; font-weight: 600; }
/* codes, prices, e-mail addresses and URLs stay left-to-right inside Arabic text */
[dir="rtl"] :is(code, kbd, .mono, .num, .tnum, input[type="email"], input[type="url"], input[type="tel"]) { unicode-bidi: isolate; }
[dir="rtl"] :is(input[type="email"], input[type="url"], input[type="tel"]) { direction: ltr; text-align: end; }

/* ---------- inset accent bars (box-shadow has no logical form) ---------- */
[dir="rtl"] .board tbody tr[aria-selected="true"] td:first-child,
[dir="rtl"] .acc-btn[aria-expanded="true"],
[dir="rtl"] .app__side a[aria-current="page"],
[dir="rtl"] .stmt tr.fee td:first-child,
[dir="rtl"] .rail__list a[aria-current="page"],
[dir="rtl"] .opt:has(input:checked),
[dir="rtl"] .hsearch__list li[aria-selected="true"], [dir="rtl"] .hsearch__list li:hover { box-shadow: inset -4px 0 0 var(--live); }
[dir="rtl"] .bn--err, [dir="rtl"] .pv li.is-fail { box-shadow: inset -4px 0 0 var(--err); }
[dir="rtl"] .bn--warn { box-shadow: inset -4px 0 0 var(--warn); }
[dir="rtl"] .bn--info { box-shadow: inset -4px 0 0 var(--action); }
[dir="rtl"] .scr__job.on,
[dir="rtl"] .pt-list a[aria-current],
[dir="rtl"] .ac-de-app:has(input:checked),
[dir="rtl"] .mini__side span.on,
[dir="rtl"] .rlist div.on,
[dir="rtl"] .queue tr.warn td:first-child { box-shadow: inset -3px 0 0 var(--live); }
[dir="rtl"] .next-task { box-shadow: inset -8px 0 0 var(--live); }
[dir="rtl"] .settings th:first-child, [dir="rtl"] .settings td:first-child { box-shadow: inset 1px 0 0 var(--rail); }
[dir="rtl"] .fit tr.is-soon th:first-child { box-shadow: inset -4px 0 0 var(--signal), inset 1px 0 0 var(--rail); }

/* ---------- physical positions and floats ---------- */
[dir="rtl"] select.input { background-position: 14px 50%, 20px 50%; }
@media (min-width: 1024px) {
  [dir="rtl"] .prose .mnote { float: left; margin: 4px 24px 12px 0; }
  [dir="rtl"] .h-shot--console { left: auto; right: 21%; }
  [dir="rtl"] .h-shot--pass { left: auto; right: 0; }
  [dir="rtl"] .h-shot--drv { right: auto; left: 3%; }
}
[dir="rtl"] .cf legend { float: right; }
[dir="rtl"] .pl__line { border-radius: 3px 0 0 3px; transform-origin: right center; }
/* mobile portal rail: portal.css slides it in from the right in RTL, but its RTL rule also beat .is-open */
@media (max-width: 1023px) { [dir="rtl"] .pt-rail.is-open { transform: none; } }

/* ---------- directional arrows that are not marked .icon--dir in the markup ---------- */
[dir="rtl"] .help-list a > .icon--sm:last-child,
[dir="rtl"] .pr-cartbar__n .icon,
[dir="rtl"] #cart-pay .icon { transform: scaleX(-1); }
