/* ============================================================
   Teconize — Typography
   ------------------------------------------------------------
   Persian / Arabic script  →  Arad      (variable, 100–1000)
   Latin script             →  Oswald    (variable, 200–700)

   Oswald is declared FIRST in every stack but its @font-face
   rules are restricted to the Latin unicode-ranges. The browser
   therefore resolves Latin characters to Oswald and falls
   through to Arad for Persian — automatically, even inside a
   single sentence such as «توسعه با Next.js».

   size-adjust: 88% brings Oswald's cap-height (0.810em) down to
   0.713em, which matches Arad's 0.731em, and keeps Oswald's line
   box (1.304em) inside Arad's (1.339em) so mixed lines never jump.
   ============================================================ */

/* ---------- Arad — Persian ---------- */

@font-face {
  font-family: "Arad";
  src: url("../fonts/AradVF.woff2") format("woff2");
  font-weight: 100 1000;
  font-style: normal;
  font-display: swap;
}

/* ---------- Oswald — Latin ---------- */

@font-face {
  font-family: "Oswald";
  src: url("../fonts/Oswald-latin.woff2") format("woff2");
  font-weight: 200 700;
  font-style: normal;
  font-display: swap;
  size-adjust: 88%;
  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;
}

@font-face {
  font-family: "Oswald";
  src: url("../fonts/Oswald-latin-ext.woff2") format("woff2");
  font-weight: 200 700;
  font-style: normal;
  font-display: swap;
  size-adjust: 88%;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
                 U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF,
                 U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB,
                 U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Stacks ---------- */

:root {
  /* Persian UI: Latin glyphs still resolve to Oswald via unicode-range. */
  --font-fa: "Oswald", "Arad", "Vazirmatn", "Segoe UI", system-ui, sans-serif;
  /* English UI: Arad stays in the stack as a fallback for stray Persian. */
  --font-en: "Oswald", "Arad", "Segoe UI", system-ui, sans-serif;
}

html {
  font-family: var(--font-fa);
  font-synthesis-weight: none;
}

html[lang="en"] {
  font-family: var(--font-en);
}

/* Oswald is a condensed display face — it needs a little air when it
   carries whole English sentences rather than single inline words. */
html[lang="en"] body {
  letter-spacing: 0.012em;
}

/* Force the Latin face on nodes that hold Latin content regardless of
   page language (tech tags, role tags, emails, phone numbers). */
.u-en,
[lang="en"] {
  font-family: var(--font-en);
}
