/* ============================================= */
/* RTL OVERRIDES — Arabic layout (dir="rtl")     */
/* ============================================= */

[dir="rtl"] body {
  font-family: 'Cairo', 'DM Sans', system-ui, sans-serif;
}

[dir="rtl"] h1,
[dir="rtl"] h2,
[dir="rtl"] h3,
[dir="rtl"] h4 {
  font-family: 'Cairo', 'Fraunces', serif;
}

[dir="rtl"] .brand-sub,
[dir="rtl"] .mega-category-head,
[dir="rtl"] .mega-footer a,
[dir="rtl"] code,
[dir="rtl"] pre {
  font-family: 'JetBrains Mono', 'Cairo', monospace;
}

/* ---------- Topbar / nav ---------- */

[dir="rtl"] .topbar-inner {
  flex-direction: row-reverse;
}

[dir="rtl"] nav.primary {
  flex-direction: row-reverse;
}

[dir="rtl"] .brand-divider {
  /* divider is symmetrical, nothing to do */
}

/* Chevron arrows flip direction */
[dir="rtl"] .chevron,
[dir="rtl"] .mega-menu .chevron {
  transform: scaleX(-1);
}

/* ---------- Mega menu ---------- */

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

[dir="rtl"] .mega-menu-inner {
  direction: rtl;
}

[dir="rtl"] .mega-category {
  border-right: none;
  border-left: 1px solid var(--rule);
}

[dir="rtl"] .mega-category:last-child {
  border-left: none;
}

[dir="rtl"] .mega-footer a::after,
[dir="rtl"] .mega-footer .arrow {
  transform: scaleX(-1);
  display: inline-block;
}

/* ---------- Mobile menu ---------- */

[dir="rtl"] .mobile-menu {
  right: auto;
  left: 0;
  border-right: none;
  border-left: 1px solid var(--rule);
}

[dir="rtl"] .mobile-menu .link-arrow {
  transform: scaleX(-1);
}

/* ---------- Hero / sections ---------- */

[dir="rtl"] .hero-meta {
  flex-direction: row-reverse;
}

[dir="rtl"] .hero-title,
[dir="rtl"] .section-title,
[dir="rtl"] .sec-head {
  text-align: right;
}

[dir="rtl"] .lede,
[dir="rtl"] .paragraph {
  text-align: right;
}

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

[dir="rtl"] .breadcrumb a::after,
[dir="rtl"] .breadcrumb span::before {
  content: "‹";
}

/* ---------- Module grid / target grid ---------- */

[dir="rtl"] .module-grid,
[dir="rtl"] .target-grid,
[dir="rtl"] .cap-grid {
  direction: rtl;
}

[dir="rtl"] .module-card,
[dir="rtl"] .target-card,
[dir="rtl"] .cap {
  text-align: right;
}

[dir="rtl"] .module-card .tag,
[dir="rtl"] .cap .tag {
  text-align: right;
}

/* ---------- FAQ ---------- */

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

[dir="rtl"] .faq-q::after {
  transform: scaleX(-1);
}

[dir="rtl"] details > summary {
  padding-right: 28px;
  padding-left: 8px;
}

[dir="rtl"] details > summary::before {
  right: 0;
  left: auto;
}

/* ---------- Process steps ---------- */

[dir="rtl"] .process-steps,
[dir="rtl"] .step-grid {
  direction: rtl;
}

[dir="rtl"] .step-arrow {
  transform: scaleX(-1);
}

/* ---------- CTA ---------- */

[dir="rtl"] .cta-inner,
[dir="rtl"] .cta-actions {
  flex-direction: row-reverse;
}

[dir="rtl"] .btn,
[dir="rtl"] .btn-quote,
[dir="rtl"] .btn-phone {
  font-family: 'Cairo', sans-serif;
}

/* ---------- Footer ---------- */

[dir="rtl"] .footer-inner,
[dir="rtl"] .footer-columns {
  direction: rtl;
}

[dir="rtl"] .footer-col {
  text-align: right;
}

[dir="rtl"] .footer-bottom {
  flex-direction: row-reverse;
}

/* ---------- Language switcher ---------- */

[dir="rtl"] .lang-switcher {
  margin-inline-start: 8px;
  margin-inline-end: 0;
}

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

[dir="rtl"] .lang-menu a {
  direction: rtl;
  text-align: right;
}

[dir="rtl"] .lang-menu a.active .lang-name::after {
  content: " ‹";
}

/* ---------- Stamp / marquee ---------- */

[dir="rtl"] .stamp {
  /* stamp text often rotated — keep as is */
}

[dir="rtl"] .marquee-track {
  animation-direction: reverse;
}

/* ---------- SVG blueprint arrows ---------- */

[dir="rtl"] svg .arrow-head,
[dir="rtl"] svg [marker-end],
[dir="rtl"] svg [marker-start] {
  /* SVG blueprints are complex — keep original orientation to preserve meaning */
}

/* ---------- Forms ---------- */

[dir="rtl"] input,
[dir="rtl"] textarea,
[dir="rtl"] select {
  text-align: right;
  direction: rtl;
}

[dir="rtl"] label {
  text-align: right;
}

/* ---------- Utility flips ---------- */

[dir="rtl"] .icon-chevron,
[dir="rtl"] .icon-arrow,
[dir="rtl"] .arrow-right,
[dir="rtl"] [class*="arrow-"] {
  transform: scaleX(-1);
}

/* ---------- Hamburger (mobile) ---------- */

[dir="rtl"] .hamburger {
  /* symmetrical, no change */
}

/* ---------- Mobile overlay side ---------- */

@media (max-width: 720px) {
  [dir="rtl"] .mobile-menu {
    left: 0;
    right: auto;
    transform: translateX(-100%);
  }
  [dir="rtl"] .mobile-menu.open {
    transform: translateX(0);
  }
}

/* ---------- Text spacing fixes for Arabic ---------- */

[dir="rtl"] .hero-title {
  line-height: 1.4; /* Arabic needs more line height */
}

[dir="rtl"] .lede,
[dir="rtl"] .paragraph,
[dir="rtl"] p {
  line-height: 1.75;
}

/* ---------- Letter spacing — Arabic doesn't need it ---------- */

[dir="rtl"] .brand-sub,
[dir="rtl"] .mega-category-head,
[dir="rtl"] .mega-footer a,
[dir="rtl"] nav.primary a {
  letter-spacing: 0;
}

/* ---------- Divider between brand and sub ---------- */

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