/* Telos Nexus Arabic layer — generated by tools/arabic_kit.py; edit there. */
:root { --tn-arabic: "IBM Plex Sans Arabic", "Noto Sans Arabic", "Segoe UI", Tahoma, sans-serif; }

/* Arabic glyphs are optically smaller than Latin at the same size: step up body text. */
html[lang="ar"] { font-size: 104%; }

/* Script-true typography for any element carrying Arabic text. */
.tn-ar {
  letter-spacing: 0 !important;       /* tracking breaks Arabic joining */
  text-transform: none !important;    /* Arabic has no case */
  font-style: normal !important;      /* no true Arabic italic */
  font-family: var(--tn-arabic) !important;
  font-kerning: normal;
  font-variant-ligatures: common-ligatures contextual;
  font-feature-settings: "calt" 1, "liga" 1, "kern" 1;
}
/* headings: balance lines, never leave a single orphaned word */
html[lang="ar"] :is(h1, h2, h3, .display, .display--m).tn-ar,
html[lang="ar"] :is(h1, h2, h3, .display, .display--m) .tn-ar { text-wrap: balance; }
html[lang="ar"] :is(p, li, dd).tn-ar { text-wrap: pretty; }
html[lang="ar"] .label.tn-ar { text-wrap: balance; }
/* running text needs taller leading in Arabic (ascenders, dots, tashkeel) */
html[lang="ar"] :is(p, li, dd, dt, blockquote).tn-ar:not(.panel *):not(button *) { line-height: 1.75; }

/* Latin runs inside Arabic keep their own direction and never reorder punctuation */
html[lang="ar"] :is(bdi, .lat, [dir="ltr"], code, kbd, samp) { unicode-bidi: isolate; }
/* numbers read as numbers in tables, meters and counters */
html[lang="ar"] :is(.num, [data-num], time) { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }

/* forms: Arabic input, Latin-only fields stay LTR */
html[lang="ar"] :is(input, textarea, select) { font-family: var(--tn-arabic); text-align: start; }
html[lang="ar"] :is(input[type="email"], input[type="url"], input[type="tel"]) { direction: ltr; text-align: end; }
