/**
 * @humain-foundation/ui - Design Tokens
 *
 * This file contains ONLY CSS custom properties (design tokens).
 * It does NOT include Tailwind CSS utilities or preflight styles.
 *
 * Usage:
 * - Import this file if you have your own Tailwind setup and only need tokens
 * - For complete styles, use `@humain-foundation/ui/styles.css` instead
 *
 * @see https://github.com/humain-foundation/ui#styling
 */

/* ============================================
   HumainOS Design System - Color Palette
   ============================================ */

:root {
  /* Brand (Lagoon Flat) - Primary brand color */
  --brand-25: #f0faf8;
  --brand-50: #e1f5f2;
  --brand-100: #c2eae5;
  --brand-200: #a2e0d8;
  --brand-300: #80d5cb;
  --brand-400: #57cabe;
  --brand-500: #00bfb2;
  --brand-600: #009b90;
  --brand-700: #007970;
  --brand-800: #005851;
  --brand-900: #003935;
  --brand-950: #001d1a;

  /* Gray (Light Mode) */
  --gray-25: #fdfdfc;
  --gray-50: #fafaf9;
  --gray-100: #f5f5f4;
  --gray-200: #e7e5e4;
  --gray-300: #d7d3d0;
  --gray-400: #a9a29d;
  --gray-500: #79716b;
  --gray-600: #57534e;
  --gray-700: #44403c;
  --gray-800: #292524;
  --gray-900: #1c1917;
  --gray-950: #171412;

  /* Error */
  --error-25: #fffbfa;
  --error-50: #fef3f2;
  --error-100: #fee4e2;
  --error-200: #fecdca;
  --error-300: #fda29b;
  --error-400: #f97066;
  --error-500: #f04438;
  --error-600: #d92d20;
  --error-700: #b42318;
  --error-800: #912018;
  --error-900: #7a271a;
  --error-950: #55160c;

  /* Warning */
  --warning-25: #fffcf5;
  --warning-50: #fffaeb;
  --warning-100: #fef0c7;
  --warning-200: #fedf89;
  --warning-300: #fec84b;
  --warning-400: #fdb022;
  --warning-500: #f79009;
  --warning-600: #dc6803;
  --warning-700: #b54708;
  --warning-800: #93370d;
  --warning-900: #7a2e0e;
  --warning-950: #4e1d09;

  /* Success */
  --success-25: #f6fef9;
  --success-50: #ecfdf3;
  --success-100: #dcfae6;
  --success-200: #abefc6;
  --success-300: #75e0a7;
  --success-400: #47cd89;
  --success-500: #17b26a;
  --success-600: #079455;
  --success-700: #067647;
  --success-800: #085d3a;
  --success-900: #074d31;
  --success-950: #053321;

  /* Secondary Colors - Desert Midnight */
  --desert-midnight-25: #f8fbfc;
  --desert-midnight-50: #d9e7ed;
  --desert-midnight-100: #b2d0dc;
  --desert-midnight-200: #88b6c9;
  --desert-midnight-300: #5798b2;
  --desert-midnight-400: #48859d;
  --desert-midnight-500: #3b6d81;
  --desert-midnight-600: #305969;
  --desert-midnight-700: #264653;
  --desert-midnight-800: #1e3842;
  --desert-midnight-900: #182c34;
  --desert-midnight-950: #101e23;

  /* Secondary Colors - Aqua Flat */
  --aqua-flat-25: #e1eef1;
  --aqua-flat-50: #c3dce3;
  --aqua-flat-100: #a5cbd5;
  --aqua-flat-200: #86bac7;
  --aqua-flat-300: #67a9b9;
  --aqua-flat-400: #4398ab;
  --aqua-flat-500: #00879f;
  --aqua-flat-600: #066d7f;
  --aqua-flat-700: #035462;
  --aqua-flat-800: #023c47;
  --aqua-flat-900: #01262d;
  --aqua-flat-950: #001116;

  /* Secondary Colors - Oasis Flat */
  --oasis-flat-25: #fcfff5;
  --oasis-flat-50: #f9fee6;
  --oasis-flat-100: #edfdba;
  --oasis-flat-200: #e4fc97;
  --oasis-flat-300: #d0f94a;
  --oasis-flat-400: #c4f71c;
  --oasis-flat-500: #a8d907;
  --oasis-flat-600: #86ad06;
  --oasis-flat-700: #6f8f05;
  --oasis-flat-800: #587204;
  --oasis-flat-900: #495e03;
  --oasis-flat-950: #263102;

  /* Secondary Colors - Air Flat */
  --air-flat-25: #e3f8ef;
  --air-flat-50: #c6f1de;
  --air-flat-100: #a7eace;
  --air-flat-200: #86e3be;
  --air-flat-300: #5edbaf;
  --air-flat-400: #00d49c;
  --air-flat-500: #10b084;
  --air-flat-600: #0b8f6b;
  --air-flat-700: #066f52;
  --air-flat-800: #03513b;
  --air-flat-900: #013425;
  --air-flat-950: #001a11;

  /* Decorative Colors - Extended palette for UI accents */
  --indigo-50: #eef4ff;
  --indigo-100: #e0eaff;
  --indigo-200: #c7d7fe;
  --indigo-300: #a4bcfd;
  --indigo-400: #8098f9;
  --indigo-500: #6172f3;
  --indigo-600: #444ce7;
  --indigo-700: #3538cd;
  --indigo-800: #2d31a6;
  --indigo-900: #2d3282;

  --purple-50: #f4f3ff;
  --purple-100: #ebe9fe;
  --purple-200: #d9d6fe;
  --purple-300: #bdb4fe;
  --purple-400: #9b8afb;
  --purple-500: #7a5af8;
  --purple-600: #6938ef;
  --purple-700: #5925dc;
  --purple-800: #4a1fb8;
  --purple-900: #3e1c96;

  --blue-50: #eff8ff;
  --blue-100: #d1e9ff;
  --blue-200: #b2ddff;
  --blue-300: #84caff;
  --blue-400: #53b1fd;
  --blue-500: #2e90fa;
  --blue-600: #1570ef;
  --blue-700: #175cd3;
  --blue-800: #1849a9;
  --blue-900: #194185;

  --pink-50: #fdf2fa;
  --pink-100: #fce7f6;
  --pink-200: #fcceee;
  --pink-300: #f670c7;
  --pink-400: #ee46bc;
  --pink-500: #dd2590;
  --pink-600: #c11574;
  --pink-700: #9e165f;
  --pink-800: #851651;
  --pink-900: #4e0d30;

  --orange-50: #fff4ed;
  --orange-100: #ffead5;
  --orange-200: #fddcab;
  --orange-300: #f9a371;
  --orange-400: #f38744;
  --orange-500: #ef6820;
  --orange-600: #e04f16;
  --orange-700: #b93815;
  --orange-800: #932f19;
  --orange-900: #772917;

  /* External Brand Colors - OAuth provider brand colors */
  --brand-google-blue: #4285f4;
  --brand-google-green: #34a853;
  --brand-google-yellow: #fbbc05;
  --brand-google-red: #eb4335;
  --brand-facebook: #1877f2;
  --brand-apple: #000000;

  /* Typography */
  --font-family-display: "Inter", system-ui, sans-serif;
  --font-family-body: "Inter", system-ui, sans-serif;

  /* Font Sizes */
  --font-size-display-2xl: 4.5rem;
  --font-size-display-xl: 3.75rem;
  --font-size-display-lg: 3rem;
  --font-size-display-md: 2.25rem;
  --font-size-display-sm: 1.875rem;
  --font-size-display-xs: 1.5rem;
  --font-size-text-xl: 1.25rem;
  --font-size-text-lg: 1.125rem;
  --font-size-text-md: 1rem;
  --font-size-text-sm: 0.875rem;
  --font-size-text-xs: 0.75rem;

  /* Line Heights */
  --line-height-display-2xl: 5.625rem;
  --line-height-display-xl: 4.5rem;
  --line-height-display-lg: 3.75rem;
  --line-height-display-md: 2.75rem;
  --line-height-display-sm: 2.375rem;
  --line-height-display-xs: 2rem;
  --line-height-text-xl: 1.875rem;
  --line-height-text-lg: 1.75rem;
  --line-height-text-md: 1.5rem;
  --line-height-text-sm: 1.25rem;
  --line-height-text-xs: 1.125rem;

  /* Letter Spacing */
  --letter-spacing-display: -0.02em;
  --letter-spacing-text: 0;

  /* Font Weights */
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  /* ============================================
     Spacing Scale
     ============================================ */
  --spacing-0: 0;
  --spacing-px: 1px;
  --spacing-0-5: 0.125rem; /* 2px */
  --spacing-1: 0.25rem; /* 4px */
  --spacing-1-5: 0.375rem; /* 6px */
  --spacing-2: 0.5rem; /* 8px */
  --spacing-2-5: 0.625rem; /* 10px */
  --spacing-3: 0.75rem; /* 12px */
  --spacing-3-5: 0.875rem; /* 14px */
  --spacing-4: 1rem; /* 16px */
  --spacing-5: 1.25rem; /* 20px */
  --spacing-6: 1.5rem; /* 24px */
  --spacing-7: 1.75rem; /* 28px */
  --spacing-8: 2rem; /* 32px */
  --spacing-9: 2.25rem; /* 36px */
  --spacing-10: 2.5rem; /* 40px */
  --spacing-11: 2.75rem; /* 44px */
  --spacing-12: 3rem; /* 48px */
  --spacing-14: 3.5rem; /* 56px */
  --spacing-16: 4rem; /* 64px */
  --spacing-20: 5rem; /* 80px */
  --spacing-24: 6rem; /* 96px */
  --spacing-28: 7rem; /* 112px */
  --spacing-32: 8rem; /* 128px */
  --spacing-36: 9rem; /* 144px */
  --spacing-40: 10rem; /* 160px */
  --spacing-44: 11rem; /* 176px */
  --spacing-48: 12rem; /* 192px */
  --spacing-52: 13rem; /* 208px */
  --spacing-56: 14rem; /* 224px */
  --spacing-60: 15rem; /* 240px */
  --spacing-64: 16rem; /* 256px */
  --spacing-72: 18rem; /* 288px */
  --spacing-80: 20rem; /* 320px */
  --spacing-96: 24rem; /* 384px */

  /* ============================================
     Shadow Tokens
     ============================================ */
  --shadow-xs: 0px 1px 2px 0px rgba(10, 13, 18, 0.05);
  --shadow-sm:
    0px 1px 2px 0px rgba(10, 13, 18, 0.06),
    0px 1px 3px 0px rgba(10, 13, 18, 0.1);
  --shadow-md:
    0px 2px 4px -2px rgba(10, 13, 18, 0.06),
    0px 4px 8px -2px rgba(10, 13, 18, 0.1);
  --shadow-lg:
    0px 4px 6px -2px rgba(10, 13, 18, 0.03),
    0px 12px 16px -4px rgba(10, 13, 18, 0.08);
  --shadow-xl:
    0px 8px 8px -4px rgba(10, 13, 18, 0.03),
    0px 20px 24px -4px rgba(10, 13, 18, 0.08);
  --shadow-2xl: 0px 24px 48px -12px rgba(10, 13, 18, 0.18);
  --shadow-3xl: 0px 32px 64px -12px rgba(10, 13, 18, 0.14);

  /* Focus ring shadows */
  --shadow-ring-brand: 0px 0px 0px 4px var(--brand-100);
  --shadow-ring-gray: 0px 0px 0px 4px var(--gray-100);
  --shadow-ring-error: 0px 0px 0px 4px var(--error-100);

  /* Raised/button inset shadows */
  --shadow-button-inset:
    0px 1px 2px 0px rgba(10, 13, 18, 0.05),
    inset 0px 0px 0px 1px rgba(10, 13, 18, 0.18),
    inset 0px -2px 0px 0px rgba(10, 13, 18, 0.05);
  --shadow-inset-ring:
    inset 0px 0px 0px 1px rgba(10, 13, 18, 0.18),
    inset 0px -2px 0px 0px rgba(10, 13, 18, 0.05);

  /* ============================================
     Elevation Tokens (combines shadow + background)
     ============================================ */
  --elevation-0: none;
  --elevation-1: var(--shadow-xs);
  --elevation-2: var(--shadow-sm);
  --elevation-3: var(--shadow-md);
  --elevation-4: var(--shadow-lg);
  --elevation-5: var(--shadow-xl);

  /* ============================================
     Z-Index Scale
     ============================================ */
  --z-auto: auto;
  --z-0: 0;
  --z-10: 10;
  --z-20: 20;
  --z-30: 30;
  --z-40: 40;
  --z-50: 50;

  /* Semantic z-index tokens */
  --z-dropdown: 1000;
  --z-sticky: 1100;
  --z-fixed: 1200;
  --z-modal-backdrop: 1300;
  --z-modal: 1400;
  --z-popover: 1500;
  --z-tooltip: 1600;
  --z-toast: 1700;

  /* ============================================
     Motion / Animation Tokens
     ============================================ */
  /* Durations */
  --duration-instant: 0ms;
  --duration-fast: 100ms;
  --duration-normal: 200ms;
  --duration-slow: 300ms;
  --duration-slower: 400ms;
  --duration-slowest: 500ms;

  /* Easing functions */
  --ease-linear: linear;
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
  --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);

  /* Transition presets */
  --transition-colors:
    color, background-color, border-color, text-decoration-color, fill,
    stroke var(--duration-normal) var(--ease-in-out);
  --transition-opacity: opacity var(--duration-normal) var(--ease-in-out);
  --transition-shadow: box-shadow var(--duration-normal) var(--ease-in-out);
  --transition-transform: transform var(--duration-normal) var(--ease-in-out);
  --transition-all: all var(--duration-normal) var(--ease-in-out);

  /* ============================================
     Border Radius
     ============================================ */
  --radius-none: 0;
  --radius-sm: 0.125rem; /* 2px */
  --radius-md: 0.375rem; /* 6px */
  --radius-lg: 0.5rem; /* 8px */
  --radius-xl: 0.75rem; /* 12px */
  --radius-2xl: 1rem; /* 16px */
  --radius-3xl: 1.5rem; /* 24px */
  --radius-full: 9999px;

  /* App Shell / Connected Layout */
  --app-shell-radius: 0.75rem; /* 12px */
  --app-shell-padding: 1rem; /* 16px */
  --app-shell-divider-color: var(--border);
  --app-shell-divider-width: 1px;
}

/* Semantic Color Mappings - Light Mode (shadcn + humainOS) */
:root {
  --radius: 0.625rem;

  /* Core */
  --background: #ffffff;
  --foreground: #000000de;
  --card: #ffffff;
  --card-alt: #fafafa;
  --card-hover: #f5f5f5;
  --card-foreground: #000000de;
  --popover: #fffffff2;
  --popover-foreground: #00000099;
  --primary: #009688;
  --primary-foreground: #ffffff;
  --secondary: #ffffff;
  --secondary-foreground: #00000099;
  --muted: #00000005;
  --muted-foreground: #0000008c;
  --accent: #f5f5f5;
  --accent-foreground: #000000de;
  --destructive: #dc2626;
  --destructive-foreground: #fef2f2;
  --border: #00000014;
  --input: #0000001f;
  --ring: #00968880;

  /* Extended foregrounds (humainOS) */
  --quaternary-foreground: #0000003d;

  /* Status colors */
  --info: #0284c7;
  --info-foreground: #ecfeff;
  --success: #067647;
  --success-foreground: #f0fdf4;
  --warning: #92400e;
  --warning-foreground: #fffdf5;

  /* Surface hierarchy */
  --surface-0: #ffffff;
  --surface-1: #fafafa;
  --surface-2: #f5f5f5;
  --surface-3: #eeeeee;
  --surface-elevated: #ffffff;

  /* App background — multi-layer gradient (linear + 2 radial primary washes) */
  --app-bg:
    radial-gradient(
      ellipse at 70% 10%,
      color-mix(in srgb, var(--primary) 5%, transparent),
      transparent 60%
    ),
    radial-gradient(
      ellipse at 30% 90%,
      color-mix(in srgb, var(--primary) 3%, transparent),
      transparent 60%
    ),
    linear-gradient(180deg, var(--surface-1), var(--surface-2));

  /* Charts */
  --chart-1: #009688;
  --chart-2: #2ecab1;
  --chart-3: #7fae14;
  --chart-4: #b8e636;
  --chart-5: #e1f88a;

  /* Sidebar */
  --sidebar: #00000005;
  --sidebar-foreground: #000000cc;
  --sidebar-primary: #161616;
  --sidebar-primary-foreground: #f8f8f8;
  --sidebar-accent: #f5f5f5;
  --sidebar-accent-foreground: #161616;
  --sidebar-border: #e4e4e4;
  --sidebar-ring: #a1a1a1;

  /* Custom */
  --custom-shadow: #00000019;
  --custom-backdrop-overlay: #3c3a4099;
  --extra-shadow: white;
  --custom-tw-gradient-from: #00b89c;
  --custom-tw-gradient-to: #009688;

  /* Sent message bubble — darkened primary for WCAG AA contrast with white text */
  --sent-bubble: color-mix(in srgb, var(--primary) 82%, black);

  /* Focus ring background */
  --ring-bg-primary: #ffffff;

  /* Theme Toggle Component */
  --theme-toggle-gradient-light-start: var(--warning-500);
  --theme-toggle-gradient-light-mid: #de4b24;
  --theme-toggle-gradient-light-end: var(--error-600);
  --theme-toggle-gradient-dark-start: var(--blue-200);
  --theme-toggle-gradient-dark-mid: #6f8dd7;
  --theme-toggle-gradient-dark-end: var(--blue-800);
  --theme-toggle-track-bg: var(--input);
  --theme-toggle-indicator-bg: var(--card);
  --theme-toggle-indicator-surface: #fafafa;
  --theme-toggle-icon-sun: var(--warning);
  --theme-toggle-icon-moon: var(--muted-foreground);
  --theme-toggle-transition-duration: var(--duration-slow);
  --theme-toggle-transition-easing: var(--ease-in-out);
}

/* Sugar-high syntax highlighting - Light Mode */
:root {
  --sh-class: var(--blue-700, #175cd3);
  --sh-identifier: var(--gray-700, #44403c);
  --sh-sign: var(--gray-700, #44403c);
  --sh-property: var(--blue-700, #175cd3);
  --sh-entity: var(--blue-700, #175cd3);
  --sh-jsxliterals: var(--blue-700, #175cd3);
  --sh-string: var(--gray-700, #44403c);
  --sh-keyword: var(--pink-600, #c11574);
  --sh-comment: var(--success-700, #067647);
}

/* Sugar-high syntax highlighting - Dark Mode */
.dark {
  --sh-class: var(--blue-300, #84caff);
  --sh-identifier: var(--gray-50, #fafaf9);
  --sh-sign: var(--gray-300, #d7d3d0);
  --sh-property: var(--blue-300, #84caff);
  --sh-entity: var(--blue-300, #84caff);
  --sh-jsxliterals: var(--blue-300, #84caff);
  --sh-string: var(--gray-200, #e7e5e4);
  --sh-keyword: var(--pink-300, #f670c7);
  --sh-comment: var(--success-300, #75e0a7);
}

/* Semantic Color Mappings - Dark Mode (shadcn + humainOS) */
.dark {
  /* Core */
  --background: #161616;
  --foreground: #ffffffde;
  --card: #ffffff05;
  --card-alt: #1e1e1e;
  --card-hover: #252525;
  --card-foreground: #ffffff;
  --popover: #000000f2;
  --popover-foreground: #ffffff99;
  --primary: #009688;
  --primary-foreground: #ffffff;
  --secondary: #000000;
  --secondary-foreground: #ffffff99;
  --muted: #ffffff05;
  --muted-foreground: #ffffff8c;
  --accent: #404040;
  --accent-foreground: #f5f5f5;
  --destructive: #dc2626;
  --destructive-foreground: #fef2f2;
  --border: #ffffff14;
  --input: #ffffff1f;
  --ring: #00968880;

  /* Extended foregrounds (humainOS) */
  --quaternary-foreground: #ffffff3d;

  /* Status colors (same in dark) */
  --info: #0284c7;
  --info-foreground: #ecfeff;
  --success: #16a34a;
  --success-foreground: #f0fdf4;
  --warning: #b45309;
  --warning-foreground: #fffdf5;

  /* Surface hierarchy (dark) */
  --surface-0: #000000;
  --surface-1: #121212;
  --surface-2: #1f1f1f;
  --surface-3: #252525;
  --surface-elevated: #000000;

  /* Charts (same in dark) */
  --chart-1: #009688;
  --chart-2: #2ecab1;
  --chart-3: #7fae14;
  --chart-4: #b8e636;
  --chart-5: #e1f88a;

  /* Sidebar (dark) */
  --sidebar: #18181d;
  --sidebar-foreground: #fcfcfc;
  --sidebar-primary: #1649e5;
  --sidebar-primary-foreground: #ffffff;
  --sidebar-accent: #26262b;
  --sidebar-accent-foreground: #fcfcfc;
  --sidebar-border: #ffffff1a;
  --sidebar-ring: #70707d;

  /* Custom (dark) */
  --custom-shadow: #0000004c;
  --custom-backdrop-overlay: #3c3a40cc;
  --extra-shadow: rgba(255, 255, 255, 0.05);

  /* Sent message bubble (dark) */
  --sent-bubble: color-mix(in srgb, var(--primary) 82%, black);

  /* Focus ring background (dark) */
  --ring-bg-primary: #161616;

  /* Shadow overrides for dark mode */
  --shadow-button-inset:
    0px 1px 2px 0px rgba(0, 0, 0, 0.3),
    inset 0px 0px 0px 1px rgba(255, 255, 255, 0.1),
    inset 0px -2px 0px 0px rgba(0, 0, 0, 0.2);
  --shadow-inset-ring:
    inset 0px 0px 0px 1px rgba(255, 255, 255, 0.1),
    inset 0px -2px 0px 0px rgba(0, 0, 0, 0.2);
}

@media (prefers-reduced-motion: reduce) {
  :root,
  .dark {
    --theme-toggle-transition-duration: 0ms;
  }
}
