/* Arabic pages (/ar/): right-to-left adjustments on top of the English theme.
   Latin text (brand names, numbers) stays in Quicksand; Arabic letters fall through to Tajawal. */
html[dir="rtl"] body,
html[dir="rtl"] :is(h1, h2, h3, h4, h5, h6, p, a, li, span, div, button, input, select, textarea, label, small, strong, b, em, td, th, blockquote, figcaption, nav, section, main, header, footer):not(.fa):not([class*="fa-"]) {
	font-family: 'Quicksand', 'Tajawal', Tahoma, Arial, sans-serif !important;
	letter-spacing: 0 !important; /* spacing breaks the joins between Arabic letters */
	text-transform: none !important; /* Arabic has no capitals; keeps Latin names as written */
}
html[dir="rtl"] body { text-align: right; }
html[dir="rtl"] :is(p, li) { line-height: 1.8; }
html[dir="rtl"] :is(h1, h2) { line-height: 1.45 !important; text-wrap: balance; }
html[dir="rtl"] :is(h3, h4) { line-height: 1.5 !important; text-wrap: balance; }

/* Short left-to-right names, numbers and codes inside Arabic sentences stay on one line. */
html[dir="rtl"] bdi.sam-nw { white-space: nowrap; }
/* Buttons are flex boxes, which drop the space between the words and an isolated number. */
html[dir="rtl"] :is([class*="btn"], [class*="button"]) > bdi { margin-inline: .3em; }

/* Small labels above headings: English uses letter-spaced capitals; Arabic needs a bigger size instead. */
html[dir="rtl"] :is(.sam-v2-eyebrow, .sam-service-kicker, .sam-page-eyebrow) { font-size: 14px !important; }

/* Header */
html[dir="rtl"] .sam-header-cta { margin-left: 0 !important; margin-right: 20px; }
@media (min-width: 981px) {
	html[dir="rtl"] body.home #menu-wrapper { margin-left: 0 !important; margin-right: 24px !important; }
}
@media (min-width: 768px) {
	html[dir="rtl"] #main-menu,
	html[dir="rtl"] #main-menu ul.menu,
	html[dir="rtl"] #main-menu ul.menu > li,
	html[dir="rtl"] #main-menu > ul.menu > li > a { float: right; }
	html[dir="rtl"] #main-menu > ul.menu > li > a { padding: 0 14px; }
}
html[dir="rtl"] #main-menu ul li.menu-item-simple-parent ul { left: auto; right: 0; float: right; text-align: right; }
html[dir="rtl"] #main-menu > ul.menu { text-align: right; }
html[dir="rtl"] .dt-menu-toggle { text-align: right !important; }
html[dir="rtl"] #dt-menu-toggle .dt-menu-toggle-icon,
html[dir="rtl"] body.home #dt-menu-toggle .dt-menu-toggle-icon { right: auto !important; left: 22px !important; }

/* Bulleted lists: dot and indent on the right. */
html[dir="rtl"] :is(.sam-page-list, .sam-service-list, .sam-v2-list) li { padding-left: 0; padding-right: 26px; }
html[dir="rtl"] :is(.sam-page-list, .sam-service-list, .sam-v2-list) li:before { left: auto; right: 0; }
html[dir="rtl"] .sam-policy :is(ul, ol) { padding-left: 0; padding-right: 24px; }
html[dir="rtl"] .sam-translation-note { font-size: 15px; color: #6b6470; }

/* Opening hours: day on the right, time on the left. */
html[dir="rtl"] .sam-hours.compact span { text-align: left !important; }
html[dir="rtl"] .sam-location-hours-card { text-align: right !important; }

/* Separators between the home page's rating boxes. */
@media (min-width: 641px) {
	html[dir="rtl"] .sam-v2-proof div { border-right: 0; border-left: 1px solid var(--sam-line); }
	html[dir="rtl"] .sam-v2-proof div:last-child { border-left: 0; }
}

/* Small screens: service cards put the image on the right, so the divider goes on its left. */
@media (max-width: 640px) {
	html[dir="rtl"] .sam-hub-card img,
	html[dir="rtl"] body .sam-services-hub .sam-hub-grid a.sam-hub-card[href] > img,
	html[dir="rtl"] body.home .service-image-grid > article > a > img { border-right: 0 !important; border-left: 1px solid #eaded9 !important; }
}

/* Google reviews: the widget forces left-to-right; let it run right to left (its script supports it). */
html[dir="rtl"] .wp-gr { direction: rtl !important; }
html[dir="rtl"] .wp-gr :is(.wp-google-text, .wp-google-feedback) { text-align: right !important; }

/* Arabic Instagram grid stays hidden until the @sammedspaarabic feed has loaded. */
html[dir="rtl"] .sam-ig-grid:empty { display: none; }

/* Videos keep their fixed WordPress width; fit them in the card. */
html[dir="rtl"] .wp-video { max-width: 100% !important; }
html[dir="rtl"] .wp-video video { max-width: 100%; height: auto; }

/* Chat button: bottom left, where Arabic lines end, so it doesn't cover the start of text. */
html[dir="rtl"] .sam-messenger-stack { right: auto !important; left: 22px !important; align-items: flex-start !important; }
html[dir="rtl"] .sam-messenger-menu { right: auto !important; left: 0 !important; }
@media (max-width: 767px) {
	html[dir="rtl"] .sam-messenger-stack { left: 12px !important; }
}

/* The contact form's hidden spam trap must sit off the right edge, which an RTL page does not scroll to. */
html[dir="rtl"] .sam-hp { left: auto !important; right: -9999px !important; }

/* Form fields */
html[dir="rtl"] :is(input:not([type="submit"]):not([type="button"]), textarea, select) { text-align: right; }
html[dir="rtl"] :is(input[type="submit"], input[type="button"], button) { text-align: center; }
html[dir="rtl"] :is(input[type="email"], input[type="tel"], input[type="url"]) { direction: ltr; text-align: right; }

/* Services page rows break out to full width with left:50% / -50vw margins; mirror that for RTL. */
html[dir="rtl"] body.page-id-14 .vc_row.wpb_row { left: auto !important; right: 50% !important; }
