/*
 * JC Custom — right-to-left (Arabic) mirror styles.
 * Loaded ONLY on right-to-left pages, after every other theme style.
 * Every rule starts with html[dir="rtl"], so it can never touch the English site.
 * Each block names the theme file whose rule it mirrors.
 */

/* ---------- Arabic fonts (stored in the theme, Arabic letters only, no Google request) ---------- */
@font-face {
  font-family: "Amiri";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/arabic/amiri-arabic-400.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+25CC;
}
@font-face {
  font-family: "Amiri";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/arabic/amiri-arabic-700.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+25CC;
}

@font-face {
  font-family: "Noto Naskh Arabic";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../fonts/arabic/noto-naskh-arabic-var.woff2") format("woff2");
  size-adjust: 112%; /* Naskh letters are small for their size: +12% matches the old text size on phones (16 Nov) */
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+25CC;
}

/* ---------- Test bar (administrators only) ---------- */
.jc-ar-testbar { position: relative; z-index: auto; padding: 6px 16px; background: #1F3A30; color: #FAF7F2; font: 13px/1.4 system-ui, sans-serif; text-align: center; }
.jc-ar-testbar a { color: #E2C98F; text-decoration: underline; margin-left: 8px; }

/* ---------- Logo stays as it is (Latin letters, never mirrored) ---------- */
html[dir="rtl"] .jc-mark { direction: ltr; unicode-bidi: isolate; }

/* ---------- base.css ---------- */
html[dir="rtl"] .screen-reader-text:focus { left: auto; right: 8px; }
html[dir="rtl"] .jc-heart { right: auto; left: 10px; }
@media (max-width: 600px) {
  html[dir="rtl"] .jc-heart:not(.jc-heart--big) { right: auto; left: 6px; }
}
html[dir="rtl"] .jc-textpage__body ul,
html[dir="rtl"] .jc-textpage__body ol { padding-left: 0; padding-right: 1.2em; }

/* ---------- cards.css (carousels) ---------- */
html[dir="rtl"] .jc-carousel__bar span { left: auto; right: 0; }
@media (max-width: 760px) {
  html[dir="rtl"] .jc-carousel__track { margin-right: 0; padding-right: 0; margin-left: calc(var(--jc-gutter) * -1); padding-left: var(--jc-gutter); scroll-padding-left: 0; scroll-padding-right: 0; }
}

/* ---------- header.css ---------- */
html[dir="rtl"] .jc-cart-count { right: auto; left: 3px; }
/* phone menu slides in from the right */
html[dir="rtl"] .jc-drawer__panel { left: auto; right: 0; box-shadow: -20px 0 60px rgba(17,17,17,.2); transform: translateX(100%); }
html[dir="rtl"] .jc-drawer__head .jc-mark { align-items: flex-end; }
html[dir="rtl"] .jc-drawer__count { margin-left: 0; margin-right: 6px; }
html[dir="rtl"] .jc-drawer__quick .jc-drawer__count { margin-right: 0; }
/* search panel is centred: translateX(-50%) with left:50% stays correct, nothing to change */

/* ---------- home.css ---------- */
/* category tiles: the → arrow points left (←) and nudges left on hover */
html[dir="rtl"] .jc-cat__label span { display: inline-block; transform: scaleX(-1); }
html[dir="rtl"] .jc-cat:hover .jc-cat__label span,
html[dir="rtl"] .jc-cat:focus-visible .jc-cat__label span,
html[dir="rtl"] .jc-cat:active .jc-cat__label span { transform: translateX(-4px) scaleX(-1); }

/* ---------- cards.css: carousel arrow buttons (← →) point the mirrored way ---------- */
html[dir="rtl"] .jc-carousel__arrows .jc-icon-btn { transform: scaleX(-1); }

/* ---------- minicart.css: side cart slides in from the left ---------- */
html[dir="rtl"] .jc-minicart__panel { right: auto; left: 16px; transform: translateX(calc(-100% - 24px)); }
@media (max-width: 600px) {
  /* phones: bottom sheet, same as English */
  html[dir="rtl"] .jc-minicart__panel { left: 8px; right: 8px; transform: translateY(calc(100% + 24px)); }
}

/* ---------- shop.css ---------- */
html[dir="rtl"] .jc-sortmenu { right: auto; left: 0; }
@media (max-width: 760px) {
  html[dir="rtl"] .jc-sortmenu { left: 0; right: 0; }
  html[dir="rtl"] .jc-toolbar__chips .jc-toolbar__clear { margin-left: 0; margin-right: 4px; }
}
/* filters panel slides in from the right */
html[dir="rtl"] .jc-filters__panel { left: auto; right: 16px; transform: translateX(calc(100% + 24px)); }
@media (max-width: 760px) {
  /* phones: bottom sheet, same as English */
  html[dir="rtl"] .jc-filters__panel { left: 0; right: 0; transform: translateY(100%); }
}
html[dir="rtl"] .jc-filters__group legend { float: right; }
html[dir="rtl"] .jc-check span::before { margin-right: 0; margin-left: 10px; }
/* price slider: the slider itself keeps working left-to-right (low → high), like the numbers */
html[dir="rtl"] .jc-range,
html[dir="rtl"] .jc-range__values { direction: ltr; } /* the price labels under it must match: lowest on the left */

/* ---------- product.css ---------- */
html[dir="rtl"] .jc-notices .woocommerce-message a.button { float: left; }
html[dir="rtl"] .jc-gallery__zoom { right: auto; left: 12px; }
html[dir="rtl"] .jc-product__price del { margin-right: 0; margin-left: 6px; }
html[dir="rtl"] .jc-opt__label { float: right; padding: 0 0 0 96px; }
html[dir="rtl"] .jc-opt__guide { right: auto; left: 0; }
html[dir="rtl"] .jc-buy__msg a { margin-left: 0; margin-right: 6px; }
html[dir="rtl"] .jc-lightbox__close { right: auto; left: 14px; }
html[dir="rtl"] .jc-lightbox__nav--prev { left: auto; right: 18px; }
html[dir="rtl"] .jc-lightbox__nav--next { right: auto; left: 18px; }
html[dir="rtl"] .jc-lightbox__nav { transform: scaleX(-1); } /* ← → arrows point the mirrored way */
/* photo counters ("1 / 2") keep their number order */
html[dir="rtl"] .jc-gallery__count,
html[dir="rtl"] .jc-lightbox__count { direction: ltr; unicode-bidi: isolate; }
@media (max-width: 900px) {
  html[dir="rtl"] .jc-gallery__count:not([hidden]) { right: auto; left: 14px; }
  html[dir="rtl"] .jc-recent__list { margin-right: 0; padding-right: 0; margin-left: calc(var(--jc-gutter) * -1); padding-left: var(--jc-gutter); }
}
html[dir="rtl"] .jc-guide__table th,
html[dir="rtl"] .jc-guide__table td { text-align: right; }
/* size tables hold only numbers: keep ranges like "13.5 – 14.5" in their normal order */
html[dir="rtl"] .jc-guide__table td { direction: ltr; unicode-bidi: isolate; }

/* ---------- sizer.css ("Find my size") ---------- */
html[dir="rtl"] .jc-finder__summary .jc-ico { margin-left: 0; margin-right: auto; }
html[dir="rtl"] .jc-opt__guides { right: auto; left: 0; }
html[dir="rtl"] .jc-opt--guides .jc-opt__label { padding-right: 0; padding-left: 220px; }
@media (max-width: 480px) {
  html[dir="rtl"] .jc-opt--guides .jc-opt__label { padding-left: 0; }
}
/* the on-screen measuring card is a real-size drawing: never mirrored */
html[dir="rtl"] .jc-finder__stage { direction: ltr; }

/* ---------- pages.css (About, Contact, Size guide) ---------- */
html[dir="rtl"] .jc-sizepage .jc-guide__table th,
html[dir="rtl"] .jc-sizepage .jc-guide__table td { text-align: right; }
html[dir="rtl"] .jc-contact__arrow,
html[dir="rtl"] .jc-contact__go::after,
html[dir="rtl"] .jc-mega__cats li a span,
html[dir="rtl"] .jc-arrow { display: inline-block; transform: scaleX(-1); } /* .jc-arrow: typed arrows wrapped by design-chat item 2 */

/* ---------- hidden spam-trap boxes (footer.css .jc-hp, pages.css .jc-trap) ---------- */
/* parked off-screen on the right: in right-to-left pages, anything parked on the left makes the page scroll sideways */
html[dir="rtl"] .jc-hp,
html[dir="rtl"] .jc-trap { left: auto; right: -9999px; }

/* ---------- footer.css ---------- */
html[dir="rtl"] .jc-wa-float { right: auto; left: max(16px, env(safe-area-inset-left)); }
html[dir="rtl"] .jc-soon__form { text-align: right; }

/* ---------- cart.css (cart, checkout, my account) ---------- */
html[dir="rtl"] .woocommerce-message .button,
html[dir="rtl"] .woocommerce-info .button { float: left; margin-left: 0; margin-right: 12px; }
html[dir="rtl"] .form-row select { padding-right: 16px; padding-left: 40px; background-position: left 16px center; }
html[dir="rtl"] #payment .payment_methods > li > input[type="radio"] { left: auto; right: 18px; }
html[dir="rtl"] #payment .payment_methods > li > label img { margin-left: 0; margin-right: auto; }
html[dir="rtl"] .jc-review .product-total { text-align: left; }
html[dir="rtl"] .jc-review tfoot th { text-align: right; }
html[dir="rtl"] .jc-review tfoot td { text-align: left; }
html[dir="rtl"] .jc-review #shipping_method input[type="radio"] { margin-right: 0; margin-left: 6px; }
html[dir="rtl"] .woocommerce-table th, html[dir="rtl"] .woocommerce-table td,
html[dir="rtl"] .shop_table:not(.jc-review) th, html[dir="rtl"] .shop_table:not(.jc-review) td { text-align: right; }
html[dir="rtl"] .woocommerce-MyAccount-navigation .is-active a::before { margin-right: 0; margin-left: 10px; }
html[dir="rtl"] .password-input input { padding-right: 16px; padding-left: 52px; }
html[dir="rtl"] .show-password-input { right: auto; left: 4px; }

/* ---------- Arabic words (brick b): fonts, no letter-spacing, no capitals ---------- */
/* English letters keep the English fonts; Arabic letters fall through to Amiri (headings, names, prices) and Noto Naskh Arabic (text). */
html[lang^="ar"] {
  --jc-serif: "Cormorant Garamond", "Amiri", Georgia, "Times New Roman", serif;
  --jc-sans: "Jost", "Noto Naskh Arabic", Tahoma, Arial, sans-serif;
}
/* Letter-spacing breaks joined Arabic letters, and Arabic has no capitals.
   The logo (English letters) keeps its spacing. */
html[lang^="ar"] body *:not(.jc-mark):not(.jc-mark *):not(.jc-logo__text):not(.jc-logo__text *) {
  letter-spacing: normal !important;
  text-transform: none !important;
}

/* ---------- Things that always stay left-to-right inside Arabic pages ---------- */
/* phone numbers, e-mail addresses, SKUs and card fields read left-to-right in Arabic too */
html[dir="rtl"] input[type="tel"],
html[dir="rtl"] input[type="email"],
html[dir="rtl"] input[type="url"],
html[dir="rtl"] input[type="number"] { direction: ltr; text-align: right; }

/* English name under the Arabic product title (brick e) */
.jc-product__title-en { margin: -6px 0 16px; font-family: var(--jc-serif); font-size: 15px; line-height: 1.5; color: var(--jc-muted, #7a746c); text-align: right; letter-spacing: 0; }
