/* ==========================================================================
   Design tokens — the single source of truth for the STS-ED look.

   Two tiers:

   1. PRIMITIVES  --stsed-{hue}-{weight}, raw palette values with no meaning
                  attached. Never referenced directly by component CSS.
   2. SEMANTIC    --stsed-color-*, --stsed-space-*, … what components actually
                  consume. Re-skinning the site means re-pointing these at
                  different primitives; no component CSS changes.

   Plugin CSS reads the semantic tier too, with its old hex as a fallback:
       background: var( --stsed-color-primary, #2a6f97 );
   so plugins still look right if used without this theme.

   DARK THEME: the values are authored at the bottom of this file but are NOT
   active — the site ships light-only for now. See the note there for how to
   turn it on.
   ========================================================================== */

:root {
    /* ---------------------------------------------------------------------
       Tier 1: primitives
       --------------------------------------------------------------------- */

    /* Brand blue — the header bar and primary actions. Ramp built around #0072bc
       as -600 (the menu-bar / primary colour); white text on it is AA (5.08:1). */
    --stsed-blue-50: #eaf4fb;
    --stsed-blue-100: #cfe6f6;
    --stsed-blue-200: #9fcdec;
    --stsed-blue-300: #63acdb;
    --stsed-blue-500: #2a8fce;
    --stsed-blue-600: #0072bc; /* primary */
    --stsed-blue-700: #005d9c;
    --stsed-blue-800: #004d81;
    --stsed-blue-900: #003a62;

    /* Plum — "My Courses" and course-side accents. */
    --stsed-plum-50: #fbeef5;
    --stsed-plum-100: #f3d3e5;
    --stsed-plum-500: #b83b85;
    --stsed-plum-600: #a0246e; /* accent */
    --stsed-plum-700: #841a5a;

    /* Teal — "My Events" and event-side accents. */
    --stsed-teal-50: #ecf8f6;
    --stsed-teal-100: #cdeee8;
    --stsed-teal-500: #3aa693; /* accent alt */
    --stsed-teal-600: #2f8b7b;
    --stsed-teal-700: #266f63;

    /* Status. */
    --stsed-green-50: #eaf7f0;
    --stsed-green-500: #52b788;
    --stsed-green-600: #3f9b70;
    --stsed-green-800: #2d6a4f;
    --stsed-red-50: #fdecec;
    --stsed-red-500: #e5383b;
    --stsed-red-600: #c92a2d;
    --stsed-red-800: #9d0208;
    --stsed-amber-50: #fff8e6;
    --stsed-amber-500: #ffc107;
    --stsed-amber-800: #7c4a03;

    /* Callout quartet — matched to the PDF/callout block palette. Keep in sync
       with stsed-callouts and stsed-lms/course-pdf.css. */
    --stsed-callout-blue: #86bbd8;
    --stsed-callout-amber: #ffc338;
    --stsed-callout-green: #bbe884;
    --stsed-callout-coral: #ff9b85;

    /* Neutrals — a slightly cool grey ramp to sit with the blue. */
    --stsed-grey-0: #ffffff;
    --stsed-grey-25: #fbfcfd;
    --stsed-grey-50: #f6f8fa;
    --stsed-grey-100: #eef1f4;
    --stsed-grey-200: #e2e6ea;
    --stsed-grey-300: #cfd5db;
    --stsed-grey-400: #aab3bc;
    --stsed-grey-500: #7d8892;
    --stsed-grey-600: #5c666f;
    --stsed-grey-700: #414a52;
    --stsed-grey-800: #2b3238;
    --stsed-grey-900: #1b1f23;

    /* ---------------------------------------------------------------------
       Tier 2: semantic — what component CSS consumes
       --------------------------------------------------------------------- */

    /* Brand / actions */
    --stsed-color-primary: var( --stsed-blue-600 );
    --stsed-color-primary-hover: var( --stsed-blue-800 );
    --stsed-color-primary-contrast: var( --stsed-grey-0 );
    --stsed-color-accent: var( --stsed-plum-600 );
    --stsed-color-accent-hover: var( --stsed-plum-700 );
    --stsed-color-accent-alt: var( --stsed-teal-500 );
    --stsed-color-accent-alt-hover: var( --stsed-teal-600 );

    /* Neutral action — the LMS "secondary" button. */
    --stsed-color-secondary: var( --stsed-grey-600 );
    --stsed-color-secondary-hover: var( --stsed-grey-700 );

    /* Status */
    --stsed-color-success: var( --stsed-green-500 );
    --stsed-color-success-strong: var( --stsed-green-800 );
    --stsed-color-success-bg: var( --stsed-green-50 );
    --stsed-color-danger: var( --stsed-red-500 );
    --stsed-color-danger-strong: var( --stsed-red-800 );
    --stsed-color-danger-bg: var( --stsed-red-50 );
    --stsed-color-warning: var( --stsed-amber-500 );
    --stsed-color-warning-strong: var( --stsed-amber-800 );
    --stsed-color-warning-strong-hover: #5a3602;
    --stsed-color-warning-bg: var( --stsed-amber-50 );

    /* Surfaces & text */
    --stsed-color-bg: var( --stsed-grey-50 );
    --stsed-color-surface: var( --stsed-grey-0 );
    --stsed-color-surface-sunken: var( --stsed-grey-100 );
    --stsed-color-surface-raised: var( --stsed-grey-0 );
    --stsed-color-text: var( --stsed-grey-900 );
    --stsed-color-text-muted: var( --stsed-grey-600 );
    --stsed-color-text-subtle: var( --stsed-grey-500 );
    --stsed-color-text-on-accent: var( --stsed-grey-0 );
    --stsed-color-border: var( --stsed-grey-200 );
    --stsed-color-border-strong: var( --stsed-grey-300 );

    /* Links */
    --stsed-color-link: var( --stsed-blue-600 );
    --stsed-color-link-hover: var( --stsed-blue-800 );

    /* Focus — must stay visible against every surface. */
    --stsed-color-focus: var( --stsed-blue-500 );
    --stsed-focus-ring: 0 0 0 3px color-mix( in srgb, var( --stsed-color-focus ) 40%, transparent );

    /* Header */
    --stsed-header-bg: var( --stsed-blue-600 );
    --stsed-header-text: var( --stsed-grey-0 );
    --stsed-header-hover-bg: var( --stsed-blue-700 );
    --stsed-header-active-bg: var( --stsed-blue-800 );
    --stsed-subheader-bg: var( --stsed-grey-0 );
    --stsed-subheader-text: var( --stsed-color-link );
    --stsed-subheader-border: var( --stsed-color-border );

    /* Footer */
    --stsed-footer-bg: var( --stsed-grey-800 );
    --stsed-footer-text: var( --stsed-grey-300 );
    --stsed-footer-link: var( --stsed-grey-0 );

    /* ---------------------------------------------------------------------
       Typography
       --------------------------------------------------------------------- */
    --stsed-font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --stsed-font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    --stsed-font-body: var( --stsed-font-sans );
    --stsed-font-heading: var( --stsed-font-sans );

    --stsed-text-xs: 0.75rem;
    --stsed-text-sm: 0.875rem;
    --stsed-text-base: 1rem;
    --stsed-text-lg: 1.125rem;
    --stsed-text-xl: 1.375rem;
    --stsed-text-2xl: 1.75rem;
    --stsed-text-3xl: 2.25rem;
    --stsed-text-4xl: 3rem;

    --stsed-leading-tight: 1.2;
    --stsed-leading-snug: 1.4;
    --stsed-leading-normal: 1.65;

    --stsed-weight-normal: 400;
    --stsed-weight-medium: 500;
    --stsed-weight-semibold: 600;
    --stsed-weight-bold: 700;

    /* Long-form reading measure — lesson content. */
    --stsed-measure: 70ch;

    /* ---------------------------------------------------------------------
       Space, radius, shadow, layout
       --------------------------------------------------------------------- */
    --stsed-space-3xs: 0.25rem;
    --stsed-space-2xs: 0.5rem;
    --stsed-space-xs: 0.75rem;
    --stsed-space-sm: 1rem;
    --stsed-space-md: 1.5rem;
    --stsed-space-lg: 2rem;
    --stsed-space-xl: 3rem;
    --stsed-space-2xl: 4rem;

    --stsed-radius-sm: 4px;
    --stsed-radius-md: 8px;
    --stsed-radius-lg: 12px;
    --stsed-radius-pill: 999px;

    /* Soft, low-contrast shadows — "light and professional", not heavy. */
    --stsed-shadow-xs: 0 1px 2px rgba( 27, 31, 35, 0.04 );
    --stsed-shadow-sm: 0 1px 3px rgba( 27, 31, 35, 0.06 ), 0 1px 2px rgba( 27, 31, 35, 0.04 );
    --stsed-shadow-md: 0 4px 12px rgba( 27, 31, 35, 0.08 );
    --stsed-shadow-lg: 0 12px 28px rgba( 27, 31, 35, 0.1 );

    --stsed-container: 1200px;
    --stsed-container-narrow: 820px;
    --stsed-sidebar-width: 18rem;
    --stsed-transition: 150ms ease;
}

/* ==========================================================================
   Dark theme (authored, INACTIVE)

   Only the SEMANTIC tier is redefined — primitives stay put and no component
   CSS is aware this exists.

   To turn dark mode on later:
     1. Add a toggle that sets data-stsed-theme="dark"|"light" on <html>, with
        an inline <head> script reading localStorage before first paint (avoids
        a flash of the wrong theme).
     2. Uncomment the prefers-color-scheme block to follow the OS by default.
   Nothing else needs to change.
   ========================================================================== */

[data-stsed-theme="dark"] {
    --stsed-color-bg: #14181c;
    --stsed-color-surface: #1c2126;
    --stsed-color-surface-sunken: #14181c;
    --stsed-color-surface-raised: #232930;

    --stsed-color-text: #e8ecef;
    --stsed-color-text-muted: #a3adb7;
    --stsed-color-text-subtle: #7d8892;
    --stsed-color-border: #2e353d;
    --stsed-color-border-strong: #3d454e;

    /* Lift the brand hues: #2a6f97 on a dark ground fails contrast, so the
       lighter primitives become primary and hover goes lighter, not darker. */
    --stsed-color-primary: var( --stsed-blue-300 );
    --stsed-color-primary-hover: var( --stsed-blue-200 );
    --stsed-color-primary-contrast: var( --stsed-grey-900 );
    --stsed-color-link: var( --stsed-blue-200 );
    --stsed-color-link-hover: var( --stsed-blue-100 );
    --stsed-color-accent: var( --stsed-plum-500 );
    --stsed-color-accent-hover: var( --stsed-plum-100 );
    --stsed-color-accent-alt: var( --stsed-teal-500 );

    --stsed-color-success-bg: rgba( 82, 183, 136, 0.14 );
    --stsed-color-danger-bg: rgba( 229, 56, 59, 0.14 );
    --stsed-color-warning-bg: rgba( 255, 193, 7, 0.14 );
    --stsed-color-success-strong: var( --stsed-green-500 );
    --stsed-color-danger-strong: var( --stsed-red-500 );
    --stsed-color-warning-strong: var( --stsed-amber-500 );
    --stsed-color-warning-strong-hover: var( --stsed-amber-50 );

    --stsed-color-secondary: var( --stsed-grey-600 );
    --stsed-color-secondary-hover: var( --stsed-grey-500 );

    --stsed-header-bg: #101519;
    --stsed-header-text: #e8ecef;
    --stsed-header-hover-bg: #1c2126;
    --stsed-header-active-bg: #232930;
    --stsed-subheader-bg: var( --stsed-color-surface );
    --stsed-subheader-text: var( --stsed-color-link );
    --stsed-subheader-border: var( --stsed-color-border );

    --stsed-footer-bg: #101519;
    --stsed-footer-text: var( --stsed-color-text-muted );
    --stsed-footer-link: var( --stsed-color-text );

    --stsed-color-focus: var( --stsed-blue-300 );

    /* Shadows read as black voids on dark; deepen and soften them. */
    --stsed-shadow-xs: 0 1px 2px rgba( 0, 0, 0, 0.3 );
    --stsed-shadow-sm: 0 1px 3px rgba( 0, 0, 0, 0.4 );
    --stsed-shadow-md: 0 4px 12px rgba( 0, 0, 0, 0.45 );
    --stsed-shadow-lg: 0 12px 28px rgba( 0, 0, 0, 0.5 );
}

/*
@media ( prefers-color-scheme: dark ) {
    :root:not( [data-stsed-theme="light"] ) {
        … same declarations as [data-stsed-theme="dark"] above …
    }
}
*/
