/*
 * rtl.css — right-to-left corrections, loaded only on Arabic, Hebrew, Urdu and
 * Persian pages.
 *
 * style.css is written with physical properties (padding-left, border-left,
 * text-align: left). Rewriting 2,000 lines to logical properties would be the
 * better long-term fix and a far riskier change to ship alongside a translation
 * build, so this sheet corrects the handful of rules a reader actually notices:
 * the reading direction, the accent borders that sit on the wrong edge when the
 * text flips, and the numbers, which stay left-to-right inside RTL prose in
 * every one of these languages.
 */

html[dir="rtl"] body {
  direction: rtl;
  text-align: right;
}

/* Accent rules read as a left margin in LTR and have to move with the text. */
html[dir="rtl"] .application-card,
html[dir="rtl"] .benefit-card,
html[dir="rtl"] blockquote,
html[dir="rtl"] .note,
html[dir="rtl"] .callout,
html[dir="rtl"] .nda-note,
html[dir="rtl"] .form-msg,
html[dir="rtl"] .metric,
html[dir="rtl"] [class*="-quote"] {
  border-left: 0 !important;
  border-right: 4px solid var(--crimson);
}

/* Auto-centred blocks keep their symmetry; directional padding mirrors. */
html[dir="rtl"] .application-card > :not(.app-image) {
  padding-left: var(--spacing-lg);
  padding-right: var(--spacing-lg);
}

html[dir="rtl"] .nav-cta {
  margin-left: 0;
  margin-right: var(--spacing-sm);
}

/* Lists and their markers. */
html[dir="rtl"] ul,
html[dir="rtl"] ol {
  padding-right: 1.4em;
  padding-left: 0;
}

/* Icon-and-label pairs: the icon belongs on the reading edge. */
html[dir="rtl"] .btn i,
html[dir="rtl"] .nav-cta i {
  margin-left: 0.45em;
  margin-right: 0;
}

/* Text that stays left-to-right inside right-to-left prose: URLs, email
   addresses, model numbers and any bare figure. Without this, "500,000 sq ft"
   renders with the unit ahead of the number. */
html[dir="rtl"] a[href^="mailto:"],
html[dir="rtl"] a[href^="http"],
html[dir="rtl"] code,
html[dir="rtl"] .ltr,
html[dir="rtl"] time {
  direction: ltr;
  unicode-bidi: isolate;
  display: inline-block;
}

/* Form fields follow the text, but a phone or email field is entered in
   Latin script and reads wrong flipped. */
html[dir="rtl"] input,
html[dir="rtl"] textarea,
html[dir="rtl"] select {
  text-align: right;
}
html[dir="rtl"] input[type="email"],
html[dir="rtl"] input[type="tel"],
html[dir="rtl"] input[type="url"] {
  direction: ltr;
  text-align: left;
}

/* The language menu opens from the reading edge in both directions; the
   logical inset properties in i18n.js already handle it, this is the fallback
   for engines that do not support them. */
@supports not (inset-inline-end: 0) {
  html[dir="rtl"] .rp-lang__menu {
    right: auto;
    left: 0;
  }
}

/* Video captions render in the caption language, which may be LTR even on an
   RTL page. Let the cue decide rather than inheriting the page. */
html[dir="rtl"] video::cue {
  direction: initial;
  unicode-bidi: plaintext;
}
