/* ==========================================================================
   HairMaskOEM.com — RTL overlay stylesheet (Arabic)
   Loaded AFTER assets/css/style.css on /ar/ pages only.
   Goal: reuse the existing design system, mirror the layout for right-to-left
   reading, swap to an Arabic-capable type stack and neutralise Latin-only
   spacing rules (letter-spacing breaks Arabic letter joining).
   ========================================================================== */

html[dir="rtl"] {
  --font-head: "Segoe UI", Tahoma, "Noto Naskh Arabic", "Noto Sans Arabic", "Arabic Typesetting", "Times New Roman", serif;
  --font-body: "Segoe UI", Tahoma, "Noto Sans Arabic", "Noto Naskh Arabic", Arial, sans-serif;
}

/* --- Base direction & typography ---------------------------------------- */
html[dir="rtl"] body {
  direction: rtl;
  text-align: right;
  line-height: 1.95;
  font-family: var(--font-body);
}

html[dir="rtl"] h1,
html[dir="rtl"] h2,
html[dir="rtl"] h3,
html[dir="rtl"] h4,
html[dir="rtl"] h5,
html[dir="rtl"] .hero h1,
html[dir="rtl"] .hero-banner h1 {
  font-family: var(--font-head);
  line-height: 1.35;
}

html[dir="rtl"] h1 { line-height: 1.3; }

/* Arabic is a cursive script: tracking between letters breaks the joins. */
html[dir="rtl"] * { letter-spacing: normal !important; }

/* Latin brand strings should stay LTR inside the Arabic flow. */
html[dir="rtl"] .brand-latin,
html[dir="rtl"] .pill-en { direction: ltr; unicode-bidi: embed; display: inline-block; }

/* --- Mirror asymmetric spacing ------------------------------------------ */
html[dir="rtl"] .content ul,
html[dir="rtl"] .content ol { margin: 0 24px 22px 0; }

html[dir="rtl"] .toc ol { margin: 0 20px 10px 0; }

html[dir="rtl"] .checklist li { padding-left: 0; padding-right: 32px; }
html[dir="rtl"] .checklist li::before { left: auto; right: 0; }

html[dir="rtl"] .steps > li { padding-left: 0; padding-right: 50px; }
html[dir="rtl"] .steps > li::before { left: auto; right: 0; }

html[dir="rtl"] .steps-list li { padding: 14px 52px 14px 18px; }
html[dir="rtl"] .steps-list li::before { left: auto; right: 18px; }

/* --- Mirror accent borders ---------------------------------------------- */
html[dir="rtl"] .answer-box { border-left: none; border-right: 6px solid var(--primary); }
html[dir="rtl"] .tip-box { border-left: none; border-right: 6px solid #10b981; }
html[dir="rtl"] .warn-box { border-left: none; border-right: 6px solid #dc2626; }
html[dir="rtl"] .trust-note { border-left: 0; border-right: 3px solid #ad895d; }

/* --- Tables ------------------------------------------------------------- */
html[dir="rtl"] .content th,
html[dir="rtl"] .content td {
  text-align: right;
  border-right: none;
  border-left: 1px solid var(--border);
}
html[dir="rtl"] .content th:last-child,
html[dir="rtl"] .content td:last-child { border-left: none; }

/* --- Decorative gradients & radial glows (mirror the light source) ------- */
html[dir="rtl"] .hero::after { right: auto; left: -140px; }
html[dir="rtl"] .hero-banner .hero-overlay { transform: scaleX(-1); }
html[dir="rtl"] .page-hero::after { right: auto; left: -120px; }
html[dir="rtl"] .card::after { background: radial-gradient(600px 120px at 90% -10%, rgba(13, 148, 136, 0.07), transparent 60%); }
html[dir="rtl"] .cta-panel::before { left: auto; right: -80px; }
html[dir="rtl"] .cta-panel::after { right: auto; left: -60px; }

/* --- Forms -------------------------------------------------------------- */
html[dir="rtl"] input,
html[dir="rtl"] select,
html[dir="rtl"] textarea {
  direction: rtl;
  text-align: right;
  font-family: var(--font-body);
}
html[dir="rtl"] input[type="email"],
html[dir="rtl"] input[name="phone"],
html[dir="rtl"] input[name="quantity"] { direction: ltr; text-align: right; }
html[dir="rtl"] #draftText { direction: rtl; text-align: right; }

/* --- Small screens ------------------------------------------------------ */
@media (max-width: 640px) {
  html[dir="rtl"] .myth-fact .label { border-right: none; border-bottom: 1px solid var(--border); }
  html[dir="rtl"] .checklist li { padding-right: 30px; }
  html[dir="rtl"] .steps-list li { padding: 12px 46px 12px 12px; }
}

/* --- Arabic-language switch chip in the header nav ---------------------- */
.lang-switch { font-weight: 600; opacity: 0.9; }

/* The Arabic nav carries eleven entries (one more than the English nav),
   so tighten tracking/gaps to keep it on a single line without clipping. */
html[dir="rtl"] .nav { flex-wrap: nowrap; }
html[dir="rtl"] .nav a { white-space: nowrap; }
html[dir="rtl"] .nav a.lang-switch {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px;
  color: var(--primary-dark);
  font-size: 0.78rem;
}

@media (max-width: 1280px) {
  html[dir="rtl"] .nav { gap: 12px; }
  html[dir="rtl"] .nav a { font-size: 0.79rem; }
  html[dir="rtl"] .nav .cta { padding: 9px 14px; }
}
@media (max-width: 1100px) {
  html[dir="rtl"] .nav { gap: 9px; }
  html[dir="rtl"] .nav a { font-size: 0.73rem; }
}
@media (max-width: 960px) {
  html[dir="rtl"] .nav { gap: 14px; }
  html[dir="rtl"] .nav a { font-size: 0.9rem; }
  html[dir="rtl"] .nav a.lang-switch { align-self: flex-start; }
}
