/* Alien Keyboard website: right-to-left pages (Urdu). Owned by I18N; linked by render_head() after
   styles.css and ak-core.css on pages whose language is written right to left. styles.css is never edited.
   Every rule is scoped to html[dir="rtl"], so this file changes nothing on a left-to-right page.
   No external files: the Urdu letters use a font already on the visitor's device.

   1. Urdu type: Nastaliq for Urdu letters, while the site's own Plus Jakarta Sans still draws Latin letters
      and digits; taller lines so Nastaliq never collides; no letter-spacing (it breaks joined letters);
      small labels a little larger, because Nastaliq at 12-13px is hard to read.
   2. The pictures of apps stay left to right: the phones, keyboards and chats in the demos, the feature
      pictures, the logo strip, the poster's logo and the flowing words at the top. They show real
      left-to-right apps (and a real Urdu keyboard layout), so they look exactly as on the English page.
   3. Everything else is mirrored. Grids and rows flip by themselves; the few left/right spacings of
      styles.css are swapped here, and arrows that show the reading order point the other way. */

/* Nastaliq, always in its regular weight. The bold face of Noto Nastaliq Urdu that ships with macOS and iOS
   leaves a gap after letters that don't join forward when ھ follows (سید ھی for سیدھی, پڑ ھ for پڑھ), and
   Urdu headlines are set in regular Nastaliq anyway. This alias declares the regular face for every
   weight, so headings and bold labels keep their size and colour but never switch to the broken face or a
   synthetic bold. Only Arabic-script letters use it; local() reads the visitor's own font, nothing is
   downloaded. */
@font-face {
  font-family: "AK Nastaliq";
  src: local("Noto Nastaliq Urdu"), local("NotoNastaliqUrdu-Regular"), local("NotoNastaliqUrdu");
  font-weight: 100 900;
  font-style: normal;
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF;
}

html[dir="rtl"] {
  --ak-font-ur: "Plus Jakarta Sans", "AK Nastaliq", "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", "Urdu Typesetting",
    "Noto Naskh Arabic", "Geeza Pro", "Segoe UI", Tahoma, sans-serif;
}

/* ---------- 1. Urdu type ---------- */
html[dir="rtl"] body { font-family: var(--ak-font-ur); line-height: 2; }

/* Everything outside the app pictures, code blocks and text marked as another language (lang="id", "en"):
   room between the lines for Nastaliq, and no letter-spacing. :where() keeps this rule weak, so the
   sizes below and the headings' own line height still win. */
html[dir="rtl"] body :where(:not(
    :is(.intro-flow, .secure-seal, .apps-marquee, .hero-logo, .hs-num, .hs-flags, .hp, .phone, .cw-phone, .mock, pre, [lang]:not([lang="ur"])),
    :is(.intro-flow, .secure-seal, .apps-marquee, .hero-logo, .hs-num, .hs-flags, .hp, .phone, .cw-phone, .mock, pre, [lang]:not([lang="ur"])) *)) {
  letter-spacing: 0;
  line-height: 1.95;
}
html[dir="rtl"] :is(h1, h2, h3, h4) { line-height: 1.6; }
html[dir="rtl"] h1 { line-height: 1.55; }
html[dir="rtl"] .hero-title { line-height: 1.6; }
html[dir="rtl"] .hs-label { line-height: 1.5; }

/* small labels: a little larger in Nastaliq */
html[dir="rtl"] .eyebrow { font-size: .95rem; }
html[dir="rtl"] :is(.ex-label, .ex-switch-label, .key-langs dt, .good-to-know h4) { font-size: .88rem; }
html[dir="rtl"] .cap-label { font-size: .8rem; }
html[dir="rtl"] :is(.tag, .legend, .apps-title, .footer-legal, .trust-see) { font-size: .92rem; }
html[dir="rtl"] .apps-note { font-size: .86rem; }
html[dir="rtl"] :is(.fine, .req) { font-size: .95rem; }
html[dir="rtl"] .steps-chain li { font-size: .95rem; }
html[dir="rtl"] .cw-cap-k { font-size: .8rem; }
html[dir="rtl"] .m-dl .m-dl-t span { font-size: .86rem; }
@media (min-width: 600px) {
  html[dir="rtl"] :is(.dm-btn, .demo .demo-sound, .demo .demo-toggle) { font-size: .86rem; line-height: 1.6; }
}
@media (max-width: 599px) {
  html[dir="rtl"] :is(.fine, .req) { font-size: .9rem; }
  html[dir="rtl"] :is(.dm-btn, .demo .demo-sound, .demo .demo-toggle) { font-size: .7rem; line-height: 1.6; }
}

/* ---------- 2. The app pictures stay left to right ---------- */
html[dir="rtl"] :is(.intro-flow, .apps-marquee, .hero-logo, .hs-flags, .hp, .demo > .phone, .cw-phone, .mock) {
  direction: ltr;
  font-family: var(--font);
}
html[dir="rtl"] :is(.apps-marquee, .hp, .demo > .phone, .cw-phone, .mock) { line-height: 1.6; }
/* "26+": a number with its plus sign after it */
html[dir="rtl"] .hs-num { direction: ltr; unicode-bidi: isolate; font-family: var(--font); }
/* the poster's logo stays at the outer edge, as on the English page */
html[dir="rtl"] .hero-logo { justify-content: flex-end; }
/* the seal's Urdu word: no letter-spacing between joined letters */
html[dir="rtl"] .ss-small { letter-spacing: 0; }

/* ---------- 3. Mirrored ---------- */
html[dir="rtl"] .skip-link { left: auto; right: 16px; }
html[dir="rtl"] .nav { margin-left: 0; margin-right: auto; }

html[dir="rtl"] .ticks li { padding-left: 0; padding-right: 30px; }
html[dir="rtl"] .ticks li::before { left: auto; right: 0; }
html[dir="rtl"] .plain li { padding-left: 0; padding-right: 18px; }
html[dir="rtl"] .plain li::before { left: auto; right: 2px; }
@media (max-width: 599px) {
  html[dir="rtl"] .ticks li { padding-left: 0; padding-right: 26px; }
}

/* The poster: the ribbons behind the phones follow the phones to the left. */
html[dir="rtl"] .hero-waves-top { right: auto; left: -3%; scale: -1 1; }
html[dir="rtl"] .hero-voice { padding-left: 0; padding-right: 2cqi; }
@media (max-width: 599px) {
  html[dir="rtl"] .hero-voice { padding-right: 0; }
}
/* the voice-to-text drawing reads from right to left too */
html[dir="rtl"] .hv-art { transform: scaleX(-1); }

/* the intro title's full stop needs no tucking in */
html[dir="rtl"] .intro-title .it-dot { margin-left: 0; }
/* "See the details" arrow after the words */
html[dir="rtl"] .trust-see::after { margin-left: 0; margin-right: 6px; }

/* Live demo caption: "you say" on the right, the arrow pointing left to "typed" */
html[dir="rtl"] .cap-row:first-child { text-align: right; }
html[dir="rtl"] .cap-arrow { transform: scaleX(-1); }
html[dir="rtl"] .cap-text:not(.ur) { unicode-bidi: plaintext; text-align: right; }

/* Walkthrough: back on the right pointing right, next on the left pointing left */
html[dir="rtl"] .cw-prev svg { transform: rotate(-90deg); }
html[dir="rtl"] .cw-next svg { transform: rotate(90deg); }
html[dir="rtl"] .cw-cap-k::before { margin-right: 0; margin-left: 7px; }
/* the send arrow in "With Alien Keyboard" points the reading way, as in right-to-left chat apps */
html[dir="rtl"] .compare-card .icon:has(use[href="#i-send"]) { transform: scaleX(-1); }

/* Examples: the "Bahasa -> English" arrows point left; each sentence keeps its own direction */
html[dir="rtl"] .examples .eyebrow > [aria-hidden="true"],
html[dir="rtl"] .ex-pair > [aria-hidden="true"] { display: inline-block; transform: scaleX(-1); }
html[dir="rtl"] .ex-typed::before { right: auto; left: 18px; }
html[dir="rtl"] .ex-text { unicode-bidi: plaintext; text-align: right; }

/* Code in running text (blog) stays left to right. Blog styles should use logical properties
   (padding-inline-start, border-inline-start, text-align: start) so they mirror by themselves. */
html[dir="rtl"] :is(pre, code, kbd, samp) { direction: ltr; unicode-bidi: isolate; }

/* Walkthrough caption: its box is 54px high; Nastaliq needs taller lines, so the step's words keep to one
   line here (the Urdu steps are short). */
html[dir="rtl"] .cw-cap-k { line-height: 1.5; }
html[dir="rtl"] .cw-cap-t { line-height: 1.75; -webkit-line-clamp: 1; line-clamp: 1; }

/* Two rules of styles.css that set a tight line height with a strong selector */
html[dir="rtl"] .feature-copy > p:not(.tag):not(.fine) { line-height: 1.95; }
html[dir="rtl"] .cw .compare-new .fine { line-height: 1.95; }

/* Phones: the row of language pairs scrolls sideways; the pairs out of sight are on the left here,
   so the fade sits on the left edge (the gradient runs from the right). */
@media (max-width: 599px) {
  html[dir="rtl"] .ex-pairs {
    -webkit-mask-image: linear-gradient(270deg, transparent 0, #000 var(--fade-l), #000 calc(100% - var(--fade-r)), transparent 100%);
            mask-image: linear-gradient(270deg, transparent 0, #000 var(--fade-l), #000 calc(100% - var(--fade-r)), transparent 100%);
  }
}

/* Laptop screens (styles.css "Laptop screens" block): the same spacing on the other side */
@media (min-width: 1100px) and (min-height: 600px) {
  html[dir="rtl"] .cw-cap-k::before { margin-left: 6px; }
}
@media (min-width: 1240px) and (min-height: 600px) and (max-height: 719px) {
  html[dir="rtl"] .p-card .plain li { padding-right: 15px; }
}
