/* core.css - Refactored Global Design System for Political DNA */

/* CSS Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Custom Properties */
:root {
    /* Primary Palette */
    --primary: #1e3a5f;
    --primary-dark: #0f1f33;
    --primary-light: #2d4f7f;
    
    /* Accent Colors */
    --accent-red: #e63946;
    --accent-green: #06ffa5;
    --accent-yellow: #ffd60a;
    --accent-purple: #7209b7;
    
    /* Neutrals */
    --dark: #0a0e1a;
    --dark-blue: #141824;
    --gray-900: #1f2937;
    --gray-800: #374151;
    --gray-700: #4b5563;
    --gray-600: #6b7280;
    --gray-500: #9ca3af;
    --gray-400: #cbd5e1;
    --gray-300: #e2e8f0;
    --gray-200: #f1f5f9;
    --gray-100: #f8fafc;
    --white: #ffffff;
    
    /* DNA Gradient */
    --dna-gradient: linear-gradient(135deg, 
        var(--primary) 0%, 
        var(--accent-red) 25%, 
        var(--primary) 50%, 
        var(--accent-green) 75%, 
        var(--primary) 100%);
    
    /* Semantic Colors */
    --success: var(--accent-green);
    --warning: var(--accent-yellow);
    --error: var(--accent-red);
    --info: var(--primary-light);
    
    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
    
    /* Font Sizes - Improved scale */
    --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 */
    
    /* Spacing Scale */
    --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 */
    
    /* Border Radius */
    --radius-sm: 0.375rem;   /* 6px */
    --radius-md: 0.5rem;     /* 8px */
    --radius-lg: 0.75rem;    /* 12px */
    --radius-xl: 1rem;       /* 16px */
    --radius-2xl: 1.5rem;    /* 24px */
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.2);
    --shadow-2xl: 0 25px 50px rgba(0, 0, 0, 0.25);
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Z-index Scale */
    --z-base: 0;
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-overlay: 300;
    --z-modal: 400;
    --z-notification: 500;
    --z-tooltip: 600;
    
    /* Touch Target Minimum */
    --touch-target: 48px;
}

/* Base Styles */
html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--white);
    background: var(--dark);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: var(--white);
}

h1 { font-size: clamp(2rem, 5vw, var(--text-5xl)); }
h2 { font-size: clamp(1.75rem, 4vw, var(--text-4xl)); }
h3 { font-size: clamp(1.5rem, 3vw, var(--text-3xl)); }
h4 { font-size: var(--text-2xl); }
h5 { font-size: var(--text-xl); }
h6 { font-size: var(--text-lg); }

p {
    margin-bottom: var(--space-4);
    color: var(--gray-300);
}

a {
    color: var(--accent-green);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-red);
}

a:focus-visible {
    outline: 2px solid var(--accent-green);
    outline-offset: 4px;
    border-radius: var(--radius-sm);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-4);
}

@media (min-width: 640px) {
    .container {
        padding: 0 var(--space-6);
    }
}

@media (min-width: 1024px) {
    .container {
        padding: 0 var(--space-8);
    }
}

/* Buttons */
button, .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4) var(--space-6);
    font-size: var(--text-base);
    font-weight: 700;
    border-radius: var(--radius-lg);
    border: none;
    cursor: pointer;
    transition: all var(--transition-base);
    font-family: var(--font-sans);
    gap: var(--space-2);
    min-height: var(--touch-target);
    text-align: center;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

button:focus-visible {
    outline: 2px solid var(--accent-green);
    outline-offset: 4px;
}

/* Button Variants */
.btn-primary, button[type="submit"], .hero-cta, .start-btn, .cta-button {
    background: var(--dna-gradient);
    color: var(--white);
    border: none;
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-base);
}

.btn-primary:hover, button[type="submit"]:hover, .hero-cta:hover, .start-btn:hover, .cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 40px rgba(6, 255, 165, 0.3);
}

.btn-primary:active, button[type="submit"]:active, .hero-cta:active, .start-btn:active, .cta-button:active {
    transform: translateY(0);
}

/* Full width variant */
.btn-primary.full-width, button[type="submit"] {
    width: 100%;
}

.btn-secondary {
    background: transparent;
    color: var(--white);
    border: 2px solid var(--gray-600);
}

.btn-secondary:hover {
    background: var(--gray-800);
    border-color: var(--gray-500);
    transform: translateY(-2px);
}

.btn-secondary:active {
    transform: translateY(0);
}

/* Outline variant for less emphasis */
.btn-outline {
    background: transparent;
    color: var(--accent-green);
    border: 2px solid var(--accent-green);
}

.btn-outline:hover {
    background: var(--accent-green);
    color: var(--dark);
    transform: translateY(-2px);
}

/* Ghost variant - minimal style */
.btn-ghost {
    background: rgba(30, 58, 95, 0.3);
    color: var(--white);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-ghost:hover {
    background: rgba(30, 58, 95, 0.5);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Gradient Text */
.gradient-text {
    background: linear-gradient(135deg, var(--accent-green) 0%, var(--accent-red) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Cards */
.card {
    background: rgba(30, 42, 59, 0.5);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    transition: all var(--transition-base);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-light);
}

/* Loading States */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-600);
    border-radius: 50%;
    border-top-color: var(--accent-green);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInSimple {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }

.mt-4 { margin-top: var(--space-4); }
.mb-4 { margin-bottom: var(--space-4); }
.my-4 { margin-top: var(--space-4); margin-bottom: var(--space-4); }

.p-4 { padding: var(--space-4); }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }

/* Responsive Utilities */
@media (max-width: 767px) {
    .hide-mobile { display: none !important; }
}

@media (min-width: 768px) {
    .hide-tablet-up { display: none !important; }
}

@media (min-width: 1024px) {
    .hide-desktop { display: none !important; }
}

/* Focus States */
:focus-visible {
    outline: 2px solid var(--accent-green);
    outline-offset: 2px;
}

/* Selection */
::selection {
    background: var(--accent-green);
    color: var(--dark);
}

/* Smooth Performance */
.will-animate {
    will-change: transform;
}

.will-animate-opacity {
    will-change: opacity;
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Screen reader only - hide visually but keep for assistive tech */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Skip link for keyboard navigation */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 9999;
    background: var(--accent-green);
    color: var(--dark);
    padding: 1rem 2rem;
    text-decoration: none;
    font-weight: 700;
    border-radius: 0 0 var(--radius-md) 0;
}

.skip-link:focus {
    left: 0;
}