/* Direction- and script-aware basics. Loaded on every page; ~1 KB. */

/* Mirror an icon that points somewhere (back, forward, next, send, undo). Never mirror
   media controls, clocks, check marks, logos, charts, or the search glass. */
[dir="rtl"] .icon-flip-rtl { transform: scaleX(-1); }

/* A name, title or email typed by a user can run the other way from the sentence around
   it; isolate it so it cannot reorder the punctuation next to it. */
.i18n-isolate, bdi { unicode-bidi: isolate; }
.i18n-ltr { direction: ltr; unicode-bidi: isolate; text-align: start; }

/* CJK and Arabic need more leading than Latin, and Arabic's cursive joins break under
   letter-spacing. The family is the one the page's <head> loaded for this language. */
html:lang(zh), html:lang(zh) :is(body, button, input, select, textarea) {
  font-family: "Inter", "Noto Sans SC", system-ui, sans-serif;
}
html:lang(ja), html:lang(ja) :is(body, button, input, select, textarea) {
  font-family: "Inter", "Noto Sans JP", system-ui, sans-serif;
}
html:lang(ar), html:lang(ar) :is(body, button, input, select, textarea) {
  font-family: "Inter", "Noto Sans Arabic", system-ui, sans-serif;
}
html:lang(zh) body, html:lang(ja) body, html:lang(ar) body { line-height: 1.7; }
html:lang(ar) * { letter-spacing: 0 !important; }
/* No case in these scripts: an uppercase transform is a no-op that wastes a rule. */
html:lang(zh) *, html:lang(ja) *, html:lang(ar) * { text-transform: none !important; }

/* The switcher's label. Bootstrap's outline-secondary text is #6c757d, which is 3.8:1 on a
   tinted navbar (#EDE7E4) — under the 4.5:1 AA floor, on every page, found by the axe sweep. An app
   may set --int-i18n-fg to its own ink; the default clears 6:1 on every surface the apps use. */
.int-i18n-switcher .btn-outline-secondary {
  --bs-btn-color: var(--int-i18n-fg, #495057);
  --bs-btn-hover-color: var(--int-i18n-fg-hover, #fff);
  --bs-btn-border-color: var(--int-i18n-border, #6c757d);
}
