/*
 * ByByBG — Arabic RTL Foundation
 * Scope: Arabic pages only.
 * Phase 1: Typography and text direction.
 */

html[lang="ar"][dir="rtl"] {
    direction: rtl;
    text-align: start;
    font-family:
        "Noto Sans Arabic",
        "Noto Naskh Arabic",
        Tahoma,
        Arial,
        sans-serif;
}

/* Arabic text alignment */

html[lang="ar"][dir="rtl"] :is(
    .hero-left,
    .step,
    .trust-card,
    .faq-list,
    .faq-question,
    .faq-answer,
    .article-body,
    .docs-content,
    .legal-content,
    .policy-content,
    .contact-content,
    .footer-col
) {
    text-align: start;
}

/* Natural Arabic heading wrapping */

html[lang="ar"][dir="rtl"] :is(
    h1, h2, h3, h4, h5, h6
) {
    overflow-wrap: break-word;
    word-break: normal;
    line-height: 1.5;
}

/* Arabic paragraph readability */

html[lang="ar"][dir="rtl"] :is(
    p, li
) {
    overflow-wrap: break-word;
    line-height: 1.85;
}

/* RTL lists */

html[lang="ar"][dir="rtl"] :is(
    .docs-list,
    .policy-card ul,
    .legal-list,
    .article-body ul,
    .article-body ol
) {
    padding-inline-start: 1.5rem;
    padding-left: 0;
}

/* Preserve programming code direction */

html[lang="ar"][dir="rtl"] :is(
    pre,
    code,
    .code-block,
    .code-block pre
) {
    direction: ltr;
    text-align: left;
    unicode-bidi: isolate;
}

/* Preserve image comparison direction */

html[lang="ar"][dir="rtl"] .hero-right .image-container {
    direction: ltr;
}

/* Preserve upload progress coordinates */

html[lang="ar"][dir="rtl"] :is(
    .progress-track,
    .progress-bar
) {
    direction: ltr;
}

/* Mobile text safety */

@media (max-width: 768px) {
    html[lang="ar"][dir="rtl"] :is(
        h1, h2, h3
    ) {
        max-width: 100%;
        overflow-wrap: break-word;
    }
}

/* Arabic-only body typography */
html[lang="ar"][dir="rtl"] body {
    font-family:
        "Noto Sans Arabic",
        "Noto Naskh Arabic",
        Tahoma,
        Arial,
        sans-serif;
    direction: rtl;
}

/* Arabic navbar RTL alignment */
@media (min-width: 769px) {
    html[lang="ar"][dir="rtl"] .navbar .dropdown-menu {
        left: auto;
        right: 0;
        text-align: start;
    }
}

html[lang="ar"][dir="rtl"] .navbar .dropdown-menu a {
    text-align: start;
}

@media (max-width: 768px) {
    html[lang="ar"][dir="rtl"] .navbar nav {
        text-align: start;
    }

    html[lang="ar"][dir="rtl"] .navbar .dropdown-menu {
        position: static;
        left: auto;
        right: auto;
        text-align: start;
    }
}

/* ByByBG IBM Plex Sans Arabic Fonts */

@font-face {
    font-family: "ByByBG IBM Arabic";
    src: url("/assets/fonts/IBMPlexSansArabic-Regular.woff2") format("woff2");
    font-style: normal;
    font-weight: 400;
    font-display: swap;
}


@font-face {
    font-family: "ByByBG IBM Arabic";
    src: url("/assets/fonts/IBMPlexSansArabic-Medium.woff2") format("woff2");
    font-style: normal;
    font-weight: 500;
    font-display: swap;
}


@font-face {
    font-family: "ByByBG IBM Arabic";
    src: url("/assets/fonts/IBMPlexSansArabic-SemiBold.woff2") format("woff2");
    font-style: normal;
    font-weight: 600;
    font-display: swap;
}


@font-face {
    font-family: "ByByBG IBM Arabic";
    src: url("/assets/fonts/IBMPlexSansArabic-Bold.woff2") format("woff2");
    font-style: normal;
    font-weight: 700;
    font-display: swap;
}


html[lang="ar"][dir="rtl"],
html[lang="ar"][dir="rtl"] body {
    font-family:
        "ByByBG IBM Arabic",
        Tahoma,
        Arial,
        sans-serif;
}

html[lang="ar"][dir="rtl"] :is(
    h1, h2, h3, h4, h5, h6,
    p, a, button, input, textarea, select,
    label, li, strong, span
) {
    font-family: inherit;
}

/* ByByBG Arabic theme contrast v1 */

/* Theme-specific readable text colors */
html[lang="ar"][dir="rtl"] {
    --ar-secondary-text: #4b5563;
    --ar-link-color: #5142db;
}

html[lang="ar"][dir="rtl"].dark {
    --ar-secondary-text: #cbd5e1;
    --ar-link-color: #a5b4fc;
}

/* Homepage secondary descriptions */
html[lang="ar"][dir="rtl"] :is(
    .hero-left p,
    .how-intro,
    .step p,
    .trust-card p,
    .gallery-intro,
    .trust-intro,
    .gallery-card p,
    .cta-intro,
    .faq-intro,
    .faq-answer,
    .upload-content p
) {
    color: var(--ar-secondary-text);
}

/* Inline links inside descriptive text */
html[lang="ar"][dir="rtl"] :is(
    .hero-left p,
    .how-intro,
    .gallery-intro,
    .trust-intro,
    .cta-intro,
    .faq-intro
) a {
    color: var(--ar-link-color);
}

/* Keep CTA text white on its purple background */
html[lang="ar"][dir="rtl"] .cta-box,
html[lang="ar"][dir="rtl"] .cta-box :is(h2, h3, p, a) {
    color: #ffffff;
}
