/* =========================================================
   PaleBlueDot — Persian (FA) typography + RTL overlay
   ---------------------------------------------------------
   Phase F (2026-06): restores the FA rules Phase B stripped
   from theme.css. Loaded after theme.css; only active when
   <body> carries `palebluedot-fa` (added by inc/setup.php
   when the locale is fa_* — WPML drives that locale, or the
   per-post Persian-Unicode fallback in palebluedot_post_is_fa()).

   The Vazirmatn/IRANSansX @font-face declarations are NOT here —
   they are injected inline by inc/enqueue.php behind
   PALEBLUEDOT_FA_ENABLED so the font files resolve from
   assets/fonts/ at the right URI.
   ========================================================= */

:root {
  --pbd-font-fa: 'Vazirmatn', 'IRANSansX', Tahoma, system-ui, -apple-system, sans-serif;
}

/* Base FA typeface — body, post content, titles */
body.palebluedot-fa,
body.palebluedot-fa .wp-block-post-content,
body.palebluedot-fa .wp-block-post-title {
  font-family: var(--pbd-font-fa);
}

/* Code stays LTR + monospace even inside an RTL document */
body.palebluedot-fa .wp-block-code,
body.palebluedot-fa pre.wp-block-code,
body.palebluedot-fa pre,
body.palebluedot-fa code {
  direction: ltr;
  text-align: left;
  font-family: var(--pbd-font-mono);
}

body.palebluedot-fa .pbd-brand .pbd-wordmark { font-family: var(--pbd-font-fa); }

/* =========================================================
   RTL ADJUSTMENTS — headings
   ========================================================= */
body.palebluedot-fa h1,
body.palebluedot-fa h2,
body.palebluedot-fa h3,
body.palebluedot-fa h4,
body.palebluedot-fa .pbd-h1,
body.palebluedot-fa .pbd-h2,
body.palebluedot-fa .pbd-h3 {
  font-family: var(--pbd-font-fa);
  letter-spacing: 0;
  font-weight: 600;
  line-height: 1.45;
}
body.palebluedot-fa .pbd-hero h1 {
  font-weight: 700;
  line-height: 1.35;
}
body.palebluedot-fa .pbd-hero h1 em { font-style: normal; }
body.palebluedot-fa .pbd-section-head h3 { line-height: 1.45; }

/* =========================================================
   v0.4.1 — RTL adjustments for the language-switcher dropdown
   (menu anchors to the document's inline-start in RTL).
   inset-inline-end already flips under dir=rtl, but pin
   explicitly for older engines.
   ========================================================= */
body.palebluedot-fa .pbd-lang-menu { inset-inline-end: auto; inset-inline-start: 0; }
body.palebluedot-fa .pbd-lang-switch.pbd-lang-dropdown > summary,
body.palebluedot-fa .pbd-lang-menu a { letter-spacing: 0; }
body.palebluedot-fa .pbd-site-footer h5 { font-family: var(--pbd-font-fa); }

/* ===========================================================
   v0.4.3 — keep Persian letters joined.
   theme.css applies a small letter-spacing to body/paragraph
   text for the Latin face; on Arabic-script text letter-spacing
   BREAKS the cursive joins (each glyph renders in its isolated
   form, e.g. خ‌لاصه instead of خلاصه). Reset it to 0 across FA
   running text. Headings/switcher already handled above.
   =========================================================== */
body.palebluedot-fa,
body.palebluedot-fa p,
body.palebluedot-fa li,
body.palebluedot-fa a,
body.palebluedot-fa strong,
body.palebluedot-fa b,
body.palebluedot-fa em,
body.palebluedot-fa td,
body.palebluedot-fa th,
body.palebluedot-fa caption,
body.palebluedot-fa figcaption,
body.palebluedot-fa blockquote,
body.palebluedot-fa .pbd-callout,
body.palebluedot-fa .wp-block-post-excerpt,
body.palebluedot-fa .wp-block-post-content {
  letter-spacing: 0;
}

/* ===========================================================
   v0.4.4 — no drop-cap in Persian.
   prose.css enlarges the first letter of the first paragraph
   (float + 4.2em ::first-letter). On Arabic-script text this
   tears the opening letter out of its cursive word (a giant
   isolated glyph), which reads as broken. Persian typography
   does not use drop-caps, so reset ::first-letter to the
   normal running text.
   =========================================================== */
body.palebluedot-fa .pbd-prose > p:first-of-type::first-letter,
body.palebluedot-fa .wp-block-post-content > p:first-of-type::first-letter {
  font-size: inherit;
  float: none;
  line-height: inherit;
  padding: 0;
  font-weight: inherit;
  color: inherit;
}
