/* ═══════════════════════════════════════════════
   XDigital i18n — switcher, RTL, multilingual fonts
   ═══════════════════════════════════════════════ */

/* Per-language font: JS sets --i18n-font; we prepend it to the stack.
   When unset (en/es/de) the stack is just Inter. */
:root { --i18n-font: ; }
body {
  font-family: var(--i18n-font, ), 'Inter', sans-serif;
}

/* ─── Language switcher ─── */
.xd-lang { position: relative; display: inline-block; }
.xd-lang-btn {
  display: flex; align-items: center; gap: 7px;
  background: var(--bg-card); border: 1px solid var(--border-subtle);
  color: var(--text-primary); cursor: pointer;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .05em;
  padding: 8px 12px; border-radius: 8px; transition: all .2s;
  line-height: 1;
}
.xd-lang-btn:hover { border-color: var(--accent-cyan); color: var(--accent-cyan); }
.xd-globe { font-size: 13px; }
.xd-caret { font-size: 9px; opacity: .6; transition: transform .2s; }
.xd-lang.open .xd-caret { transform: rotate(180deg); }

.xd-lang-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  min-width: 150px; background: var(--bg-card);
  border: 1px solid var(--border-subtle); border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0,0,0,.5);
  padding: 6px; display: none; flex-direction: column; gap: 2px;
  z-index: 1000;
}
.xd-lang.open .xd-lang-menu { display: flex; }
.xd-lang-item {
  background: none; border: none; color: var(--text-secondary);
  text-align: left; cursor: pointer; padding: 9px 12px; border-radius: 6px;
  font-family: var(--font-main); font-size: 13px; transition: all .15s;
}
.xd-lang-item:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.xd-lang-item[aria-current="true"] {
  color: var(--accent-cyan); background: var(--accent-cyan-dim);
}

/* ─── RTL (fa, ar) ─── */
[dir="rtl"] body,
[dir="rtl"] { text-align: right; }

/* mono labels (stats, eyebrows) stay LTR — numbers + latin codes read better */
[dir="rtl"] [class*="-mono"],
[dir="rtl"] .hero-stat-lbl,
[dir="rtl"] .stat-lbl,
[dir="rtl"] .svc-num,
[dir="rtl"] .cs-vtag,
[dir="rtl"] .cs-geo { direction: ltr; }

/* flip flex rows that imply reading direction */
[dir="rtl"] .navbar-inner,
[dir="rtl"] .navbar-links,
[dir="rtl"] .navbar-right,
[dir="rtl"] .hero-ctas,
[dir="rtl"] .footer-links { flex-direction: row-reverse; }

/* switcher menu anchors to the left edge in RTL */
[dir="rtl"] .xd-lang-menu { right: auto; left: 0; }

/* keep $ / % numeric stat values LTR so currency reads correctly */
[dir="rtl"] .hero-stat-num,
[dir="rtl"] .stat-num,
[dir="rtl"] [class*="num"] { direction: ltr; unicode-bidi: embed; }

/* trailing UI arrows (→) in buttons flip to ← visually via content swap handled in JSON;
   ensure inline-start spacing is correct */
[dir="rtl"] .btn { text-align: center; }

/* mobile nav slide side */
[dir="rtl"] .mobile-nav { text-align: right; }

/* Persian/Arabic line-height a touch taller for diacritics */
[dir="rtl"] body { line-height: 1.8; }
[lang="zh"] body, [lang="ja"] body { line-height: 1.75; }
