/* i18n-ar.css: the Arabic pages (ar.html, ar-privacy.html). Loaded after bundle.css / base.css on those
   pages only. Grid, flex and the logical properties of the main stylesheets mirror by themselves
   under dir="rtl"; this file sets the Arabic type and mirrors only what has no logical form
   (arrows, directional gradients and masks, motions). Write new side-specific rules in the main
   stylesheets as padding-inline-start, border-inline-end, inset-inline-start, text-align: end …,
   never as -left/-right: then nothing needs to be added here. */

/* Readex Pro (SIL OFL, fonts/ofl-readex-pro.txt): one modern Arabic face for everything on the Arabic
   pages, Arabic letters, tashkeel and ، ؛ ؟ only (web/fonts-src/charset; deploy/subset-fonts.sh cuts
   the static weights from the variable font). Latin and digits stay in the English fonts.
   SIZE and WEIGHT are both MEASURED against the same element on the English page, so the Arabic looks
   as big and as dark as the English, also from a distance (deploy/check-ink-size.js):
   - size: the height of the band that holds the middle half of a line's ink (where the bulk of the
     letters sits; x-height in Latin, the baseline zone in Arabic) is equal. Arabic concentrates its ink
     in a thin band at the baseline, so at the same size it looks ~17% smaller: it is scaled up with
     size-adjust (117% body, 120% display, 121% labels, 123% kickers).
   - weight: ink per em of line is equal (lighter cuts make up for the bigger letters).
   Body and display text, paired with Poppins 200 / 400 / 500 / 600: cuts at wght 170 / 330 / 410 / 520. */
@font-face { font-family: "Readex Pro AR"; font-style: normal; font-weight: 100 299; font-display: swap; size-adjust: 120%; src: url(../fonts/readex-ar-200.9455fcd690.woff2) format("woff2"); unicode-range: U+0600-0670, U+200C-200F, U+2010-2011; }
@font-face { font-family: "Readex Pro AR"; font-style: normal; font-weight: 300 449; font-display: swap; size-adjust: 117%; src: url(../fonts/readex-ar-400.419b2625f3.woff2) format("woff2"); unicode-range: U+0600-0670, U+200C-200F, U+2010-2011; }
@font-face { font-family: "Readex Pro AR"; font-style: normal; font-weight: 450 549; font-display: swap; size-adjust: 117%; src: url(../fonts/readex-ar-500.4f543a5717.woff2) format("woff2"); unicode-range: U+0600-0670, U+200C-200F, U+2010-2011; }
@font-face { font-family: "Readex Pro AR"; font-style: normal; font-weight: 550 900; font-display: swap; size-adjust: 117%; src: url(../fonts/readex-ar-600.41632c3790.woff2) format("woff2"); unicode-range: U+0600-0670, U+200C-200F, U+2010-2011; }
/* Labels: monospace capitals in English, light and widely tracked. Arabic has no capitals and cannot
   be tracked; it is drawn 21% larger (the 12px kickers below 23%) in light cuts that give the same
   ink: wght 220 for labels, 250 for the 600-weight tag and the kickers. Latin and digits inside a
   label use the very same monospace font as the English page (the label faces cover only Arabic
   letters and the space, so the space between Arabic words is an Arabic one, not a 0.6em cell). */
@font-face { font-family: "Readex AR Label"; font-style: normal; font-weight: 100 549; font-display: swap; size-adjust: 121%; src: url(../fonts/readex-ar-label-220.d5b98ea076.woff2) format("woff2"); unicode-range: U+0020, U+00A0, U+0600-0670, U+200C-200F, U+2010-2011; }
@font-face { font-family: "Readex AR Label"; font-style: normal; font-weight: 550 900; font-display: swap; size-adjust: 121%; src: url(../fonts/readex-ar-label-250.49200d935f.woff2) format("woff2"); unicode-range: U+0020, U+00A0, U+0600-0670, U+200C-200F, U+2010-2011; }
@font-face { font-family: "Readex AR Kicker"; font-style: normal; font-weight: 100 900; font-display: swap; size-adjust: 123%; src: url(../fonts/readex-ar-label-250.49200d935f.woff2) format("woff2"); unicode-range: U+0020, U+00A0, U+0600-0670, U+200C-200F, U+2010-2011; }
/* . , : ! inside Arabic labels come from Poppins, as in Arabic body text (a monospace cell would
   leave a gap around the full stop). Same weight ranges as the faces above: a face with a different
   range is matched on its own, and the Arabic letters would then miss the Readex face. */
@font-face { font-family: "Readex AR Label"; font-style: normal; font-weight: 100 549; font-display: swap; size-adjust: 121%; src: url(../fonts/poppins-200.3b70d9c80f.woff2) format("woff2"); unicode-range: U+0021, U+002C, U+002E, U+003A; }
@font-face { font-family: "Readex AR Label"; font-style: normal; font-weight: 550 900; font-display: swap; size-adjust: 121%; src: url(../fonts/poppins-200.3b70d9c80f.woff2) format("woff2"); unicode-range: U+0021, U+002C, U+002E, U+003A; }
@font-face { font-family: "Readex AR Kicker"; font-style: normal; font-weight: 100 900; font-display: swap; size-adjust: 123%; src: url(../fonts/poppins-200.3b70d9c80f.woff2) format("woff2"); unicode-range: U+0021, U+002C, U+002E, U+003A; }
[dir="rtl"] { --sans: Poppins, "Readex Pro AR", system-ui, -apple-system, "Segoe UI", Tahoma, Arial, sans-serif;
  --mono: "Readex AR Label", ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
[dir="rtl"] .sh .t, [dir="rtl"] .label, [dir="rtl"] .nav a, [dir="rtl"] .pv-links a, [dir="rtl"] .status-pill, [dir="rtl"] .facts li, [dir="rtl"] .cmap-n, [dir="rtl"] .craft-n {
  font-family: "Readex AR Kicker", ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
/* Arabic letters join: tracking would break the words apart (uppercase does not apply). Elements the
   translation leaves in English (names, units, coordinates: lang="en", set by deploy/make-ar.js)
   and the bare numbers keep the English tracking. */
[dir="rtl"] body, [dir="rtl"] body *:not(:lang(en)):not(.cmap-n):not(.craft-n) { letter-spacing: 0 !important; word-spacing: normal !important; }
/* English inside an Arabic element would inherit its 0: give it the English element's tracking */
[dir="rtl"] .geo [lang="en"] { letter-spacing: .14em; }
/* English stays English: its own monospace (spaces included), and left-to-right as an isolated run */
[dir="rtl"] [lang="en"], [dir="rtl"] [lang="en"] * { --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
[dir="rtl"] .geo [lang="en"], [dir="rtl"] .budget-legend b[lang="en"] { font-family: var(--mono); }
[dir="rtl"] :is(span, b, a, em, strong, i, bdi)[lang="en"] { direction: ltr; unicode-bidi: isolate; }
[dir="rtl"] .budget-legend b[lang="en"] { letter-spacing: .08em; }
/* the rank mark is a drawing: it reads the same in both languages */
[dir="rtl"] .rank-mark { direction: ltr; }
/* taller ascenders/descenders: give the big display lines room */
[dir="rtl"] .hero h1, [dir="rtl"] .h2, [dir="rtl"] .rank-h, [dir="rtl"] .craft-h, [dir="rtl"] .vcard-h { line-height: 1.3; }
[dir="rtl"] .cmap-disc h3 { line-height: 1.35; }
/* the stats under the hero: the matched size is ~5% wider than the column; 7% smaller keeps one line */
[dir="rtl"] .facts b { font-size: 26px; }
@media (min-width: 1181px) { [dir="rtl"] .facts b { font-size: 23.25px; } }
/* while the counters run, a figure must not wrap the stat onto a second line for a frame (layout shift) */
@media (min-width: 1001px) { [dir="rtl"] .facts b { white-space: nowrap; } }
@media (max-width: 640px) { [dir="rtl"] .facts b { font-size: 20px; } }
/* what people type stays left-to-right */
[dir="rtl"] input[type="email"], [dir="rtl"] input[type="tel"] { direction: ltr; text-align: right; }
[dir="rtl"] input[type="email"]::placeholder, [dir="rtl"] input[type="tel"]::placeholder { text-align: right; }
/* the stress chart is a left-to-right plot: keep its slider in the same direction */
[dir="rtl"] .load input[type="range"] { direction: ltr; }

/* arrows point the reading way, and nudge that way on hover */
[dir="rtl"] .arrow::after, [dir="rtl"] .cmap-item::after, [dir="rtl"] .foot .news .btn::after, [dir="rtl"] #contact-us .form .btn::after { content: "←"; font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
[dir="rtl"] .arrow:hover::after, [dir="rtl"] .foot .news .btn:hover::after, [dir="rtl"] #contact-us .form .btn:hover::after { transform: translateX(-4px); }
[dir="rtl"] .cmap-item:hover::after, [dir="rtl"] .cmap-item:focus-visible::after { transform: translateX(-3px); }

/* Sides, paddings, borders and positions are written as logical properties (inline-start/-end) in
   the main stylesheets, so the browser mirrors them by itself. Only what CSS cannot express
   logically is mirrored here: directional gradients and masks, background positions, motions. */

/* hero: the shade darkens the side the text is on */
[dir="rtl"] .hero::before { -webkit-mask-image: radial-gradient(120% 90% at 20% 10%, #000 0%, transparent 70%); mask-image: radial-gradient(120% 90% at 20% 10%, #000 0%, transparent 70%); }
[dir="rtl"] .hero-shade { background: linear-gradient(270deg, rgba(27, 20, 22, .94) 0%, rgba(27, 20, 22, .78) 42%, rgba(27, 20, 22, .38) 100%),
  linear-gradient(0deg, var(--bg) 0%, rgba(27, 20, 22, 0) 42%),
  linear-gradient(180deg, rgba(27, 20, 22, .8) 0%, rgba(27, 20, 22, 0) 22%); }
@media (max-width: 860px) {
  [dir="rtl"] .hero-shade { background: linear-gradient(180deg, rgba(27, 20, 22, .86) 0%, rgba(27, 20, 22, .74) 55%, var(--bg) 100%); }
}

/* numbers in the ERP rows sit at the row's outer edge; the select arrow on the other side */
[dir="rtl"] .erp-v { text-align: left; }
/* the legend values are left-to-right runs: their logical margin would resolve to the wrong side */
[dir="rtl"] .budget-legend b { margin-left: 0; margin-right: auto; }
[dir="rtl"] select { background-position: 15px 50%, 20px 50%; }

/* decorative khatam patterns and glows fade towards the text side */
[dir="rtl"] #ebrd::after, [dir="rtl"] .foot::after, [dir="rtl"] .rank::after { -webkit-mask-image: linear-gradient(270deg, transparent, #000 70%); mask-image: linear-gradient(270deg, transparent, #000 70%); }
[dir="rtl"] .rank { background: radial-gradient(70% 140% at 92% 50%, rgba(var(--rose-rgb), .12), transparent 60%), var(--bg); }
[dir="rtl"] .craft { background: radial-gradient(60% 120% at 0% 0%, rgba(var(--rose-rgb), .12), transparent 60%), var(--panel); }
[dir="rtl"] .kernel { background: linear-gradient(270deg, rgba(var(--rose-rgb), .08), transparent 70%), var(--panel); }
/* Chips: no capitals to trim the line to (base.css); in the Readex label cut the ink of a word sits
   2px below the middle of the line, so the text is lifted 2px (measured: ink centred within 0.5px). */
.rank-pts .chips li, .rank-pts .chips li + li { padding-block: 2px 5px; text-box: normal; }
.kernel .chips li { padding-block: 3px 6px; text-box: normal; }
/* hero pill: the same, measured: Readex's ink sat 2.1px (desktop) / 3.3px (<=640px, 10.5px text) below the
   middle, so the text is lifted that much (same total padding, same height) and the dot, centred on the
   box, is moved back down with it (ink centred within 0.25px at 360-1440px) */
[dir="rtl"] .status-pill { padding-block: 5.87px 10.13px; }
[dir="rtl"] .status-pill i { translate: 0 2.13px; }
@media (max-width: 640px) { [dir="rtl"] .status-pill { padding-block: 5.5px 10.5px; } [dir="rtl"] .status-pill i { translate: 0 2.5px; } }
[dir="rtl"] .vcard { background: radial-gradient(80% 140% at 100% 0%, rgba(var(--rose-rgb), .12), transparent 60%); }

/* footer: newsletter strip, contact form */
[dir="rtl"] .foot-top { background: radial-gradient(70% 160% at 100% 0%, rgba(var(--rose-rgb), .1), transparent 60%), var(--panel); }
[dir="rtl"] #contact-us .form { background: radial-gradient(80% 60% at 0% 0%, rgba(var(--rose-rgb), .09), transparent 60%) padding-box, linear-gradient(var(--panel), var(--panel)) padding-box; }
[dir="rtl"] .foot-top > .khatam { -webkit-mask-image: linear-gradient(270deg, transparent, #000 75%); mask-image: linear-gradient(270deg, transparent, #000 75%); }
[dir="rtl"] .foot-top > .khatam::before { animation-name: khatam-drift-rtl; }
@keyframes khatam-drift-rtl { to { transform: translate3d(-72px, 72px, 0); } }
[dir="rtl"] .foot-top::before { background: linear-gradient(255deg, transparent 35%, rgba(255, 228, 222, .055) 45%, rgba(0, 250, 154, .06) 50%, rgba(255, 228, 222, .055) 55%, transparent 65%);
  transform: translateX(100%); animation-name: beam-rtl; }
@keyframes beam-rtl { 0% { transform: translateX(100%); } 40%, 100% { transform: translateX(-100%); } }

/* numbers inside Arabic text: keep "#1", "+40–120%", "45–71%" in their own (left-to-right) order */
[dir="rtl"] .rank-h em { unicode-bidi: isolate; }
[dir="rtl"] .erp-v, [dir="rtl"] .erp-card .v { direction: ltr; unicode-bidi: isolate; }
[dir="rtl"] .erp-card .v { text-align: right; }
/* the stress chart is a left-to-right plot (axis labels anchored as in English) */
[dir="rtl"] .bench svg { direction: ltr; }

/* measurements read left-to-right ("18 ms"), also inside right-to-left labels */
[dir="rtl"] .budget-scale span, [dir="rtl"] .budget-legend b { direction: ltr; unicode-bidi: isolate; }
/* headings: Arabic words are wider than the "ch" the English measure is counted in */
[dir="rtl"] .h2 { max-width: 24ch; }
/* side rail: the name is shortened by section-rail.js on Arabic pages; anything still longer than the English
   22em ends in an ellipsis, not a hard cut */
[dir="rtl"] .rail .t { text-overflow: ellipsis; }
