/* ============================================================================
   TAIIH AI — Theme tokens
   ----------------------------------------------------------------------------
   Brand values are taken from the live TAIIH website stylesheet
   (https://taiih.org/assets/styles.css) so the platform reads as an official
   extension of the institution:

       --primary      #0D6EFD      --accent       #F4B400
       --primary-dark #0A2E5C      --accent-dark  #C89600
       dark surfaces  #0A0F1A / #111927 / #1A2540
       light surfaces #F8F9FA / #FFFFFF / #D8DCE8

   Change colours here — never in component rules. Both themes are complete
   palettes: the dark theme is intentionally designed (deep navy institutional
   dark), not a mechanical inversion of the light theme.

   Theme resolution (see assets/js/theme.js):
     1. stored preference in localStorage  →  <html data-theme="light|dark">
     2. otherwise the OS preference via prefers-color-scheme
     3. explicit OS-follow mode re-applies automatically when the OS changes
   ========================================================================== */

/* ---------------------------------------------------------------------------
   DARK THEME — institutional default (matches taiih.org)
   ------------------------------------------------------------------------ */
:root,
[data-theme="dark"] {
    color-scheme: dark;

    /* Brand */
    --taiih-primary: #0D6EFD;
    --taiih-primary-light: #4D94FF;
    --taiih-primary-dark: #0A2E5C;
    --taiih-secondary: #0D6EFD;
    --taiih-secondary-light: #4D94FF;
    --taiih-accent: #F4B400;
    --taiih-accent-light: #FFC933;
    --taiih-accent-dark: #C89600;
    --taiih-navy: #0D3D78;

    /* Surfaces */
    --taiih-background: #0A0F1A;
    --taiih-background-alt: #0F1520;
    --taiih-surface: #111927;
    --taiih-surface-alt: #151E2E;
    --taiih-surface-hover: #162030;
    --taiih-border: #1A2540;
    --taiih-border-strong: #243050;

    /* Text */
    --taiih-text: #FFFFFF;
    --taiih-text-secondary: #B0B8C8;
    --taiih-text-muted: #6B7590;

    /* Semantic */
    --taiih-success: #10B981;
    --taiih-warning: #F4B400;
    --taiih-danger: #F87171;
    --taiih-info: #4D94FF;

    /* Effects */
    --taiih-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --taiih-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    --taiih-shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55);
    --taiih-overlay: rgba(5, 8, 15, 0.72);
    --taiih-glass: rgba(17, 25, 39, 0.86);

    /* Component-level derivations (kept here so both themes stay symmetrical) */
    --taiih-sidebar-bg: linear-gradient(180deg, #0B1220 0%, #0A0F1A 100%);
    --taiih-header-bg: rgba(10, 15, 26, 0.88);
    --taiih-user-bubble: linear-gradient(180deg, rgba(13, 110, 253, 0.20) 0%, rgba(13, 110, 253, 0.12) 100%);
    --taiih-user-bubble-border: rgba(77, 148, 255, 0.35);
    --taiih-code-bg: #070B14;
    --taiih-code-header: #0E1626;
    --taiih-inline-code-bg: rgba(77, 148, 255, 0.12);
    --taiih-inline-code-text: #A9CBFF;
    --taiih-focus-ring: rgba(77, 148, 255, 0.55);
    --taiih-accent-soft: rgba(244, 180, 0, 0.14);
    --taiih-accent-contrast: #0A0F1A;
    --taiih-primary-contrast: #FFFFFF;
    --taiih-hairline: rgba(244, 180, 0, 0.35);
    --taiih-grid-line: rgba(36, 48, 80, 0.55);
    --taiih-seal-glow: rgba(13, 110, 253, 0.28);
}

/* ---------------------------------------------------------------------------
   LIGHT THEME — institutional daylight workspace
   ------------------------------------------------------------------------ */
[data-theme="light"] {
    color-scheme: light;

    --taiih-primary: #0D6EFD;
    --taiih-primary-light: #4D94FF;
    --taiih-primary-dark: #0A2E5C;
    --taiih-secondary: #0D6EFD;
    --taiih-secondary-light: #4D94FF;
    --taiih-accent: #C89600;          /* darkened for AA contrast on light surfaces */
    --taiih-accent-light: #F4B400;
    --taiih-accent-dark: #A67B00;
    --taiih-navy: #0D3D78;

    --taiih-background: #F8F9FA;
    --taiih-background-alt: #EDF0F5;
    --taiih-surface: #FFFFFF;
    --taiih-surface-alt: #F0F2F7;
    --taiih-surface-hover: #F8F9FE;
    --taiih-border: #D8DCE8;
    --taiih-border-strong: #C8CCD8;

    --taiih-text: #0A2E5C;
    --taiih-text-secondary: #343A40;
    --taiih-text-muted: #6B7590;

    --taiih-success: #0E8A66;
    --taiih-warning: #B37F00;
    --taiih-danger: #C0392B;
    --taiih-info: #0D3D78;

    --taiih-shadow-sm: 0 1px 2px rgba(10, 46, 92, 0.06);
    --taiih-shadow: 0 8px 24px rgba(10, 46, 92, 0.09);
    --taiih-shadow-lg: 0 22px 50px rgba(10, 46, 92, 0.14);
    --taiih-overlay: rgba(10, 46, 92, 0.35);
    --taiih-glass: rgba(255, 255, 255, 0.9);

    --taiih-sidebar-bg: linear-gradient(180deg, #FFFFFF 0%, #F3F5FA 100%);
    --taiih-header-bg: rgba(248, 249, 250, 0.9);
    --taiih-user-bubble: linear-gradient(180deg, rgba(13, 110, 253, 0.10) 0%, rgba(13, 110, 253, 0.05) 100%);
    --taiih-user-bubble-border: rgba(13, 110, 253, 0.28);
    --taiih-code-bg: #F6F8FC;
    --taiih-code-header: #E8EDF7;
    --taiih-inline-code-bg: rgba(13, 110, 253, 0.08);
    --taiih-inline-code-text: #0A2E5C;
    --taiih-focus-ring: rgba(13, 110, 253, 0.45);
    --taiih-accent-soft: rgba(200, 150, 0, 0.12);
    --taiih-accent-contrast: #FFFFFF;
    --taiih-primary-contrast: #FFFFFF;
    --taiih-hairline: rgba(200, 150, 0, 0.4);
    --taiih-grid-line: rgba(216, 220, 232, 0.9);
    --taiih-seal-glow: rgba(13, 110, 253, 0.14);
}

/* ---------------------------------------------------------------------------
   Shared, theme-independent tokens
   ------------------------------------------------------------------------ */
:root {
    --taiih-radius-sm: 8px;
    --taiih-radius: 12px;
    --taiih-radius-lg: 20px;
    --taiih-radius-xl: 28px;

    --taiih-font-heading: 'Playfair Display', Georgia, 'Times New Roman', serif;
    --taiih-font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --taiih-font-mono: 'JetBrains Mono', 'Fira Code', 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;

    --taiih-transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    --taiih-transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);

    --taiih-sidebar-width: 288px;
    --taiih-header-height: 68px;
    --taiih-content-max: 880px;
}
