/* ==========================================================================
   Zarnisa Golden — right-to-left corrections
   ==========================================================================

   Loaded only when is_rtl() is true, after every other stylesheet.

   Most of the layout is already direction-agnostic: the theme uses logical
   properties (inline-start/inline-end, margin-inline, padding-inline,
   border-inline) throughout, so the browser mirrors it for free. What remains
   here is the short list of things logical properties cannot express:

     1. Physical transforms — translateX() has no logical equivalent, so the
        slide-in drawers, dropdowns and arrow links need their own values.
     2. Physical background-position — the select chevron is painted as a
        background image and must move to the left edge.
     3. Floats and text-align defaults inherited from WordPress core classes.
     4. Directional glyphs (arrows, chevrons) that should point the other way.
     5. Latin-only typographic details (letter-spacing, italics) that look
        wrong in Arabic.

   Anything added here should genuinely need mirroring. If it can be written
   with a logical property in the source file, it belongs there instead.
   ========================================================================== */

/* --- Typography ----------------------------------------------------------- */

/* Arabic is cursive: letter-spacing breaks the joins between letters and must
   never be applied. tokens.css already zeroes the --zg-ls-* tokens under
   :root:lang(ar), which covers every rule that uses them. What follows catches
   the handful of places where a letter-spacing value is written literally. */
[dir="rtl"] .zg-logo-text__tagline,
[dir="rtl"] .zg-logo-text__name,
[dir="rtl"] .zg-card__cat,
[dir="rtl"] .zg-collection__count,
[dir="rtl"] .zg-paymarks__item,
[dir="rtl"] .zg-badge,
[dir="rtl"] .zg-eyebrow,
[dir="rtl"] .zg-section__head,
[dir="rtl"] .zg-btn,
[dir="rtl"] .zg-link-arrow,
[dir="rtl"] .shop_table th,
[dir="rtl"] .woocommerce-tabs .wc-tabs a {
	letter-spacing: 0;
}

/* Uppercase transformation is a Latin-script device. Arabic has no case, so
   the browser ignores it — but it still affects any Latin text mixed in
   (SKUs, brand names), where shouting looks wrong. */
[dir="rtl"] .zg-btn,
[dir="rtl"] .zg-eyebrow,
[dir="rtl"] .zg-nav__list > li > a {
	text-transform: none;
}

/* Latin italics do not translate well to Arabic; the blockquote keeps its
   distinction through the accent rule and size instead. */
[dir="rtl"] blockquote {
	font-style: normal;
}

/* --- Select chevron ------------------------------------------------------- */

/* The chevron in base.css is positioned with `right`; it needs to move. */
[dir="rtl"] select {
	background-position: left var(--zg-space-4) center;
	padding-inline-end: var(--zg-space-4);
	padding-inline-start: var(--zg-space-8);
}

/* --- WordPress core alignment classes ------------------------------------ */

.alignleft {
	float: left;
	margin: 0 var(--zg-space-5) var(--zg-space-4) 0;
}

.alignright {
	float: right;
	margin: 0 0 var(--zg-space-4) var(--zg-space-5);
}

[dir="rtl"] .alignleft {
	float: right;
	margin: 0 0 var(--zg-space-4) var(--zg-space-5);
}

[dir="rtl"] .alignright {
	float: left;
	margin: 0 var(--zg-space-5) var(--zg-space-4) 0;
}

/* --- Navigation dropdown -------------------------------------------------- */

/* The dropdown is centred with translate(-50%, …); in RTL the sign flips.
   layout.css already handles this through [dir="rtl"] rules — kept here as a
   note because the RTL variant lives with the original rule, not in this file. */

/* --- Drawer and mini cart ------------------------------------------------- */

/* Both panels slide using translateX, which has no logical form. layout.css
   defines the RTL variants next to the LTR keyframes and selector rules. The
   only thing left to correct is the mini cart, which is anchored to the
   inline-end edge and therefore slides in from the opposite side. */
[dir="rtl"] .zg-mini-cart__panel {
	transform: translateX(-100%);
}

[dir="rtl"] .zg-mini-cart.is-open .zg-mini-cart__panel {
	transform: translateX(0);
}

/* --- Directional glyphs --------------------------------------------------- */

/* Icons that imply a direction (arrows, chevrons, the "next" affordance) point
   the wrong way once the reading direction flips. Mirroring the SVG is cleaner
   than shipping a second icon set.

   Stars are deliberately NOT in this list: a mirrored star is not a star. */
[dir="rtl"] .zg-link-arrow svg,
[dir="rtl"] .zg-breadcrumbs svg,
[dir="rtl"] .zg-pagination svg,
[dir="rtl"] .woocommerce-pagination svg {
	transform: scaleX(-1);
}

/* --- Carousel / slider (product gallery) ---------------------------------- */

/* FlexSlider detects RTL and floats slides right. Its oversized track must
   inherit that direction or the active image sits outside the viewport. */
[dir="rtl"] .flex-viewport {
	direction: rtl;
}

/* --- Forms ---------------------------------------------------------------- */

/* Telephone, email and password fields hold left-to-right data even in an RTL
   interface. Letting the browser mirror them moves the country code to the
   wrong side of the number and inverts the caret behaviour while typing. */
[dir="rtl"] input[type="tel"],
[dir="rtl"] input[type="email"],
[dir="rtl"] input[type="url"],
[dir="rtl"] input[type="password"],
[dir="rtl"] input[type="number"] {
	direction: ltr;
	text-align: right;
}

/* Placeholders follow the interface direction, not the field's data direction. */
[dir="rtl"] input::placeholder {
	direction: rtl;
	text-align: right;
}

/* --- Tables and prices ---------------------------------------------------- */

/* Currency amounts read left-to-right even in Arabic; the currency marker sits
   to the correct side but the digits themselves must not be mirrored. */
[dir="rtl"] .woocommerce-Price-amount,
[dir="rtl"] .zg-mini-cart__qty,
[dir="rtl"] .shop_table .product-subtotal {
	direction: ltr;
	unicode-bidi: embed;
}

[dir="rtl"] .shop_table .product-subtotal,
[dir="rtl"] .cart_totals .shop_table td,
[dir="rtl"] .woocommerce-checkout-review-order-table td {
	text-align: left;
}

/* --- WooCommerce specifics ------------------------------------------------ */

/* The payment method label pairs a radio with a name; the gap is logical
   already, but WooCommerce's own float on the payment box needs clearing. */
[dir="rtl"] .wc_payment_method label {
	float: none;
}

/* Quantity input: the number field stays centred, so only the step buttons
   change sides — and WooCommerce does not render step buttons, so nothing is
   needed here. Noted so the omission is deliberate rather than missed. */

/* The "remove item" cross sits in the first cell of the cart table. Logical
   properties handle its position; the hover background is symmetric. */

/* --- Breadcrumb separator ------------------------------------------------- */

/* The separator is written as content:"/" and margin-inline-end, which mirrors
   correctly. Arabic breadcrumbs conventionally use the same slash. */

/* --- Reduced motion ------------------------------------------------------- */

/* base.css disarms all transitions globally under prefers-reduced-motion, and
   that rule is direction-agnostic — nothing to add. */
