/*!
 * fa.css — Persian layer, loaded only when the locale is `fa`,
 * after style.rtl.css.
 *
 * style.rtl.css is generated by rtlcss and handles every directional
 * property (margins, floats, text-align, transforms) and even the
 * directional Unicons glyphs. This file covers only what a mechanical
 * LTR→RTL flip cannot know: the Persian typeface and the typographic
 * adjustments Persian needs.
 *
 * All manual corrections belong here — never in style.rtl.css, which is
 * regenerated from the theme.
 */

/* --------------------------------------------------------------------
   1. Typeface — self-hosted. Never a CDN: Google Fonts and jsDelivr are
      not reliably reachable for this site's audience.

      Ravi FaNum, two static cuts. There is no variable axis and nothing
      above Regular, so the theme's font-weight: 700 (31 rules) and 500
      (20 rules) are synthesised by the browser. Adding a real Bold file
      as a third @font-face at font-weight: 700 is all it would take to
      stop that. See ../fonts/ravi-fanum/README.md — which also records
      that this font's licence is "all rights reserved" and that the
      right to serve it as a webfont is unconfirmed.

      The unicode-range excludes U+0030–U+0039 on purpose. "FaNum" means
      the ASCII digits in this family ARE Persian numerals: U+0030 is a
      composite glyph pointing at the U+06F0 outline, and every feature
      that normally switches figure styles (onum, tnum) resolves back to
      the same shapes, because the font holds no Latin figures at all.
      Dropping 0–9 from the face is the only way to keep ASCII digits
      Latin, which is what section 4 and the content files assume.
      Persian digits written as Persian characters are unaffected —
      U+06F0–U+06F9 is inside the range and still comes from Ravi.
   -------------------------------------------------------------------- */
@font-face {
  font-family: "Ravi FaNum";
  src: url("../fonts/ravi-fanum/RaviFaNum-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0-2F, U+3A-10FFFF;
}

@font-face {
  font-family: "Ravi FaNum";
  src: url("../fonts/ravi-fanum/RaviFaNum-Light.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0-2F, U+3A-10FFFF;
}

/* --------------------------------------------------------------------
   1b. Manrope, latin subset — for one element on the page.

      Nothing in the Persian layout sets this family. The only thing that
      asks for it is .footer-mark, the giant ZAMAN watermark cut off by
      the bottom edge of the footer, which motion.css pins to Manrope so
      that both locales get the identical shape and the identical cut.
      Everything else on /fa stays Ravi FaNum; section 2 below is
      untouched by this.

      Why it has to be declared again here: style.rtl.css is generated
      from style.css with the Manrope @font-face blocks stripped out (its
      header says so), because until now the Persian tree had no use for
      them. The file itself is not new — it is the same latin subset the
      English tree already serves from the same path, so a visitor who
      has seen both has it once in cache.

      Cost when they have not: 24.8 KB, fetched once. It is also fetched
      lazily and only on demand. A face nobody matches is never
      downloaded, so if motion.css is ever removed — which that file
      promises can be done at any time — this declaration goes inert
      rather than costing a request.

      Latin only, no latin-ext. ZAMAN is Z A M A N, four distinct glyphs,
      all inside U+0000-00FF. If data-mark in either footer component is
      ever changed to a word with an accented capital, add the latin-ext
      face from style.css:37 as well; without it that one glyph would
      fall back to Ravi FaNum and sit at the wrong baseline while its
      neighbours did not.
   -------------------------------------------------------------------- */
@font-face {
  font-family: "Manrope";
  src: url("../fonts/manrope/Manrope-Variable-latin.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* --------------------------------------------------------------------
   2. Base typography.

      The theme declares --bs-body-font-family: var(--bs-font-sans-serif)
      on :root, so overriding --bs-font-sans-serif on the same element
      re-points every font-family in the stylesheet at once.

      --bs-root-font-size (20px) is deliberately NOT touched: every
      spacing utility in the theme is rem-based, so changing it would
      rescale the entire layout rather than just the text.
   -------------------------------------------------------------------- */
[dir="rtl"] {
  --bs-font-sans-serif: "Ravi FaNum", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Persian glyphs render visually smaller than Latin at the same size,
     and need more leading to keep dots and descenders legible.

     Both values were re-measured against Ravi FaNum when it replaced
     Vazirmatn and neither needed to move. Glyph heights in em: alef
     0.694 (Vazirmatn 0.672), seen 0.681 (0.598), beh 0.634 (0.567),
     meem 0.712 (0.661) — Ravi sets Persian slightly LARGER on the same
     body, so the +0.05rem bump is still right and is not now excessive.
     The em box is a shade tighter (1.650em against 1.709em), which only
     matters where line-height is `normal`; every line-height here is an
     explicit number, so the font's own metrics never get consulted. */
  --bs-body-font-size: 0.85rem;   /* theme default: 0.8rem  */
  --bs-body-line-height: 2;       /* theme default: 1.7     */
}

[dir="rtl"] body {
  font-family: var(--bs-font-sans-serif);
}

/* Headings ship at a tight Latin line-height that clips Persian
   descenders and the dots under ب / پ / ج.
   Still 1.55 after the move to Ravi FaNum: the tallest-to-deepest ink on
   a Persian line grew from 0.983em to 1.023em, which leaves 0.53em of
   clearance here instead of 0.57em. Not enough to justify reflowing
   every heading on the Persian tree. */
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3,
[dir="rtl"] h4, [dir="rtl"] h5, [dir="rtl"] h6,
[dir="rtl"] .h1, [dir="rtl"] .h2, [dir="rtl"] .h3,
[dir="rtl"] .h4, [dir="rtl"] .h5, [dir="rtl"] .h6,
[dir="rtl"] [class^="display-"] {
  line-height: 1.55;
}

/* --------------------------------------------------------------------
   3. Tracking. Latin display type is tracked tightly; applying that to
      Persian breaks the cursive joins between letters.

      The unqualified rule carries no !important on purpose. The five
      below exist solely to match the five !important declarations in
      style.css — a blanket `* { letter-spacing: normal !important }`
      would be an unnecessary cascade nuke.
   -------------------------------------------------------------------- */
[dir="rtl"] * {
  letter-spacing: normal;
  word-spacing: normal;
}

[dir="rtl"] .tracking-tight,
[dir="rtl"] .tracking-tighter,
[dir="rtl"] .tracking-normal,
[dir="rtl"] .tracking-wide,
[dir="rtl"] .tracking-wider {
  letter-spacing: normal !important;
}

/* --------------------------------------------------------------------
   4. Numerals. The rule is: a digit renders in the script it was written
      in. ASCII 0–9 in the source stays Latin on screen; Persian numerals
      appear where the content asked for them by emitting U+06F0–U+06F9,
      which is what App\Support\Locale::digits() does.

      That is not automatic under Ravi FaNum — see section 1. The font
      draws Persian numerals for ASCII digits, so the unicode-range up
      there hands 0–9 to the fallback face to keep this rule true.

      It matters for the strings that are identifiers rather than
      quantities and have to be read character by character: the cookie
      name _ga_S7K9YZ1934 in the privacy policy, the postcode "NSW 2060",
      the citation labels "McKinsey (2023)" and "IBM (2023)".

      font-variant-numeric still applies, and now applies to the fallback
      face: lining figures rather than old-style, tabular so columns of
      numbers align.
   -------------------------------------------------------------------- */
[dir="rtl"] {
  font-variant-numeric: lining-nums tabular-nums;
}

/* --------------------------------------------------------------------
   5. Bidi isolation.

      Latin runs inside Persian sentences reorder incorrectly when they
      start or end with a neutral character — "UI/UX", "Node.js",
      ".NET", "(React)". Content must wrap these in <bdi> or .ltr;
      these rules make that work.
   -------------------------------------------------------------------- */
[dir="rtl"] bdi,
[dir="rtl"] .ltr,
[dir="rtl"] code,
[dir="rtl"] kbd,
[dir="rtl"] samp,
[dir="rtl"] a[href^="tel:"],
[dir="rtl"] a[href^="mailto:"] {
  unicode-bidi: isolate;
  direction: ltr;
}

/* Phone numbers and emails read left-to-right but should still sit on
   the right-hand side of a Persian line. */
[dir="rtl"] a[href^="tel:"],
[dir="rtl"] a[href^="mailto:"] {
  display: inline-block;
}

/* --------------------------------------------------------------------
   6. Known overflow points.

      The theme's underline/highlight bars are nowrap, which is safe for
      short English phrases but overflows on the longer Persian
      equivalents. Allow them to wrap.
   -------------------------------------------------------------------- */
[dir="rtl"] .underline,
[dir="rtl"] .underline-2,
[dir="rtl"] .underline-3 {
  white-space: normal;
}

/* Persian body copy must not be justified — the renderer stretches the
   cursive joins rather than the spaces.
   Scoped to elements that actually declare `justify`, NOT to every <p>:
   a blanket rule here overrode the theme's own .text-center and knocked
   centred CTA copy out of alignment. */
[dir="rtl"] .text-justify,
[dir="rtl"] [style*="text-align: justify"] {
  text-align: start;
}

/* --------------------------------------------------------------------
   7. Directional glyphs.

      rtlcss flips boxes, not pictures. `.icon-list` bullets use
      uil-angle-right-b: a chevron that in LTR sits left of the text and
      points into it. rtlcss moves the bullet to the right edge correctly,
      but the glyph keeps pointing right — away from the text it belongs
      to. Mirror the glyph so it points back at the line, as it does in
      English.

      Scoped to .icon-list on purpose. A blanket flip of every
      uil-angle-right-b would also reverse chevrons that mean "right" in
      an absolute sense (carousel controls, which Swiper already handles
      through rtlTranslate).
   -------------------------------------------------------------------- */
[dir="rtl"] .icon-list li > i[class*="uil-angle-right"],
[dir="rtl"] .icon-list li > i[class*="uil-corner-down-right"] {
  display: inline-block;
  transform: scaleX(-1);
}
