/*
 * Right-to-left fixes (Hebrew, Arabic). Linked only by RTL pages that
 * scripts/build-i18n.py generates, so left-to-right pages are untouched.
 * Flex/grid rows and logical properties already mirror on their own.
 */

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

/* Directional chevrons point the other way. */
[dir="rtl"] .gd-shell [data-gd-icon="chevron-left"] svg,
[dir="rtl"] .gd-shell [data-gd-icon="chevron-right"] svg {
    transform: scaleX(-1);
}

/* Credential bullets: dot on the right. */
[dir="rtl"] .credential-card__bullets li {
    padding-left: 0;
    padding-right: 0.9rem;
}

[dir="rtl"] .credential-card__bullets li::before {
    left: auto;
    right: 0.2rem;
}

/* Featured work card divider sits between media and text. */
@media (min-width: 46rem) {
    [dir="rtl"] .work-card--featured .work-card__media {
        border-right: 0;
        border-left: 1px solid var(--color-divider);
    }
}

/* Latin names, URLs and numbers stay readable inside RTL text. */
[dir="rtl"] .stack-badge__name,
[dir="rtl"] .gd-corner__prompt p {
    unicode-bidi: plaintext;
}

/* Reader counter reads "1/5", not "5/1". */
[dir="rtl"] .gd-reader__count {
    direction: ltr;
    unicode-bidi: isolate;
}

/*
 * Script fonts, loaded only on these pages by scripts/build-i18n.py.
 * Hebrew: Heebo for text, headings, footer and UI; Frank Ruhl Libre for the
 *   hero (it also sets the "Ein od milvado" line).
 * Arabic: IBM Plex Sans Arabic for text, headings, footer and UI; Noto Naskh
 *   Arabic for the hero.
 * Heebo and IBM Plex Sans Arabic carry their own Latin, so names such as
 * DataSafari or Python match the surrounding text. Noto Naskh has no Latin,
 * so "Creatio Perpetua." falls back to Playfair Display, as in English.
 */
:root:lang(he) {
    --font-body: "Heebo", "Nunito", system-ui, sans-serif;
    --font-display: "Heebo", "Nunito", system-ui, sans-serif;
    --gd-font: "Heebo", "Nunito", system-ui, sans-serif;
    --gd-display: "Heebo", "Nunito", system-ui, sans-serif;
    --rtl-hero: "Frank Ruhl Libre", "Playfair Display", Georgia, serif;
}

:root:lang(ar) {
    --font-body: "IBM Plex Sans Arabic", "Nunito", system-ui, sans-serif;
    --font-display: "IBM Plex Sans Arabic", "Nunito", system-ui, sans-serif;
    --gd-font: "IBM Plex Sans Arabic", "Nunito", system-ui, sans-serif;
    --gd-display: "IBM Plex Sans Arabic", "Nunito", system-ui, sans-serif;
    --rtl-hero: "Noto Naskh Arabic", "Playfair Display", Georgia, serif;
}

:root:is(:lang(he), :lang(ar)) .hero__motto {
    font-family: var(--rtl-hero);
}

/* Arabic letterforms need a little more room between lines. */
:root:lang(ar) body {
    line-height: 1.75;
}
