/* Arabic and Persian pages (<html dir="rtl">), loaded only there.
   The browser already mirrors text direction and the order of flex and grid
   items; this file turns around what the site wrote with physical
   left/right, and gives the script a font that has its letters. */

html[dir="rtl"] body {
    font-family: 'Vazirmatn', 'Inter', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
}
html[dir="rtl"] body h1,
html[dir="rtl"] body h2,
html[dir="rtl"] body h3,
html[dir="rtl"] body h4,
html[dir="rtl"] body summary,
html[dir="rtl"] body .btn-primary,
html[dir="rtl"] body button {
    font-family: 'Vazirmatn', var(--serif, Georgia), serif;
}
/* Arabic letters join: spacing them apart breaks the words. */
html[dir="rtl"] body *:not(.stw-wordmark):not(.stw-wordmark *) {
    letter-spacing: 0 !important;
}
html[dir="rtl"] body h1, html[dir="rtl"] body h2 { line-height: 1.35; }
/* The brand stays a left-to-right word. */
html[dir="rtl"] .stw-wordmark { direction: ltr; unicode-bidi: isolate; }

/* Header */
html[dir="rtl"] .tagline {
    border-left: 0;
    border-right: 1px solid rgba(46, 59, 78, 0.15);
    padding-left: 0;
    padding-right: 12px;
}
@media (max-width: 768px) {
    html[dir="rtl"] .nav-links {
        left: auto !important;
        right: -100% !important;
        border-right: none !important;
        border-left: 1px solid rgba(46, 59, 78, 0.08) !important;
        box-shadow: -4px 0 12px rgba(46, 59, 78, 0.08) !important;
        align-items: flex-start !important;
    }
    html[dir="rtl"] .nav-links.active { right: 0 !important; left: auto !important; }
    html[dir="rtl"] .nav-links a { text-align: right !important; }
}

/* Text that was aligned left on purpose follows the reading direction. */
html[dir="rtl"] body .stw-hero-copy,
html[dir="rtl"] body .lp-table th,
html[dir="rtl"] body .lp-table td,
html[dir="rtl"] body table th,
html[dir="rtl"] body table td,
html[dir="rtl"] body table tr { text-align: right; }

/* Landing pages */
html[dir="rtl"] body .lp-answer { border-left: 1px solid var(--line); border-right: 4px solid var(--coral); }
html[dir="rtl"] body .lp-sec ul { padding-left: 0; padding-right: 20px; }
html[dir="rtl"] body .lp-faq summary::after { float: left; }

/* YouTube transcript tool */
html[dir="rtl"] body .ytt-answer { border-left: 1px solid var(--line); border-right: 4px solid var(--coral); }
html[dir="rtl"] body .ytt-body ol { padding-left: 0; padding-right: 22px; }
html[dir="rtl"] body .ytt-faq summary::after { right: auto; left: 4px; }
html[dir="rtl"] body .ytt-spin { margin-right: 0; margin-left: 6px; }
/* Links, file names and transcripts pasted from elsewhere keep their own direction. */
html[dir="rtl"] body input[type="url"],
html[dir="rtl"] body input[type="email"],
html[dir="rtl"] body input[type="password"] { direction: ltr; text-align: right; }

/* Lists in articles */
html[dir="rtl"] body .stw-article ul,
html[dir="rtl"] body .stw-article ol { padding-left: 0; padding-right: 1.4em; }
html[dir="rtl"] body blockquote { border-left: 0; border-right: 3px solid var(--line); padding-left: 0; padding-right: 1em; }

/* Footer */
html[dir="rtl"] body .footer-column ul { padding-right: 0; }
