/*
 * Right-to-left overrides — loaded ONLY when I18n::isRtl() (Arabic, Persian).
 *
 * The marketing CSS is a pre-built Tailwind sheet using physical properties
 * (ml-*, text-left, left-0 …), so `dir="rtl"` on <html> alone flips text
 * direction but leaves spacing and alignment mirrored the wrong way. Rather
 * than rebuild every utility, this sheet re-maps the handful that actually
 * carry layout on public pages. Scoped to [dir="rtl"] so it can never affect an
 * LTR page even if it were loaded by mistake.
 */

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

/* Text alignment utilities that must follow the reading direction. */
[dir="rtl"] .text-left  { text-align: right; }
[dir="rtl"] .text-right { text-align: left; }
/* .text-center is direction-agnostic — left alone on purpose. */

/* Directional margins/padding used by the shared partials. */
[dir="rtl"] .ml-auto { margin-left: 0; margin-right: auto; }
[dir="rtl"] .mr-auto { margin-right: 0; margin-left: auto; }
[dir="rtl"] .ml-3    { margin-left: 0; margin-right: .75rem; }
[dir="rtl"] .mr-3    { margin-right: 0; margin-left: .75rem; }
[dir="rtl"] .pl-4    { padding-left: 0; padding-right: 1rem; }
[dir="rtl"] .pr-4    { padding-right: 0; padding-left: 1rem; }

/* Absolute positioning helpers. */
[dir="rtl"] .left-0  { left: auto; right: 0; }
[dir="rtl"] .right-0 { right: auto; left: 0; }

/* Borders that mark a side (blockquotes, callouts, the docs sidebar). */
[dir="rtl"] .border-l { border-left-width: 0; border-right-width: 1px; }
[dir="rtl"] .border-r { border-right-width: 0; border-left-width: 1px; }

/* Site chrome: the nav dropdown, mobile drawer and footer columns. */
[dir="rtl"] .cp-dd-menu  { left: 0; right: auto; }
[dir="rtl"] .cp-mobnav   { text-align: right; }
[dir="rtl"] .cp-mobnav a { text-align: right; }

/* Long-form article bodies (blog, legal). */
[dir="rtl"] .bl-body,
[dir="rtl"] .lg-body { text-align: right; }
[dir="rtl"] .bl-body ul,
[dir="rtl"] .bl-body ol,
[dir="rtl"] .lg-body ul,
[dir="rtl"] .lg-body ol { padding-left: 0; padding-right: 1.4rem; }

/* Code, hashes, addresses and amounts stay LTR — a wallet address or a JSON
 * payload reversed by the paragraph direction is unreadable and, worse,
 * copy-pasteable in the wrong order. */
[dir="rtl"] code,
[dir="rtl"] pre,
[dir="rtl"] .cp-mono,
[dir="rtl"] .cp-code,
[dir="rtl"] .cp-code-body,
[dir="rtl"] [data-ltr] {
    direction: ltr;
    text-align: left;
    unicode-bidi: isolate;
}
