/**
 * DLN bilingual + RTL layer
 */

:root {
    --dln-font-ar: 'IBM Plex Sans Arabic', ui-sans-serif, system-ui, sans-serif;
}

html[dir='rtl'] body,
html[lang^='ar'] body {
    font-family: var(--dln-font-ar);
}

/* Apply the Arabic typeface even where legacy theme rules set a font directly. */
html[lang^='ar'] body :where(
    p, h1, h2, h3, h4, h5, h6, a, button, label,
    input, textarea, select, span, small, strong, li
) {
    font-family: var(--dln-font-ar) !important;
}

html[lang^='ar'] .logo-dln,
html[lang^='ar'] .logo-dln span,
html[lang^='ar'] .dln-hero__core-label {
    font-family: 'DM Sans', ui-sans-serif, system-ui, sans-serif !important;
}

html[dir='rtl'] .header-tagline,
html[dir='rtl'] .dln-hero,
html[dir='rtl'] .dln-clients,
html[dir='rtl'] .dln-company-intro,
html[dir='rtl'] .dln-focus,
html[dir='rtl'] .dln-process,
html[dir='rtl'] .dln-portfolio,
html[dir='rtl'] .dln-gallery,
html[dir='rtl'] .dln-contact,
html[dir='rtl'] .dln-footer,
html[dir='rtl'] .menu--contact-only,
html[dir='rtl'] .careers-modal {
    font-family: var(--dln-font-ar);
}

/* Language toggle */
.dln-lang-toggle {
    min-width: 2.75rem;
    height: 2.75rem;
    padding: 0 0.65rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid color-mix(in srgb, var(--main-text) 14%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--body-color) 80%, transparent);
    color: var(--main-text);
    font-family: 'DM Sans', var(--dln-font-ar), sans-serif;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    line-height: 1;
    cursor: pointer;
    transition:
        border-color 0.2s ease,
        color 0.2s ease,
        background-color 0.2s ease,
        transform 0.2s ease;
}

.dln-lang-toggle:hover {
    border-color: var(--template-data);
    color: var(--template-data);
    transform: translateY(-1px);
}

.dln-lang-toggle:focus-visible {
    outline: 2px solid var(--template-data);
    outline-offset: 3px;
}

html[dir='rtl'] .menu-data {
    flex-direction: row-reverse;
}

html[dir='rtl'] .header-brand {
    align-items: flex-start;
    text-align: start;
}

html[dir='rtl'] .logo-dln {
    letter-spacing: 0.08em;
}

/* Hero RTL */
html[dir='rtl'] .dln-hero__title {
    letter-spacing: -0.03em;
}

html[dir='rtl'] .dln-hero__eyebrow {
    letter-spacing: 0.08em;
}

html[dir='rtl'] .dln-hero__proof span::before {
    order: 2;
}

html[dir='rtl'] .dln-hero__btn i {
    transform: scaleX(-1);
}

html[dir='rtl'] .dln-hero__visual {
    justify-self: start;
}

@media (max-width: 767.98px) {
    html[dir='rtl'] .dln-hero__visual {
        justify-self: center;
    }
}

/* Section text alignment */
html[dir='rtl'] .dln-company-intro .second-heading,
html[dir='rtl'] .dln-company-intro__eyebrow,
html[dir='rtl'] .dln-focus .second-heading,
html[dir='rtl'] .dln-focus__eyebrow,
html[dir='rtl'] .dln-process .second-heading,
html[dir='rtl'] .dln-process__eyebrow,
html[dir='rtl'] .dln-portfolio .second-heading,
html[dir='rtl'] .dln-portfolio__eyebrow,
html[dir='rtl'] .dln-gallery .second-heading,
html[dir='rtl'] .dln-gallery__eyebrow,
html[dir='rtl'] .dln-contact .second-heading,
html[dir='rtl'] .dln-contact__eyebrow {
    text-align: start;
}

html[dir='rtl'] .dln-clients__title {
    letter-spacing: 0.08em;
}

/* Menu contact panel — open from the reading start edge */
html[dir='rtl'] #menu.menu--contact-only {
    justify-content: flex-start;
}

html[dir='rtl'] #menu.menu--contact-only .menu-inpage__nav,
html[dir='rtl'] #menu.menu--contact-only .text-main-soclai-detail {
    text-align: start;
}

html[dir='rtl'] #menu.menu--contact-only .close-bar {
    left: auto;
    right: 1.25rem;
}

@media (max-width: 767.98px) {
    html[dir='rtl'] #menu.menu--contact-only .close-bar {
        right: max(1rem, calc(env(safe-area-inset-right, 0px) + 0.5rem));
        left: auto;
    }
}

/* Footer */
html[dir='rtl'] .dln-footer__brand,
html[dir='rtl'] .dln-footer__heading,
html[dir='rtl'] .dln-footer__list,
html[dir='rtl'] .dln-footer__address {
    text-align: start;
}

html[dir='rtl'] .dln-footer .dln-footer__join-btn.btn-design {
    margin-left: auto !important;
    margin-right: 0 !important;
}

html[dir='rtl'] .scroll-top-btn {
    right: auto;
    left: 1.25rem;
}

@media (max-width: 576px) {
    html[dir='rtl'] .scroll-top-btn {
        left: 1rem;
        right: auto;
    }
}

/* Careers modal */
html[dir='rtl'] .careers-modal__panel,
html[dir='rtl'] .careers-modal__title-block,
html[dir='rtl'] .careers-modal__field label,
html[dir='rtl'] .careers-modal__hint {
    text-align: start;
}

html[dir='rtl'] .careers-modal__close {
    left: 1rem;
    right: auto;
}
