/* RTL layout overrides for the home page (loaded only when <html dir="rtl">, i.e. Arabic).
   Typography lives in rtl-common.css. */
[dir=rtl] body { text-align: right; }

/* Bootstrap 4 alignment helpers are physical (left/right): mirror them. */
@media (min-width: 768px) {
  [dir=rtl] .text-md-left { text-align: right !important; }
}
@media (min-width: 992px) {
  [dir=rtl] .text-lg-left { text-align: right !important; }
}
[dir=rtl] .text-left { text-align: right !important; }

/* Margin utilities used in the navbar / newsletter form. */
[dir=rtl] .ml-2 { margin-left: 0 !important; margin-right: .5rem !important; }
[dir=rtl] .mr-2 { margin-right: 0 !important; margin-left: .5rem !important; }

/* Language dropdown opens towards the inside of the page. */
[dir=rtl] .dropdown-menu { text-align: right; left: auto; right: 0; }
[dir=rtl] .dropdown-toggle::after { margin-left: 0; margin-right: .255em; }
[dir=rtl] .dropdown-item[lang]:not([lang="ar"]) { direction: ltr; text-align: right; }

/* Hero: download buttons hug the text column (right side in RTL). */
[dir=rtl] .hero-download-group { align-items: flex-start; }
[dir=rtl] header.section-fade-out p { margin-left: auto; margin-right: 0; }

/* Lists in the APK modal and patch notes. */
[dir=rtl] ol, [dir=rtl] ul { padding-left: 0; padding-right: 20px; }
[dir=rtl] .modal-header .close { margin: -1rem auto -1rem -1rem; }

/* FAQ accordion buttons. */
[dir=rtl] #faqAccordion .btn-link,
[dir=rtl] .btn.text-left { text-align: right !important; }

/* Bebas Neue has no Arabic glyphs and its letter-spacing breaks Arabic joining. */
[dir=rtl] h1, [dir=rtl] h2, [dir=rtl] h3, [dir=rtl] h4, [dir=rtl] h5, [dir=rtl] h6,
[dir=rtl] .h1, [dir=rtl] .h2, [dir=rtl] .h3,
[dir=rtl] .fc-title, [dir=rtl] .stat-number, [dir=rtl] #notesTitle {
  letter-spacing: 0 !important;
}
[dir=rtl] .stat-label, [dir=rtl] .section-tag { letter-spacing: 0 !important; }
[dir=rtl] .review-text { font-style: normal; }

@media (max-width: 767px) {
  [dir=rtl] .hero-download-group { align-items: center !important; }
  [dir=rtl] #faqAccordion .btn-link { text-align: right !important; }
}

/* Inline letter-spacing (eyebrows/labels) also breaks Arabic letter joining. */
[dir=rtl] [style*="letter-spacing"] { letter-spacing: 0 !important; }

/* Reviewer handles are Latin ("404.lilyy"): keep them LTR so they are not reordered. */
[dir=rtl] .review-author { direction: ltr; text-align: right; }
