/**
 * Arabic presentation layer. Direction comes from WordPress/Polylang's dir="rtl";
 * this file owns typography and components that require explicit bidi rules.
 */

html[lang^="ar"] {
  --drive-arabic-font-family: "IBM Plex Sans Arabic", "IBM Plex Sans", Tahoma, Arial, sans-serif;
}

html[lang^="ar"] body.drive-ma-site {
  --drive-font-family: var(--drive-arabic-font-family);
  --drive-font-family-ui: var(--drive-arabic-font-family);
  --drive-font-family-display: var(--drive-arabic-font-family);
  --drive-tracking-display: 0;
  --drive-tracking-heading: 0;
  --drive-leading-tight: 1.18;
}

html[lang^="ar"] body,
html[lang^="ar"] button,
html[lang^="ar"] input,
html[lang^="ar"] select,
html[lang^="ar"] textarea {
  font-family: var(--drive-arabic-font-family);
}

html[lang^="ar"] body.drive-ma-site .site :where(h1, h2, h3, h4, h5, h6) {
  letter-spacing: 0 !important;
  line-height: 1.22;
  overflow-wrap: normal;
}

html[lang^="ar"] body.drive-ma-site .site :where(.drive-media-article__body, .drive-guide-article, .drive-news-article) :where(p, li) {
  line-height: 1.8;
}

html[lang^="ar"] body.drive-ma-site .site :where(.drive-news-hero h1, .drive-guide-article .drive-media-article__header h1, .drive-guide-hero h1, .drive-news-masthead h1, .drive-brand-landing__copy h1) {
  max-inline-size: 100% !important;
  max-width: none !important;
  text-wrap: pretty;
}

html[dir="rtl"] body.drive-ma-site .site :where(.drive-price, .drive-model-price, .drive-version-price, time, bdi) {
  unicode-bidi: isolate;
}

html[dir="rtl"] body.drive-ma-site {
  direction: rtl;
  text-align: start;
}

html[dir="rtl"] .drive-wordmark,
html[dir="rtl"] .drive-footer-wordmark,
html[dir="rtl"] [data-drive-price],
html[dir="rtl"] .drive-price,
html[dir="rtl"] .drive-model-price,
html[dir="rtl"] .drive-version-price {
  direction: ltr;
  unicode-bidi: isolate;
}

html[dir="rtl"] input[type="email"],
html[dir="rtl"] input[type="tel"],
html[dir="rtl"] input[type="url"],
html[dir="rtl"] input[type="number"],
html[dir="rtl"] input[type="date"],
html[dir="rtl"] input[type="time"] {
  direction: ltr;
  text-align: start;
}

html[dir="rtl"] .drive-container,
html[dir="rtl"] .entry-content,
html[dir="rtl"] .drive-card,
html[dir="rtl"] .drive-media-article__body,
html[dir="rtl"] .drive-model-landing,
html[dir="rtl"] .drive-brand-landing {
  text-align: start;
}

html[dir="rtl"] .drive-language-switcher__inner,
html[dir="rtl"] .drive-top-language-menu {
  direction: ltr;
}

html[dir="rtl"] .drive-language-switcher__link[lang="ar"] {
  font-family: var(--drive-arabic-font-family);
}

html[dir="rtl"] .drive-vehicle-gallery__counter {
  direction: ltr;
  unicode-bidi: isolate;
}

/* Keep Western-digit calculator amounts in reading order while the surrounding
 * controls and Arabic currency labels remain RTL. */
html[dir="rtl"] #driveSimWidget .drive-sim-control:first-child > div,
html[dir="rtl"] #driveSimWidget #ds_apport_dh,
html[dir="rtl"] #driveSimWidget #ds_mensualite {
  direction: ltr;
  unicode-bidi: isolate;
  white-space: nowrap;
}

html[dir="rtl"] #driveSimWidget .drive-sim-control:first-child > div,
html[dir="rtl"] #driveSimWidget #ds_apport_dh {
  text-align: right;
}

/* A negative physical left offset creates a 10,000px-wide RTL canvas. Keep the
 * anti-spam field in the accessibility-safe clipping pattern instead. */
html[dir="rtl"] .drive-native-lead__trap {
  border: 0 !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  height: 1px !important;
  left: auto !important;
  margin: -1px !important;
  overflow: hidden !important;
  padding: 0 !important;
  position: absolute !important;
  white-space: nowrap !important;
  width: 1px !important;
}
