/*
 * Self-hosted Vazirmatn — the typeface the whole site is built on.
 *
 * This is the *variable* build: a single 111 KB file that covers every weight
 * from 100 to 900, so the browser makes one request instead of four and we
 * still get real Medium/Bold/Black rather than synthetically smeared text.
 *
 * Vazirmatn covers Persian and Latin in one family, which keeps the Persian
 * and English versions of the site visually identical, and its Persian
 * numerals (۰۱۲۳۴۵۶۷۸۹) are properly drawn — system fallbacks like Tahoma
 * render them poorly, which is why shipping the font matters here.
 *
 * Licence: SIL Open Font License 1.1 — see OFL.txt in this directory.
 * Upstream: https://github.com/rastikerdar/vazirmatn
 */

@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/vazirmatn-variable.woff2') format('woff2-variations'),
         url('../fonts/vazirmatn-variable.woff2') format('woff2');
    /* One face, the full weight axis. */
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

/*
 * Numerals.
 *
 * `tabular-nums` gives every digit the same advance width. Without it, prices,
 * statistics counters and calendar cells jitter as their values change — which
 * is exactly where Persian digits look worst. `lining-nums` keeps digits on a
 * single baseline instead of dropping descenders.
 */
:root {
    font-variant-numeric: lining-nums tabular-nums;
    font-feature-settings: 'lnum' 1, 'tnum' 1;
}

/*
 * Persian digits need a touch more breathing room than Latin ones at small
 * sizes; without it ۱۱ and ۱۷ start to look like a single smudged glyph.
 */
[lang='fa'] {
    letter-spacing: 0;
}

/* Anything that displays a number the reader compares or watches change. */
.stat__value,
.kpi__value,
.hero__stats strong,
.rating-summary__value,
.course-card__price strong,
.price-card__amount strong,
.calendar__day-num,
.slot__time,
.confirm-code__value,
.timeline__meta .chip,
.pagination__page,
.admin-pagination a,
.admin-pagination span {
    font-variant-numeric: lining-nums tabular-nums;
    font-feature-settings: 'lnum' 1, 'tnum' 1;
}

/*
 * Latin-only strings inside Persian pages — phone numbers, emails, times,
 * booking codes. Forcing LTR stops the bidi algorithm from reordering them.
 */
[dir='ltr'] {
    font-variant-numeric: lining-nums tabular-nums;
}
