/**
 * =============================================================================
 * ParsExam GLOBAL TYPOGRAPHY — Vazirmatn enforcement (MANDATORY)
 * =============================================================================
 * Single source of truth for all products (Home, Admin, IELTS, MCQ, Coding,
 * FastType, ClipArt, FitAI, Assistant, future ParsLogo).
 *
 * Rule: No page-level font decisions. Load this file first in every HTML shell.
 * Docs: docs/architecture/26_Global_Typography_Vazirmatn.md
 *
 * Allowed exceptions: monospace for code editors only (.pe-mono / code / pre /
 * Monaco / known coding classes). Never use Arial/Tahoma as primary UI fonts.
 * =============================================================================
 */

/* ── Local faces (no CDN) ─────────────────────────────────────────────────── */
@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/Vazir-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/Vazir-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/Vazir-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/Vazir-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/Vazir-Black.woff2') format('woff2');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

/* Legacy alias — maps to the same files so older CSS using "Vazir" still paints */
@font-face {
  font-family: 'Vazir';
  src: url('/fonts/Vazir-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vazir';
  src: url('/fonts/Vazir-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vazir';
  src: url('/fonts/Vazir-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vazir';
  src: url('/fonts/Vazir-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vazir';
  src: url('/fonts/Vazir-Black.woff2') format('woff2');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

/* ── Design tokens ────────────────────────────────────────────────────────── */
:root {
  /* Official UI stack — Vazirmatn first; Vazir alias; system sans as last resort only */
  --pe-font-ui: 'Vazirmatn', 'Vazir', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --pe-font-mono: ui-monospace, 'Cascadia Code', 'SF Mono', Consolas, 'Liberation Mono', monospace;
  --font-family-base: var(--pe-font-ui);
  --font-family-ui: var(--pe-font-ui);
  --font-family-mono: var(--pe-font-mono);
  /* Stitch / px-ds compatibility */
  --px-font-ui: var(--pe-font-ui);
  --px-font-mono: var(--pe-font-mono);
}

/* ── Global UI enforcement ────────────────────────────────────────────────── */
html {
  font-family: var(--pe-font-ui);
}

html,
body {
  font-family: var(--pe-font-ui) !important;
}

/* Form controls do not always inherit — force UI stack */
button,
input,
select,
textarea,
optgroup,
option,
label,
legend,
summary,
details,
dialog,
meter,
progress,
output,
datalist {
  font-family: var(--pe-font-ui) !important;
}

/* Common shells / components across products */
table,
th,
td,
caption,
.card,
.modal,
.dropdown,
.btn,
.button,
.nav,
.sidebar,
.topbar,
.toolbar,
.menu,
.menu-item,
.tab,
.tabs,
.badge,
.chip,
.toast,
.alert,
.tooltip,
.popover,
.drawer,
.panel,
.form-control,
.form-group,
.table,
.list-group,
.pagination,
.breadcrumb,
.hp-orb,
.hp-cap,
.ft-body,
.ft-top,
.cl-body,
.admin-shell,
.fx-body {
  font-family: inherit;
}

/* Content containers: inherit (do not reintroduce foreign stacks) */
p,
h1, h2, h3, h4, h5, h6,
a, span, div, li, ul, ol, dl, dt, dd,
section, article, aside, header, footer, main, nav,
blockquote, figcaption, figure {
  font-family: inherit;
}

/* Educational / rich content surfaces */
.pars-content,
.ck-content,
.ck-editor__editable,
[class*='editor__editable'] {
  font-family: var(--pe-font-ui) !important;
}

/* ── Monospace exceptions (code only) ─────────────────────────────────────── */
code,
kbd,
pre,
samp,
.mono,
.pe-mono,
.font-mono,
.cq-code-area,
.ctc-row textarea,
.cm-editor,
.cm-content,
.monaco-editor,
.monaco-editor *,
[class*='monaco-'],
.ex-code-badge,
.ac-wrap input,
.notif-event-code,
.sb-release-version,
.topbar-time {
  font-family: var(--pe-font-mono) !important;
}

/* RTL/LTR: same family; direction is a separate concern (html[dir]) */
html[dir='rtl'],
html[dir='ltr'],
html[lang='fa'],
html[lang='en'] {
  font-family: var(--pe-font-ui);
}
