/* ==========================================================================
   RTL Overrides — Arabic-specific adjustments
   Logical properties handle most LTR↔RTL flipping automatically.
   This file addresses edge cases that logical properties cannot solve.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Arabic typography adjustments
   -------------------------------------------------------------------------- */
:root[dir="rtl"] {
  --tracking-negative: 0;
  --tracking-tighter: 0;
  --tracking-base: 0;
  --tracking-wide: 0;
  --tracking-wider: 0;
  --leading-base: 1.8;
  --leading-half: 1.7;
  --leading-loose: 1.95;
  --leading-wide: 2.2;
}

:lang(ar) {
  --font-family-base: 'Noto Sans Arabic', 'Inter', sans-serif;
  --font-family-red-hat: 'Red Hat Display', 'Noto Sans Arabic', sans-serif;
  word-break: normal;
  overflow-wrap: break-word;
  hyphens: none;
}

/* --------------------------------------------------------------------------
   Directional icon flipping
   -------------------------------------------------------------------------- */
[dir="rtl"] .c-button__icon img,
[dir="rtl"] .c-button__icon svg,
[dir="rtl"] .icon-arrow-right {
  transform: scaleX(-1);
}

/* --------------------------------------------------------------------------
   Balloon pointer adjustment
   -------------------------------------------------------------------------- */
[dir="rtl"] .page-balloon::before {
  transform: translateX(50%);
}

/* --------------------------------------------------------------------------
   Separator SVG flip
   -------------------------------------------------------------------------- */
[dir="rtl"] .c-separator-r svg {
  transform: scaleX(-1);
}

/* --------------------------------------------------------------------------
   Company table dashed border (gradient direction)
   -------------------------------------------------------------------------- */
[dir="rtl"] .company-table__row {
  background-image: linear-gradient(
    to left,
    var(--color-border) 0 0.4rem,
    transparent 0.4rem 0.6rem
  );
}

/* --------------------------------------------------------------------------
   LTR isolation for inherently directional content
   -------------------------------------------------------------------------- */
[dir="rtl"] .u-ltr,
[dir="rtl"] [type="email"],
[dir="rtl"] [type="url"],
[dir="rtl"] [type="tel"],
[dir="rtl"] [type="number"],
[dir="rtl"] .phone-number,
[dir="rtl"] .price,
[dir="rtl"] time,
[dir="rtl"] .company-table__value,
[dir="rtl"] .l-footer__info a[href^="tel:"] {
  direction: ltr;
  unicode-bidi: isolate;
}

/* Text alignment for LTR input fields in RTL context */
[dir="rtl"] [type="email"],
[dir="rtl"] [type="url"],
[dir="rtl"] [type="tel"],
[dir="rtl"] [type="number"] {
  text-align: end;
}

/* --------------------------------------------------------------------------
   Form control pseudo-element repositioning
   -------------------------------------------------------------------------- */
[dir="rtl"] .form-radio-input:checked::before {
  left: auto;
  right: 50%;
  transform: translate(50%, -50%);
}

[dir="rtl"] .form-check-input:checked::before {
  left: auto;
  right: 50%;
  transform: translate(50%, -50%) rotate(45deg);
}

/* --------------------------------------------------------------------------
   Font weight reinforcement for Arabic scripts
   -------------------------------------------------------------------------- */
[dir="rtl"] .page-balloon,
[dir="rtl"] .strength-item__keyword {
  font-weight: var(--font-weight-bold);
}
