/* OpenMausBot - Hebrew/RTL layer.
 * Loaded after the app stylesheet (which the entrypoint already served in its
 * mirrored form). Everything here keys on behaviour, not on DOM structure, so
 * upstream component changes do not break it.
 */

/* Inter carries no Hebrew glyphs. Append Hebrew-capable families instead of
   replacing the theme font, so per-theme typography is preserved. */
body,
input,
textarea,
select,
button {
  font-family: var(--font-sans), "Segoe UI", "Arial Hebrew", "Noto Sans Hebrew", Arial, sans-serif;
}

/* Code, terminal output and identifiers are LTR content inside an RTL page.
   `isolate` keeps punctuation at the correct end of the line. */
[dir="rtl"] pre,
[dir="rtl"] code,
[dir="rtl"] kbd,
[dir="rtl"] samp,
[dir="rtl"] .font-mono {
  direction: ltr;
  text-align: left;
  unicode-bidi: isolate;
}

/* Chat content is user/agent text of unknown language: let each paragraph pick
   its own direction from its first strong character. */
[dir="rtl"] .chat-md,
[dir="rtl"] .whitespace-pre-wrap {
  unicode-bidi: plaintext;
  text-align: start;
}

/* Directional icons, tagged by he.js from their English label. */
[dir="rtl"] [data-omb-mirror] svg {
  transform: scaleX(-1);
}

/* Inputs follow the paragraph direction rather than the page. */
[dir="rtl"] input,
[dir="rtl"] textarea {
  text-align: start;
}
[dir="rtl"] input[type="url"],
[dir="rtl"] input[type="email"],
[dir="rtl"] input[type="password"],
[dir="rtl"] input[inputmode="numeric"] {
  direction: ltr;
  text-align: left;
}

/* Numbers, versions and paths keep Latin digits and LTR order. */
[dir="rtl"] .tabular-nums,
[dir="rtl"] time {
  direction: ltr;
  unicode-bidi: isolate;
}

/* פאנל ברוחב קבוע (w-[400px] של פרופיל הסוכן) רחב מהמסך במכשיר צר ודוחף
   גלילה אופקית. אומת: התקלה זהה גם ב-LTR — כלומר upstream, לא שכבת ה-RTL —
   אבל היא נופלת בשער שלנו, ולכן נחסמת כאן ברוחב מקסימלי במקום לגעת ב-app/. */
@media (max-width: 480px) {
  aside,
  [role="dialog"] {
    max-width: 100vw;
  }
}
