/* ================================================================
   MBM: Arabic / RTL
   Loaded on every storefront page; every rule is scoped to
   [dir="rtl"] so the English layout is untouched.

   Box flow (padding, borders, text-align) already uses logical
   properties in style.css and mirrors on its own. What remains here
   is absolute positioning, transforms, and Arabic typography: the
   things CSS cannot mirror for us.
   ================================================================ */

/* ---- Arabic typography ---------------------------------------
   Bodoni Moda and Manrope carry no Arabic glyphs, so Arabic text
   falls back to whatever the OS supplies unless a face is named.

   Noto Naskh Arabic is the face the footer's Arabic line already
   used, and it is the right one: a traditional Naskh with real
   stroke contrast, which sits beside Bodoni the way a geometric
   sans never could. It was only ever a local-install reference, so
   it is loaded properly here and used for the whole Arabic site.

   Arabic has no serif/sans split, so one family covers both roles;
   weight does the work that changing family does in Latin. */
@import url('https://fonts.googleapis.com/css2?family=Noto+Naskh+Arabic:wght@400;500;600;700&display=swap');

[dir="rtl"] {
  --serif: 'Noto Naskh Arabic', 'Traditional Arabic', 'Arabic Typesetting', Georgia, serif;
  --sans:  'Noto Naskh Arabic', 'Traditional Arabic', 'Arabic Typesetting', system-ui, sans-serif;
  --font-serif: var(--serif);
  --font-sans:  var(--sans);
}

/* Naskh carries its emphasis in weight, not in a second family, so
   display type is set heavier rather than switched. */
[dir="rtl"] .section-title,
[dir="rtl"] .pdp__title,
[dir="rtl"] .pdp__related-title,
[dir="rtl"] .form-page__title,
[dir="rtl"] .cart-header h2 {
  font-weight: 600;
}

/* Arabic letterforms carry their weight in the body of the line
   rather than in capitals, so the wide tracking used for Latin
   small-caps headings reads as broken text. */
[dir="rtl"] .section-eyebrow,
[dir="rtl"] .nav-link,
[dir="rtl"] .btn,
[dir="rtl"] .product-card-btn,
[dir="rtl"] .mobile-link,
[dir="rtl"] .cart-item-title,
[dir="rtl"] .dot-num,
[dir="rtl"] .toast,
[dir="rtl"] .mbm-footer__nav-col a,
[dir="rtl"] .mbm-footer__tagline,
[dir="rtl"] .mbm-footer__bottom,
[dir="rtl"] .mbm-footer__contact a,
[dir="rtl"] .form-label,
[dir="rtl"] label,
[dir="rtl"] .pdp__eyebrow,
[dir="rtl"] .pdp__related-eyebrow,
[dir="rtl"] .summary-row,
[dir="rtl"] .checkout-delivery-note,
[dir="rtl"] .order-field-label {
  letter-spacing: 0;
}

/* ---- Arabic type scale -----------------------------------------
   The Latin sizes below 0.75rem work because uppercase Latin fills
   the whole cap-height. Arabic has no capitals, so `text-transform:
   uppercase` does nothing for it and the same size renders at
   lowercase scale, which is what made the nav and footer look tiny.
   Naskh also packs fine detail into each glyph. Everything set small
   for Latin small-caps is therefore stepped up for Arabic. */
[dir="rtl"] .nav-link              { font-size: 0.95rem; font-weight: 500; }
[dir="rtl"] .section-eyebrow       { font-size: 0.95rem; }
[dir="rtl"] .pdp__eyebrow,
[dir="rtl"] .pdp__related-eyebrow  { font-size: 0.92rem; }
[dir="rtl"] .btn                   { font-size: 0.9rem; }
[dir="rtl"] .product-card-btn      { font-size: 0.95rem; }
[dir="rtl"] .checkout-btn          { font-size: 0.95rem; }
[dir="rtl"] .out-of-stock-badge    { font-size: 0.85rem; }
[dir="rtl"] .cart-item-title       { font-size: 1.05rem; }
[dir="rtl"] .cart-item-price,
[dir="rtl"] .summary-row           { font-size: 0.95rem; }
[dir="rtl"] .checkout-delivery-note { font-size: 0.85rem; }
[dir="rtl"] .form-group label,
[dir="rtl"] .form-label            { font-size: 0.9rem; }
[dir="rtl"] .form-control          { font-size: 1rem; }
[dir="rtl"] .toast                 { font-size: 0.9rem; }
[dir="rtl"] .action-btn            { font-size: 0.9rem; }

/* Footer: the smallest type on the site, and the most affected. */
[dir="rtl"] .mbm-footer__nav-col a { font-size: 0.95rem; }
[dir="rtl"] .mbm-footer__tagline   { font-size: 0.92rem; }
[dir="rtl"] .mbm-footer__bottom    { font-size: 0.85rem; }
[dir="rtl"] .mbm-footer__contact a { font-size: 0.95rem; }

/* The mobile menu is already display-sized; Arabic needs a touch less
   so the longer words still fit one line. */
[dir="rtl"] .mobile-link {
  font-size: clamp(1.9rem, 7.5vw, 2.8rem);
}

/* Naskh has long descenders and generous ascenders, so lines need
   more room than Latin, more again than a geometric Arabic sans. */
[dir="rtl"] body,
[dir="rtl"] .product-title,
[dir="rtl"] .section-subtitle,
[dir="rtl"] .pdp__description,
[dir="rtl"] .pdp__pullquote {
  line-height: 1.9;
}

/* ---- Cart drawer: slides in from the left in RTL --------------- */
[dir="rtl"] .cart-drawer {
  right: auto;
  left: -500px;
  transition: left 0.5s var(--ease);
}
[dir="rtl"] .cart-drawer.active {
  right: auto;
  left: 0;
}

/* ---- Floating cart and other edge-anchored controls ------------ */
[dir="rtl"] .floating-cart {
  right: auto;
  left: 1.5rem;
}

[dir="rtl"] .cart-count {
  right: auto;
  left: -0.15rem;
}

/* ---- Hero furniture -------------------------------------------- */
[dir="rtl"] .hero-dots {
  left: auto;
  right: 2.5rem;
}

[dir="rtl"] .hero-scroll-indicator {
  right: auto;
  left: 2.5rem;
}

/* Centring transforms are direction-neutral and must not be flipped,
   so they are restated rather than inherited from a blanket rule. */
[dir="rtl"] .hero-dot.active .dot-line {
  transform-origin: right center;
}

/* ---- Form controls --------------------------------------------- */
/* Phone entry stays left-to-right: a dialling code reads the same in
   every language and mirroring it makes the number ambiguous. */
[dir="rtl"] input[type="tel"],
[dir="rtl"] input[type="email"],
[dir="rtl"] input[type="url"],
[dir="rtl"] #custPhone,
[dir="rtl"] #custPhoneArea,
[dir="rtl"] #contactPhoneNumber {
  direction: ltr;
  text-align: right;
}

/* The country value is submitted in English, so the field stays LTR and reads
   from the start of the name. Right-aligned it scrolled to the end and showed
   "ted Arab Emirates". */
[dir="rtl"] #custCountry {
  direction: ltr;
  text-align: left;
}

/* A phone number reads left-to-right in any language, so only the text
   direction flips back; the wrapper keeps the row's own layout. */
[dir="rtl"] .iti__tel-input {
  direction: ltr;
  text-align: right;
}

[dir="rtl"] select {
  background-position: left 0.85rem center;
  padding-inline-end: 1rem;
  padding-inline-start: 2.2rem;
}

/* ---- Quantity stepper: the minus stays on the left visually ----- */
[dir="rtl"] .cart-item-qty-actions,
[dir="rtl"] .pdp__qty {
  flex-direction: row-reverse;
}

/* ---- Prices ---------------------------------------------------- */
/* A price is a number followed by a currency mark; keeping the pair
   isolated stops the bidi algorithm reordering them mid-sentence. */
[dir="rtl"] .product-price,
[dir="rtl"] .cart-item-price,
[dir="rtl"] .summary-row span:last-child,
[dir="rtl"] .pdp__price {
  unicode-bidi: isolate;
}

/* ---- Footer ---------------------------------------------------- */
[dir="rtl"] .mbm-footer__arabic {
  font-size: 1.15rem;
}

/* The footer's Arabic line is already RTL in the English layout, so
   in Arabic it needs no special direction handling. */
[dir="rtl"] .mbm-footer__legal-sep {
  transform: scaleX(-1);
}

/* ---- Language toggle -------------------------------------------
   The colour comes from the header rules in style.css so the toggle
   tracks the nav through its transparent, scrolled and light states.

   The label is always the *other* language, so in English it reads
   العربية, Arabic glyphs sitting in a Latin interface. The font
   stack therefore carries both: Manrope resolves the Latin, Noto
   Naskh Arabic the Arabic, whichever way round the site is. */
.lang-toggle {
  background: none;
  border: 1px solid currentColor;
  border-radius: 999px;
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Manrope', 'Noto Naskh Arabic', system-ui, sans-serif;
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1;
  /* A comfortable target: the toggle is the first thing an Arabic
     speaker reaches for, often on a phone. */
  min-height: 40px;
  opacity: 0.92;
  padding: 0.5rem 0.95rem;
  transition: opacity 0.3s var(--ease), border-color 0.3s var(--ease);
  white-space: nowrap;
}

.lang-toggle:hover,
.lang-toggle:focus-visible {
  opacity: 1;
}

/* A visible focus ring matters more here than elsewhere: this is the
   control a keyboard user needs before they can read anything. */
.lang-toggle:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

/* In Arabic the label reads "English", so Latin tracking applies. */
[dir="rtl"] .lang-toggle {
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* The full word is the default; the short code only appears once the
   header runs out of room. */
.lang-toggle__short { display: none; }

@media (max-width: 800px) {
  /* Below this the full word collides with the centred logo, so the
     toggle shrinks to a single code and keeps its tap target. */
  .lang-toggle__full { display: none; }
  .lang-toggle__short {
    display: inline;
    font-size: 1.05rem;
  }

  .lang-toggle {
    border: none;
    min-width: 40px;
    padding: 0.4rem 0.35rem;
  }

  /* "EN" is Latin and reads better slightly smaller than the ع glyph. */
  [dir="rtl"] .lang-toggle__short {
    font-size: 0.85rem;
  }
}

@media (max-width: 360px) {
  /* On the narrowest phones the centred logo and the two controls
     either side run out of room, so the gaps and mark tighten rather
     than letting anything overlap. */
  .nav-container .nav-right { gap: 0.6rem; }
  .logo-img { height: 2rem; }
  .lang-toggle {
    min-width: 32px;
    padding: 0.4rem 0.15rem;
  }
}
