/* ============================================================
   YESSINE_OS — RTL / ARABIC SUPPORT
   Loaded after every other stylesheet so its rules win on
   specificity ties. Scoped to [dir="rtl"] / html[lang="ar"] only —
   it changes nothing for LTR languages.
   ============================================================ */

/* ---------- typography ---------- */
html[lang="ar"] {
  --font-display: var(--font-arabic);
  --font-mono: var(--font-arabic);
}

/* Tracked-out letter-spacing (used everywhere for the OS/mono look)
   breaks Arabic letter connections — strip it in RTL only. The extra
   "html[...]" element component gives this just enough specificity
   to win over the ".class { letter-spacing: ... }" rules it targets. */
html[lang="ar"] * {
  letter-spacing: normal !important;
}

[dir="rtl"] {
  direction: rtl;
}

/* ---------- skip link (top-left when focused -> top-right) ---------- */
[dir="rtl"] .skip-link {
  left: auto;
  right: var(--space-sm);
}

/* ---------- nav dropdowns open from the side they hang under ---------- */
[dir="rtl"] .theme-menu,
[dir="rtl"] .lang-menu {
  right: auto;
  left: 0;
}

/* ---------- live status widget (bottom-right -> bottom-left) ---------- */
[dir="rtl"] #status-widget {
  right: auto;
  left: calc(env(safe-area-inset-left, 0px) + var(--space-sm));
}
[dir="rtl"] #status-widget button.collapse-btn {
  right: auto;
  left: 2px;
}

/* ---------- terminal launcher (bottom-left -> bottom-right) ---------- */
[dir="rtl"] #terminal-toggle {
  left: auto;
  right: calc(env(safe-area-inset-right, 0px) + var(--space-sm));
}

/* ---------- toasts (top-right -> top-left) ---------- */
[dir="rtl"] #toast-container {
  right: auto;
  left: var(--space-sm);
  align-items: flex-start;
}

/* ---------- evolution timeline rail flips to the right ---------- */
[dir="rtl"] .timeline::before {
  left: auto;
  right: 18px;
}
[dir="rtl"] .timeline-item {
  padding-left: 0;
  padding-right: 56px;
}
[dir="rtl"] .timeline-node {
  left: auto;
  right: 10px;
}

/* ---------- project detail overlay close button ---------- */
[dir="rtl"] .detail-close {
  right: auto;
  left: var(--space-sm);
}

/* ---------- version-quote accent border flips to the right ---------- */
[dir="rtl"] .version-quote {
  border-left: none;
  border-right: 2px solid var(--accent);
}

/* ---------- hero prompt caret mirrors direction ---------- */
[dir="rtl"] .hero-roles .prompt {
  display: inline-block;
  transform: scaleX(-1);
}

/* ---------- terminal: keep typed shell commands LTR-legible ---------- */
[dir="rtl"] #terminal-input {
  direction: ltr;
  text-align: right;
}
[dir="rtl"] .terminal-input-row .prompt {
  direction: ltr;
}

/* ---------- settings / language switcher option rows ---------- */
[dir="rtl"] .theme-option,
[dir="rtl"] .lang-option,
[dir="rtl"] .settings-lang-option,
[dir="rtl"] .settings-accent-option {
  text-align: right;
}

/* ---------- section eyebrow tags keep a small leading rule mirrored ---------- */
[dir="rtl"] .section-tag {
  direction: rtl;
}
