/* Arabic version, phase 1: rules that apply ONLY in a right-to-left page.
   Linked by templates/_ui_locale_head.html (and the stored dashboards at serve
   time) only when <html dir="rtl">, so English pages never load this file.
   Everything that mirrors on its own (flex rows, grids, text) is handled by
   logical properties in the main stylesheets; this file is for what logical
   properties can't express. */

/* arrows from i18n.arrow(): point the other way in reading order */
.flip-rtl { display: inline-block; transform: scaleX(-1); }

/* values that always read left to right: a score with its %, a rank, "5 of 5" */
bdi[dir="ltr"] { unicode-bidi: isolate; direction: ltr; }

/* names in lists and labels keep the column's edge whatever their script: on a right-to-left page
   that is the right edge (ds.css keeps `left` for English, since an Arabic name's own dir would turn
   `start` around; Chromium has no text-align: match-parent) */
.heat-name, .ov-client, .sidebar-label, .cp-item > span, .sw-item > span, .sw-cur, .page-title, .crumb-phone { text-align: right; }

/* ── transforms and backgrounds logical properties can't express (the hand list) ── */
/* the light/dark-style switch: its knob starts at inline-start and slides the other way */
.ds-switch input:checked + i::after { transform: translateX(-12px); }
/* skeleton shimmer runs in reading direction */
.skeleton::after { transform: translateX(100%); animation-name: ds-shimmer-rtl; }
@keyframes ds-shimmer-rtl { to { transform: translateX(-100%); } }
/* the question sheet's step slide comes from the reading-order side */
.qs-step { animation-name: qs-in-rtl; }
.qs-step.from-left { animation-name: qs-in-left-rtl; }
@keyframes qs-in-rtl { from { opacity: 0; transform: translateX(-28px); } }
@keyframes qs-in-left-rtl { from { opacity: 0; transform: translateX(28px); } }
/* the collapsed rail's tooltips open away from the rail (left of it); [dir="rtl"]: the sidebar's
   own <style>, later in the page, would win at the same specificity */
[dir="rtl"] .sidebar-collapse-btn[data-label]::after,
[dir="rtl"] .sidebar-link[data-label]::after { transform: translateY(-50%) translateX(-8px); }
/* the phone drawer slides in from the right edge. [dir="rtl"]: the sidebar's own <style> comes later
   in the page with the same specificity and would win, leaving the closed drawer over the left of
   the page (phase 3's 390px check) */
@media (max-width: 780px) {
  [dir="rtl"] .sidebar { transform: translateX(100%); }
  [dir="rtl"] .sidebar.open { transform: translateX(0); }
}
/* the report's side drawer slides in from the left */
.bf-panel { animation-name: bf-in-rtl; }
@keyframes bf-in-rtl { from { transform: translateX(-24px); opacity: 0 } to { transform: none; opacity: 1 } }
/* selects: our chevron sits at the inline end (padding-inline-end already moved) */
select { background-position: left 12px center; }
/* the "more to scroll" fades fade toward the inline end */
.tbl-fade-end { background: linear-gradient(to left, transparent, var(--card)); }
.hdr-fade-end { background: linear-gradient(to left, transparent, var(--hdr)); }

/* ── values that read left to right: a score with its %, a rank (#1.2), a change (▲ 6) ──
   Their number and unit are separate boxes (a flex row, a <small>), which a right-to-left
   page would put in the other order («% 55»). Blocks keep the page's right edge. */
/* not the early count («4 من 5»): in an LTR box an Arabic reader would read it as 5 of 4 */
.bf-ring-num:not(.is-count-box), .ds-delta, .heat-cell, .ov-score, .ov-chg { direction: ltr; unicode-bidi: isolate; }
/* a signed number reads sign first: the quick-win cards' "+10" showed «10+» (part 1's review) */
.pts { direction: ltr; unicode-bidi: isolate; }
.stat-value, .hero-stat-big { direction: ltr; unicode-bidi: isolate; text-align: right; }
/* a count with words reads right to left («10 من 24»), never in an LTR box */
/* (its own class, not .hero-stat-count: show.html styles that one, the early result's count, as an
   inline-flex row, and on the recognition tile it moved English 2px — v2.0.0's pixel gate) */
.hero-stat-big.hero-stat-words, .ov-score.early { direction: rtl; }

/* Charts keep English's geometry (time runs left to right). In a right-to-left page an SVG
   text's start and end swap sides, so "end" (a label kept inside the right edge) would spill past
   it: swap them back, so every label sits where the English one does. */
svg text[text-anchor="end"] { text-anchor: start; }
svg text[text-anchor="start"], svg text:not([text-anchor]) { text-anchor: end; }

/* Part 2: an address typed into a form reads left to right, so a long one keeps its start in view
   («nkedin.com/company/…» on Configuration at 390px); it stays aligned with the page's other fields */
[dir="rtl"] input[type="url"], [dir="rtl"] input[type="email"] { direction: ltr; text-align: right; }

/* v2.9.3: a radar field (radar.css .cr-field: a header's or a panel's rings and beam, aria-hidden, no text) is laid out
   left to right, as in English. Right to left, Chrome reported its rings moving while the page loaded (/ar/privacy up
   to 0.03 at 1440, nothing on screen moving; the beam overflows the field by its radius on both sides). */
.cr-field { direction: ltr; }
