/**
 * Design System CSS
 * Mobile-First UI/UX Redesign
 * 
 * This file defines the core design tokens using CSS custom properties.
 * All values are mobile-first and scale responsively across breakpoints.
 */

/* Google Fonts — Inter (400, 500, 600, 700) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* ============================================
     COLOR PALETTE
     ============================================ */
  
  /* Primary Colors - Deep Indigo */
  --color-primary-50: #eef2ff;
  --color-primary-100: #e0e7ff;
  --color-primary-200: #c7d2fe;
  --color-primary-300: #a5b4fc;
  --color-primary-400: #818cf8;
  --color-primary-500: #6366f1;  /* Main primary */
  --color-primary-600: #4f46e5;
  --color-primary-700: #4338ca;
  --color-primary-800: #3730a3;
  --color-primary-900: #312e81;
  
  /* Neutral Colors - Warm Gray */
  --color-neutral-50: #fafaf9;
  --color-neutral-100: #f5f5f4;
  --color-neutral-200: #e7e5e4;
  --color-neutral-300: #d6d3d1;
  --color-neutral-400: #a8a29e;
  --color-neutral-500: #78716c;
  --color-neutral-600: #57534e;
  --color-neutral-700: #44403c;
  --color-neutral-800: #292524;
  --color-neutral-900: #1c1917;
  
  /* Semantic Colors */
  --color-success-500: #10b981;  /* Emerald */
  --color-success-600: #059669;
  --color-warning-500: #f59e0b;  /* Amber */
  --color-warning-600: #d97706;
  --color-danger-500: #ef4444;   /* Red */
  --color-danger-600: #dc2626;
  --color-info-500: #3b82f6;     /* Blue */
  --color-info-600: #2563eb;
  
  /* Surface Colors */
  --color-surface-base: #ffffff;
  --color-surface-raised: #ffffff;
  --color-surface-overlay: #ffffff;
  --color-background: #fafaf9;
  
  /* Text Colors */
  --color-text-primary: #1c1917;
  --color-text-secondary: #57534e;
  --color-text-tertiary: #a8a29e;
  --color-text-inverse: #ffffff;
  --color-text-link: #4f46e5;
  
  /* Border Colors */
  --color-border-subtle: #e7e5e4;
  --color-border-default: #d6d3d1;
  --color-border-strong: #a8a29e;
  
  /* ============================================
     TYPOGRAPHY SYSTEM
     ============================================ */
  
  /* Font Families */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", 
               Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", Consolas, monospace;
  
  /* Font Sizes - Fluid Typography using clamp() */
  --font-size-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);      /* 12-14px */
  --font-size-sm: clamp(0.875rem, 0.825rem + 0.25vw, 1rem);       /* 14-16px */
  --font-size-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);      /* 16-18px */
  --font-size-md: clamp(1.125rem, 1.05rem + 0.375vw, 1.25rem);    /* 18-20px */
  --font-size-lg: clamp(1.25rem, 1.15rem + 0.5vw, 1.5rem);        /* 20-24px */
  --font-size-xl: clamp(1.5rem, 1.35rem + 0.75vw, 2rem);          /* 24-32px */
  --font-size-2xl: clamp(2rem, 1.75rem + 1.25vw, 3rem);           /* 32-48px */
  --font-size-3xl: clamp(2.5rem, 2rem + 2.5vw, 4rem);             /* 40-64px */
  
  /* Line Heights */
  --line-height-tight: 1.25;
  --line-height-snug: 1.375;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.625;
  --line-height-loose: 2;
  
  /* Font Weights */
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  
  /* Letter Spacing */
  --letter-spacing-tight: -0.025em;
  --letter-spacing-normal: 0;
  --letter-spacing-wide: 0.025em;
  
  /* ============================================
     SPACING SCALE
     ============================================ */
  
  --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 */
  
  /* ============================================
     BORDER RADIUS SYSTEM
     ============================================ */
  
  --radius-none: 0;
  --radius-sm: 0.25rem;    /* 4px */
  --radius-base: 0.5rem;   /* 8px */
  --radius-md: 0.75rem;    /* 12px */
  --radius-lg: 1rem;       /* 16px */
  --radius-xl: 1.5rem;     /* 24px */
  --radius-full: 9999px;   /* Pill shape */
  
  /* ============================================
     SHADOW SYSTEM
     ============================================ */
  
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 
               0 1px 2px -1px rgba(0, 0, 0, 0.1);
  --shadow-base: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 
                 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 
               0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 
               0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  
  /* ============================================
     ANIMATION SYSTEM
     ============================================ */
  
  /* Durations */
  --duration-fast: 150ms;
  --duration-base: 250ms;
  --duration-slow: 350ms;
  --duration-slower: 500ms;
  
  /* Easing Functions - Spring/Bounce */
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --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);
  
  /* ============================================
     TOUCH TARGET SPECIFICATIONS
     ============================================ */
  
  --touch-target-min: 44px;          /* Minimum touch target size (WCAG) */
  --touch-target-comfortable: 48px;  /* Comfortable touch target */
  --touch-target-spacious: 56px;     /* Spacious touch target */
  --touch-spacing-min: 8px;          /* Minimum spacing between targets */
}

/* ============================================
   BASE STYLES
   ============================================ */

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  color: var(--color-text-primary);
  background: var(--color-background);
}

/* ============================================
   TYPOGRAPHY BASE STYLES
   ============================================ */

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--space-4) 0;
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  color: var(--color-text-primary);
}

h1 {
  font-size: var(--font-size-3xl);
}

h2 {
  font-size: var(--font-size-2xl);
}

h3 {
  font-size: var(--font-size-xl);
}

h4 {
  font-size: var(--font-size-lg);
}

h5 {
  font-size: var(--font-size-md);
}

h6 {
  font-size: var(--font-size-base);
}

p {
  margin: 0 0 var(--space-4) 0;
}

a {
  color: var(--color-text-link);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-smooth);
}

a:hover {
  color: var(--color-primary-700);
}

a:focus-visible {
  outline: 2px solid var(--color-primary-500);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ============================================
   MOMENTUM SCROLLING (iOS)
   ============================================ */

.scroll-container {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ============================================
   SAFE AREA SUPPORT (Notched Devices)
   ============================================ */

.safe-area-inset-top {
  padding-top: env(safe-area-inset-top);
}

.safe-area-inset-bottom {
  padding-bottom: env(safe-area-inset-bottom);
}

.safe-area-inset-left {
  padding-left: env(safe-area-inset-left);
}

.safe-area-inset-right {
  padding-right: env(safe-area-inset-right);
}

/* ============================================
   FOCUS VISIBLE STYLES
   ============================================ */

*:focus-visible {
  outline: 2px solid var(--color-primary-500);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Remove default focus outline */
*:focus:not(:focus-visible) {
  outline: none;
}

/* ============================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================ */

/* Remove tap highlight color on mobile */
* {
  -webkit-tap-highlight-color: transparent;
}

/* Improve touch scrolling performance */
.touch-scroll {
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
  * {
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }
  
  a,
  a:visited {
    text-decoration: underline;
  }
  
  a[href]:after {
    content: " (" attr(href) ")";
  }
  
  h2,
  h3 {
    page-break-after: avoid;
  }
}
