/* ==========================================================================
   English Learning Center — Design tokens
   Single source of truth for colour, typography, spacing, radius, elevation.
   Light theme  : :root
   Dark theme   : [data-theme="dark"]
   Never hard-code a colour in a page template — use these variables.
   ========================================================================== */

:root {
    color-scheme: light;

    /* ---------- Brand ramp: deep navy -> modern medium blue ---------- */
    --brand-950: #061a33;
    --brand-900: #0b2545;
    --brand-800: #0f3563;
    --brand-700: #14478a;
    --brand-600: #1d5bb8;
    --brand-500: #2563eb;
    --brand-400: #558bf5;
    --brand-300: #93b4fb;
    --brand-200: #c0d3fd;
    --brand-100: #dbe7ff;
    --brand-50: #eff5ff;

    /* ---------- Brand anchors ----------
       The two canonical identity colours. Screen-scoped brand surfaces (the
       dashboard header and its navigation bar) use these instead of a ramp
       step, so the primary blue stays #2563EB and the dark blue #1E40AF. */
    --brand-primary: #2563eb;
    --brand-deep: #1e40af;
    --brand-on-primary: #ffffff;

    /* ---------- Raw semantic hues ---------- */
    --green-800: #166534;
    --green-700: #15803d;
    --green-600: #16a34a;
    --green-100: #dcfce7;
    --green-50: #f2fdf5;

    --amber-800: #92400e;
    --amber-700: #b45309;
    --amber-600: #d97706;
    --amber-100: #fef3c7;
    --amber-50: #fffbeb;

    --red-800: #991b1b;
    --red-700: #b91c1c;
    --red-600: #dc2626;
    --red-100: #fee2e2;
    --red-50: #fef4f4;

    --violet-800: #5b21b6;
    --violet-700: #6d28d9;
    --violet-600: #7c3aed;
    --violet-100: #ede9fe;
    --violet-50: #f6f3ff;

    --sky-700: #0369a1;
    --sky-100: #e0f2fe;
    --sky-50: #f1f9ff;

    /* ---------- Surfaces & background ---------- */
    --bg: #f4f6fb;
    --bg-accent: radial-gradient(1200px 520px at 100% -10%, var(--brand-50), transparent 70%);
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --surface-muted: #eef2f8;
    --surface-inverse: var(--brand-900);
    --surface-overlay: rgba(15, 23, 42, 0.55);

    /* ---------- Text ---------- */
    --text: #0f172a;
    --text-2: #3d4c63;
    --text-muted: #64748b;
    --text-faint: #94a3b8;
    --text-inverse: #ffffff;

    /* ---------- Borders & lines ---------- */
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --border-subtle: #eef1f6;

    /* ---------- Primary action ---------- */
    --primary: var(--brand-600);
    --primary-hover: var(--brand-700);
    --primary-active: var(--brand-800);
    --primary-soft: var(--brand-50);
    --primary-soft-border: var(--brand-200);
    --primary-contrast: #ffffff;

    /* ---------- Semantic states ---------- */
    --success: var(--green-700);
    --success-hover: var(--green-800);
    --success-soft: var(--green-50);
    --success-border: #bbe7c8;
    --success-text: var(--green-800);

    --warning: var(--amber-600);
    --warning-hover: var(--amber-700);
    --warning-soft: var(--amber-50);
    --warning-border: #f6dfa6;
    --warning-text: var(--amber-800);

    --danger: var(--red-600);
    --danger-hover: var(--red-700);
    --danger-soft: var(--red-50);
    --danger-border: #f7cccc;
    --danger-text: var(--red-800);

    --info: var(--sky-700);
    --info-soft: var(--sky-50);
    --info-border: #bfe3fb;
    --info-text: #0b4f78;

    --accent: var(--violet-700);
    --accent-soft: var(--violet-50);
    --accent-border: #ddd2fb;
    --accent-text: var(--violet-800);

    --neutral: var(--text-muted);
    --neutral-soft: var(--surface-muted);
    --neutral-border: var(--border);
    --neutral-text: var(--text-2);
    /* ---------- Focus ---------- */
    --focus-ring: 0 0 0 3px rgba(37, 99, 235, 0.28);
    --focus-ring-danger: 0 0 0 3px rgba(220, 38, 38, 0.25);
    --focus-outline: 2px solid var(--brand-500);

    /* ---------- Elevation ---------- */
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.07), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 6px 18px -6px rgba(15, 23, 42, 0.16), 0 2px 6px rgba(15, 23, 42, 0.05);
    --shadow-lg: 0 18px 40px -18px rgba(15, 23, 42, 0.3), 0 6px 14px rgba(15, 23, 42, 0.06);
    --shadow-pop: 0 12px 28px -10px rgba(15, 23, 42, 0.28);
    --appbar-shadow: 0 1px 0 var(--border), 0 6px 20px -18px rgba(15, 23, 42, 0.4);

    /* ---------- Radius ---------- */
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-pill: 999px;
    --radius: var(--radius-md);

    /* ---------- Spacing scale (4px base) ---------- */
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 20px;
    --sp-6: 24px;
    --sp-7: 32px;
    --sp-8: 40px;
    --sp-9: 48px;
    --sp-10: 64px;

    /* ---------- Typography ---------- */
    --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
        "Noto Sans Arabic", "Segoe UI Web (Arabic)", Tahoma, Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, monospace;

    --fs-2xs: 0.6875rem;
    --fs-xs: 0.75rem;
    --fs-sm: 0.875rem;
    --fs-base: 0.9375rem;
    --fs-md: 1rem;
    --fs-lg: 1.0625rem;
    --fs-xl: 1.25rem;
    --fs-2xl: 1.5rem;
    --fs-3xl: 1.875rem;
    --fs-4xl: 2.25rem;

    --fw-regular: 400;
    --fw-medium: 500;
    --fw-semibold: 600;
    --fw-bold: 700;

    --lh-tight: 1.2;
    --lh-snug: 1.35;
    --lh-normal: 1.55;

    --ls-tight: -0.01em;
    --ls-wide: 0.02em;
    --ls-caps: 0.06em;

    /* ---------- Controls & density ---------- */
    --control-h: 40px;
    --control-h-sm: 32px;
    --control-h-lg: 46px;
    --control-px: 12px;
    --row-h: 56px;
    --row-h-dense: 46px;
    --appbar-h: 64px;
    --content-max: 1440px;

    /* ---------- Motion ---------- */
    --ease: cubic-bezier(0.32, 0.72, 0, 1);
    --dur-fast: 120ms;
    --dur: 180ms;
    --dur-slow: 260ms;

    /* ---------- Layout ---------- */
    --z-appbar: 60;
    --z-drawer: 70;
    --z-dropdown: 80;
    --z-modal: 90;
    --z-toast: 100;

    /* ---------- Charts ---------- */
    --chart-1: var(--brand-500);
    --chart-2: var(--violet-600);
    --chart-3: var(--sky-700);
    --chart-4: var(--amber-600);
    --chart-5: var(--green-600);
    --chart-6: #0ea5a5;
    --chart-grid: var(--border);
    --chart-axis: var(--text-faint);
}
/* ==========================================================================
   Dark theme — deliberately designed, never a simple inversion.
   ========================================================================== */
[data-theme="dark"] {
    color-scheme: dark;

    --brand-50: #101d33;
    --brand-100: #16294a;
    --brand-200: #1d3a66;
    --brand-300: #2c56a0;
    --brand-400: #3f77d6;
    --brand-500: #4c8dff;
    --brand-600: #5c98ff;
    --brand-700: #7cadff;
    --brand-800: #a5c6ff;
    --brand-900: #0b1220;

    /* Identity colours stay the same in both themes: the brand surfaces are
       fixed blue, not theme-dependent surfaces. */
    --brand-primary: #2563eb;
    --brand-deep: #1e40af;
    --brand-on-primary: #ffffff;

    --bg: #070c17;
    --bg-accent: radial-gradient(1100px 520px at 100% -10%, rgba(37, 99, 235, 0.16), transparent 72%);
    --surface: #101a2b;
    --surface-2: #16223a;
    --surface-muted: #1b2942;
    --surface-inverse: #0b1220;
    --surface-overlay: rgba(2, 6, 23, 0.72);

    --text: #e9eefa;
    --text-2: #c2cddf;
    --text-muted: #93a2ba;
    --text-faint: #78889f;
    --text-inverse: #0b1220;

    --border: #24314b;
    --border-strong: #33445f;
    --border-subtle: #1b2740;

    --primary: #4c8dff;
    --primary-hover: #6aa1ff;
    --primary-active: #3f7fe8;
    --primary-soft: rgba(76, 141, 255, 0.14);
    --primary-soft-border: rgba(76, 141, 255, 0.34);
    --primary-contrast: #06142b;

    --success: #34d399;
    --success-hover: #5ee0ad;
    --success-soft: rgba(52, 211, 153, 0.14);
    --success-border: rgba(52, 211, 153, 0.32);
    --success-text: #7ee7bf;

    --warning: #fbbf24;
    --warning-hover: #fcd34d;
    --warning-soft: rgba(251, 191, 36, 0.14);
    --warning-border: rgba(251, 191, 36, 0.32);
    --warning-text: #fcd88a;

    --danger: #f87171;
    --danger-hover: #fca5a5;
    --danger-soft: rgba(248, 113, 113, 0.14);
    --danger-border: rgba(248, 113, 113, 0.32);
    --danger-text: #fca5a5;

    --info: #38bdf8;
    --info-soft: rgba(56, 189, 248, 0.14);
    --info-border: rgba(56, 189, 248, 0.32);
    --info-text: #86dbfb;

    --accent: #a78bfa;
    --accent-soft: rgba(167, 139, 250, 0.16);
    --accent-border: rgba(167, 139, 250, 0.34);
    --accent-text: #c4b1fd;

    --neutral: var(--text-muted);
    --neutral-soft: var(--surface-muted);
    --neutral-border: var(--border);
    --neutral-text: var(--text-2);

    --focus-ring: 0 0 0 3px rgba(76, 141, 255, 0.4);
    --focus-ring-danger: 0 0 0 3px rgba(248, 113, 113, 0.35);
    --focus-outline: 2px solid var(--brand-500);

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.45);
    --shadow-md: 0 8px 22px -12px rgba(0, 0, 0, 0.7), 0 2px 6px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 22px 48px -20px rgba(0, 0, 0, 0.8), 0 8px 18px rgba(0, 0, 0, 0.4);
    --shadow-pop: 0 16px 34px -14px rgba(0, 0, 0, 0.75);
    --appbar-shadow: 0 1px 0 var(--border), 0 10px 30px -24px rgba(0, 0, 0, 0.9);

    --chart-1: #4c8dff;
    --chart-2: #a78bfa;
    --chart-3: #38bdf8;
    --chart-4: #fbbf24;
    --chart-5: #34d399;
    --chart-6: #2dd4bf;
    --chart-grid: rgba(255, 255, 255, 0.08);
    --chart-axis: var(--text-faint);
}
/* "Auto" (follow system) is resolved to light/dark by static/js/theme.js before
   first paint, so these tokens only ever need two states. */
/* @@TOKENS_END@@ */
