/* SARA Open — shared RTL stylesheet.
 *
 * Companion to /static/i18n.js. Drop a <link rel="stylesheet"
 * href="/static/i18n-rtl.css"> into any static page that needs RTL
 * support. Rules are scoped under html[dir="rtl"] so LTR pages are
 * untouched.
 *
 * Provides:
 *   - Arabic font fallback chain on body / inputs / buttons / selects
 *   - text-align flip on common content blocks
 *   - <code> / <kbd> stays LTR with unicode-bidi: isolate (technical
 *     tokens like CVE IDs, IPs, hashes must not flow RTL)
 *   - Markdown body uses unicode-bidi: plaintext to preserve mixed-
 *     direction content shape
 *   - Chevron/arrow flip via transform: scaleX(-1) on common selectors
 *
 * Pages still need their own page-specific RTL adjustments for layout
 * (sidebar slide-direction, modal close-button position, etc.) — this
 * file is the COMMON baseline only.
 */

html[dir="rtl"] body,
html[dir="rtl"] input,
html[dir="rtl"] textarea,
html[dir="rtl"] button,
html[dir="rtl"] select {
  font-family: 'IBM Plex Sans Arabic', 'DM Sans', -apple-system, sans-serif;
}

/* Technical tokens stay Latin and LTR even inside Arabic prose. */
html[dir="rtl"] code,
html[dir="rtl"] kbd {
  font-family: 'JetBrains Mono', monospace;
  unicode-bidi: isolate;
  direction: ltr;
}

/* Arbitrary-direction content (markdown bodies, chat messages, log
   excerpts) — preserve original text direction per-paragraph. */
html[dir="rtl"] [data-bidi="plaintext"],
html[dir="rtl"] .markdown-body,
html[dir="rtl"] .ms,
html[dir="rtl"] .message-body {
  unicode-bidi: plaintext;
}

/* Mirror chevrons / arrows that point left in the LTR layout. Use
   class hooks rather than blanket SVG flips so icons that AREN'T
   directional (logos, avatars) stay upright. */
html[dir="rtl"] .chevron-mirror,
html[dir="rtl"] .arrow-mirror,
html[dir="rtl"] .tab-chevron {
  transform: scaleX(-1);
}

/* Tab indicators / progress bars common to admin + settings pages. */
html[dir="rtl"] .tab-btn.active::after { right: 0; left: auto; }
