/* Kian RTL (Persian) overrides — loaded when lang=fa */
html[dir="rtl"],
body.is-rtl,
body.rtl {
  --font-agane: "Peyda", "Outfit", ui-sans-serif, system-ui, sans-serif;
}

html[dir="rtl"] body,
body.is-rtl,
body.rtl {
  direction: rtl;
  font-family: "Peyda", "Outfit", ui-sans-serif, system-ui, sans-serif;
}

/* Header FA: MENU on the right, utility icons on the left (RTL). */
.site-header--rtl,
html[dir="rtl"] .site-header,
body.is-rtl .site-header,
body.rtl .site-header {
  direction: rtl;
  flex-direction: row;
}

.site-header--rtl .site-header__menu,
html[dir="rtl"] .site-header__menu,
body.is-rtl .site-header__menu,
body.rtl .site-header__menu {
  order: 1; /* with direction:rtl this sits on the right */
}

.site-header--rtl .site-header__utils,
html[dir="rtl"] .site-header__utils,
body.is-rtl .site-header__utils,
body.rtl .site-header__utils {
  order: 3; /* with direction:rtl this sits on the left */
}

/* Mobile logo sits opposite the menu; drop LTR ml-auto push. */
.site-header--rtl .ml-auto,
html[dir="rtl"] .site-header .ml-auto {
  margin-left: 0;
  margin-right: 0;
}

/* Keep language switcher UI LTR (EN / FA codes). */
html[dir="rtl"] .site-header__lang-wrap,
body.is-rtl .site-header__lang-wrap,
body.rtl .site-header__lang-wrap {
  direction: ltr;
}

/* In RTL the lang control sits on the left; open dropdown into the page. */
html[dir="rtl"] .site-header__lang-menu,
body.is-rtl .site-header__lang-menu,
body.rtl .site-header__lang-menu {
  right: auto;
  left: 0;
}

/* Mega menu: open from the right, right-aligned copy. */
html[dir="rtl"] .site-menu,
body.is-rtl .site-menu,
body.rtl .site-menu {
  direction: rtl;
}

html[dir="rtl"] .site-menu__desktop {
  transform: translateX(24px);
}

html[dir="rtl"] .site-menu.is-open .site-menu__desktop {
  transform: translateX(0);
}

html[dir="rtl"] .site-menu__close {
  left: auto;
  right: 17px;
}

html[dir="rtl"] .site-menu__primary {
  background: linear-gradient(to left, #121212, #161616);
}

html[dir="rtl"] .site-menu__logo {
  margin-left: 0;
  margin-right: 29px;
}

html[dir="rtl"] .site-menu__primary-nav {
  align-items: flex-start;
  padding-left: 0;
  padding-right: 29px;
}

html[dir="rtl"] .site-menu__item {
  text-align: right;
}

html[dir="rtl"] .site-menu__active-bar {
  left: auto;
  right: 14px; /* mirror of LTR left:14px — keep inside overflow:hidden primary */
}

html[dir="rtl"] .site-menu__secondary {
  background: linear-gradient(to left, #121212, #1b1b1b);
}

html[dir="rtl"] .site-menu__secondary-nav {
  align-items: flex-start; /* right edge in RTL */
  padding-left: 2.25rem; /* room for chevrons on the left */
  padding-right: 2.25rem;
}

html[dir="rtl"] .site-menu__sub-item {
  text-align: right;
}

/* Submenu chevrons: left edge in RTL (mirror of LTR right-[29px]) */
html[dir="rtl"] .site-menu__scrollbar {
  right: auto;
  left: 29px;
}

html[dir="rtl"] .site-menu__scroll-mark svg {
  transform: scaleX(-1);
}

@keyframes site-menu-panel-in-rtl {
  from {
    opacity: 0;
    transform: translateX(12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

html[dir="rtl"] .site-menu.is-open .site-menu__secondary,
html[dir="rtl"] .site-menu.is-open .site-menu__feature {
  animation-name: site-menu-panel-in-rtl;
}

html[dir="rtl"] .site-menu__glow {
  left: auto;
  right: -99px;
}

html[dir="rtl"] .site-menu__glow img {
  transform: rotate(-28.56deg) scaleX(-1);
}

html[dir="rtl"] .site-menu__mobile {
  transform: translateX(100%);
}

html[dir="rtl"] .site-menu.is-open .site-menu__mobile {
  transform: translateX(0);
}

html[dir="rtl"] .site-menu.is-mobile-sub .site-menu__mobile-panel--root {
  transform: translateX(30%);
}

html[dir="rtl"] .site-menu__mobile-panel--sub {
  transform: translateX(-100%);
}

html[dir="rtl"] .site-menu.is-mobile-sub .site-menu__mobile-panel--sub {
  transform: translateX(0);
}

html[dir="rtl"] .site-menu__mobile-item {
  text-align: right;
  /* DOM: label then chevron — in RTL flex, label on the right, chevron on the left */
  flex-direction: row;
  justify-content: space-between;
  width: 100%;
}

html[dir="rtl"] .site-menu__mobile-chevron {
  /* Base rotate-180 already points left (into submenu in RTL). */
  transform: none;
  margin-inline-start: auto;
}

html[dir="rtl"] .site-menu__mobile-back img {
  transform: scaleX(-1);
}

html[dir="rtl"] .site-menu__mobile-card-name {
  left: auto;
  right: 1.25rem;
  text-align: right;
}

html[dir="rtl"] .site-menu__glow--mobile {
  left: auto;
  right: -13px;
}

/* Header logo stays centered; do not mirror absolute centering utilities here. */
html[dir="rtl"] .site-header [class*="left-1/2"] {
  left: 50%;
  right: auto;
}

html[dir="rtl"] .site-header [class*="translate-x-1/2"] {
  --tw-translate-x: calc(50% * -1);
}

/* Footer: logo on the right, description follows in RTL reading order */
html[dir="rtl"] .site-footer__desc {
  text-align: right;
}

@media (min-width: 1024px) {
  html[dir="rtl"] .site-footer__logo {
    left: auto !important;
    right: 79px;
  }

  html[dir="rtl"] .site-footer__desc {
    left: auto !important;
    right: 172px;
    text-align: right;
  }

  html[dir="rtl"] .site-footer__nav {
    left: auto !important;
    right: 5rem; /* mirrors lg:left-20 */
    flex-direction: row;
  }
}

/* Hero copy: English / LTR — always left-pinned and left-aligned. */
html[dir="ltr"] .kian-hero-copy,
html[dir="ltr"] .kian-hero-copy[dir="ltr"] {
  left: 2.75rem !important; /* left-11 */
  right: auto !important;
  align-items: flex-start !important;
  text-align: left !important;
  direction: ltr !important;
}

html[dir="ltr"] .kian-hero-copy img,
html[dir="ltr"] .kian-hero-copy .object-left {
  object-position: left !important;
}

html[dir="ltr"] .kian-hero-copy .text-left {
  text-align: left !important;
}

/* Hero copy blocks: pin to the right + right-align on all FA pages. */
html[dir="rtl"] .kian-hero-copy {
  left: auto !important;
  right: 2.75rem; /* mirrors left-11 */
  /* flex-start = inline-start = right in RTL (flex-end was pinning logo left). */
  align-items: flex-start !important;
  text-align: right;
  direction: rtl;
}

html[dir="rtl"] .kian-hero-copy img,
html[dir="rtl"] .kian-hero-copy .object-left,
html[dir="rtl"] .kian-hero-copy .object-right {
  object-position: right !important;
}

/* In-flow mobile heroes (e.g. category): push block to the right edge. */
html[dir="rtl"] .kian-hero-copy:not(.absolute):not(.lg\:absolute) {
  margin-left: auto;
  margin-right: 0;
}

html[dir="rtl"] .kian-hero-copy--blog,
html[dir="rtl"] .kian-hero-copy--post {
  right: 1rem; /* mirrors left-4 */
}

@media (min-width: 1024px) {
  html[dir="ltr"] .kian-hero-copy {
    left: 154px !important; /* lg:left-[154px] */
    right: auto !important;
  }

  html[dir="ltr"] .kian-hero-copy--147 {
    left: 147px !important;
    right: auto !important;
  }

  html[dir="ltr"] .kian-hero-copy--blog {
    left: 103px !important;
    right: auto !important;
  }

  html[dir="ltr"] .kian-hero-copy--post {
    left: 54px !important; /* lg:left-[54px] */
    right: auto !important;
  }

  html[dir="rtl"] .kian-hero-copy {
    right: 154px; /* mirrors lg:left-[154px] */
  }

  html[dir="rtl"] .kian-hero-copy--147 {
    right: 147px; /* mirrors lg:left-[147px] */
  }

  html[dir="rtl"] .kian-hero-copy--blog {
    right: 103px; /* mirrors lg:left-[103px] */
  }

  html[dir="rtl"] .kian-hero-copy--post {
    right: 54px; /* mirrors lg:left-[54px] */
  }

  /* Category desktop hero uses lg:absolute (relative below lg). */
  html[dir="rtl"] .kian-hero-copy.lg\:absolute {
    left: auto !important;
    right: 147px;
  }
}

/* Override global FA remap of .text-left so EN hero stays left-aligned. */
html[dir="ltr"] .kian-hero-copy .text-left,
html[dir="ltr"] .kian-hero-copy h1 {
  text-align: left !important;
}

/* About dark feature: visual LTR (image right / text left); copy stays RTL. */
html[dir="rtl"] .about-feature[dir="ltr"] {
  direction: ltr;
}

html[dir="rtl"] .about-feature__copy {
  direction: rtl;
  text-align: justify;
}

/* Shop collections: keep flex axis LTR so lg:flex-row-reverse mirrors sides in FA
   (PHP flips which rows get reverse). Hero copy still RTL via .kian-hero-copy. */
html[dir="rtl"] .kian-shop-collections,
html[dir="rtl"] .kian-shop-collections[dir="ltr"] {
  direction: ltr;
}

html[dir="rtl"] .kian-shop-collections .kian-hero-copy {
  direction: rtl;
}

html[dir="rtl"] .kian-shop-collections .text-left {
  text-align: left;
}

html[dir="rtl"] .kian-shop-collections .text-right {
  text-align: right;
}

html[dir="rtl"] .kian-shop-collections [dir="rtl"] {
  direction: rtl;
  text-align: right;
}

html[dir="rtl"] .text-left {
  text-align: right;
}

html[dir="rtl"] .lg\:text-left {
  text-align: right;
}

html[dir="rtl"] .text-justify {
  text-align: justify;
}

/* Cart / checkout forms */
html[dir="rtl"] .woocommerce form .form-row,
html[dir="rtl"] .woocommerce-account {
  text-align: right;
}

/* Cart / checkout amounts & qty use Persian digits → keep Peyda (not Outfit fallback). */
html[dir="rtl"] .kian-cart,
html[dir="rtl"] .kian-checkout,
html[dir="rtl"] .cart-modal,
body.is-rtl .kian-cart,
body.is-rtl .kian-checkout,
body.is-rtl .cart-modal {
  font-family: "Peyda", "Outfit", ui-sans-serif, system-ui, sans-serif;
}

/* Prices + currency unit (ریال) — Peyda so Persian digits/labels render correctly. */
html[dir="rtl"] .price,
html[dir="rtl"] .woocommerce-Price-amount,
html[dir="rtl"] .woocommerce-Price-currencySymbol,
html[dir="rtl"] [data-kian-product-price],
html[dir="rtl"] .kian-cart .woocommerce-Price-amount,
html[dir="rtl"] .kian-checkout .woocommerce-Price-amount,
html[dir="rtl"] .cart-qty__value,
html[dir="rtl"] .payment-qty__value,
html[dir="rtl"] .cart-modal__qty-value,
html[dir="rtl"] .cart-modal__price,
html[dir="rtl"] .kian-checkout-totals dd,
html[dir="rtl"] .kian-checkout-totals [data-checkout-subtotal],
html[dir="rtl"] .kian-checkout-totals [data-checkout-discount],
html[dir="rtl"] .kian-checkout-totals [data-checkout-shipping],
html[dir="rtl"] .kian-checkout-totals [data-checkout-total-mobile],
html[dir="rtl"] .kian-checkout-totals [data-checkout-total-desktop],
html[dir="rtl"] #cart-subtotal,
html[dir="rtl"] #cart-discount,
html[dir="rtl"] #cart-shipping,
html[dir="rtl"] #cart-total-mobile,
html[dir="rtl"] #cart-total-desktop,
body.is-rtl .price,
body.is-rtl .woocommerce-Price-amount,
body.is-rtl .woocommerce-Price-currencySymbol,
body.is-rtl [data-kian-product-price],
body.is-rtl .kian-cart .woocommerce-Price-amount,
body.is-rtl .kian-checkout .woocommerce-Price-amount,
body.is-rtl .cart-qty__value,
body.is-rtl .payment-qty__value,
body.is-rtl .cart-modal__qty-value,
body.is-rtl .cart-modal__price {
  font-family: "Peyda", ui-sans-serif, system-ui, sans-serif;
}

html[dir="rtl"] .woocommerce-Price-currencySymbol,
body.is-rtl .woocommerce-Price-currencySymbol {
  font-family: "Peyda", ui-sans-serif, system-ui, sans-serif;
  font-weight: inherit;
  letter-spacing: 0;
  margin-inline-start: 0.25em;
}

/*
 * Cart / checkout columns: keep flex axis LTR so row-reverse is physical (not double-flipped by dir=rtl).
 * FA: summary/address right, payment left. Text inside columns stays RTL.
 */
html[dir="rtl"] .kian-cart__layout,
html[dir="rtl"] .kian-checkout__layout,
body.is-rtl .kian-cart__layout,
body.is-rtl .kian-checkout__layout {
  direction: ltr;
}

html[dir="rtl"] .kian-cart__summary,
html[dir="rtl"] .kian-cart__aside,
html[dir="rtl"] .kian-checkout__main,
html[dir="rtl"] .kian-checkout__aside,
body.is-rtl .kian-cart__summary,
body.is-rtl .kian-cart__aside,
body.is-rtl .kian-checkout__main,
body.is-rtl .kian-checkout__aside {
  direction: rtl;
}

@media (min-width: 1024px) {
  html[dir="rtl"] .kian-cart__layout,
  html[dir="rtl"] .kian-checkout__layout,
  body.is-rtl .kian-cart__layout,
  body.is-rtl .kian-checkout__layout {
    flex-direction: row-reverse !important;
  }

  html[dir="rtl"] .kian-cart__summary,
  html[dir="rtl"] .kian-checkout__main,
  body.is-rtl .kian-cart__summary,
  body.is-rtl .kian-checkout__main {
    order: 1 !important;
  }

  html[dir="rtl"] .kian-cart__aside,
  html[dir="rtl"] .kian-checkout__aside,
  body.is-rtl .kian-cart__aside,
  body.is-rtl .kian-checkout__aside {
    order: 2 !important;
  }
}

/* Profile sidebar active bar sits on the reading-start edge (right in RTL) */
html[dir="rtl"] .profile-sidebar__indicator {
  left: auto;
  right: 0;
}

/* Address toolbar CTA: physical right in LTR → left in RTL */
html[dir="rtl"] .address-toolbar__add-btn {
  right: auto;
  left: 2rem;
}

html[dir="rtl"] .address-modal__close,
html[dir="rtl"] .address-delete-modal__close {
  right: auto;
  left: 15px;
}

/* Action buttons inherit page RTL so edit/delete flip vs EN (no dir="ltr"). */

/*
 * Product cards meta: lock flex axis to LTR so order is predictable whether the
 * page is RTL or a parent forces direction:ltr (shop collections).
 * FA → row-reverse: text on the right, arrow on the left.
 */
.product-card__meta {
  direction: ltr;
}

html[dir="rtl"] .product-card__meta,
body.is-rtl .product-card__meta,
body.rtl .product-card__meta {
  flex-direction: row-reverse;
}

html[dir="rtl"] .product-card__meta-text,
body.is-rtl .product-card__meta-text,
body.rtl .product-card__meta-text {
  direction: rtl;
  text-align: right;
}

html[dir="rtl"] .product-card__arrow,
html[dir="rtl"] .product-card__meta img[src*="card-arrow.svg"],
body.is-rtl .product-card__arrow,
body.is-rtl .product-card__meta img[src*="card-arrow.svg"],
body.rtl .product-card__arrow,
body.rtl .product-card__meta img[src*="card-arrow.svg"] {
  transform: scaleX(-1);
}

/* Sidebar: copy right-aligned; chevron on the left of each link. */
html[dir="rtl"] .product-sidebar__panel {
  text-align: right;
}

html[dir="rtl"] .product-sidebar__links {
  flex-direction: row-reverse;
  justify-content: flex-start;
}

html[dir="rtl"] .product-sidebar__link {
  flex-direction: row-reverse;
}

html[dir="rtl"] .product-sidebar__link img {
  transform: scaleX(-1);
}

/*
 * Swiper nav chevrons: keep the same physical directions as LTR.
 * Do NOT set transform/rotate here — Tailwind `rotate-180` uses the
 * individual `rotate` property; an extra transform:rotate(180deg) would
 * double-flip and make both arrows point the same way.
 */
html[dir="rtl"] .collections-swiper-prev img,
html[dir="rtl"] .collections-swiper-next img,
html[dir="rtl"] .testimonial-swiper-prev img,
html[dir="rtl"] .testimonial-swiper-next img,
html[dir="rtl"] .testimonial-modal__nav--prev img,
html[dir="rtl"] .testimonial-modal__nav--next img,
html[dir="rtl"] .product-gallery-prev img,
html[dir="rtl"] .product-gallery-next img {
  transform: none;
}

html[dir="rtl"] .testimonial-modal__close {
  right: auto;
  left: 0.75rem;
}

@media (min-width: 1024px) {
  html[dir="rtl"] .testimonial-modal__close {
    left: 1rem;
  }
}

/* Checkout payment qty (mobile) */
html[dir="rtl"] .payment-qty .payment-qty__value,
html[dir="rtl"] .payment-qty .payment-qty__plus,
body.is-rtl .payment-qty .payment-qty__value,
body.is-rtl .payment-qty .payment-qty__plus,
body.rtl .payment-qty .payment-qty__value,
body.rtl .payment-qty .payment-qty__plus {
  margin-left: 0;
  margin-right: -1px;
}

/* Cart page qty control (border join mirrors LTR border-l-0) */
html[dir="rtl"] .cart-qty .cart-qty__value,
html[dir="rtl"] .cart-qty [data-cart-qty-inc],
body.is-rtl .cart-qty .cart-qty__value,
body.is-rtl .cart-qty [data-cart-qty-inc],
body.rtl .cart-qty .cart-qty__value,
body.rtl .cart-qty [data-cart-qty-inc] {
  border-left-width: 1px;
  border-right-width: 0;
}

/* Mini cart: under the cart icon on the left in FA */
html[dir="rtl"] .cart-modal__panel,
body.is-rtl .cart-modal__panel,
body.rtl .cart-modal__panel,
.cart-modal--rtl .cart-modal__panel {
  right: auto;
  left: 0;
  transform: translateX(-100%);
}

html[dir="rtl"] .cart-modal.is-open .cart-modal__panel,
body.is-rtl .cart-modal.is-open .cart-modal__panel,
body.rtl .cart-modal.is-open .cart-modal__panel,
.cart-modal--rtl.is-open .cart-modal__panel {
  transform: translateX(0);
}

html[dir="rtl"] .cart-modal__close,
body.is-rtl .cart-modal__close,
body.rtl .cart-modal__close,
.cart-modal--rtl .cart-modal__close {
  right: auto;
  left: 17px;
}

html[dir="rtl"] .cart-modal__header,
html[dir="rtl"] .cart-modal__list,
html[dir="rtl"] .cart-modal__footer,
html[dir="rtl"] .cart-modal__item,
html[dir="rtl"] .cart-modal__info,
body.is-rtl .cart-modal__header,
body.is-rtl .cart-modal__list,
body.is-rtl .cart-modal__footer,
body.is-rtl .cart-modal__item,
body.is-rtl .cart-modal__info,
.cart-modal--rtl .cart-modal__header,
.cart-modal--rtl .cart-modal__list,
.cart-modal--rtl .cart-modal__footer,
.cart-modal--rtl .cart-modal__item,
.cart-modal--rtl .cart-modal__info {
  text-align: right;
}

html[dir="rtl"] .cart-modal__qty-btn + .cart-modal__qty-value,
html[dir="rtl"] .cart-modal__qty-value + .cart-modal__qty-btn,
body.is-rtl .cart-modal__qty-btn + .cart-modal__qty-value,
body.is-rtl .cart-modal__qty-value + .cart-modal__qty-btn,
.cart-modal--rtl .cart-modal__qty-btn + .cart-modal__qty-value,
.cart-modal--rtl .cart-modal__qty-value + .cart-modal__qty-btn {
  margin-left: 0;
  margin-right: -1px;
}

html[dir="rtl"] .js-cart-trigger__badge,
body.is-rtl .js-cart-trigger__badge,
body.rtl .js-cart-trigger__badge {
  right: auto;
  left: 0;
}

@media (min-width: 1024px) {
  html[dir="rtl"] .cart-modal__panel,
  body.is-rtl .cart-modal__panel,
  body.rtl .cart-modal__panel,
  .cart-modal--rtl .cart-modal__panel {
    inset: auto;
    right: auto;
    left: 118px;
    top: 54px;
    height: 489px;
    width: 453px;
    transform: scale(0.95);
    opacity: 0;
  }

  html[dir="rtl"] .cart-modal.is-open .cart-modal__panel,
  body.is-rtl .cart-modal.is-open .cart-modal__panel,
  body.rtl .cart-modal.is-open .cart-modal__panel,
  .cart-modal--rtl.is-open .cart-modal__panel {
    transform: scale(1);
    opacity: 1;
  }
}

/* Search modal RTL */
html[dir="rtl"] .search-modal__close,
body.is-rtl .search-modal__close,
body.rtl .search-modal__close,
.search-modal--rtl .search-modal__close {
  right: auto;
  left: 1rem;
}

html[dir="rtl"] .search-modal__header,
html[dir="rtl"] .search-modal__form,
html[dir="rtl"] .search-modal__input,
html[dir="rtl"] .search-modal__title,
body.is-rtl .search-modal__header,
body.is-rtl .search-modal__form,
body.is-rtl .search-modal__input,
body.is-rtl .search-modal__title,
.search-modal--rtl .search-modal__header,
.search-modal--rtl .search-modal__form,
.search-modal--rtl .search-modal__input,
.search-modal--rtl .search-modal__title {
  text-align: right;
}

html[dir="rtl"] .search-modal__input,
body.is-rtl .search-modal__input,
body.rtl .search-modal__input,
.search-modal--rtl .search-modal__input {
  direction: rtl;
}

@media (min-width: 1024px) {
  html[dir="rtl"] .search-modal__close,
  body.is-rtl .search-modal__close,
  body.rtl .search-modal__close,
  .search-modal--rtl .search-modal__close {
    left: 1.25rem;
  }
}

/* Orders: expand toggle on the left in FA/RTL (mirrors LTR right-4 / lg:right-[42px]). */
html[dir="rtl"] .order-card__toggle,
body.is-rtl .order-card__toggle,
body.rtl .order-card__toggle {
  right: auto;
  left: 1rem; /* Tailwind right-4 */
}

@media (min-width: 1024px) {
  html[dir="rtl"] .order-card__toggle,
  body.is-rtl .order-card__toggle,
  body.rtl .order-card__toggle {
    left: 42px; /* mirrors lg:right-[42px] */
  }
}
