/**
 * Fanamooz Academy - Unified Typography & Font System
 * Complete Offline Fonts (YekanBakh & Dana)
 * No dependency on external CDNs (Google Fonts, jsdelivr, etc.)
 */

/* ==========================================================================
   1. YekanBakh Font Faces
   ========================================================================== */

/* Regular (Weight: 400) */
@font-face {
    font-family: 'YekanBakh';
    font-weight: 400;
    font-style: normal;
    font-display: swap;
    src: url('/fonts/YekanBakh-Regular.woff2') format('woff2'),
         url('/fonts/YekanBakh-Regular.woff') format('woff'),
         url('/fonts/YekanBakh-Regular.ttf') format('truetype');
}

/* Medium / SemiBold (Weight: 500, 600) */
@font-face {
    font-family: 'YekanBakh';
    font-weight: 500;
    font-style: normal;
    font-display: swap;
    src: url('/fonts/YekanBakh-SemiBold.woff2') format('woff2'),
         url('/fonts/YekanBakh-SemiBold.woff') format('woff'),
         url('/fonts/YekanBakh-SemiBold.ttf') format('truetype');
}

@font-face {
    font-family: 'YekanBakh';
    font-weight: 600;
    font-style: normal;
    font-display: swap;
    src: url('/fonts/YekanBakh-SemiBold.woff2') format('woff2'),
         url('/fonts/YekanBakh-SemiBold.woff') format('woff'),
         url('/fonts/YekanBakh-SemiBold.ttf') format('truetype');
}

/* Bold (Weight: 700, 800) */
@font-face {
    font-family: 'YekanBakh';
    font-weight: 700;
    font-style: normal;
    font-display: swap;
    src: url('/fonts/YekanBakh-Bold.woff2') format('woff2'),
         url('/fonts/YekanBakh-Bold.woff') format('woff'),
         url('/fonts/YekanBakh-Bold.ttf') format('truetype');
}

@font-face {
    font-family: 'YekanBakh';
    font-weight: 800;
    font-style: normal;
    font-display: swap;
    src: url('/fonts/YekanBakh-Bold.woff2') format('woff2'),
         url('/fonts/YekanBakh-Bold.woff') format('woff'),
         url('/fonts/YekanBakh-Bold.ttf') format('truetype');
}

/* Black (Weight: 900) */
@font-face {
    font-family: 'YekanBakh';
    font-weight: 900;
    font-style: normal;
    font-display: swap;
    src: url('/fonts/YekanBakh-Black.woff2') format('woff2'),
         url('/fonts/YekanBakh-Black.woff') format('woff'),
         url('/fonts/YekanBakh-Black.ttf') format('truetype');
}

/* ExtraBlack (Weight: 950) */
@font-face {
    font-family: 'YekanBakh';
    font-weight: 950;
    font-style: normal;
    font-display: swap;
    src: url('/fonts/YekanBakh-ExtraBlack.woff') format('woff'),
         url('/fonts/YekanBakh-ExtraBlack.ttf') format('truetype');
}

/* Light / Thin Fallback (Weight: 100, 200, 300) -> Maps to Regular for high legibility */
@font-face {
    font-family: 'YekanBakh';
    font-weight: 300;
    font-style: normal;
    font-display: swap;
    src: url('/fonts/YekanBakh-Regular.woff2') format('woff2'),
         url('/fonts/YekanBakh-Regular.woff') format('woff'),
         url('/fonts/YekanBakh-Regular.ttf') format('truetype');
}

/* Alias 'Yekan' mapped to YekanBakh */
@font-face {
    font-family: 'Yekan';
    font-weight: 400;
    font-style: normal;
    font-display: swap;
    src: url('/fonts/YekanBakh-Regular.woff2') format('woff2');
}
@font-face {
    font-family: 'Yekan';
    font-weight: 700;
    font-style: normal;
    font-display: swap;
    src: url('/fonts/YekanBakh-Bold.woff2') format('woff2');
}

/* Local fallback alias for 'Vazirmatn' to avoid broken CDN requests */
@font-face {
    font-family: 'Vazirmatn';
    font-weight: 400;
    font-style: normal;
    font-display: swap;
    src: url('/fonts/YekanBakh-Regular.woff2') format('woff2'),
         url('/fonts/YekanBakh-Regular.woff') format('woff'),
         url('/fonts/YekanBakh-Regular.ttf') format('truetype');
}
@font-face {
    font-family: 'Vazirmatn';
    font-weight: 700;
    font-style: normal;
    font-display: swap;
    src: url('/fonts/YekanBakh-Bold.woff2') format('woff2'),
         url('/fonts/YekanBakh-Bold.woff') format('woff'),
         url('/fonts/YekanBakh-Bold.ttf') format('truetype');
}

/* ==========================================================================
   2. Dana Font Faces (Secondary Iranian Font)
   ========================================================================== */

@font-face {
    font-family: 'Dana';
    font-weight: 300;
    font-style: normal;
    font-display: swap;
    src: url('/fonts/Dana/DanaLight.woff2') format('woff2'),
         url('/fonts/Dana/DanaLight.woff') format('woff'),
         url('/fonts/Dana/DanaLight.ttf') format('truetype');
}

@font-face {
    font-family: 'Dana';
    font-weight: 400;
    font-style: normal;
    font-display: swap;
    src: url('/fonts/Dana/DanaRegular.woff2') format('woff2'),
         url('/fonts/Dana/DanaRegular.woff') format('woff'),
         url('/fonts/Dana/DanaRegular.ttf') format('truetype');
}

@font-face {
    font-family: 'Dana';
    font-weight: 700;
    font-style: normal;
    font-display: swap;
    src: url('/fonts/Dana/DanaBold.woff2') format('woff2'),
         url('/fonts/Dana/DanaBold.woff') format('woff'),
         url('/fonts/Dana/DanaBold.ttf') format('truetype');
}

@font-face {
    font-family: 'Dana';
    font-weight: 900;
    font-style: normal;
    font-display: swap;
    src: url('/fonts/Dana/DanaExtraBlack.woff2') format('woff2'),
         url('/fonts/Dana/DanaExtraBlack.woff') format('woff'),
         url('/fonts/Dana/DanaExtraBlack.ttf') format('truetype');
}

@font-face {
    font-family: 'DanaB';
    font-weight: 400;
    font-style: normal;
    font-display: swap;
    src: url('/fonts/Dana/DanaRegular.woff2') format('woff2');
}
@font-face {
    font-family: 'DanaB';
    font-weight: 700;
    font-style: normal;
    font-display: swap;
    src: url('/fonts/Dana/DanaBold.woff2') format('woff2');
}

/* ==========================================================================
   3. Universal Typography Enforcement
   ========================================================================== */

:root {
    --font-primary: 'YekanBakh', 'Dana', 'Vazirmatn', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
}

html, body {
    font-family: var(--font-primary) !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Apply unified font across all text containers, inputs, buttons, tables */
h1, h2, h3, h4, h5, h6,
p, a, span, label, div,
button, input, select, textarea, optgroup, option,
table, thead, tbody, tfoot, tr, th, td,
ul, ol, li, dl, dt, dd,
blockquote, q, cite, caption,
strong, b, em, i:not(.bi):not(.fa):not(.ri), small, u, s, del, ins, sub, sup,
nav, header, footer, main, aside, section, article {
    font-family: var(--font-primary) !important;
}

/* ==========================================================================
   4. Icon Preservation (Preventing Persian Font Overriding Glyph Ligatures)
   ========================================================================== */

/* Bootstrap Icons */
i.bi, i[class^="bi-"], i[class*=" bi-"], .bi, [class^="bi-"], [class*=" bi-"] {
    font-family: 'bootstrap-icons' !important;
    font-style: normal !important;
    font-weight: normal !important;
    font-variant: normal !important;
    text-transform: none !important;
    line-height: 1 !important;
    vertical-align: -0.125em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Remix Icons */
i.ri, i[class^="ri-"], i[class*=" ri-"], .ri, [class^="ri-"], [class*=" ri-"] {
    font-family: 'remixicon' !important;
    font-style: normal !important;
}

/* FontAwesome */
i.fa, i[class^="fa-"], i[class*=" fa-"], .fa, .fas, .far, .fab, .fa-solid, .fa-regular, .fa-brands {
    font-family: 'Font Awesome 6 Free', 'Font Awesome 6 Brands', 'FontAwesome' !important;
    font-style: normal !important;
}

/* ==========================================================================
   5. Monospace & Code Blocks
   ========================================================================== */

code, kbd, samp, pre, .font-mono, [class*="font-mono"], .code-font {
    font-family: var(--font-mono) !important;
    direction: ltr !important;
    text-align: left;
}


/* ==========================================================================
   6. Persian Digits OpenType Feature Settings
   ========================================================================== */
html:not([lang="en"]), html[lang="fa"], [dir="rtl"], .dir-rtl, body {
    font-feature-settings: "ss01" 1, "ss02" 1;
    -webkit-font-feature-settings: "ss01" 1, "ss02" 1;
}

[dir="ltr"], .dir-ltr, code, pre, .font-mono, input[type="tel"], input[type="number"], input[type="email"], input[type="password"] {
    font-feature-settings: normal !important;
    -webkit-font-feature-settings: normal !important;
}
