/* Right-to-left and Arabic typography (languages layer: inc/parts/i18n*.php).
   Active when <html dir="rtl"> (Arabic pages under /ar/). Most layout already uses logical
   properties (inline-start/end) in site.css; this file mirrors what is still physical,
   flips directional icons and tunes type for Arabic. Nothing here affects English pages. */

/* ---- Arabic type: IBM Plex Sans Arabic (files in assets/fonts, @font-face in site.css). ---- */
html[lang^="ar"] body {
	font-family: 'IBM Plex Sans Arabic', 'General Sans', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
	line-height: 1.75;
}
html[lang^="ar"] h1,
html[lang^="ar"] h2,
html[lang^="ar"] h3,
html[lang^="ar"] h4 { font-family: 'IBM Plex Sans Arabic', var(--sans); line-height: 1.4; }
html[lang^="ar"] h1 { line-height: 1.3; }
/* Arabic letters must join: no tracking, no uppercase, no fake italics. */
html[lang^="ar"] body,
html[lang^="ar"] body * { letter-spacing: 0 !important; }
html[lang^="ar"] .eyebrow,
html[lang^="ar"] .t-card-kicker,
html[lang^="ar"] .home-stats span,
html[lang^="ar"] .tp-differ-label,
html[lang^="ar"] .tp-differ-top,
html[lang^="ar"] .st-num { text-transform: none; font-size: max(12px, 1em); }
html[lang^="ar"] em,
html[lang^="ar"] i,
html[lang^="ar"] .tp-hero-line { font-style: normal; }
html[lang^="ar"] .prose,
html[lang^="ar"] p { line-height: 1.85; }

/* English islands inside Arabic pages (bios, guide bodies, names in their own script). */
html[lang^="ar"] [lang="en"] { font-family: 'General Sans', system-ui, -apple-system, 'Segoe UI', sans-serif; }
html[lang^="ar"] [lang="en"] p,
html[lang^="ar"] [lang="en"] li { line-height: 1.65; }
.dt-lang-orig { text-align: left; }
.dt-lang-note {
	display: inline-flex; align-items: center; gap: 8px; margin: 0 0 14px; padding: 6px 12px;
	border-radius: 999px; background: var(--mint-softer, #f2f7f4); color: var(--muted, #555); font-size: 14px; line-height: 1.4;
}
.dt-lang-note .icon { width: 16px; height: 16px; flex: none; }

/* Numbers, phones, emails, URLs and licence numbers stay left-to-right. */
[dir="rtl"] a[href^="tel:"],
[dir="rtl"] a[href^="mailto:"],
[dir="rtl"] .licence-num strong,
[dir="rtl"] .st-tel { direction: ltr; unicode-bidi: isolate; }
[dir="rtl"] input[type="email"],
[dir="rtl"] input[type="tel"],
[dir="rtl"] input[type="url"] { direction: ltr; text-align: right; }
[dir="rtl"] input[type="email"]::placeholder,
[dir="rtl"] input[type="tel"]::placeholder,
[dir="rtl"] input[type="url"]::placeholder { direction: rtl; }

/* ---- Directional icons ---- */
/* The "arrow" icon (inc/icons.php) points right; in RTL forward is left. :has() targets it by its path. */
[dir="rtl"] svg.icon:has(> path[d="M5 12h14M13 6l6 6-6 6"]) { transform: scaleX(-1); }
[dir="rtl"] .link-arrow:hover svg.icon:has(> path[d="M5 12h14M13 6l6 6-6 6"]) { transform: scaleX(-1) translateX(2px); }
/* Back buttons already rotate the arrow; in RTL "back" points right, i.e. the icon as drawn. */
[dir="rtl"] .mq-back svg.icon { transform: none; }
/* The external-link icon mirrors too. */
[dir="rtl"] svg.icon:has(> path[d^="M14 4h6v6"]) { transform: scaleX(-1); }

/* ---- Still-physical rules in the part stylesheets ---- */
/* Get matched (match.css) */
[dir="rtl"] .mq-opt .mq-tick,
[dir="rtl"] .mq-tick { right: auto; left: 14px; }
[dir="rtl"] .mq-type-multi .mq-tick { right: auto; left: 12px; }
[dir="rtl"] .mq-nav .mq-next:only-child { margin-left: 0; margin-right: auto; }
[dir="rtl"] .mq-sum-a,
[dir="rtl"] .mq-private { text-align: right; }
@media (min-width: 560px) { [dir="rtl"] .mq-sum-a { text-align: left; } }

/* For therapists (therapists.css) */
[dir="rtl"] .tp-not li { border-left: 0; border-right: 3px solid var(--clay); border-radius: 12px 0 0 12px; }

/* Self-tests and emergency page (selftest.css) */
[dir="rtl"] .st-tel { margin-right: 0; margin-left: 6px; }
[dir="rtl"] .em-steps { padding-left: 0; padding-right: 1.4em; }
[dir="rtl"] .em-tips li { padding-left: 0; padding-right: 16px; border-left: 0; border-right: 3px solid var(--teal-soft); }

/* Generic lists and quotes inside prose. */
[dir="rtl"] .prose ul,
[dir="rtl"] .prose ol { padding-left: 0; padding-right: 1.3em; }
[dir="rtl"] .prose blockquote { border-left: 0; border-right: 3px solid var(--line, #ddd); padding-left: 0; padding-right: 1em; }
[dir="rtl"] .prose [lang="en"] ul,
[dir="rtl"] .prose [lang="en"] ol { padding-right: 0; padding-left: 1.3em; }

/* Language switcher: the list opens towards the page edge in both directions. */
.lang-switch .lang-menu a[aria-current="true"] { font-weight: 600; }
