/* =============================================================================
 * wf-tokens.css — the WealthFlow design tokens, and nothing else
 * -----------------------------------------------------------------------------
 * ONE SOURCE OF TRUTH FOR COLOUR, TYPE, SPACE, RADIUS AND MOTION.
 *
 * This file holds custom properties and the @font-face for Geist — no selectors
 * that style an element — so any WealthFlow surface can load it without changing
 * how its markup looks:
 * the app (via wf-ui.css), the customer portal, a printed statement, a landing
 * page. A surface that adopts the tokens gets the same gold, the same ink, the
 * same type scale and the same dark/light behaviour as the app without copying
 * a hex code.
 *
 * THEMES
 *   Dark ("Ink") is the default. Light ("Ivory") applies under
 *   [data-theme="light"] — the attribute the app already sets on <html>. A
 *   surface that wants to follow the device instead can add
 *   data-theme-auto="" to <html>; the media query below then does the switching
 *   until an explicit data-theme is set.
 *
 * WHY THESE VALUES
 *   · Surfaces are separated by LUMINANCE steps, not by glow or heavy borders,
 *     which is what makes a banking app read as calm.
 *   · Text greys are chosen to clear WCAG 2.2 AA (4.5:1) on every surface they
 *     are used on, in both themes. text-3 is the faintest allowed for copy a
 *     person must read; nothing important is set in it.
 *   · One accent (the logo's gold). Green and red mean money in and money out
 *     and are never used decoratively.
 *   · Numbers are tabular everywhere, so a column of amounts lines up.
 * ===========================================================================*/

/* ── Geist, self-hosted ───────────────────────────────────────────────────────
   Served from our own origin (SIL OFL 1.1, see assets/fonts/OFL.txt) rather than
   Google Fonts: no third-party round-trip before text can paint, it works under
   the portal's `font-src 'self'` policy, and the numerals the whole interface is
   built around never swap to a different face mid-load. Absolute paths so the
   file resolves the same from /, /t/<token> and any future surface.
   Sinhala is NOT in Geist; it falls through the stack below to Noto Sans Sinhala. */
@font-face {
    font-family: 'Geist'; font-style: normal; font-weight: 100 900; font-display: swap;
    src: url(/assets/fonts/geist-latin-ext.woff2) format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Geist'; font-style: normal; font-weight: 100 900; font-display: swap;
    src: url(/assets/fonts/geist-latin.woff2) format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Geist Mono'; font-style: normal; font-weight: 100 900; font-display: swap;
    src: url(/assets/fonts/geist-mono-latin.woff2) format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    /* ── Type ─────────────────────────────────────────────────────────────── */
    --wf-font: 'Geist', 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto,
        'Noto Sans Sinhala', 'Iskoola Pota', 'Noto Sans', sans-serif;
    --wf-font-mono: 'Geist Mono', ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;

    --wf-fs-2xs: 11px;
    --wf-fs-xs: 12px;
    --wf-fs-sm: 13px;
    --wf-fs-md: 14px;
    --wf-fs-lg: 16px;
    --wf-fs-xl: 18px;
    --wf-fs-2xl: 22px;
    --wf-fs-3xl: 28px;
    --wf-fs-4xl: 36px;
    --wf-fs-display: clamp(32px, 6vw, 48px);

    /* ── Space (4-pt grid) ───────────────────────────────────────────────── */
    --wf-s1: 4px;
    --wf-s2: 8px;
    --wf-s3: 12px;
    --wf-s4: 16px;
    --wf-s5: 20px;
    --wf-s6: 24px;
    --wf-s8: 32px;
    --wf-s10: 40px;
    --wf-s12: 48px;

    /* ── Radius ───────────────────────────────────────────────────────────── */
    --wf-r-xs: 6px;
    --wf-r-sm: 10px;
    --wf-r-md: 14px;
    --wf-r-lg: 18px;
    --wf-r-xl: 24px;
    --wf-r-pill: 999px;

    /* ── Motion ───────────────────────────────────────────────────────────── */
    --wf-ease: cubic-bezier(.2, .7, .2, 1);
    --wf-ease-spring: cubic-bezier(.34, 1.4, .64, 1);
    --wf-dur-1: 120ms;
    --wf-dur-2: 200ms;
    --wf-dur-3: 320ms;

    /* ── Layers ───────────────────────────────────────────────────────────── */
    /* These mirror what index.html already ships (modal 200, toast 600), so adopting
       the scale re-orders nothing; the new layers slot in between. */
    --wf-z-nav: 60;
    --wf-z-modal: 200;
    --wf-z-sheet: 550;
    --wf-z-palette: 560;
    --wf-z-toast: 600;

    /* ── Brand (from the logo; the same in both themes) ──────────────────── */
    --wf-gold-300: #efd58a;
    --wf-gold-400: #e4c26b;
    --wf-gold-500: #d4a94a;
    --wf-gold-600: #b98b2b;
    --wf-gold-700: #8f6a1b;
    --wf-logo-green: #44a84f;

    /* ── Dark theme ("Ink") ──────────────────────────────────────────────── */
    color-scheme: dark;
    --wf-bg: #0a0d13;
    --wf-surface: #0f131b;
    --wf-card: #141a25;
    --wf-card-2: #1a2230;
    --wf-card-3: #232e42;
    --wf-line: #222b3b;
    --wf-line-2: #303c53;
    --wf-line-3: #566380;          /* a form control's edge: 3:1 against its field (WCAG 1.4.11) */
    --wf-text: #eef1f7;
    --wf-text-2: #aab3c5;
    --wf-text-3: #8f9bb1;
    --wf-accent: var(--wf-gold-400);
    --wf-accent-fill: var(--wf-gold-400);
    --wf-accent-fill-2: var(--wf-gold-500);
    --wf-accent-ink: #17120a;
    --wf-accent-soft: rgba(228, 194, 107, .13);
    --wf-accent-line: rgba(228, 194, 107, .34);
    --wf-pos: #3dd28d;
    --wf-pos-soft: rgba(61, 210, 141, .13);
    --wf-neg: #ff6b78;
    --wf-neg-soft: rgba(255, 107, 120, .13);
    --wf-warn: #f5b454;
    --wf-warn-soft: rgba(245, 180, 84, .13);
    --wf-info: #6ea8ff;
    --wf-info-soft: rgba(110, 168, 255, .13);
    --wf-violet: #a493ff;
    --wf-violet-soft: rgba(164, 147, 255, .13);
    --wf-teal: #3cc8d8;
    --wf-teal-soft: rgba(60, 200, 216, .13);
    --wf-overlay: rgba(4, 6, 10, .66);
    --wf-hover: rgba(255, 255, 255, .045);
    --wf-press: rgba(255, 255, 255, .08);
    --wf-shadow-1: 0 1px 2px rgba(0, 0, 0, .35);
    --wf-shadow-2: 0 8px 28px rgba(0, 0, 0, .38), 0 1px 0 rgba(255, 255, 255, .03) inset;
    --wf-shadow-3: 0 24px 64px rgba(0, 0, 0, .55);
    --wf-focus: 0 0 0 3px rgba(228, 194, 107, .38);
    --wf-chart-grid: rgba(255, 255, 255, .06);
    --wf-field: #0d1118;
}

/* ── Light theme ("Ivory") ───────────────────────────────────────────────── */
[data-theme="light"] {
    color-scheme: light;
    --wf-bg: #f4f5f8;
    --wf-surface: #ffffff;
    --wf-card: #ffffff;
    --wf-card-2: #f3f4f8;
    --wf-card-3: #e8ebf1;
    --wf-line: #e4e7ee;
    --wf-line-2: #d0d6e1;
    --wf-line-3: #818ca2;
    --wf-text: #0f1420;
    --wf-text-2: #444e61;
    --wf-text-3: #566074;
    --wf-accent: #7a5a08;
    --wf-accent-fill: var(--wf-gold-400);
    --wf-accent-fill-2: var(--wf-gold-500);
    --wf-accent-ink: #1a1405;
    --wf-accent-soft: rgba(185, 139, 43, .12);
    --wf-accent-line: rgba(138, 102, 9, .4);
    --wf-pos: #066b40;
    --wf-pos-soft: rgba(11, 138, 82, .1);
    --wf-neg: #b81f33;
    --wf-neg-soft: rgba(207, 42, 64, .09);
    --wf-warn: #965608;
    --wf-warn-soft: rgba(217, 130, 20, .12);
    --wf-info: #1f5fd6;
    --wf-info-soft: rgba(31, 95, 214, .09);
    --wf-violet: #6246d6;
    --wf-violet-soft: rgba(98, 70, 214, .09);
    --wf-teal: #0b7f90;
    --wf-teal-soft: rgba(11, 127, 144, .09);
    --wf-overlay: rgba(15, 20, 32, .46);
    --wf-hover: rgba(15, 20, 32, .04);
    --wf-press: rgba(15, 20, 32, .07);
    --wf-shadow-1: 0 1px 2px rgba(17, 24, 39, .06);
    --wf-shadow-2: 0 8px 28px rgba(17, 24, 39, .09), 0 1px 2px rgba(17, 24, 39, .04);
    --wf-shadow-3: 0 24px 64px rgba(17, 24, 39, .2);
    --wf-focus: 0 0 0 3px rgba(138, 102, 9, .32);
    --wf-chart-grid: rgba(15, 20, 32, .07);
    --wf-field: #f6f7fa;
}

/* A surface that wants to follow the device sets data-theme-auto on <html> and
   leaves data-theme off; the app itself always sets data-theme explicitly. */
@media (prefers-color-scheme: light) {
    :root[data-theme-auto]:not([data-theme]) {
        color-scheme: light;
        --wf-bg: #f4f5f8;
        --wf-surface: #ffffff;
        --wf-card: #ffffff;
        --wf-card-2: #f3f4f8;
        --wf-card-3: #e8ebf1;
        --wf-line: #e4e7ee;
        --wf-line-2: #d0d6e1;
        --wf-line-3: #818ca2;
        --wf-text: #0f1420;
        --wf-text-2: #444e61;
        --wf-text-3: #566074;
        --wf-accent: #7a5a08;
        --wf-accent-soft: rgba(185, 139, 43, .12);
        --wf-accent-line: rgba(138, 102, 9, .4);
        --wf-pos: #066b40;
        --wf-neg: #b81f33;
        --wf-warn: #965608;
        --wf-info: #1f5fd6;
        --wf-overlay: rgba(15, 20, 32, .46);
        --wf-hover: rgba(15, 20, 32, .04);
        --wf-press: rgba(15, 20, 32, .07);
        --wf-shadow-2: 0 8px 28px rgba(17, 24, 39, .09), 0 1px 2px rgba(17, 24, 39, .04);
        --wf-focus: 0 0 0 3px rgba(138, 102, 9, .32);
    }
}

@media (prefers-reduced-motion: reduce) {
    :root {
        --wf-dur-1: 1ms;
        --wf-dur-2: 1ms;
        --wf-dur-3: 1ms;
    }
}
