/*
    ════════════════════════════════════════════════════════════════════
    HOMEi Admin — GLOBAL TYPOGRAPHY SYSTEM (single source of truth)
    ════════════════════════════════════════════════════════════════════

    One typeface for the whole admin panel: IBM Plex Sans Arabic.

    WHY this family and not two (a Latin face + an Arabic face): the
    approved Sales-Inventory design (resources/css/sales-inventory.css,
    2026-08) already shipped it, self-hosted, and it is the type the
    reference screenshots were signed off on. It is ONE superfamily that
    draws Latin, Arabic AND the digits from a shared set of metrics, so
    mixed strings ("شقة 10 · J177 · EGP 37,709,000") sit on one baseline
    with one x-height. Pairing two unrelated families would reintroduce
    exactly the baseline/weight mismatch this system exists to remove.

    HOW it reaches every page: AdminPanelProvider::font() sets Filament's
    --font-family token, which the Filament theme expands into
    --default-font-family and applies at `html`. Everything in the panel
    inherits from there — sidebar, topbar, tables, forms, modals,
    drawers, notifications, badges, tabs, breadcrumbs, pagination. There
    is no `* { font-family }` anywhere: icon fonts, inline SVG icons,
    the mono stack (code / key-value / markdown + code editors) and
    third-party widgets keep their own type on purpose.

    The panel provider names the family; THIS file is the only place the
    faces are declared. Nothing else in the app should ship an
    @font-face for it.

    Script routing is done by unicode-range, so a Latin-only page never
    downloads the Arabic subsets and vice-versa:
      · Arabic glyphs  → *-arabic-*.woff2
      · Latin glyphs, digits, punctuation, currency → *-latin-*.woff2
    Ranges below are the ACTUAL cmap coverage of the shipped .woff2
    files (read off the font binaries, not copied from a CDN snippet) —
    under-declaring them is what used to drop "…", "•", "€" and "™" to
    a system fallback mid-sentence.
    ════════════════════════════════════════════════════════════════════
*/

/* ---- Arabic subsets ---------------------------------------------------- */
@font-face {
    font-family: 'IBM Plex Sans Arabic';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/ibm-plex-sans-arabic/ibm-plex-sans-arabic-arabic-400-normal.woff2') format('woff2');
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
    font-family: 'IBM Plex Sans Arabic';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('/fonts/ibm-plex-sans-arabic/ibm-plex-sans-arabic-arabic-500-normal.woff2') format('woff2');
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
    font-family: 'IBM Plex Sans Arabic';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('/fonts/ibm-plex-sans-arabic/ibm-plex-sans-arabic-arabic-600-normal.woff2') format('woff2');
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
    font-family: 'IBM Plex Sans Arabic';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/fonts/ibm-plex-sans-arabic/ibm-plex-sans-arabic-arabic-700-normal.woff2') format('woff2');
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF;
}

/* ---- Latin subsets (also carries the digits) --------------------------- */
@font-face {
    font-family: 'IBM Plex Sans Arabic';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/ibm-plex-sans-arabic/ibm-plex-sans-arabic-latin-400-normal.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0300-0301, U+0303-0304, U+0308, U+2013-2014, U+2018-201A, U+201C-201E, U+2022, U+2026, U+2039-203A, U+2044, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215;
}
@font-face {
    font-family: 'IBM Plex Sans Arabic';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('/fonts/ibm-plex-sans-arabic/ibm-plex-sans-arabic-latin-500-normal.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0300-0301, U+0303-0304, U+0308, U+2013-2014, U+2018-201A, U+201C-201E, U+2022, U+2026, U+2039-203A, U+2044, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215;
}
@font-face {
    font-family: 'IBM Plex Sans Arabic';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('/fonts/ibm-plex-sans-arabic/ibm-plex-sans-arabic-latin-600-normal.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0300-0301, U+0303-0304, U+0308, U+2013-2014, U+2018-201A, U+201C-201E, U+2022, U+2026, U+2039-203A, U+2044, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215;
}
@font-face {
    font-family: 'IBM Plex Sans Arabic';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/fonts/ibm-plex-sans-arabic/ibm-plex-sans-arabic-latin-700-normal.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0300-0301, U+0303-0304, U+0308, U+2013-2014, U+2018-201A, U+201C-201E, U+2022, U+2026, U+2039-203A, U+2044, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215;
}

/*
    ---- Token ---------------------------------------------------------
    For app CSS that needs to name the family explicitly (scoped module
    skins). Prefer `font-family: inherit` where inheriting is enough —
    this token exists so that no second literal font name is hard-coded
    anywhere in the app.
*/
:root {
    --homei-font-sans: 'IBM Plex Sans Arabic';
}

/*
    ---- The floor -----------------------------------------------------
    The smallest text in the product. There is no step below it.

    Measured on a real render of sixteen admin screens (2026-09-11,
    1,440px, homei_dev_copy): 1,484 of 3,937 visible text nodes — 38% —
    sat below 12px, and they were the words doing the most work: «SLA
    breached», «Overdue», stage pills, event times, KPI captions. Filament
    itself never goes below 12px (`text-xs`); every smaller size was ours,
    in 38 flavours from 2px to 11.84px.

    A hierarchy expressed below 12px is not a hierarchy — nobody could see
    it. De-emphasis is weight, colour and case (`--ho-ink-muted`, 500 vs
    700, small caps with tracking), never a smaller number. So every size
    that used to sit below the floor now reads this token, and
    tests/Feature/Design/TypeFloorTest.php refuses a new one — in a
    stylesheet, a <style> block, an inline style, a Tailwind text-[…]
    class, an ApexCharts fontSize or an injected style. Paper (brochure,
    receipts, statements, extracts, contracts, payslip) is laid out to a
    page and is the only exemption; the test tracks those so they cannot
    grow.

    0.75rem, not 12px: the floor scales with the root like the rest of
    the panel's type, and it is the same value as Filament's `text-xs`.
*/
:root {
    --ho-text-xs: 0.75rem;
}

/*
    ---- The one place inheritance does not reach ----------------------
    ApexCharts writes `font-family: Helvetica, Arial, sans-serif` as an
    INLINE style on the <text> nodes it generates, so axis labels, data
    labels, legends and tooltips are the only panel text that does not
    inherit from `html`. This is the sole reason !important appears in
    this file, and it is deliberately limited to the text nodes: the
    chart's <path>/<rect>/<circle> marks, colours and layout are
    untouched, and no other charting or icon library is targeted.
*/
.apexcharts-canvas text,
.apexcharts-canvas .apexcharts-title-text,
.apexcharts-canvas .apexcharts-legend-text,
.apexcharts-tooltip,
.apexcharts-tooltip-title,
.apexcharts-xaxistooltip,
.apexcharts-yaxistooltip {
    font-family: var(--font-family), var(--homei-font-sans), ui-sans-serif, system-ui, sans-serif !important;
}
