/* ==========================================================================
   RTL (Right-to-Left) Stylesheet for Arabic Language Support
   ========================================================================== */

html[dir="rtl"] {
  font-family: "Cairo", "Plus Jakarta Sans", "Inter", sans-serif;
}

html[dir="rtl"] h1,
html[dir="rtl"] h2,
html[dir="rtl"] h3,
html[dir="rtl"] h4,
html[dir="rtl"] h5,
html[dir="rtl"] h6,
html[dir="rtl"] .eyebrow,
html[dir="rtl"] .button,
html[dir="rtl"] .site-nav__link {
  font-family: "Cairo", "Plus Jakarta Sans", sans-serif;
  letter-spacing: 0 !important;
}

html[dir="rtl"] h1,
html[dir="rtl"] .hero__title,
html[dir="rtl"] .page-hero h1,
html[dir="rtl"] .hero-title,
html[dir="rtl"] .ada-blog-hero__title {
  line-height: 1.42 !important;
  padding-block: 0.08em;
}

html[dir="rtl"] h2 {
  line-height: 1.38 !important;
}

html[dir="rtl"] h3 {
  line-height: 1.34 !important;
}

/* --- Layout & Typography Adjustments --- */
html[dir="rtl"] .text-center {
  text-align: center;
}

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

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

/* --- Header & Navigation --- */
html[dir="rtl"] .site-header,
html[dir="rtl"] .site-header__inner {
  direction: rtl !important;
}

html[dir="rtl"] .site-header__right-actions {
  direction: ltr !important;
  flex-direction: row !important;
}

html[dir="rtl"] .menu-toggle {
  order: -1 !important;
}

html[dir="rtl"] .site-nav {
  direction: rtl !important;
}

html[dir="rtl"] .site-nav__links {
  direction: rtl !important;
  flex-direction: row !important;
}

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

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

html[dir="rtl"] .site-nav__dropdown-arrow {
  margin-left: 0;
  margin-right: 6px;
}

/* --- Language Switcher Dropdown (Exact Match to User Mockup) --- */
.site-nav__lang-dropdown {
  position: relative;
}

.lang-switcher-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.lang-switcher-btn:hover {
  color: #38bdf8;
  opacity: 0.9;
}

.lang-switcher-btn .flag-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.flag-icon-img {
  width: 22px;
  height: 14px;
  object-fit: cover;
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  display: inline-block;
  vertical-align: middle;
}

.lang-switcher-btn .lang-arrow {
  transition: transform 0.25s ease;
  margin-left: 2px;
}

.site-nav__lang-dropdown.is-open .lang-switcher-btn .lang-arrow {
  transform: rotate(180deg);
}

.lang-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 105px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-top: 3.5px solid #00a884;
  border-radius: 14px;
  padding: 0;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
  list-style: none;
  margin: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1000;
  overflow: hidden;
}

html[dir="rtl"] .lang-dropdown-menu {
  right: auto;
  left: 0;
}

.site-nav__lang-dropdown.is-open .lang-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.lang-dropdown-menu li {
  border-bottom: 1px solid #e2e8f0;
}

.lang-dropdown-menu li:last-child {
  border-bottom: none;
}

.lang-dropdown-option {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.55rem;
  padding: 0.65rem 0.9rem;
  border: none;
  background: transparent;
  color: #1e293b;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.lang-dropdown-option:hover {
  background: #f8fafc;
  color: #0284c7;
}

.lang-dropdown-option.is-selected {
  background: #ffffff;
  color: #0f172a;
  font-weight: 700;
}

.lang-dropdown-option:hover {
  background: #f1f5f9;
  color: #0284c7;
}

.lang-dropdown-option.is-selected {
  background: #eff6ff;
  color: #0284c7;
  font-weight: 800;
}

.lang-dropdown-option .check-icon {
  margin-left: auto;
  color: #0284c7;
  font-weight: 900;
}

html[dir="rtl"] .lang-dropdown-option .check-icon {
  margin-left: 0;
  margin-right: auto;
}

/* --- Lists & Icons --- */
html[dir="rtl"] .cluster-list-item {
  padding-left: 0;
  padding-right: 1.5rem;
}

html[dir="rtl"] .cluster-list-item .check-icon {
  left: auto;
  right: 0;
}

/* --- Timeline Component (RTL) --- */
html[dir="rtl"] .timeline-card {
  text-align: right;
}

html[dir="rtl"] .timeline-card__list {
  padding-left: 0;
  padding-right: 1.2rem;
}

@media (max-width: 860px) {
  html[dir="rtl"] .timeline__line {
    left: auto !important;
    right: 28px !important;
    transform: none !important;
  }

  html[dir="rtl"] .timeline-item {
    padding-left: 0 !important;
    padding-right: 60px !important;
  }

  html[dir="rtl"] .timeline-node {
    left: auto !important;
    right: 19.5px !important;
    direction: ltr !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 0.5rem !important;
  }

  html[dir="rtl"] .timeline-node__dot {
    margin: 0 !important;
    flex-shrink: 0 !important;
    order: 2 !important;
  }

  html[dir="rtl"] .timeline-node__year {
    order: 1 !important;
  }
}

/* --- Footer --- */
html[dir="rtl"] .site-footer__grid {
  direction: rtl;
  text-align: right;
}
/* Cluster White Logo aligned above start of Arabic sentence */
html[dir="rtl"] .site-footer__brand {
  display: inline-flex !important;
  direction: ltr !important;
  justify-content: flex-start !important;
  align-self: flex-start !important;
  margin-left: auto !important;
  margin-right: 0 !important;
}

html[dir="rtl"] .site-footer__logo {
  height: 38px !important;
  width: auto !important;
  margin-left: auto !important;
  margin-right: 0 !important;
}

/* Keep "C" watermark static in same position as English; shift download store buttons to the right in Arabic */
html[dir="rtl"] .footer-store {
  justify-self: start !important;
  text-align: right !important;
  margin-right: 0 !important;
  margin-left: 0 !important;
  transform: translateX(115px) !important;
}

html[dir="rtl"] .footer-store__buttons {
  margin-right: 0 !important;
  margin-left: auto !important;
}

@media (max-width: 900px) {
  html[dir="rtl"] .hero__focus-zone {
    text-align: right !important;
    align-items: flex-start !important;
  }

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

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

  html[dir="rtl"] .site-footer__grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 2rem 1.25rem !important;
    direction: rtl !important;
    text-align: right !important;
  }

  html[dir="rtl"] .site-footer__grid > :first-child {
    grid-column: 1 / -1 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    text-align: right !important;
  }

  html[dir="rtl"] .site-footer__brand {
    display: inline-flex !important;
    direction: ltr !important;
    justify-content: flex-start !important;
    align-self: flex-start !important;
    margin-left: auto !important;
    margin-right: 0 !important;
  }

  html[dir="rtl"] .site-footer__logo {
    height: 34px !important;
    width: auto !important;
    margin-left: auto !important;
    margin-right: 0 !important;
  }

  html[dir="rtl"] .site-footer__grid > :first-child p {
    text-align: right !important;
    font-size: 0.9rem !important;
    line-height: 1.65 !important;
    color: rgba(255, 255, 255, 0.7) !important;
    margin-top: 0.5rem !important;
  }

  html[dir="rtl"] .site-footer__grid > :first-child a.button--text {
    text-align: right !important;
    align-self: flex-start !important;
    color: #38bdf8 !important;
    font-size: 0.9rem !important;
    font-weight: 600 !important;
    margin-top: 0.25rem !important;
    padding: 0 !important;
  }

  html[dir="rtl"] .footer-store {
    grid-column: 1 / -1 !important;
    margin-top: 0.5rem !important;
    margin-right: 0 !important;
    margin-left: clamp(140px, 22vw, 240px) !important;
    max-width: 380px !important;
    transform: none !important;
  }

  html[dir="rtl"] .footer-store__buttons {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 0.6rem !important;
    width: 100% !important;
    margin-right: 0 !important;
    margin-left: 0 !important;
  }

  html[dir="rtl"] .footer-store__buttons .store-btn {
    flex: 1 1 140px !important;
    min-width: 135px !important;
    max-width: 180px !important;
    min-height: 48px !important;
    height: auto !important;
    padding: 0.45rem 0.75rem !important;
    gap: 0.5rem !important;
    box-sizing: border-box !important;
    justify-content: flex-start !important;
  }
}

@media (max-width: 620px) {
  html[dir="rtl"] .footer-store {
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    transform: none !important;
  }

  html[dir="rtl"] .footer-store__buttons {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.5rem !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  html[dir="rtl"] .footer-store__buttons .store-btn {
    flex: 1 1 0 !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    min-height: 46px !important;
    padding: 0.4rem 0.5rem !important;
    gap: 0.4rem !important;
    box-sizing: border-box !important;
    justify-content: flex-start !important;
  }
}

html[dir="rtl"] .site-footer__bottom {
  text-align: center;
}

/* --- Buttons --- */
html[dir="rtl"] .button {
  letter-spacing: normal;
}

/* --- Toggle Switches RTL Fix (Sharing Switch & Visibility Switch) --- */
html[dir="rtl"] .sharing-switch[aria-checked="true"] span,
[dir="rtl"] .sharing-switch[aria-checked="true"] span {
  transform: translateX(-21px) !important;
}

html[dir="rtl"] .visibility-switch[aria-checked="true"]::before,
[dir="rtl"] .visibility-switch[aria-checked="true"]::before {
  transform: translateX(-20px) !important;
}

/* --- Hero Follow Card RTL (Kept on the right, only buttons mirrored) --- */

html[dir="rtl"] .follow-btn {
  flex-direction: row-reverse;
}

html[dir="rtl"] .follow-btn:hover {
  transform: translateX(-3px);
}


html[dir=rtl] .brand {
  margin-right: 0 !important;
  margin-left: 3rem !important;
}

html[dir="rtl"] .platform-tab {
  text-align: right;
  align-items: flex-start;
}

/* --- Growth Chart RTL Coordinate & Label Alignment --- */
html[dir="rtl"] .growth-chart-card {
  direction: ltr !important;
}

html[dir="rtl"] .growth-chart-svg-wrap {
  overflow: visible !important;
  direction: ltr !important;
}

html[dir="rtl"] .growth-chart-svg,
html[dir="rtl"] .growth-chart-svg text {
  direction: ltr !important;
  overflow: visible !important;
}

