/* Right-to-left and Arabic typography. Loaded only on /ar/ pages. */

:root {
	--joelle-ar-font: "Cairo", "Segoe UI", "Noto Naskh Arabic", "Geeza Pro", "Tahoma", sans-serif;
}

body.joelle-ar,
body.joelle-ar input,
body.joelle-ar textarea,
body.joelle-ar select,
body.joelle-ar button,
body.joelle-ar .btn,
body.joelle-ar h1,
body.joelle-ar h2,
body.joelle-ar h3,
body.joelle-ar h4,
body.joelle-ar h5,
body.joelle-ar h6 {
	font-family: var(--joelle-ar-font);
	letter-spacing: 0;
}

/* Arabic needs a little more line height than the Latin stack was set for. */
body.joelle-ar {
	line-height: 1.85;
}

body.joelle-ar p,
body.joelle-ar li {
	line-height: 1.95;
}

/* Arabic has no letter case, so the theme's uppercasing only mangles it. */
body.joelle-ar .jh-label,
body.joelle-ar .eyebrow,
body.joelle-ar .btn,
body.joelle-ar .tj-eyebrow,
body.joelle-ar .callback-label,
body.joelle-ar .menu-item > a,
body.joelle-ar .ps-cta .btn,
body.joelle-ar .jh-cards-of,
body.joelle-ar .jh-ba-of {
	text-transform: none;
}

/* ---------------------------------------------------------------- direction */

body.joelle-ar .page-container,
body.joelle-ar .container,
body.joelle-ar .entry-content,
body.joelle-ar .tj-section,
body.joelle-ar .ps-cta-copy,
body.joelle-ar .callback,
body.joelle-ar .loc-band-copy {
	text-align: right;
}

/* A centred section sets text-align on the section, but the right-align above
   lands on the .page-container inside it, so the child wins and the band goes
   ragged. Name every centred block here. */
body.joelle-ar .center,
body.joelle-ar .jh-celebs-head,
body.joelle-ar .jh-statement .page-container,
body.joelle-ar .jh-values .page-container,
body.joelle-ar .tj-specialists,
body.joelle-ar .ps-gallery,
body.joelle-ar .callback-done {
	text-align: center;
}

/* Arabic sets a quotation off with angle quotes. They are bidi-mirrored, so
   the opening one is still U+00AB and the renderer turns it round. */
body.joelle-ar .jh-statement-text::before {
	content: "\0000AB";
}

body.joelle-ar .jh-statement-text::after {
	content: "\0000BB";
}

body.joelle-ar .jh-statement-text::before,
body.joelle-ar .jh-statement-text::after {
	font-size: 1.35em;
	vertical-align: -.06em;
}

body.joelle-ar ul,
body.joelle-ar ol {
	padding-right: 1.2em;
	padding-left: 0;
}

body.joelle-ar blockquote {
	border-right: 3px solid currentColor;
	border-left: 0;
	padding-right: 1.1rem;
	padding-left: 0;
}

/* The FAQ accordion marker sits on the opposite side. */
body.joelle-ar .wp-block-details summary {
	padding-right: 0;
	padding-left: 2.2rem;
}

body.joelle-ar .wp-block-details summary::after {
	right: auto;
	left: 0;
}

/* Benefit ticks and the why-us numbers flip with the text. */
body.joelle-ar .tj-benefit-list li {
	padding-right: 2rem;
	padding-left: 0;
}

body.joelle-ar .tj-benefit-list li::before {
	right: 0;
	left: auto;
}

body.joelle-ar .tj-why-list {
	padding-right: 0;
}

body.joelle-ar .tj-why-list li::before {
	right: 0;
	left: auto;
}

/* Sliders: the track is laid out by script in document order, which RTL
   already reverses, so only the chevrons need turning round. */
body.joelle-ar .jh-ba-nav svg,
body.joelle-ar .jh-cards-nav,
body.joelle-ar .jh-reviews-nav,
body.joelle-ar .jh-slider-btn {
	transform: scaleX(-1);
}

body.joelle-ar .jh-ba-rail > [data-ba-fill] {
	right: 0;
	left: auto;
}

/* Counters stay in Latin digits and left-to-right, like the numerals do. */
body.joelle-ar .jh-cards-count,
body.joelle-ar .jh-ba-count,
body.joelle-ar [data-countdown] {
	direction: ltr;
	unicode-bidi: isolate;
}

/* The ticker is two identical tracks side by side, each sliding to
   translateX(-100%) so the second arrives exactly where the first left off.
   That depends on the tracks being laid out in DOM order; `direction: rtl`
   reverses them while the animation still moves them physically left, so the
   second never arrives and the loop tears open.

   Mirroring the strip does not fix that - it mirrors the gap along with
   everything else. Laying the strip out left-to-right does: the geometry is
   then identical to the English ticker, which loops cleanly. Each item still
   renders its own Arabic text right-to-left, which is all bidi needs to do
   here, and isolate keeps one item's digits from reordering against the
   next one's. */
body.joelle-ar .joelle-ticker {
	direction: ltr;
}

body.joelle-ar .joelle-ticker-track li {
	unicode-bidi: isolate;
}

/* Phone numbers, prices and the address keep their own direction so the
   digits do not get reordered inside an Arabic sentence. */
body.joelle-ar a[href^="tel:"],
body.joelle-ar .callback-details a[href^="tel:"],
body.joelle-ar .ps-cta-contact a {
	unicode-bidi: isolate;
}

body.joelle-ar input[type="tel"],
body.joelle-ar #callback-code,
body.joelle-ar #tj-enq-phone {
	direction: ltr;
	text-align: left;
}

/* The contact form breaks out of the content column with
   `margin-left: 50%; translateX(-50%)`. In RTL the inline start is the right
   edge, so that pushes the whole grid off the left of the page. Mirror it. */
body.joelle-ar .callback {
	margin-left: 0;
	margin-right: 50%;
	transform: translateX(50%);
}

@media (max-width: 800px) {
	body.joelle-ar .callback {
		margin-right: 0;
		transform: none;
	}
}

/* Patient reviews are left in the language they were written in, and some are
   Arabic while others are English. plaintext takes the direction from the
   text's own first strong character, so each review reads the right way round
   without the theme having to know which language it is in. */
body.joelle-ar .jh-review-quote,
body.joelle-ar .tj-review-quote,
body.joelle-ar .wp-block-quote p,
body.joelle-ar .wp-block-quote cite,
body.joelle-ar .jh-review-by,
body.joelle-ar .tj-review-by {
	unicode-bidi: plaintext;
	text-align: start;
}

/* ------------------------------------------------- the location page bands */

/* Both bands break out of the container by a different amount on each side,
   so the inset has to move with the text. */
body.joelle-ar .clinic-slider {
	margin-left: calc(50% - 50vw);
	margin-right: calc(50% - 45vw + clamp(16px, 3vw, 64px));
}

body.joelle-ar .loc-band {
	margin-left: calc(50% - 50vw + var(--loc-inset));
	margin-right: calc(50% - 50vw);
}

@media (max-width: 781px) {
	body.joelle-ar .clinic-slider {
		margin-right: calc(50% - 50vw);
	}
}

/* The slide track reverses, so the arrows swap sides and point the other way.
   The script reads the scroll position through Math.abs for the same reason. */
body.joelle-ar .clinic-arrow-prev {
	left: auto;
	right: clamp(4px, 2vw, 28px);
}

body.joelle-ar .clinic-arrow-next {
	right: auto;
	left: clamp(4px, 2vw, 28px);
}

body.joelle-ar .clinic-arrow svg {
	transform: scaleX(-1);
}

@media (max-width: 760px) {
	body.joelle-ar .jh-hero-actions,
	body.joelle-ar .ps-cta-actions {
		text-align: center;
	}
}
