/* ============================================================
   Arabic RTL — Almarai + layout mirrors of the English site
   ============================================================ */

html[dir="rtl"],
body.rtl,
body.lang-ar {
  --font-display: "Almarai", sans-serif;
  --font-body: "Almarai", sans-serif;
  --font-mono: "Almarai", sans-serif;
}

html[dir="rtl"] body,
html[dir="rtl"] button,
html[dir="rtl"] input,
html[dir="rtl"] select,
html[dir="rtl"] textarea,
body.rtl,
body.lang-ar {
  font-family: "Almarai", sans-serif;
}

html[dir="rtl"] .display,
html[dir="rtl"] .eyebrow,
html[dir="rtl"] .btn,
html[dir="rtl"] .text-link,
html[dir="rtl"] .topbar__nav a,
html[dir="rtl"] .nav-item > a,
html[dir="rtl"] .lang-switch,
html[dir="rtl"] .lang-switch__link,
html[dir="rtl"] .footer__bottom,
html[dir="rtl"] .footer__company,
html[dir="rtl"] .stat__num,
html[dir="rtl"] .tl-item__year,
html[dir="rtl"] .wpcf7-submit,
html[dir="rtl"] .wpcf7 label,
html[dir="rtl"] .contact-form label {
  font-family: "Almarai", sans-serif !important;
  font-stretch: normal;
  letter-spacing: 0.02em;
  text-transform: none;
}

html[dir="rtl"] .eyebrow,
html[dir="rtl"] .page-hero .eyebrow,
html[dir="rtl"] .section__head .eyebrow,
html[dir="rtl"] .partners__head .eyebrow,
html[dir="rtl"] .timeline-sec__head .eyebrow,
html[dir="rtl"] .drive__head .eyebrow,
html[dir="rtl"] .feature__body > .eyebrow {
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: none;
}

html[dir="rtl"] .btn,
html[dir="rtl"] .wpcf7-submit {
  font-weight: 700;
}

/* ----------------------------------------------------------
   HEADER — one flex row, no grid (grid was stacking rows)
   DOM: logo | nav | lang | toggle
   direction:rtl → logo right, lang left, nav middle
   ---------------------------------------------------------- */
html[dir="rtl"] .topbar .wrap {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: space-between !important;
  direction: rtl;
  gap: 24px;
  height: 100%;
  min-height: 0;
}

html[dir="rtl"] .topbar__logo,
html[dir="rtl"] .lang-switch--bar,
html[dir="rtl"] .nav-toggle {
  top: auto !important;
  bottom: auto !important;
  align-self: center !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  order: 0 !important;
  grid-area: unset !important;
  grid-column: unset !important;
  grid-row: unset !important;
}

html[dir="rtl"] .topbar__logo {
  display: flex;
  align-items: center;
  line-height: 0;
  flex: 0 0 auto;
  position: relative;
}

html[dir="rtl"] .topbar__nav {
  display: flex;
  align-items: center;
  flex: 0 1 auto;
  flex-direction: row;
  direction: rtl; /* Home → right, Contact → left */
  gap: 34px;
  /* position left alone so mobile can use position:fixed */
}

html[dir="rtl"] .lang-switch {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  margin: 0 !important;
  gap: 6px;
  white-space: nowrap;
  position: relative;
}

html[dir="rtl"] .lang-switch__link--ar,
html[dir="rtl"] .lang-switch__link[lang="ar"] {
  font-family: "Almarai", sans-serif !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  font-size: 13px;
  font-weight: 700;
}

html[dir="rtl"] .lang-switch.lang-switch--nav {
  display: none !important;
}

html[dir="rtl"] .nav-toggle {
  position: relative;
}

html[dir="rtl"] .topbar__nav > a,
html[dir="rtl"] .nav-item > a {
  font-size: 13px;
  padding: 8px 0;
}

html[dir="rtl"] .nav-item .dropdown {
  left: auto;
  right: 0;
  text-align: right;
  direction: rtl;
  padding: 10px 0;
  min-width: 280px;
}

html[dir="rtl"] .dropdown a {
  display: block;
  padding: 11px 24px !important;
  text-align: right !important;
  border-left: none !important;
  border-right: 2px solid transparent;
}

html[dir="rtl"] .dropdown a:hover {
  border-right-color: var(--red);
  border-left-color: transparent !important;
}

html[dir="rtl"] .topbar__nav > a::after,
html[dir="rtl"] .nav-item > a::after {
  left: auto;
  right: 0;
}

/* ----------------------------------------------------------
   RED MISSION BOX — true mirror of English
   English: block starts on the left (LTR).
   Arabic: container direction rtl → block starts on the right.
   ---------------------------------------------------------- */
html[dir="rtl"] .hero > .hero__container:last-of-type {
  direction: rtl;
}

html[dir="rtl"] .hero__mission {
  margin-left: 0 !important;
  margin-right: 0 !important;
  width: 60%;
  /* Text ends on the content .wrap right edge (flip of EN) */
  padding: 0 var(--ttc-align) 0 120px;
  text-align: right;
  justify-content: flex-start;
  direction: rtl;
}

html[dir="rtl"] .hero__mission p {
  margin-left: 0;
  margin-right: 0;
  max-width: 52ch;
}

html[dir="rtl"] .pixels {
  right: auto;
  left: -32px;
}

html[dir="rtl"] .hero__title {
  text-align: right;
}

@media (min-width: 921px) {
  html[dir="rtl"] .hero__title {
    left: auto;
    right: var(--ttc-align);
    max-width: calc(100% - (148px + 300px) - max(148px, calc(40% - 300px)));
  }
}

/* Text alignment */
html[dir="rtl"] .section__head,
html[dir="rtl"] .drive__head,
html[dir="rtl"] .partners__head,
html[dir="rtl"] .lead,
html[dir="rtl"] .page-hero,
html[dir="rtl"] .feature__body,
html[dir="rtl"] .card__body,
html[dir="rtl"] .footer,
html[dir="rtl"] .contact-tile,
html[dir="rtl"] .faq,
html[dir="rtl"] .article__content,
html[dir="rtl"] .article__aside,
html[dir="rtl"] .drive__tile {
  text-align: right;
}

/* Bullets on the right */
html[dir="rtl"] .arrow-list {
  direction: rtl;
  text-align: right;
}

html[dir="rtl"] .arrow-list li {
  padding-top: var(--bullet-pad, 7px);
  padding-bottom: var(--bullet-pad, 7px);
  padding-right: 22px;
  padding-left: 0;
  text-align: right;
}

html[dir="rtl"] .arrow-list li::before {
  left: auto !important;
  right: 0 !important;
}

html[dir="rtl"] .text-link .ext {
  display: inline-block;
  transform: scaleX(-1);
}

html[dir="rtl"] .footer__grid {
  direction: rtl;
}

html[dir="rtl"] .footer__bottom {
  direction: rtl;
  text-align: right;
  justify-content: flex-start;
  gap: 24px;
}

html[dir="rtl"] .cta-band .wrap {
  flex-direction: row;
  direction: rtl;
  text-align: right;
}

html[dir="rtl"] .feature__grid {
  direction: rtl;
}

html[dir="rtl"] .feature__body,
html[dir="rtl"] .feature__body .lead,
html[dir="rtl"] .feature__body .display,
html[dir="rtl"] .feature__body .eyebrow {
  text-align: right;
}

/* ----------------------------------------------------------
   CONTACT — whole compose block on the RIGHT
   ---------------------------------------------------------- */
html[dir="rtl"] .contact-compose {
  display: block !important;
  width: 100% !important;
  max-width: 720px !important;
  margin-left: auto !important;
  margin-right: 0 !important;
  float: none !important;
  text-align: right !important;
  direction: rtl !important;
}

html[dir="rtl"] .contact-compose .section__head,
html[dir="rtl"] .contact-compose .eyebrow,
html[dir="rtl"] .contact-compose .display {
  text-align: right !important;
}

html[dir="rtl"] .contact-compose .wpcf7,
html[dir="rtl"] .contact-compose .wpcf7 form,
html[dir="rtl"] .contact-compose .contact-form {
  direction: rtl !important;
  text-align: right !important;
  width: 100% !important;
  max-width: none !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

html[dir="rtl"] .contact-compose label,
html[dir="rtl"] .contact-compose input,
html[dir="rtl"] .contact-compose textarea {
  text-align: right !important;
  font-family: "Almarai", sans-serif !important;
}

html[dir="rtl"] .contact-grid {
  direction: rtl;
}

.phone-ltr,
html[dir="rtl"] a[href^="tel:"] {
  direction: ltr;
  unicode-bidi: embed;
  display: inline-block;
}

html[dir="rtl"] .contact-tile p {
  text-align: right;
}

/* Timeline */
html[dir="rtl"] .timeline-sec__head {
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}

html[dir="rtl"] .timeline-sec__head .eyebrow,
html[dir="rtl"] .timeline-sec__head .display,
html[dir="rtl"] .timeline-sec__head .lead {
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}

html[dir="rtl"] .timeline {
  direction: ltr;
}

html[dir="rtl"] .timeline::before {
  left: 50%;
  right: auto;
  transform: translateX(-50%);
}

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

html[dir="rtl"] .tl-item:nth-child(odd) {
  align-self: flex-end;
}

html[dir="rtl"] .tl-item:nth-child(odd)::after {
  right: auto;
  left: -14px;
  border-left: none;
  border-right: 14px solid var(--grey);
}

html[dir="rtl"] .tl-item:nth-child(odd) .tl-item__dot {
  right: auto;
  left: -56px;
  transform: translateX(-50%);
}

html[dir="rtl"] .tl-item:nth-child(even) {
  align-self: flex-start;
}

html[dir="rtl"] .tl-item:nth-child(even)::after {
  left: auto;
  right: -14px;
  border-right: none;
  border-left: 14px solid var(--grey);
}

html[dir="rtl"] .tl-item:nth-child(even) .tl-item__dot {
  left: auto;
  right: -56px;
  transform: translateX(50%);
}

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

html[dir="rtl"] .stat,
html[dir="rtl"] .stat__num,
html[dir="rtl"] .stat__label {
  text-align: right;
}

html[dir="rtl"] .stat__icon,
html[dir="rtl"] .stat__rule {
  margin-left: auto;
  margin-right: 0;
}

/* Shared lang switcher (EN pages too) */
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-inline-start: 16px;
  font-size: 12px;
  white-space: nowrap;
}

.lang-switch__sep { opacity: 0.35; }
.lang-switch__link { color: var(--text); }
.lang-switch__link:hover,
.lang-switch__link.is-active { color: var(--red); }
.lang-switch__link.is-active { font-weight: 600; }

/* ----------------------------------------------------------
   MOBILE — flip of English mobile, not a different layout
   ---------------------------------------------------------- */
@media (max-width: 920px) {
  html[dir="rtl"] .topbar .wrap {
    display: flex !important;
    direction: rtl;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
  }

  html[dir="rtl"] .topbar__nav {
    position: fixed !important;
    top: var(--header-h) !important;
    right: 0 !important;
    left: 0 !important;
    z-index: 99 !important;
    flex-direction: column !important;
    /* direction:rtl + flex-end = LEFT. Use stretch so text-align:right wins. */
    align-items: stretch !important;
    text-align: right !important;
    direction: rtl;
    background: #fff !important;
    padding: 28px min(4vw, 30px) 36px !important;
    gap: 22px !important;
    box-shadow: 0 24px 40px rgba(0, 0, 0, 0.12);
    transform: translateY(-130%);
    transition: transform 0.3s ease;
  }

  html[dir="rtl"] .topbar__nav.open {
    transform: none !important;
  }

  html[dir="rtl"] .topbar__nav > a,
  html[dir="rtl"] .topbar__nav .nav-item,
  html[dir="rtl"] .topbar__nav .nav-item > a,
  html[dir="rtl"] .topbar__nav .dropdown,
  html[dir="rtl"] .topbar__nav .dropdown a {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box;
    text-align: right !important;
    justify-content: flex-end;
  }

  html[dir="rtl"] .lang-switch--bar {
    display: none !important;
  }

  html[dir="rtl"] .lang-switch.lang-switch--nav {
    display: inline-flex !important;
    margin-top: 12px !important;
    margin-inline-start: 0 !important;
    width: 100% !important;
    justify-content: flex-end !important;
    box-sizing: border-box;
  }

  html[dir="rtl"] .dropdown {
    padding: 6px 0 0 !important;
    text-align: right !important;
  }

  html[dir="rtl"] .dropdown a {
    padding: 10px 0 !important;
    text-align: right !important;
  }

  html[dir="rtl"] .hero__title {
    right: auto;
    left: auto;
    max-width: none;
    width: 100%;
    white-space: nowrap;
    text-align: right;
    font-size: clamp(16px, 4.2vw, 22px);
  }

  /* Flip of EN mobile: width 85%, padding heavy on pixel side */
  html[dir="rtl"] .hero > .hero__container:last-of-type {
    direction: rtl;
  }

  html[dir="rtl"] .hero__mission {
    width: 85% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-top: 24px;
    padding: 28px 4vw 28px 80px !important;
    min-height: 120px;
  }

  html[dir="rtl"] .pixels {
    left: -20px !important;
    right: auto !important;
    width: 64px;
    height: 64px;
    grid-template: repeat(3, 21px) / repeat(3, 21px);
  }

  html[dir="rtl"] .cta-band .wrap {
    flex-direction: column;
    align-items: flex-end;
  }

  html[dir="rtl"] .contact-compose {
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  html[dir="rtl"] .timeline::before {
    left: auto;
    right: 8px;
    transform: none;
  }

  html[dir="rtl"] .tl-item,
  html[dir="rtl"] .tl-item:nth-child(odd),
  html[dir="rtl"] .tl-item:nth-child(even) {
    align-self: stretch;
    width: calc(100% - 48px);
    margin-left: 0;
    margin-right: 48px;
    text-align: right;
  }

  html[dir="rtl"] .tl-item:nth-child(odd)::after,
  html[dir="rtl"] .tl-item:nth-child(even)::after {
    left: auto;
    right: -14px;
    border-right: none;
    border-left: 14px solid var(--grey);
  }

  html[dir="rtl"] .tl-item:nth-child(odd) .tl-item__dot,
  html[dir="rtl"] .tl-item:nth-child(even) .tl-item__dot {
    left: auto;
    right: -40px;
    transform: translateX(50%);
  }

  html[dir="rtl"] .footer__bottom {
    flex-direction: column;
    align-items: flex-end;
  }
}

@media (max-width: 560px) {
  html[dir="rtl"] .hero__mission {
    width: 92% !important;
    padding: 24px 4vw 24px 64px !important;
  }
}
