/*
 * Arabic (RTL) adjustments — loaded ONLY on /ar/ pages by mu-plugins/abdalla-arabic.php.
 * The English site never loads this file.
 */

/* ---------- Font: Cairo, self-hosted (variable font 200–1000, files next to this stylesheet) ----------
 * Own family name so it never depends on the Elementor/Kirki Cairo CSS (which points at absolute URLs). */
@font-face {
    font-family: 'AbdallaCairo';
    font-style: normal;
    font-weight: 200 1000;
    font-display: swap;
    src: url(fonts/cairo-arabic.woff2) format('woff2');
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
    font-family: 'AbdallaCairo';
    font-style: normal;
    font-weight: 200 1000;
    font-display: swap;
    src: url(fonts/cairo-latin-ext.woff2) format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'AbdallaCairo';
    font-style: normal;
    font-weight: 200 1000;
    font-display: swap;
    src: url(fonts/cairo-latin.woff2) format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
html[lang^="ar"] body,
html[lang^="ar"] body :is(h1, h2, h3, h4, h5, h6, p, a, span, li, div, label, button, input, textarea, select, blockquote, strong, em, b, small, td, th, figcaption, cite, time, address):not([class*="fa-"]):not(.fa):not(.fas):not(.far):not(.fab):not([class*="eicon"]):not([class*="dashicons"]) {
    font-family: 'AbdallaCairo', sans-serif !important;
}

/* ---------- Header ---------- */
/* Theme pushes the menu with margin-left:auto (LTR). Mirror it so the menu sits on the far (left) side. */
html[dir="rtl"] .classic-menu:not(.dsn-line-style) .site-header .extend-container .main-navigation {
    margin-left: 0;
    margin-right: auto;
}
/* Desktop dropdown (Services): mirror its offset and the accent bar of the hovered item */
html[dir="rtl"] .classic-menu:not(.dsn-line-style) .site-header .extend-container .main-navigation ul.extend-container > li ul {
    margin-left: 0;
    margin-right: -10px;
}
html[dir="rtl"] .classic-menu:not(.dsn-line-style) .site-header .extend-container .main-navigation ul.extend-container > li ul li:before {
    left: auto;
    right: -10px;
}
/* Menu links have overflow:hidden with line-height 1.2: Cairo's descenders (dots under ي، ب…) got clipped */
html[dir="rtl"] .site-header #dsn-primary-list a,
html[dir="rtl"] .site-header #dsn-primary-list .dsn-title-menu {
    line-height: 1.75;
}
/* Menu item spacing: theme uses margin-left between items */
html[dir="rtl"] .site-header #dsn-primary-list > li + li {
    margin-left: 0;
    margin-right: 30px;
}
/* Language switcher (theme slot #dsn_multi_lang is fixed at right:165px for LTR) */
html[dir="rtl"] #dsn_multi_lang {
    right: auto;
    left: 60px;
}
html[dir="rtl"] #dsn_multi_lang a { font-family: Poppins, Roboto, sans-serif; }
/* The theme keeps #dsn_multi_lang fixed while the header slides away on scroll-down
   (body.hide-nav), so it floated over page text. Hide/show it together with the header. */
html[dir="rtl"] #dsn_multi_lang {
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
}
html[dir="rtl"] body.hide-nav #dsn_multi_lang {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-20px);
}
/* Fixed side elements: in English the logo/menu/social sidebar is on the left and the vertical
   "Contact" button + contact panel on the right. Mirror all of them (the logo already moves right,
   and otherwise collides with the Contact button on the blog/article layout). */
html[dir="rtl"] .contact-btn { right: auto; left: 15px; }
@media only screen and (min-width: 992px) {
    html[dir="rtl"] body.dsn-line-style .contact-btn { right: auto; left: calc(var(--body-style-space) / 2 - 4px); }
}
html[dir="rtl"] .contact-btn:before { right: auto; left: 2px; }
html[dir="rtl"] .contact-btn .contact-btn-txt {
    right: auto;
    left: 0;
    padding-right: 0;
    padding-left: 20px;
    transform-origin: 6px 50%;
    transform: rotate(90deg);
    letter-spacing: 0;
}
html[dir="rtl"] body.dsn-show-contact .contact-btn .contact-btn-txt { transform: rotate(0deg); }
html[dir="rtl"] .contact-modal {
    right: auto;
    left: 0;
    padding-right: 0;
    padding-left: 100px;
    transform: translate3d(-120%, 0, 0);
}
html[dir="rtl"] body.dsn-show-contact .contact-modal { transform: translate3d(0, 0, 0); }
html[dir="rtl"] .social-side { left: auto; right: 0; }
/* Page-header "scroll down" circle: bottom-right in English -> bottom-left */
html[dir="rtl"] #dsn_header .scroll-d { right: auto; left: 0; }

/* Mobile/tablet: the "Menu" toggle sits on the left in RTL, keep the switcher clear of it */
@media only screen and (max-width: 991px) {
    html[dir="rtl"] #dsn_multi_lang { left: 105px; }
}

/* Mobile "Menu" toggle text: the theme splits the word into per-letter inline-blocks
   (letter animation), which breaks Arabic letter joining and wraps the word.
   Keep the letters inline (joined) and fade instead of the per-letter slide. */
html[dir="rtl"] .site-header .menu-icon .text-menu {
    width: 52px;
    white-space: nowrap;
}
html[dir="rtl"] .site-header .menu-icon .text-menu > div {
    left: auto;
    right: 0;
}
html[dir="rtl"] .site-header .menu-icon .text-menu .dsn-word-wrapper,
html[dir="rtl"] .site-header .menu-icon .text-menu .dsn-chars-wrapper {
    display: inline !important;
    transform: none !important;
}

/* Alignment: the Arabic posts store mirrored Elementor alignment values (left<->right swapped
   in their own data), so the theme's own right/left-aligned styles apply natively. */

/* ---------- Section labels / sub-headings decorations ----------
 * English: thin line BEFORE the label (left) and a skewed dark box behind the END of the label (right).
 * Arabic: line before the label on the right, dark box behind the end of the label on the left. */
html[dir="rtl"] .line-shape:not(.line-shape-after):before { margin-right: 0; margin-left: 15px; }
html[dir="rtl"] .line-shape:not(.line-shape-before):after { margin-left: 0; margin-right: 15px; }
html[dir="rtl"] .line-bg-right { padding-right: 0; padding-left: 15px; }
html[dir="rtl"] .line-bg-right:after {
    right: auto;
    left: 0;
    transform-origin: bottom left;
    transform: skew(10deg);
}
html[dir="rtl"] .line-bg-left { padding-left: 0; padding-right: 20px; }
html[dir="rtl"] .line-bg-left:before {
    left: auto;
    right: 0;
    transform-origin: bottom right;
    transform: skew(10deg);
}
html[dir="rtl"] .line-under { padding-right: 0; padding-left: 15px; }
html[dir="rtl"] .line-under:after { right: auto; left: 0; }
html[dir="rtl"] .line-under-left { padding-left: 0; padding-right: 15px; }
html[dir="rtl"] .line-under-left:before { left: auto; right: 0; }

/* Numbered service cards: "01 ———" → number on the right, line runs to the left */
html[dir="rtl"] .dsn-service.with-number .service-item::before { left: auto; right: 10px; }
@media only screen and (max-width: 400px) {
    html[dir="rtl"] .dsn-service.with-number .service-item::before { left: auto; right: 30px; }
}
html[dir="rtl"] .dsn-service .line-top::before { left: 0; right: 55px; }
html[dir="rtl"] .dsn-service.icon-left .dsn-icon { margin-right: 0; margin-left: 20px; }
html[dir="rtl"] .dsn-service.icon-right .dsn-icon { margin-left: 0; margin-right: 20px; }

/* Counters (71+ / 100+ / 16): number and "+" are one left-to-right unit,
   shown exactly like English ("71+"), with the same 10px gap to the label as in English (the gap was on the wrong side, so the label touched the sign). */
html[dir="rtl"] .dsn-awards .award-inner .dsn-number-award {
    direction: ltr;
    unicode-bidi: isolate;
    margin-right: 0;
    margin-left: 10px;
}
html[dir="rtl"] .dsn-awards .award-inner:not(.d-flex) .dsn-number-award { margin-left: 0; text-align: right; }
/* "على Google" — no forced capitals in the Arabic labels */
html[dir="rtl"] .dsn-awards .dsn-title-award { text-transform: none !important; }

/* Theme spacing helpers are physical (.mr-15 = gap after the check icons in lists, .ml-5 = gap before small icons).
   Mirror the one-sided ones used on the Arabic pages; the two-sided pairs (pl-30+pr-30, ml-30+mr-30) are symmetric already. */
html[dir="rtl"] .mr-15:not([class*="ml-"]) { margin-right: 0; margin-left: 15px; }
html[dir="rtl"] .ml-5:not([class*="mr-"]) { margin-left: 0; margin-right: 5px; }

/* Theme ".text-left" helper is physical: blog list cards (category + title) and the single post hero
   (categories row + title) stayed left. In Arabic it means "start" = right. */
html[dir="rtl"] .text-left { text-align: right !important; }
/* post hero categories: the gap after each link goes on its left side */
html[dir="rtl"] .entry-header .metas a { margin-right: 0; margin-left: 15px; }

/* Arabic letters need taller lines: Elementor headings set to line-height 1 (hero H1) made the lines touch */
html[dir="rtl"] .elementor-widget-heading .elementor-heading-title,
html[dir="rtl"] .elementor-icon-box-title,
html[dir="rtl"] .elementor-image-box-title { line-height: 1.4 !important; }

/* ---------- Text ---------- */
/* break-all splits Arabic words in the middle (letters are joined) */
html[dir="rtl"] .word-wrap,
html[dir="rtl"] .post-title,
html[dir="rtl"] .title-block,
html[dir="rtl"] .dsn-heading-title {
    word-break: normal;
    overflow-wrap: break-word;
}
/* uppercase/letter-spacing breaks Arabic letter joining */
html[dir="rtl"] body :lang(ar),
html[dir="rtl"] .text-transform-upper,
html[dir="rtl"] .sm-title-block,
html[dir="rtl"] .title-block,
html[dir="rtl"] .dsn-heading-title,
html[dir="rtl"] .dsn-btn,
html[dir="rtl"] .title-btn {
    letter-spacing: 0 !important;
}

/* Phone numbers / e-mails stay left-to-right */
html[dir="rtl"] a[href^="tel:"],
html[dir="rtl"] a[href^="mailto:"],
html[dir="rtl"] [itemprop="telephone"] {
    direction: ltr;
    unicode-bidi: isolate;
    display: inline-block;
}

/* Google reviews are English content: keep them LTR so punctuation is not flipped */
html[dir="rtl"] .wp-gr,
html[dir="rtl"] .grw-review,
html[dir="rtl"] .wp-google-feedback,
html[dir="rtl"] .wp-google-name {
    direction: ltr;
    text-align: left;
}

/* Directional icons point the other way in RTL */
html[dir="rtl"] .elementor-icon-list-icon .fa-caret-right,
html[dir="rtl"] .elementor-icon-list-icon .fa-chevron-right,
html[dir="rtl"] .elementor-icon-list-icon .fa-angle-right,
html[dir="rtl"] .elementor-icon-list-icon .fa-arrow-right {
    transform: scaleX(-1);
}
html[dir="rtl"] .elementor-icon-list-icon {
    margin-right: 0;
    margin-left: 8px;
}

/* ---------- Half-bleed sections ----------
 * .dsn-right-container keeps the text on the container line and lets the image bleed to the
 * right edge (margin-left:auto). Mirror: text keeps its distance from the RIGHT edge, image bleeds left. */
@media (min-width: 992px) {
    html[dir="rtl"] .dsn-right-container { margin-left: 0; margin-right: auto; }
    html[dir="rtl"] .dsn-left-container { margin-right: 0; margin-left: auto; }
}
/* 992–1366px: theme keeps the 50px container padding only on the text side */
@media (min-width: 992px) and (max-width: 1366px) {
    html[dir="rtl"] .dsn-right-container { padding-left: 0; padding-right: 50px; }
    html[dir="rtl"] .dsn-left-container { padding-right: 0; padding-left: 50px; }
}

/* ---------- Isotope / masonry grids ----------
 * Theme uses margin-left:-gutter on the grid and margin-left:gutter on items.
 * In RTL a left overflow becomes scrollable (page shifts sideways on mobile), so mirror the gutter. */
html[dir="rtl"] .dsn-grid-layout {
    margin-left: 0;
    margin-right: calc(-1 * var(--dsn-col-item));
}
html[dir="rtl"] .dsn-grid-layout > * {
    margin-left: 0;
    margin-right: var(--dsn-col-item);
}

/* Decorative dotted circle sits at top-left with left:-15px; mirror it to the top-right
   (a left overflow would make RTL pages scroll sideways on mobile). */
html[dir="rtl"] .bg-circle-dotted:not(.bg-circle-dotted-right) {
    left: auto;
    right: -15px;
    transform: scaleX(-1);
}
@media only screen and (min-width: 992px) {
    html[dir="rtl"] body.dsn-line-style .bg-circle-dotted:not(.bg-circle-dotted-right) { left: auto; right: 0; }
}

/* ---------- "Next service" block at the bottom of service pages ---------- */
html[dir="rtl"] .next-project .project-number { left: auto; right: 0; }
html[dir="rtl"] .next-project .metas { right: auto; left: 0; }
html[dir="rtl"] .next-project .title span.p-absolute {
    left: auto;
    right: 0;
    transform-origin: right;
}
html[dir="rtl"] .next-project .case { right: auto; left: 50px; }
@media only screen and (max-width: 575px) {
    html[dir="rtl"] .next-project .case { right: auto; left: 30px; }
}

/* ---------- Additional-CSS mirrors (SEOPress cookie preferences mini tab) ---------- */
html[dir="rtl"] .seopress-user-consent.seopress-edit-choice {
    left: 0 !important;
    right: auto !important;
    border-right: 1px solid rgba(255, 255, 255, 0.16) !important;
    border-left: 0 !important;
    border-radius: 0 6px 6px 0 !important;
}
html[dir="rtl"] .seopress-user-consent.seopress-edit-choice::before {
    right: auto;
    left: 31px;
}
@media (max-width: 767px) {
    html[dir="rtl"] .seopress-user-consent.seopress-edit-choice {
        left: 0 !important;
        right: auto !important;
    }
}
