/**
 * Clank Design System - Theme Tokens
 *
 * This file defines the core design tokens (variables) for the Clank design system.
 * Modify these values to customize the visual appearance of the entire application.
 *
 * Architecture:
 * 1. Design tokens (primitives): Base colors, sizes, etc.
 * 2. Semantic tokens: Purpose-driven tokens that reference primitives
 * 3. Component styles (in main.css): Use semantic tokens
 *
 * HOW TO CUSTOMIZE:
 * To create a custom theme, simply modify the values in this file:
 * 1. Change brand colors (--color-primary-base, --color-secondary-base)
 * 2. Adjust spacing scale (--space-*)
 * 3. Modify typography (--font-family-*, --font-size-*)
 * 4. Update border radius for sharper or rounder aesthetic (--radius-*)
 * 5. Customize dark mode colors in [data-theme="dark"] section
 *
 * See docs/visual-style-guide.md for complete documentation.
 */

/* =============================================================================
   LIGHT THEME (Default)
   ========================================================================== */

:root {
  /* ---------------------------------------------------------------------------
     Color Primitives - Base Palette
     --------------------------------------------------------------------------- */

  /* Brand colors */
  --color-primary-base: #ff6b00;
  --color-primary-light: #ff8534;
  --color-primary-dark: #c50;
  --color-secondary-base: #1d4ed8;
  --color-secondary-light: #3b82f6;
  --color-secondary-dark: #1e40af;

  /* Semantic color primitives */
  --color-success-base: #10b981;
  --color-success-light: #34d399;
  --color-success-dark: #059669;
  --color-warning-base: #f59e0b;
  --color-warning-light: #fbbf24;
  --color-warning-dark: #d97706;
  --color-error-base: #ef4444;
  --color-error-light: #f87171;
  --color-error-dark: #dc2626;
  --color-info-base: #3b82f6;
  --color-info-light: #60a5fa;
  --color-info-dark: #2563eb;

  /* Grayscale primitives */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --gray-950: #030712;

  /* ---------------------------------------------------------------------------
     Semantic Color Tokens
     --------------------------------------------------------------------------- */

  /* Primary actions and brand elements */
  --color-primary: var(--color-primary-base);
  --color-primary-hover: var(--color-primary-dark);
  --color-primary-active: var(--color-primary-dark);

  /* Secondary actions */
  --color-secondary: var(--color-secondary-base);
  --color-secondary-hover: var(--color-secondary-dark);

  /* Success states */
  --color-success: var(--color-success-base);
  --color-success-bg: #d1fae5;
  --color-success-text: #065f46;
  --color-success-border: #a7f3d0;

  /* Warning states */
  --color-warning: var(--color-warning-base);
  --color-warning-bg: #fef3c7;
  --color-warning-text: #92400e;
  --color-warning-border: #fde68a;

  /* Error states */
  --color-error: var(--color-error-base);
  --color-error-bg: #fee2e2;
  --color-error-text: #991b1b;
  --color-error-border: #fecaca;

  /* Info states */
  --color-info: var(--color-info-base);
  --color-info-bg: #dbeafe;
  --color-info-text: #1e40af;
  --color-info-border: #bfdbfe;

  /* Text colors */
  --color-text: var(--gray-900);
  --color-text-secondary: var(--gray-600);
  --color-text-tertiary: var(--gray-500);
  --color-heading: var(--gray-950);

  /* Surface colors */
  --color-background: var(--gray-50);
  --color-surface: #fff;
  --color-surface-secondary: var(--gray-100);
  --color-white: #fff;

  /* Border colors */
  --color-border: var(--gray-200);
  --color-border-hover: var(--gray-300);
  --color-border-focus: var(--color-primary);

  /* Focus ring colors */
  --color-focus-ring: rgb(255 107 0 / 10%);
  --color-focus-ring-error: rgb(239 68 68 / 10%);
  --color-focus-ring-success: rgb(16 185 129 / 20%);

  /* Overlay colors */
  --color-overlay: rgb(0 0 0 / 50%);

  /* Disabled state */
  --color-disabled: var(--gray-400);
  --color-disabled-bg: var(--gray-100);

  /* ---------------------------------------------------------------------------
     Typography Tokens
     --------------------------------------------------------------------------- */

  /* Font families
   * For a different look, try:
   * - Serif: Georgia, "Times New Roman", serif
   * - Modern: "Inter", "Helvetica Neue", sans-serif
   * - Rounded: "Nunito", "Quicksand", sans-serif
   */
  --font-family-base: -apple-system, blinkmacsystemfont, "Segoe UI", roboto,
    "Helvetica Neue", arial, sans-serif;
  --font-family-mono: "JetBrains Mono", "Fira Code", "SF Mono", monaco,
    "Cascadia Code", consolas, monospace;

  /* Font sizes - Modular scale (base 16px, ratio 1.25) */
  --font-size-xs: 0.75rem; /* 12px */
  --font-size-sm: 0.875rem; /* 14px */
  --font-size-base: 1rem; /* 16px */
  --font-size-lg: 1.125rem; /* 18px */
  --font-size-xl: 1.25rem; /* 20px */
  --font-size-2xl: 1.5rem; /* 24px */
  --font-size-3xl: 1.875rem; /* 30px */
  --font-size-4xl: 2.25rem; /* 36px */

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

  /* Line heights */
  --line-height-tight: 1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.75;

  /* ---------------------------------------------------------------------------
     Spacing Tokens - 4px base unit
     --------------------------------------------------------------------------- */

  --space-0: 0;
  --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 */

  /* ---------------------------------------------------------------------------
     Border Tokens
     --------------------------------------------------------------------------- */

  /* Border widths */
  --border-width-default: 1px;
  --border-width-thick: 2px;
  --border-width-accent: 3px;

  /* Border radius
   * For sharper design: use smaller values (2px, 4px, 6px)
   * For rounder design: use larger values (8px, 12px, 16px)
   */
  --radius-sm: 0.25rem; /* 4px */
  --radius-md: 0.5rem; /* 8px */
  --radius-lg: 0.75rem; /* 12px */
  --radius-xl: 1rem; /* 16px */
  --radius-full: 9999px;

  /* ---------------------------------------------------------------------------
     Shadow Tokens
     --------------------------------------------------------------------------- */

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 5%);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 10%),
    0 2px 4px -1px rgb(0 0 0 / 6%);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 10%),
    0 4px 6px -2px rgb(0 0 0 / 5%);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 10%),
    0 10px 10px -5px rgb(0 0 0 / 4%);

  /* ---------------------------------------------------------------------------
     Transition Tokens
     --------------------------------------------------------------------------- */

  --transition-fast: 150ms;
  --transition-base: 250ms;
  --transition-slow: 350ms;
  --timing-function-default: cubic-bezier(0.4, 0, 0.2, 1); /* ease-out */
  --timing-function-in: cubic-bezier(0.4, 0, 1, 1); /* ease-in */
  --timing-function-in-out: cubic-bezier(0.4, 0, 0.2, 1); /* ease-in-out */

  /* ---------------------------------------------------------------------------
     Z-index Scale
     --------------------------------------------------------------------------- */

  --z-index-base: 0;
  --z-index-dropdown: 1000;
  --z-index-sticky: 1100;
  --z-index-overlay: 1200;
  --z-index-modal: 1300;
  --z-index-popover: 1400;
  --z-index-tooltip: 1500;
}

/* =============================================================================
   DARK THEME
   ========================================================================== */

[data-theme="dark"] {
  /* ---------------------------------------------------------------------------
     Semantic Color Tokens (Dark Mode Overrides)
     --------------------------------------------------------------------------- */

  /* Primary remains vibrant in dark mode */
  --color-primary: var(--color-primary-base);
  --color-primary-hover: var(--color-primary-light);
  --color-primary-active: var(--color-primary-light);

  /* Secondary */
  --color-secondary: var(--color-secondary-light);
  --color-secondary-hover: var(--color-secondary-base);

  /* Success states */
  --color-success-bg: #064e3b;
  --color-success-text: #6ee7b7;
  --color-success-border: #065f46;

  /* Warning states */
  --color-warning-bg: #78350f;
  --color-warning-text: #fcd34d;
  --color-warning-border: #92400e;

  /* Error states */
  --color-error-bg: #7f1d1d;
  --color-error-text: #fca5a5;
  --color-error-border: #991b1b;

  /* Info states */
  --color-info-bg: #1e3a8a;
  --color-info-text: #93c5fd;
  --color-info-border: #1e40af;

  /* Text colors */
  --color-text: var(--gray-100);
  --color-text-secondary: var(--gray-400);
  --color-text-tertiary: var(--gray-500);
  --color-heading: var(--gray-50);

  /* Surface colors */
  --color-background: var(--gray-950);
  --color-surface: var(--gray-900);
  --color-surface-secondary: var(--gray-800);

  /* Border colors */
  --color-border: var(--gray-700);
  --color-border-hover: var(--gray-600);
  --color-border-focus: var(--color-primary);

  /* Disabled state */
  --color-disabled: var(--gray-600);
  --color-disabled-bg: var(--gray-800);

  /* ---------------------------------------------------------------------------
     Shadow Tokens (Dark Mode)
     --------------------------------------------------------------------------- */

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 30%);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 40%),
    0 2px 4px -1px rgb(0 0 0 / 30%);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 40%),
    0 4px 6px -2px rgb(0 0 0 / 30%);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 50%),
    0 10px 10px -5px rgb(0 0 0 / 30%);
}

/* =============================================================================
   SYSTEM PREFERENCE DARK MODE
   Auto-apply dark theme based on system preference if no manual override
   ========================================================================== */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    /* Same as [data-theme="dark"] */
    --color-primary: var(--color-primary-base);
    --color-primary-hover: var(--color-primary-light);
    --color-primary-active: var(--color-primary-light);
    --color-secondary: var(--color-secondary-light);
    --color-secondary-hover: var(--color-secondary-base);
    --color-success-bg: #064e3b;
    --color-success-text: #6ee7b7;
    --color-success-border: #065f46;
    --color-warning-bg: #78350f;
    --color-warning-text: #fcd34d;
    --color-warning-border: #92400e;
    --color-error-bg: #7f1d1d;
    --color-error-text: #fca5a5;
    --color-error-border: #991b1b;
    --color-info-bg: #1e3a8a;
    --color-info-text: #93c5fd;
    --color-info-border: #1e40af;
    --color-text: var(--gray-100);
    --color-text-secondary: var(--gray-400);
    --color-text-tertiary: var(--gray-500);
    --color-heading: var(--gray-50);
    --color-background: var(--gray-950);
    --color-surface: var(--gray-900);
    --color-surface-secondary: var(--gray-800);
    --color-border: var(--gray-700);
    --color-border-hover: var(--gray-600);
    --color-disabled: var(--gray-600);
    --color-disabled-bg: var(--gray-800);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 30%);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 40%),
      0 2px 4px -1px rgb(0 0 0 / 30%);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 40%),
      0 4px 6px -2px rgb(0 0 0 / 30%);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 50%),
      0 10px 10px -5px rgb(0 0 0 / 30%);
  }
}

/* =============================================================================
   ACCESSIBILITY - Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    /* stylelint-disable-next-line declaration-no-important */
    animation-duration: 0.01ms !important;
    /* stylelint-disable-next-line declaration-no-important */
    animation-iteration-count: 1 !important;
    /* stylelint-disable-next-line declaration-no-important */
    transition-duration: 0.01ms !important;
  }
}

/* =============================================================================
   THEME CUSTOMIZATION EXAMPLES
   ========================================================================== */

/* Example 1: High Contrast Theme
 * Uncomment and customize to create a high-contrast variant
 */

/*
[data-theme="high-contrast"] {
  --color-primary-base: #0000ff;
  --color-background: #fff;
  --color-text: #000;
  --color-border: #000;
  --border-width-default: 2px;
}
*/

/* Example 2: Soft/Pastel Theme
 * Uncomment and customize for a softer, pastel aesthetic
 */

/*
:root {
  --color-primary-base: #a78bfa;
  --color-success-base: #86efac;
  --color-error-base: #fca5a5;
  --radius-md: 1rem;
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 5%);
}
*/

/* Example 3: Custom Brand Colors
 * Replace the primary and secondary colors with your brand
 */

/*
:root {
  --color-primary-base: #your-brand-color;
  --color-primary-light: #lighter-variant;
  --color-primary-dark: #darker-variant;
  --color-secondary-base: #your-secondary-color;
}
*/
