/* Arabic (right-to-left) layer for index-ar.html. Loaded only by the Arabic site (tools/build_ar.py adds it).
   Flex and grid layouts mirror on their own under dir="rtl"; this file fixes what does not. */

/* Typeface: IBM Plex Sans Arabic everywhere (it includes Latin letters too). Arabic must not be letter-spaced. */
html[dir="rtl"] { --font-sans: "IBM Plex Sans Arabic", "Inter Tight", sans-serif; --font-mono: "IBM Plex Sans Arabic", "JetBrains Mono", monospace; }
html[dir="rtl"] body, html[dir="rtl"] body *:not(code):not(pre):not(kbd) {
  font-family: "IBM Plex Sans Arabic", "Inter Tight", -apple-system, sans-serif !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}
html[dir="rtl"] body { line-height: 1.7; }
html[dir="rtl"] h1, html[dir="rtl"] h2, html[dir="rtl"] h3 { line-height: 1.25 !important; }

/* Language switch */
.lang-sw { font-weight: 500; }
html[dir="rtl"] .lang-sw { font-family: "Inter Tight", sans-serif !important; }

/* Scrolling logo strip and sideways rails keep a left-to-right track so the animation and arrows work;
   the cards inside stay right-to-left. */
html[dir="rtl"] .lg-viewport, html[dir="rtl"] .lg-track, html[dir="rtl"] .sc-rail { direction: ltr; }
html[dir="rtl"] .sc-rail > *, html[dir="rtl"] .lg-track > * { direction: rtl; }

/* Phone numbers, emails and other Latin runs read left to right inside Arabic text */
html[dir="rtl"] .contact-phone-link, html[dir="rtl"] .contact-email-text, html[dir="rtl"] a[href^="mailto:"] { direction: ltr; unicode-bidi: isolate; }

/* Figures such as 4M+, AED 1B+ and $10M keep their own (left-to-right) order */
html[dir="rtl"] b, html[dir="rtl"] strong, html[dir="rtl"] .ar-big, html[dir="rtl"] .case-meta-value, html[dir="rtl"] .sd-glyph,
html[dir="rtl"] .wb-proof b, html[dir="rtl"] .wk-stat b, html[dir="rtl"] .sd-stat b, html[dir="rtl"] [class*="stat"] > b { unicode-bidi: plaintext; }

/* Off-screen helpers (skip link, form honeypot) sit at left:-9999px, which in right-to-left pages becomes
   scrollable space. Keep the page from scrolling sideways. */
html[dir="rtl"] { overflow-x: clip; }
html[dir="rtl"] a[href="#main"]:not(:focus) { left: auto !important; right: -9999px; }
html[dir="rtl"] .project-form .honeypot { left: auto; right: -9999px; }
html[dir="rtl"] .nav-new::after { content: "جديد"; }

/* How we operate: the day timeline's vertical line sits beside the times, which move to the right */
html[dir="rtl"] .op-tl::before, html[dir="rtl"] .op-tl-fill { left: auto; right: 118px; }
@media (max-width: 600px) { html[dir="rtl"] .op-tl::before, html[dir="rtl"] .op-tl-fill { left: auto; right: 14px; } }
html[dir="rtl"] .op-tl time { text-align: right; }

/* Home: the language-understanding demo sentence is Arabic here */
html[dir="rtl"] .wb-nlp { direction: rtl !important; }
@media (max-width: 600px) {
  html[dir="rtl"] .op-dot { margin: 4px 7px 0 0; }
  html[dir="rtl"] .op-day-end { margin-left: 0; margin-right: 30px; }
}

/* Rail arrows: the right-to-left sector pages scroll right to left, so the arrows point the other way.
   The home sector rail keeps a left-to-right track, so its two buttons keep left-to-right order. */
html[dir="rtl"] .sd-arrows button { transform: scaleX(-1); }
html[dir="rtl"] .sc-nav { direction: ltr; }
