/* Right-to-left and Persian typography.
   Scoped to [dir="rtl"], which baseof.html sets from the site language,
   so these rules cover every section rather than only notes. */

[dir="rtl"] body,
body[dir="rtl"],
html[dir="rtl"] body {
  font-family: "Vazirmatn", Tahoma, sans-serif;
}

/* Tachyons' avenir/athelas/serif stacks have no Persian coverage. */
html[dir="rtl"] .athelas,
html[dir="rtl"] .serif,
html[dir="rtl"] .sans-serif,
html[dir="rtl"] .avenir {
  font-family: "Vazirmatn", Tahoma, sans-serif;
}

html[dir="rtl"] .notes-single-content,
html[dir="rtl"] .courses-single-content,
html[dir="rtl"] .notes-intro,
html[dir="rtl"] .courses-intro,
html[dir="rtl"] .health-intro,
html[dir="rtl"] .health-tool-intro,
html[dir="rtl"] .gold-intro,
html[dir="rtl"] .home-bio {
  text-align: start;
  line-height: 1.95;
}

html[dir="rtl"] .notes-single-content h2,
html[dir="rtl"] .notes-single-content h3,
html[dir="rtl"] .courses-single-content h2,
html[dir="rtl"] .courses-single-content h3 {
  font-weight: 700;
}

/* Letter-spacing on tracked/ttu utilities breaks Persian joining. */
html[dir="rtl"] .tracked,
html[dir="rtl"] .notes-kicker,
html[dir="rtl"] .notes-meta,
html[dir="rtl"] .notes-edit,
html[dir="rtl"] .courses-kicker,
html[dir="rtl"] .health-kicker,
html[dir="rtl"] .home-kicker,
html[dir="rtl"] .home-side-label,
html[dir="rtl"] .home-feature-kicker {
  letter-spacing: normal;
}

/* Persian has no capital letters; ttu just distorts the text. */
html[dir="rtl"] .ttu {
  text-transform: none;
}

/* Logical replacement for the physical pr4-l/pl4-l gutter between
   article body and sidebar (see notes/single.html, courses/single.html). */
.notes-content--aside {
  padding-inline-end: 0;
}

@media screen and (min-width: 60em) {
  .notes-content--aside {
    padding-inline-end: 2rem;
  }
}

/* Lists and quotes need their indent on the start side. */
html[dir="rtl"] .notes-single-content ul,
html[dir="rtl"] .notes-single-content ol,
html[dir="rtl"] .courses-single-content ul,
html[dir="rtl"] .courses-single-content ol {
  padding-inline-start: 1.5rem;
  padding-left: 0;
}

html[dir="rtl"] blockquote {
  border-left: 0;
  border-inline-start: 3px solid #cbd5e0;
  padding-inline-start: 1rem;
  padding-left: 0;
  margin-inline-start: 0;
}

/* Code, numbers, and identifiers stay left-to-right inside RTL prose. */
html[dir="rtl"] code,
html[dir="rtl"] pre,
html[dir="rtl"] kbd,
html[dir="rtl"] samp {
  direction: ltr;
  unicode-bidi: embed;
  text-align: left;
}

html[dir="rtl"] pre code {
  display: block;
}

/* Form fields that hold Latin-script or numeric data. */
html[dir="rtl"] input[type="number"],
html[dir="rtl"] input[inputmode="decimal"],
html[dir="rtl"] input[inputmode="numeric"] {
  direction: ltr;
  text-align: start;
}

/* Language switcher */
.lang-switcher {
  display: inline-flex;
  gap: 0.75rem;
  align-items: center;
}

.lang-switcher-link {
  color: inherit;
  text-decoration: none;
  font-size: 0.875rem;
  opacity: 0.85;
  border-bottom: 1px solid currentColor;
  padding-bottom: 1px;
}

.lang-switcher-link:hover,
.lang-switcher-link:focus {
  opacity: 1;
}

/* Ordered lists use ASCII "1." markers in the Markdown source so Goldmark
   builds a real <ol>; the Persian numerals come from the counter style. */
html[dir="rtl"] ol {
  list-style-type: persian;
}
