/* Arabic / RTL overrides.
 *
 * Loaded only when Polylang reports the current language as `ar`
 * (see inc/i18n.php). Most of the layout already uses logical properties
 * (margin-inline, padding-inline) which flip automatically, so this file only
 * covers the places that use physical left/right — mainly the fixed-position
 * elements, which are positioned against the viewport and don't flip on their
 * own. */

.po-rtl {
	text-align: right;
}

/* Floating action buttons swap corners so the contact launcher stays on the
 * "start" side of the reading direction. */
.po-rtl .po-contact-fab {
	left: auto;
	right: 1.25rem;
}
.po-rtl .po-to-top {
	right: auto;
	left: 1.25rem;
}
@media (max-width: 600px) {
	.po-rtl .po-contact-fab {
		right: 1rem;
	}
	.po-rtl .po-to-top {
		left: 1rem;
	}
}

/* The contact options put their label to the left of the icon in LTR; mirror
 * that so the label sits on the correct side of the button. */
.po-rtl .po-contact-option {
	flex-direction: row;
}

/* Locale dropdown aligns to the opposite edge of its toggle. */
.po-rtl .po-locale__list {
	right: auto;
	left: 0;
}

/* Footer content, statement and social row all read from the right. */
.po-rtl .site-footer .footer-social-wrap,
.po-rtl .site-footer .footer-widget-area.footer-social,
.po-rtl .site-footer .footer-widget-area.footer-social .footer-widget-area-inner {
	text-align: right;
}
.po-rtl .site-footer .footer-social-wrap .footer-social-inner-wrap {
	justify-content: flex-start;
}
.po-rtl .po-footer-statement {
	margin-inline-start: 0;
}

/* Accordion chevrons sit at the far edge; margin-inline handles the flip. */
.po-rtl .site-footer .po-accordion-toggle {
	text-align: right;
}
.po-rtl .site-footer .po-accordion-toggle::after {
	margin-left: 0;
	margin-right: auto;
}

/* Testimonials: the review sits left of the product in LTR — mirror the grid so
 * the reading order still starts on the correct side. */
.po-rtl .po-testimonial.is-active {
	direction: rtl;
}
.po-rtl .po-testimonial__quote,
.po-rtl .po-testimonial__author,
.po-rtl .po-testimonial__stars {
	text-align: right;
}

/* Featured Collection scrolls the other way; the arrows swap ends with it. */
.po-rtl .po-featured__arrow--prev {
	left: auto;
	right: -22px;
	transform: translateY(-50%) rotate(180deg);
}
.po-rtl .po-featured__arrow--next {
	right: auto;
	left: -22px;
	transform: translateY(-50%) rotate(180deg);
}

/* Gift-box builder rows read right-to-left. */
.po-rtl .po-box-item__subtotal,
.po-rtl .po-search-result__price {
	text-align: left;
}

/* Newsletter: the SUBSCRIBE action moves to the left of the field. */
.po-rtl .po-newsletter {
	flex-direction: row;
}

/* ==== Single product page ================================================
 *
 * assets/css/single-product.css uses logical properties (margin-inline-end,
 * padding-inline, inset-inline-end) wherever it can, so most of that page
 * mirrors on its own. What is left is the things CSS cannot flip for us:
 * rotations and translations. */

/* The breadcrumb chevron points "forwards", which is the other way round. */
.po-rtl .po-pdp-breadcrumbs .po-pdp-icon--chevron {
	transform: rotate(90deg);
}

/* Shopify's button wipes travel in the reading direction: the outline button's
 * tint enters from the start edge and the solid button's panel leaves towards
 * the end edge. Both are `translate3d` on a skewed pseudo-element, which is a
 * physical transform, so each has to be mirrored by hand. */
.po-rtl .single-product div.product .single_add_to_cart_button::before {
	transform: translate3d(100%, 0, 0) skew(-30deg);
}

.po-rtl .single-product div.product .po-pdp-buy-now::before {
	transform: skew(-30deg);
}

.po-rtl .single-product div.product .po-pdp-buy-now:hover::before,
.po-rtl .single-product div.product .po-pdp-buy-now:focus-visible::before {
	transform: translate3d(-100%, 0, 0);
}

/* The grid itself needs no rule. inc/i18n.php already puts dir="rtl" on <html>,
 * and CSS Grid resolves `grid-column: 1` against the writing direction — so the
 * gallery lands on the right and the summary on the left without being told.
 */

/* ==== Search drawer ======================================================
 *
 * The drawer's geometry is physical, not logical: it is parked off the left
 * edge of the window and pulled in with translateX. In Arabic it has to come
 * from the right instead, so both halves of that two-stage move are mirrored —
 * the parking position AND the transform. Mirroring only one leaves the panel
 * sliding in from off-screen and stopping in the wrong place.
 *
 * Only the desktop side-panel needs it. Below 960px the drawer comes down from
 * the top, which reads the same either way. */

@media (min-width: 960px) {
	.po-rtl .po-search {
		left: auto;
		right: calc(var(--po-search-width) * -1);
	}

	.po-rtl .po-search--visible .po-search__container {
		transform: translateX(-100%);
	}
}

/* The close button sits on the opposite corner. */
.po-rtl .po-search__close {
	align-self: flex-start;
}

/* The "View all results" wipe travels in the reading direction, like the
 * product-page buttons above. */
.po-rtl .po-search__view-all::before {
	transform: skew(-30deg);
}

.po-rtl .po-search__view-all:hover::before,
.po-rtl .po-search__view-all:focus-visible::before {
	transform: translate3d(-100%, 0, 0);
}
