/* ==========================================================================
   CSS Custom Properties (Design Tokens)
   TBDesigned Theme
   ========================================================================== */

:root {
    /* ======================================================================
       Colors
       ====================================================================== */
    
    /* Primary Brand Colors */
    --color-primary: #2563eb;
    --color-primary-light: #3b82f6;
    --color-primary-dark: #1d4ed8;
    --color-primary-50: #eff6ff;
    --color-primary-100: #dbeafe;
    --color-primary-900: #1e3a8a;
    
    /* Secondary/Accent */
    --color-secondary: #7c3aed;
    --color-secondary-light: #8b5cf6;
    --color-secondary-dark: #6d28d9;
    
    /* Neutral Colors */
    --color-white: #ffffff;
    --color-black: #000000;
    --color-gray-50: #f9fafb;
    --color-gray-100: #f3f4f6;
    --color-gray-200: #e5e7eb;
    --color-gray-300: #d1d5db;
    --color-gray-400: #9ca3af;
    --color-gray-500: #6b7280;
    --color-gray-600: #4b5563;
    --color-gray-700: #374151;
    --color-gray-800: #1f2937;
    --color-gray-900: #111827;
    
    /* Semantic Colors */
    --color-success: #059669;
    --color-success-light: #10b981;
    --color-warning: #d97706;
    --color-warning-light: #f59e0b;
    --color-error: #dc2626;
    --color-error-light: #ef4444;
    --color-info: #0284c7;
    --color-info-light: #0ea5e9;
    
    /* Contextual Colors (light theme) */
    --color-bg: var(--color-white);
    --color-bg-alt: var(--color-gray-50);
    --color-surface: var(--color-gray-100);
    --color-text: var(--color-gray-700);
    --color-heading: var(--color-gray-900);
    --color-muted: var(--color-gray-500);
    --color-border: var(--color-gray-200);
    
    /* ======================================================================
       Typography
       ====================================================================== */
    
    /* Font Families - System font stack for speed */
    --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, 
                 "Helvetica Neue", Arial, "Noto Sans", sans-serif, 
                 "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    --font-heading: var(--font-body);
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, 
                 "Liberation Mono", monospace;
    
    /* Font Sizes (mobile-first) */
    --text-xs: 0.75rem;      /* 12px */
    --text-sm: 0.875rem;     /* 14px */
    --text-base: 1rem;       /* 16px */
    --text-lg: 1.125rem;     /* 18px */
    --text-xl: 1.25rem;      /* 20px */
    --text-2xl: 1.5rem;      /* 24px */
    --text-3xl: 1.875rem;    /* 30px */
    --text-4xl: 2.25rem;     /* 36px */
    --text-5xl: 3rem;        /* 48px */
    --text-6xl: 3.75rem;     /* 60px */
    
    /* Line Heights */
    --leading-none: 1;
    --leading-tight: 1.25;
    --leading-snug: 1.375;
    --leading-normal: 1.5;
    --leading-relaxed: 1.625;
    --leading-loose: 2;
    
    /* Font Weights */
    --font-thin: 100;
    --font-light: 300;
    --font-normal: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;
    --font-extrabold: 800;
    
    /* Letter Spacing */
    --tracking-tighter: -0.05em;
    --tracking-tight: -0.025em;
    --tracking-normal: 0em;
    --tracking-wide: 0.025em;
    --tracking-wider: 0.05em;
    
    /* ======================================================================
       Spacing
       ====================================================================== */
    
    --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 */
    --space-20: 5rem;        /* 80px */
    --space-24: 6rem;        /* 96px */
    --space-32: 8rem;        /* 128px */
    
    /* ======================================================================
       Layout
       ====================================================================== */
    
    /* Container widths */
    --container-sm: 640px;
    --container-md: 768px;
    --container-lg: 1024px;
    --container-xl: 1280px;
    --container-2xl: 1440px;
    
    /* Content width */
    --content-width: var(--container-xl);
    --content-narrow: var(--container-md);
    
    /* Gutters */
    --gutter: var(--space-4);
    --gutter-md: var(--space-6);
    --gutter-lg: var(--space-8);
    
    /* ======================================================================
       Borders & Shadows
       ====================================================================== */
    
    /* Border Radius */
    --radius-none: 0;
    --radius-sm: 0.125rem;   /* 2px */
    --radius-default: 0.25rem; /* 4px */
    --radius-md: 0.375rem;   /* 6px */
    --radius-lg: 0.5rem;     /* 8px */
    --radius-xl: 0.75rem;    /* 12px */
    --radius-2xl: 1rem;      /* 16px */
    --radius-full: 9999px;
    
    /* Box Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
    --shadow-inner: inset 0 2px 4px 0 rgb(0 0 0 / 0.05);
    
    /* ======================================================================
       Transitions & Animation
       ====================================================================== */
    
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;
    
    /* Easing functions */
    --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);
    
    /* ======================================================================
       Z-Index Scale
       ====================================================================== */
    
    --z-negative: -1;
    --z-0: 0;
    --z-10: 10;
    --z-20: 20;
    --z-30: 30;
    --z-40: 40;
    --z-50: 50;
    --z-header: 100;
    --z-dropdown: 200;
    --z-modal: 300;
    --z-toast: 400;
}

/* ==========================================================================
   Dark Mode (optional — can be toggled via class or media query)
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    :root {
        --color-bg: var(--color-gray-900);
        --color-bg-alt: var(--color-gray-800);
        --color-surface: var(--color-gray-700);
        --color-text: var(--color-gray-300);
        --color-heading: var(--color-white);
        --color-muted: var(--color-gray-400);
        --color-border: var(--color-gray-600);
    }
}

/* Manual dark mode toggle */
.dark {
    --color-bg: var(--color-gray-900);
    --color-bg-alt: var(--color-gray-800);
    --color-surface: var(--color-gray-700);
    --color-text: var(--color-gray-300);
    --color-heading: var(--color-white);
    --color-muted: var(--color-gray-400);
    --color-border: var(--color-gray-600);
}

/* ==========================================================================
   Responsive Typography Scale
   ========================================================================== */

@media (min-width: 768px) {
    :root {
        --text-4xl: 2.5rem;    /* 40px */
        --text-5xl: 3.5rem;    /* 56px */
        --text-6xl: 4.5rem;    /* 72px */
    }
}

@media (min-width: 1024px) {
    :root {
        --text-4xl: 3rem;      /* 48px */
        --text-5xl: 4rem;      /* 64px */
        --text-6xl: 5rem;      /* 80px */
        --gutter: var(--space-6);
    }
}
