/**
 * Design Tokens - Neutral Foundation
 *
 * These tokens provide a neutral, semantic foundation that can be
 * customized by design system variants (Swiss, Neumorphic, Bauhaus).
 *
 * Do not include theme-specific values here - those belong in
 * the respective /styles/systems/ files.
 */

:root {
  /* ==================== COLOR PRIMITIVES ==================== */
  /* Neutral grays - used for text, borders, backgrounds */
  --gray-50: #f8f9fa;
  --gray-100: #f1f3f4;
  --gray-200: #e8eaed;
  --gray-300: #dadce0;
  --gray-400: #bdc1c6;
  --gray-500: #9aa0a6;
  --gray-600: #80868b;
  --gray-700: #5f6368;
  --gray-800: #3c4043;
  --gray-900: #202124;
  --gray-950: #000000;

  /* Pure black and white */
  --black: #000000;
  --white: #ffffff;

  /* Semantic feedback colors (neutral definitions) */
  --success-base: #0f9d58;
  --success-light: #a8f4c0;
  --warning-base: #f4b400;
  --warning-light: #fde8a8;
  --error-base: #d93025;
  --error-light: #f8c9c5;
  --info-base: #4285f4;
  --info-light: #c9daf8;

  /* ==================== SPACING SCALE ==================== */
  /* 8px base unit, geometric progression */
  --space-1: 0.25rem;   /* 4px */
  --space-2: 0.5rem;    /* 8px */
  --space-3: 0.75rem;   /* 12px */
  --space-4: 1rem;      /* 16px */
  --space-5: 1.25rem;   /* 20px */
  --space-6: 1.5rem;    /* 24px */
  --space-8: 2rem;      /* 32px */
  --space-10: 2.5rem;   /* 40px */
  --space-12: 3rem;     /* 48px */
  --space-16: 4rem;     /* 64px */
  --space-20: 5rem;     /* 80px */
  --space-24: 6rem;     /* 96px */

  /* Semantic spacing aliases */
  --spacing-xs: var(--space-1);
  --spacing-sm: var(--space-2);
  --spacing-md: var(--space-4);
  --spacing-lg: var(--space-6);
  --spacing-xl: var(--space-8);
  --spacing-2xl: var(--space-12);
  --spacing-3xl: var(--space-16);

  /* ==================== TYPOGRAPHY ==================== */
  /* Font stacks - system fonts for performance */
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI',
               Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
  --font-serif: Georgia, Cambria, 'Times New Roman', Times, serif;
  --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo,
               'Courier New', monospace;

  /* Accessible font alternatives */
  --font-accessible-sans: 'Open Sans', var(--font-sans);
  --font-accessible-dyslexic: 'OpenDyslexic', var(--font-sans);
  --font-accessible-inclusive: 'Atkinson Hyperlegible', var(--font-sans);

  /* Font weights */
  --font-weight-light: 300;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-extrabold: 800;

  /* Type scale - 1.2 (Major Third) ratio */
  --font-size-xs: 0.694rem;    /* 11.1px */
  --font-size-sm: 0.833rem;    /* 13.3px */
  --font-size-base: 1rem;      /* 16px */
  --font-size-lg: 1.2rem;      /* 19.2px */
  --font-size-xl: 1.44rem;     /* 23px */
  --font-size-2xl: 1.728rem;   /* 27.6px */
  --font-size-3xl: 2.074rem;   /* 33.2px */
  --font-size-4xl: 2.488rem;   /* 39.8px */
  --font-size-5xl: 2.986rem;   /* 47.8px */
  --font-size-6xl: 3.583rem;   /* 57.3px */

  /* Line heights */
  --line-height-none: 1;
  --line-height-tight: 1.25;
  --line-height-snug: 1.375;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.625;
  --line-height-loose: 2;

  /* Letter spacing */
  --letter-spacing-tighter: -0.05em;
  --letter-spacing-tight: -0.025em;
  --letter-spacing-normal: 0;
  --letter-spacing-wide: 0.025em;
  --letter-spacing-wider: 0.05em;
  --letter-spacing-widest: 0.1em;

  /* ==================== BORDERS & RADIUS ==================== */
  /* Border widths */
  --border-width-none: 0;
  --border-width-thin: 1px;
  --border-width-medium: 2px;
  --border-width-thick: 4px;

  /* Border radius */
  --radius-none: 0;
  --radius-sm: 0.125rem;   /* 2px */
  --radius-base: 0.25rem;  /* 4px */
  --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;   /* Pill shape */
  --radius-circle: 50%;    /* Perfect circle */

  /* ==================== SHADOWS ==================== */
  /* Elevation system */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-base: 0 1px 3px 0 rgba(0, 0, 0, 0.1),
                 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
               0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
               0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
               0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
  --shadow-none: none;

  /* ==================== Z-INDEX SCALE ==================== */
  /* Consistent layering system */
  --z-base: 0;
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
  --z-toast: 1080;
  --z-max: 9999;

  /* ==================== ANIMATION TIMING ==================== */
  /* Duration */
  --duration-instant: 50ms;
  --duration-fast: 100ms;
  --duration-normal: 200ms;
  --duration-medium: 300ms;
  --duration-slow: 500ms;
  --duration-slower: 800ms;
  --duration-slowest: 1200ms;

  /* Easing curves */
  --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.34, 1.56, 0.64, 1);
  --ease-elastic: cubic-bezier(0.68, -0.55, 0.27, 1.55);

  /* ==================== BREAKPOINTS ==================== */
  /* Responsive design breakpoints (for reference in media queries) */
  /* Use in CSS as: @media (min-width: 48em) */
  --breakpoint-sm: 30em;    /* 480px */
  --breakpoint-md: 48em;    /* 768px */
  --breakpoint-lg: 64em;    /* 1024px */
  --breakpoint-xl: 80em;    /* 1280px */
  --breakpoint-2xl: 96em;   /* 1536px */

  /* ==================== GRID SYSTEM ==================== */
  /* Container widths */
  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 1280px;
  --container-2xl: 1536px;

  /* Grid columns */
  --grid-columns: 12;
  --grid-gap: var(--space-4);

  /* ==================== FOCUS INDICATORS ==================== */
  /* Accessibility focus rings */
  --focus-ring-width: 3px;
  --focus-ring-offset: 2px;
  --focus-ring-opacity: 0.5;

  /* ==================== ACCESSIBILITY ==================== */
  /* Touch target minimum */
  --touch-target-min: 44px;

  /* Maximum line length for readability */
  --measure-narrow: 45ch;
  --measure-base: 65ch;
  --measure-wide: 80ch;
}

/**
 * Reduced Motion Support
 *
 * Respect user's motion preferences for accessibility
 */
@media (prefers-reduced-motion: reduce) {
  :root {
    --duration-instant: 0ms;
    --duration-fast: 0ms;
    --duration-normal: 0ms;
    --duration-medium: 0ms;
    --duration-slow: 0ms;
    --duration-slower: 0ms;
    --duration-slowest: 0ms;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/**
 * High Contrast Mode Detection
 *
 * Enhance contrast when user prefers high contrast
 */
@media (prefers-contrast: high) {
  :root {
    --border-width-thin: 2px;
    --border-width-medium: 3px;
    --border-width-thick: 5px;
  }
}
