/* Arabic / RTL — scoped to html[dir="rtl"] (dir is on html + body in MVC layout) */
html[dir="rtl"] .marketing-site,
html[dir="rtl"] body.marketing-site {
  direction: rtl;
  text-align: right;
}

html[dir="rtl"] .marketing-site .q-nav .btn-plain,
html[dir="rtl"] .marketing-site .demo-modal .form-row,
html[dir="rtl"] .marketing-site .form-card,
html[dir="rtl"] .marketing-site .req-type {
  direction: rtl;
}

html[dir="rtl"] .marketing-site .q-nav .btn-plain {
  align-self: flex-end;
}

/* Device images (MVC) */
html[dir="rtl"] .marketing-site .dev-ar {
  display: block !important;
}
html[dir="rtl"] .marketing-site .dev-en {
  display: none !important;
}
html[dir="rtl"] .marketing-site .dev-ar-inline {
  display: inline !important;
}
html[dir="rtl"] .marketing-site .dev-en-inline {
  display: none !important;
}

/* Header: DOM order plus RTL flex puts logo right and burger left. */
@media (max-width: 1100px) {
  html[dir="rtl"] .marketing-site .hdr-bar {
    flex-direction: row;
    flex-wrap: nowrap;
  }
  html[dir="rtl"] .marketing-site .hdr-bar .burger {
    order: 0;
    margin-inline-start: auto;
    margin-inline-end: 0;
  }
  html[dir="rtl"] .marketing-site .hdr-bar .logo {
    order: 0;
  }
  html[dir="rtl"] .marketing-site .hdr.open .hdr-bar {
    flex-wrap: wrap;
  }
  html[dir="rtl"] .marketing-site .hdr.open .burger {
    order: 0;
  }
}

/* Hero: main copy stays on the inline-start side; pill sits on the opposite edge (physical left in RTL). */
html[dir="rtl"] .marketing-site .hero .wrap,
html[dir="rtl"] .marketing-site .hero-tag,
html[dir="rtl"] .marketing-site .hero-ctas {
  justify-self: start;
}
html[dir="rtl"] .marketing-site .hero-pill {
  justify-self: end;
}
@media (min-width: 901px) {
  html[dir="rtl"] .marketing-site .hero-pill {
    inset-inline-end: clamp(16px, 5vw, 60px);
    inset-inline-start: auto;
  }
}
@media (max-width: 900px) {
  html[dir="rtl"] .marketing-site .hero-pill {
    position: static !important;
    inset: auto !important;
    width: fit-content;
    max-width: 100%;
    margin-inline-start: auto;
    margin-inline-end: 0;
  }
}

/* Desktop hero mirrors the English composition:
   copy/stats on the right, decorative wave on the left. */
@media (min-width: 901px) {
  html[dir="rtl"] .marketing-site .hero .wrap {
    width: 100%;
    text-align: right;
  }
  html[dir="rtl"] .marketing-site .hero h1,
  html[dir="rtl"] .marketing-site .hero .lede,
  html[dir="rtl"] .marketing-site .hero-ctas,
  html[dir="rtl"] .marketing-site .hero-cred {
    width: min(48%, 560px);
    margin-left: auto;
    margin-right: 0;
    justify-self: stretch;
  }
  html[dir="rtl"] .marketing-site .hero-tag {
    margin-left: auto;
    margin-right: 0;
  }
  html[dir="rtl"] .marketing-site .hero-ctas {
    justify-content: flex-start;
  }
  html[dir="rtl"] .marketing-site .figs {
    width: min(48%, 470px);
    margin-left: auto;
    margin-right: 0;
    justify-content: flex-start;
  }
}

/* Wave path is mirrored; un-flip each step bubble so labels stay readable after animation */
html[dir="rtl"] .marketing-site .wave .dot {
  transform: translate(-50%, -50%) scaleX(-1);
}
html[dir="rtl"] .marketing-site .wave .dot b,
html[dir="rtl"] .marketing-site .wave .dot i {
  display: block;
  transform: none;
}

/* Desktop uses the mirrored wave. The compact row is mobile-only. */
@media (max-width: 900px) {
  html[dir="rtl"] .marketing-site .steps-row {
    display: flex;
    width: 100%;
    max-width: 100%;
    justify-content: space-between;
    gap: 6px;
  }
  html[dir="rtl"] .marketing-site .steps-row span {
    flex: 1 1 0;
    min-width: 0;
    max-width: none;
    width: auto;
    aspect-ratio: 1;
    border-radius: 50%;
    padding: 6px 4px;
    font-size: 11px;
    line-height: 1.2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: pre-line;
    overflow: hidden;
    box-sizing: border-box;
  }
  html[dir="rtl"] .marketing-site .steps-row span[style*="background:#fff"] {
    border: 2px solid rgba(15, 74, 92, 0.35);
  }
}

/* Impact intro glass — mirror EN layout (end-aligned box, max ~420px), RTL via flex-start */
html[dir="rtl"] .marketing-site .intro .glass-row {
  justify-content: flex-start;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
html[dir="rtl"] .marketing-site .intro .glass {
  max-width: min(420px, 100%);
  width: 100%;
  box-sizing: border-box;
  overflow-wrap: anywhere;
  word-break: break-word;
}

html[dir="rtl"] .marketing-site .intro .wrap {
  max-width: 100%;
  overflow-wrap: anywhere;
}

/* Figure cards / highlighted stats — keep glow inside viewport */
html[dir="rtl"] .marketing-site .fgrid3 {
  overflow: visible;
  max-width: 100%;
}
html[dir="rtl"] .marketing-site .fbig {
  overflow: hidden;
  min-width: 0;
}
html[dir="rtl"] .marketing-site .fbig::after {
  left: -40px;
  right: auto;
}
@media (max-width: 480px) {
  html[dir="rtl"] .marketing-site .fbig::after {
    left: -80px;
    opacity: 0.5;
  }
  html[dir="rtl"] .marketing-site .fbig b {
    font-size: clamp(36px, 12vw, 52px);
  }
}

/* Schools intro: mirror background like home hero */
html[dir="rtl"] .marketing-site .sch-intro {
  background-position: left center;
}
html[dir="rtl"] .marketing-site .intro-about {
  transform: none;
}

/* Platform intro pill / timeline overflow */
html[dir="rtl"] .marketing-site .pi-pill {
  inset-inline-start: 16px;
  inset-inline-end: 16px;
  left: 16px !important;
  right: 16px !important;
  max-width: calc(100% - 32px);
}

html[dir="rtl"] .marketing-site .hdr .nav a.active::after {
  left: 12px;
  right: 12px;
}

html[dir="rtl"] .marketing-site .flow::before {
  left: 16.6%;
  right: 16.6%;
}

html[dir="rtl"] .marketing-site .login-page .role {
  text-align: right;
}
