/*
 * Al-Nassaj Multilingual — Arabic presentation layer.
 * Loaded only on RTL languages, after WoodMart/Elementor RTL styles.
 * Layout mirroring comes from WordPress/WoodMart/Elementor RTL support;
 * this file handles typography and the components that need a deliberate
 * Arabic treatment.
 */

/* Typography: one Arabic family through WoodMart's own font variables. */
html[dir="rtl"] {
	--wd-text-font: var(--anm-ar-font), sans-serif;
	--wd-title-font: var(--anm-ar-font), sans-serif;
	--wd-entities-title-font: var(--anm-ar-font), sans-serif;
	--wd-widget-title-font: var(--anm-ar-font), sans-serif;
	--wd-header-el-font: var(--anm-ar-font), sans-serif;
	--wd-primary-nav-font: var(--anm-ar-font), sans-serif;
	--wd-brd-font: var(--anm-ar-font), sans-serif;
	--e-global-typography-primary-font-family: var(--anm-ar-font);
	--e-global-typography-secondary-font-family: var(--anm-ar-font);
	--e-global-typography-text-font-family: var(--anm-ar-font);
	--e-global-typography-accent-font-family: var(--anm-ar-font);
}

html[dir="rtl"] body,
html[dir="rtl"] :is(h1, h2, h3, h4, h5, h6, p, li, a, span, button, input, textarea, select, label, blockquote, figcaption, td, th, dt, dd),
html[dir="rtl"] .elementor-widget :is(.elementor-heading-title, .elementor-button, .elementor-icon-box-title, .elementor-icon-box-description, .elementor-widget-container),
html[dir="rtl"] .wd-entities-title,
html[dir="rtl"] .title {
	font-family: var(--anm-ar-font), "Segoe UI", Tahoma, sans-serif !important;
}

/*
 * Icon fonts are untouched: <i> is not in the list above, and theme icons
 * declare their font on ::before, which these element rules do not reach.
 */

/* Arabic letters must join: no letter-spacing, no case transforms. */
html[dir="rtl"] body *:not(code):not(pre) {
	letter-spacing: 0 !important;
}
html[dir="rtl"] :is(h1, h2, h3, h4, h5, h6, .elementor-heading-title, .wd-entities-title, .title, .elementor-button, .button, .btn, button, a) {
	text-transform: none !important;
}

/* Arabic needs more line height than Latin display type. */
html[dir="rtl"] :is(h1, h2, h3, .elementor-heading-title) { line-height: 1.45 !important; }
html[dir="rtl"] :is(h4, h5, h6) { line-height: 1.55; }
html[dir="rtl"] :is(p, li, .elementor-text-editor, .elementor-widget-text-editor) { line-height: 1.85; }

/* Numbers, phone numbers, e-mails and URLs stay left-to-right inside Arabic text. */
html[dir="rtl"] a[href^="tel:"],
html[dir="rtl"] a[href^="mailto:"],
html[dir="rtl"] .anm-ltr {
	direction: ltr;
	unicode-bidi: isolate;
	display: inline-block;
}

/* Leaflet maps: the map surface is LTR, its popups are RTL. */
html[dir="rtl"] .leaflet-container { direction: ltr; }
html[dir="rtl"] .leaflet-popup-content { direction: rtl; text-align: right !important; }
html[dir="rtl"] .leaflet-control-attribution { direction: ltr; }

/* Branch cards on the dotted world map. */
html[dir="rtl"] .njm-tip { direction: rtl; }
html[dir="rtl"] .njm-tip.is-card { text-align: right; }

/* WooCommerce prices and quantities read LTR. */
html[dir="rtl"] .price, html[dir="rtl"] .amount, html[dir="rtl"] .quantity input { direction: ltr; unicode-bidi: isolate; }

/* Form fields: Arabic text right-aligned, e-mail/phone/url fields LTR. */
html[dir="rtl"] input[type="email"],
html[dir="rtl"] input[type="tel"],
html[dir="rtl"] input[type="url"] {
	direction: ltr;
	text-align: right;
}

/* WoodMart start/end alignment classes are physical (left/right) even in its
   RTL stylesheet. Content mirrored from English keeps its "start" alignment.
   Only the variable is changed, so per-element Elementor rules (e.g. centered
   on mobile) still take precedence. */
body.anm-rtl .text-left { --text-align: right; }
body.anm-rtl .text-right { --text-align: left; }

/* Directional icons point in the reading direction: an "arrow-right" that
   means "go / next / open" points left in Arabic. Only directional glyphs
   are mirrored (Font Awesome, Elementor SVG icons, Elementor icon font);
   logos, product images and other icons are left alone. */
body.anm-rtl :is(
	.fa-arrow-right, .fa-arrow-left, .fa-long-arrow-right, .fa-long-arrow-left,
	.fa-long-arrow-alt-right, .fa-long-arrow-alt-left, .fa-arrow-circle-right, .fa-arrow-circle-left,
	.fa-chevron-right, .fa-chevron-left, .fa-chevron-circle-right, .fa-chevron-circle-left,
	.fa-angle-right, .fa-angle-left, .fa-angle-double-right, .fa-angle-double-left,
	.fa-caret-right, .fa-caret-left, .fa-arrow-right-long, .fa-arrow-left-long,
	.e-fas-arrow-right, .e-fas-arrow-left, .e-fas-long-arrow-alt-right, .e-fas-long-arrow-alt-left,
	.e-fas-chevron-right, .e-fas-chevron-left, .e-fas-angle-right, .e-fas-angle-left,
	.e-fas-caret-right, .e-fas-caret-left, .e-fas-arrow-circle-right, .e-fas-arrow-circle-left,
	.eicon-arrow-right, .eicon-arrow-left, .eicon-chevron-right, .eicon-chevron-left,
	.eicon-angle-right, .eicon-angle-left, .eicon-long-arrow-right, .eicon-long-arrow-left
) {
	transform: scaleX(-1);
}

/* Slider Revolution 7 navigation is left to SR7's native RTL mode (module
   setting nav.rtl = "auto", on for dir="rtl" documents): the left arrow
   goes to the next slide, bullets and swipes run right to left. Moving or
   mirroring the arrows here would reverse them a second time. */

/* Arabic slide copy is shorter per line than the English it replaces, so
   SR7's full-width mobile text layers leave single-word last lines and run
   edge to edge. Balance the lines; layer sizes and positions are unchanged. */
body.anm-rtl sr7-module sr7-txt { text-wrap: balance; }

/* WoodMart mirrors the cart drawer for RTL but not the mobile menu drawer:
   open it from the side of its (mirrored) hamburger button. */
body.anm-rtl .mobile-nav.wd-side-hidden.wd-left { left: auto; right: 0; transform: translate3d(100%, 0, 0); }
body.anm-rtl .mobile-nav.wd-side-hidden.wd-left.wd-opened { transform: none; }

/* Stacked CTA pairs (two consecutive button widgets in one container):
   Arabic labels differ more in length than the English ones, so the pair
   shares a minimum width to stay aligned as a group. */
body.anm-rtl .e-con:has(> .elementor-widget-button + .elementor-widget-button) > .elementor-widget-button .elementor-button {
	min-width: 200px;
	justify-content: center;
}

/* Arabic typography: multi-line headings break into balanced lines, and
   paragraphs avoid very short last lines. Wrapping only — no nowrap here
   (single-line headings are opt-in, see assets/js/fit-line.js). */
body.anm-rtl .elementor-heading-title { text-wrap: balance; }
body.anm-rtl :is(.elementor-widget-text-editor, .elementor-icon-box-description, .elementor-image-box-description, .wd-text-block, .woocommerce-product-details__short-description) { text-wrap: pretty; }
