/*
 * EW Design System — typography, fonts, and design tokens.
 * Self-hosted Kanit (headings) + Prompt (body). Loaded after AdminLTE so the
 * :root tokens here win. See docs/UI-PATTERNS.md for the full system.
 */

/* ---- Self-hosted font: IBM Plex Sans Thai (woff2, latin + thai subsets) ---- */
@font-face {
    font-family: 'IBM Plex Sans Thai';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/ibm-plex-sans-thai-v11-latin_thai-regular.woff2') format('woff2');
}
@font-face {
    font-family: 'IBM Plex Sans Thai';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('../fonts/ibm-plex-sans-thai-v11-latin_thai-500.woff2') format('woff2');
}
@font-face {
    font-family: 'IBM Plex Sans Thai';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('../fonts/ibm-plex-sans-thai-v11-latin_thai-600.woff2') format('woff2');
}
@font-face {
    font-family: 'IBM Plex Sans Thai';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('../fonts/ibm-plex-sans-thai-v11-latin_thai-700.woff2') format('woff2');
}

/* ---- Design tokens ---- */
:root {
    /* Font family — single font for the whole app (headings differ by weight only) */
    --font-heading: 'IBM Plex Sans Thai', system-ui, -apple-system, 'Segoe UI', 'Noto Sans Thai', sans-serif;
    --font-body: 'IBM Plex Sans Thai', system-ui, -apple-system, 'Segoe UI', 'Noto Sans Thai', sans-serif;

    /* Type scale — every size scales with --fs-scale (A−/A/A+ buttons in navbar) */
    --fs-scale: 1;
    --fs-display: calc(2rem * var(--fs-scale));     /* 32px — KPI / summary numbers */
    --fs-h1: calc(1.5rem * var(--fs-scale));        /* 24px — page title */
    --fs-h2: calc(1.25rem * var(--fs-scale));       /* 20px — card / section title */
    --fs-lg: calc(1.125rem * var(--fs-scale));      /* 18px — lead / emphasized text, small heading */
    --fs-h3: calc(1.05rem * var(--fs-scale));       /* ~17px — subsection / item name */
    --fs-base: calc(1rem * var(--fs-scale));        /* 16px — body */
    --fs-sm: calc(0.875rem * var(--fs-scale));      /* 14px — secondary / table / label */
    --fs-xs: calc(0.75rem * var(--fs-scale));       /* 12px — badge / hint / btn-sm */

    /* Brand + semantic colors */
    --brand-green: #198754;
    --warning: #ffc107;
    --warning-text: #997404;
    --color-primary: #0d6efd;
    --color-danger: #dc3545;
    --color-info: #0dcaf0;
    --color-secondary: #6c757d;

    /* Categorical chart series palette */
    --chart-1: #0d6efd;
    --chart-2: #198754;
    --chart-3: #dc3545;
    --chart-4: #fd7e14;
    --chart-5: #6f42c1;
    --chart-6: #20c997;
    --chart-7: #d63384;
    --chart-8: #0dcaf0;
    --chart-9: #ffc107;
    --chart-10: #6610f2;

    /* Radius scale (soft) */
    --radius-sm: 0.375rem;   /* 6px — inputs, buttons, badges */
    --radius: 0.75rem;       /* 12px — status boxes, chips */
    --radius-lg: 1rem;       /* 16px — cards */
    --radius-xl: 1.5rem;     /* 24px — login / hero panels */

    /* Elevation */
    --shadow: 0 1rem 2.5rem rgba(17, 24, 39, 0.08);
    --shadow-lg: 0 1.5rem 4rem rgba(15, 23, 42, 0.12);
    --focus-ring: 0 0 0 0.25rem rgba(13, 110, 253, 0.12);
    --accent-selected: inset 4px 0 0 #0d6efd;

    /* Apply body font + scalable size through Bootstrap's own variables
       (scales .small and other em/default text along with the tokens). */
    --bs-body-font-family: var(--font-body);
    --bs-body-font-size: calc(1rem * var(--fs-scale));
}

/* ---- Base application ---- */
body {
    font-family: var(--font-body);
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--font-heading);
    font-weight: 600;
}

h1, .h1 { font-size: var(--fs-h1); }
h2, .h2 { font-size: var(--fs-h2); }
h3, .h3 { font-size: var(--fs-h3); }
h4, .h4 { font-size: var(--fs-base); }
h5, .h5 { font-size: var(--fs-sm); }
h6, .h6 { font-size: var(--fs-sm); }

/* KPI / summary number helper (replaces the per-page clamp values).
   Numbers use the body font (Prompt) per the design decision. */
.fs-display {
    font-family: var(--font-body);
    font-size: var(--fs-display);
    font-weight: 700;
    line-height: 1;
}
