/*
 * QOSCO design system: tokens.
 * The only place raw colours, sizes, spacing, radii, shadows and motion are written.
 * Components (ds.css) and pages use these variables only. A brand (Qosco, LEK) is a
 * token layer: override the --brand-* values under [data-brand="…"]; components never change.
 */

:root {
    /* Brand: Qosco (default). The colours the platform already uses. */
    --brand-primary: #0f766e;
    --brand-primary-strong: #0c5f59;
    --brand-primary-soft: #dff2ed;
    --brand-accent: #e45f4f;
    --brand-ink: #102c31;

    /* Neutral roles */
    --color-canvas: #f3f5f2;
    --color-surface: #ffffff;
    --color-surface-raised: #eef2ee;
    --color-surface-sunken: #e5ebe6;
    --color-text: var(--brand-ink);
    --color-text-soft: #355159;
    --color-text-muted: #6a7e82;
    --color-line: #dbe3dd;
    --color-line-strong: #c4d0c8;
    --color-focus: var(--brand-primary);
    --color-on-primary: #ffffff;
    --color-overlay: rgba(7, 21, 24, 0.48);

    /* App frame: a deep brand sidebar, so content stays calm and bright. */
    --sidebar-bg: #0b2a2e;
    --sidebar-text: #d7e6e3;
    --sidebar-muted: #8fb0ab;
    --sidebar-hover: rgba(255, 255, 255, 0.06);
    --sidebar-active-bg: rgba(57, 185, 170, 0.18);
    --sidebar-active-text: #ffffff;
    --sidebar-line: rgba(255, 255, 255, 0.08);
    --logo-tile: #ffffff;

    /* Status roles: text colour, soft background */
    --color-success: #21845a;
    --color-success-soft: #e2f4e9;
    --color-warning: #b87712;
    --color-warning-soft: #fff2d8;
    --color-danger: #c84343;
    --color-danger-soft: #fee8e6;
    --color-info: #24729a;
    --color-info-soft: #e3f1f8;
    --color-neutral: #6a7e82;
    --color-neutral-soft: #eef2ee;

    /* Type: one family, one scale. */
    --font-sans: 'ThmanyahSans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
    --font-display: 'ThmanyahDisplay', var(--font-sans);
    --text-xs: 0.75rem;   /* 12 */
    --text-sm: 0.8125rem; /* 13 */
    --text-md: 0.9375rem; /* 15: body */
    --text-lg: 1.0625rem; /* 17 */
    --text-xl: 1.375rem;  /* 22: page title */
    --text-2xl: 1.75rem;  /* 28: stat value */
    --leading-tight: 1.3;
    --leading-body: 1.6;
    --weight-regular: 400;
    --weight-medium: 500;
    --weight-bold: 700;

    /* Space: 4px steps */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;

    /* Shape and depth */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-pill: 999px;
    --border-width: 1px;
    --shadow-sm: 0 1px 2px rgba(16, 44, 49, 0.05), 0 4px 18px rgba(16, 44, 49, 0.04);
    --shadow-md: 0 16px 48px rgba(16, 44, 49, 0.1);

    /* Sizes */
    --control-height: 2.5rem;
    --control-height-sm: 2rem;
    --icon-sm: 1rem;
    --icon-md: 1.25rem;
    --sidebar-width: 17rem;
    --sidebar-collapsed-width: 4.5rem;
    --topbar-height: 4rem;
    --content-max: 90rem;
    --dialog-width: 32rem;

    /* Motion */
    --motion-fast: 120ms;
    --motion-base: 200ms;
    --ease: cubic-bezier(0.2, 0, 0, 1);

    /* Layers */
    --z-sticky: 10;
    --z-drawer: 40;
    --z-dialog: 50;

    /* ------------------------------------------------------------------
     * System v2 (docs/design-system/SYSTEM.md). New names only: nothing
     * uses them until a page opts in, so the current screens do not change.
     * ------------------------------------------------------------------ */

    /* Type: 6 fixed steps + 2 fluid display steps, shared by Blade and React. */
    --font-text: 'ThmanyahText', var(--font-sans);
    --type-xs: 0.75rem;     /* 12: badges, captions */
    --type-sm: 0.875rem;    /* 14: secondary text, table cells, buttons */
    --type-md: 1rem;        /* 16: body */
    --type-lg: 1.125rem;    /* 18: lead text, card titles */
    --type-xl: 1.375rem;    /* 22: page title, card heading on public pages */
    --type-2xl: 1.75rem;    /* 28: stat values */
    --type-3xl: clamp(1.75rem, 1.35rem + 1.6vw, 2.5rem);  /* 28 → 40: section titles */
    --type-4xl: clamp(2.25rem, 1.55rem + 3vw, 3.75rem);   /* 36 → 60: the one hero title */
    --leading-display: 1.15;
    --leading-snug: 1.4;
    --leading-text: 1.7;
    --tracking-display: -0.01em;
    --weight-black: 900;

    /* Space: 4px base. 12–24 are for page and section rhythm only. */
    --space-0: 0;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-20: 5rem;
    --space-24: 6rem;
    --space-section: clamp(3rem, 2rem + 4vw, 6rem);
    --space-gutter: clamp(1rem, 0.4rem + 2.6vw, 2.5rem);

    /* Layout */
    --layout-max: 75rem;     /* 1200: public content */
    --layout-measure: 38rem; /* readable line length */
    --header-height: 4.5rem;
    --logo-height: 2.75rem;  /* the Qosco mark keeps its own 445:318 shape */
    --focus-ring: 2px;
    --control-height-lg: 3rem;
    --card-min: 17.5rem;     /* narrowest card in an auto grid */
    --price-symbol: 0.85em;  /* riyal symbol, relative to the price text */

    /* Shape */
    --radius-xs: 6px;
    --radius-xl: 24px;
    --border-hairline: 1px;
    --color-line-subtle: #e8ede9;

    /* Elevation: one signal per surface. Border OR shadow, never both. */
    --elev-0: none;
    --elev-1: 0 1px 2px rgba(16, 44, 49, 0.04), 0 2px 10px rgba(16, 44, 49, 0.05);
    --elev-2: 0 6px 24px rgba(16, 44, 49, 0.09);
    --elev-3: 0 18px 48px rgba(16, 44, 49, 0.16);

    /* Icons: Lucide everywhere. */
    --icon-xs: 0.875rem;
    --icon-lg: 1.5rem;
    --icon-stroke: 1.75;

    /* Motion */
    --duration-instant: 80ms;
    --duration-fast: 140ms;
    --duration-base: 220ms;
    --duration-slow: 420ms;
    --duration-enter: 640ms;
    --ease-standard: cubic-bezier(0.2, 0, 0, 1);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in: cubic-bezier(0.4, 0, 1, 1);
    --stagger-step: 70ms;
    --enter-distance: 0.75rem;
    --hover-lift: -2px;
    --press-scale: 0.97;

    /* Public surfaces */
    --color-band: var(--brand-ink);
    --color-on-band: #ffffff;
    --color-on-band-muted: rgba(255, 255, 255, 0.72);
    --color-header: rgba(255, 255, 255, 0.86);
    --color-scrim-media: linear-gradient(to top, rgba(7, 21, 24, 0.55), rgba(7, 21, 24, 0));
    --backdrop-blur: blur(16px);

    color-scheme: light;
}

/* Reduced motion: every named animation collapses to an instant state change. */
@media (prefers-reduced-motion: reduce) {
    :root {
        --duration-fast: 0ms;
        --duration-base: 0ms;
        --duration-slow: 0ms;
        --duration-enter: 0ms;
        --stagger-step: 0ms;
        --enter-distance: 0;
        --hover-lift: 0;
        --press-scale: 1;
    }
}

/*
 * The sample switch (owner review, 12 Nov 2026). Pages that opt in carry
 * data-ds="2" on <html>; only there do the shared sizes move to the v2 scale.
 * Rollback: remove this block and the data-ds attribute.
 */
[data-ds='2'] {
    --text-sm: var(--type-sm);
    --text-md: var(--type-md);
    --text-lg: var(--type-lg);
    --radius-lg: 16px;
    --shadow-sm: var(--elev-1);
    --shadow-md: var(--elev-3);
    --motion-fast: var(--duration-fast);
    --motion-base: var(--duration-base);
    --ease: var(--ease-standard);
}

/* Brand: LEK. Values are placeholders taken from lek-ksa.com; confirm against LEK's logo before launch. */
[data-brand='lek'] {
    --sidebar-bg: #221437;
    --sidebar-active-bg: rgba(169, 140, 224, 0.2);
    --brand-primary: #4c2d85;
    --brand-primary-strong: #391139;
    --brand-primary-soft: #ece6f6;
    --brand-accent: #db726d;
    --brand-ink: #241a33;
}

[data-theme='dark'] {
    --sidebar-bg: #061417;
    --brand-primary: #39b9aa;
    --brand-primary-strong: #58c9bb;
    --brand-primary-soft: #123c3a;
    --brand-ink: #f0f6f4;
    --color-canvas: #071518;
    --color-surface: #0d2226;
    --color-surface-raised: #112b30;
    --color-surface-sunken: #19353a;
    --color-text-soft: #bdd0ce;
    --color-text-muted: #8ca5a4;
    --color-line: #254146;
    --color-line-strong: #33555b;
    --color-on-primary: #071518;
    --color-overlay: rgba(0, 0, 0, 0.6);
    --color-success: #66d59d;
    --color-success-soft: #15392a;
    --color-warning: #f4bc56;
    --color-warning-soft: #3a2b13;
    --color-danger: #ff8179;
    --color-danger-soft: #42211f;
    --color-info: #66b8e1;
    --color-info-soft: #16384b;
    --color-neutral: #8ca5a4;
    --color-neutral-soft: #19353a;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.18);
    --shadow-md: 0 20px 56px rgba(0, 0, 0, 0.34);
    --color-line-subtle: #1b3337;
    --elev-1: 0 1px 2px rgba(0, 0, 0, 0.22);
    --elev-2: 0 8px 28px rgba(0, 0, 0, 0.32);
    --elev-3: 0 20px 56px rgba(0, 0, 0, 0.44);
    --color-band: #10292d;
    --color-header: rgba(7, 21, 24, 0.82);
    color-scheme: dark;
}

/* The v2 overrides above also apply in dark mode; dark values come from the elev tokens. */
[data-theme='dark'][data-ds='2'] {
    --shadow-sm: var(--elev-1);
    --shadow-md: var(--elev-3);
}

[data-theme='dark'][data-brand='lek'] {
    --brand-primary: #a98ce0;
    --brand-primary-strong: #c0a9ec;
    --brand-primary-soft: #2c2142;
    --brand-ink: #f3effa;
}
