/* Right-to-left corrections. Loaded on every page; every rule is scoped to
   [dir="rtl"] or targets mixed-direction content, so this file changes nothing
   for en, ru and el.

   WHY OVERRIDES AND NOT A LOGICAL-PROPERTIES REWRITE

   `dir="rtl"` on <html> already does most of the work: text alignment, flex and
   grid flow, list markers, scrollbar side and the bidi base direction all flip
   on their own. What remains is the handful of places where that automatic
   mirroring does not apply. Converting every margin-left across five
   stylesheets to margin-inline-start would touch far more code for the same
   result, and would put the three working locales at risk.

   EVERY SELECTOR BELOW WAS TAKEN FROM THE STYLESHEETS, NOT GUESSED

   A first draft of this file invented plausible-sounding class names --
   .nav-links, .lb-close, .back-arrow, .cert-serial -- none of which exist in
   this codebase. It would have shipped as dead CSS that looked like a fix. The
   rules below cite the file and line they mirror.

   THE PART THAT MATTERS MOST IS SECTION 3

   Mirroring the layout is the easy half, and it is the half a screenshot shows.
   The half that decides whether a native reader trusts the page is bidi
   isolation on mixed-direction runs: prices, phone numbers, emails. Those look
   correct in a screenshot and read as scrambled to someone who can read them. */

/* ---------- 1. Physical margins that dir= does not flip ----------
   margin-left is still the left under dir="rtl". Each rule below swaps a
   specific declaration that exists in the stylesheets today. */

/* styles.css:78 and :754 -- .utility-bar a { margin-right: 24px } / 14px */
[dir="rtl"] .utility-bar a { margin-right: 0; margin-left: 24px; }

/* styles.css:532 -- .link-arrow span { margin-left: 8px } */
[dir="rtl"] .link-arrow span { margin-left: 0; margin-right: 8px; }

/* styles.css:620 -- .footer-links a { margin-left: 22px } */
[dir="rtl"] .footer-links a { margin-left: 0; margin-right: 22px; }

@media (max-width: 767px) {
  [dir="rtl"] .utility-bar a { margin-right: 0; margin-left: 14px; }
}

/* certificate.css:181 sets padding-left AND padding-right to the same 20px on
   .cert-l, .cert-r and .stone-tabs, so it is already symmetric. Listed here so
   the next reader does not have to re-check it. */

/* ---------- 2. Directional glyphs ----------
   An arrow pointing against the reading direction reads as a mistake. The arrow
   in .link-arrow means "onward", which in RTL is leftward. */

[dir="rtl"] .link-arrow span { transform: scaleX(-1); }

/* Keep the hover translate going the right way too: the base rule slides the
   arrow forward on hover, and forward is now the other way. */
[dir="rtl"] a:hover .link-arrow span { transform: scaleX(-1) translateX(4px); }

/* ---------- 3. BIDI ISOLATION -- invisible in a screenshot, wrong to a reader ----------

   A Latin or numeric run inside Hebrew text is reordered by the Unicode
   bidirectional algorithm unless it is isolated. The classic failures:

     "€ 4,200"       the currency symbol jumps to the wrong end
     "+357 99 1234"  the country code lands at the far end
     "1.00 ct"       the unit detaches from its number

   Each renders as a plausible-looking string that is WRONG, and no screenshot
   review catches one. `unicode-bidi: isolate` treats the run as a single opaque
   unit, which is what a price or an identifier actually is.

   NOT scoped to [dir="rtl"]: these elements are equally mixed-direction on an
   LTR page, so this is a correctness fix that happens to matter most for
   Hebrew. Class names verified present in the markup. */

.lightbox-price,
.lightbox-price-note,
.price-display,
#priceDisplay,
#request-balance {
  unicode-bidi: isolate;
}

/* Phone and email are pure LTR content wherever they appear, in any locale. */
a[href^="tel:"],
a[href^="mailto:"] {
  unicode-bidi: isolate;
  direction: ltr;
}

/* ---------- 4. Forms ----------
   The markup carries dir="auto" on free-text inputs, which lets the browser
   pick direction per VALUE -- a Hebrew name renders RTL and an email address
   renders LTR, in the same form. These rules cover what dir="auto" cannot. */

/* A phone or email typed into an RTL field has its +357 prefix thrown to the
   wrong end, making a valid number look malformed to the person typing it. */
[dir="rtl"] input[type="email"],
[dir="rtl"] input[type="tel"],
[dir="rtl"] input[type="url"] { direction: ltr; text-align: right; }

/* ---------- 5. No horizontal scroll ----------
   A mirrored layout that overflows by a pixel gives RTL readers a scrollbar the
   other locales do not have, which reads as a broken page rather than as a
   rounding error. */

[dir="rtl"] body { overflow-x: hidden; }
