/* Max Democracy Professional Design System */

/* CSS Variables / Design Tokens */
:root {
    /* Colors - Light Theme */
    --primary: #1a1a2e;
    --primary-light: #2d2d4e;
    --accent: #0f4c75;
    --highlight: #3282b8;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    
    /* Text Colors */
    --text: #1a1a1a;
    --text-muted: #6b7280;
    --text-light: #9ca3af;
    
    /* Backgrounds */
    --bg: #ffffff;
    --surface: #f8f9fa;
    --surface-hover: #f3f4f6;
    
    /* Borders & Shadows */
    --border: #e5e7eb;
    --border-dark: #d1d5db;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 2px 8px 0 rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 40px 0 rgb(0 0 0 / 0.15);
    
    /* Typography */
    --font-serif: 'Charter', 'Georgia', 'Cambria', serif;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', sans-serif;
    --font-mono: 'JetBrains Mono', 'Consolas', 'Monaco', monospace;
    
    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    
    /* Font Sizes */
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
    --text-4xl: 2.25rem;
    --text-5xl: 3rem;
    
    /* Line Heights */
    --leading-tight: 1.25;
    --leading-snug: 1.375;
    --leading-normal: 1.5;
    --leading-relaxed: 1.625;
    --leading-loose: 2;
    
    /* Border Radius */
    --radius-sm: 0.125rem;
    --radius: 0.25rem;
    --radius-md: 0.375rem;
    --radius-lg: 0.5rem;
    --radius-xl: 0.75rem;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition: 300ms ease;
    --transition-slow: 500ms ease;
    
    /* Z-index Scale */
    --z-base: 0;
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-overlay: 300;
    --z-modal: 400;
    --z-popover: 500;
    --z-tooltip: 600;
}

/* Dark Theme */
[data-theme="dark"] {
    --primary: #bbe1fa;
    --primary-light: #d4ebfc;
    --accent: #3282b8;
    --highlight: #0f4c75;
    
    --text: #e5e7eb;
    --text-muted: #9ca3af;
    --text-light: #6b7280;
    
    --bg: #0f0f0f;
    --surface: #1a1a1a;
    --surface-hover: #262626;
    
    --border: #374151;
    --border-dark: #4b5563;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow: 0 2px 8px 0 rgb(0 0 0 / 0.4);
    --shadow-lg: 0 10px 40px 0 rgb(0 0 0 / 0.5);
}

/* Base Reset & Defaults */
*, *::before, *::after {
    box-sizing: border-box;
}

* {
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--font-serif);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--text);
    background-color: var(--bg);
    transition: background-color var(--transition), color var(--transition);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-sans);
    font-weight: 700;
    line-height: var(--leading-tight);
    color: var(--text);
}

h1 { font-size: var(--text-4xl); margin-bottom: var(--space-6); }
h2 { font-size: var(--text-3xl); margin-bottom: var(--space-5); }
h3 { font-size: var(--text-2xl); margin-bottom: var(--space-4); }
h4 { font-size: var(--text-xl); margin-bottom: var(--space-3); }
h5 { font-size: var(--text-lg); margin-bottom: var(--space-3); }
h6 { font-size: var(--text-base); margin-bottom: var(--space-2); }

p {
    margin-bottom: var(--space-4);
    line-height: var(--leading-relaxed);
}

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

a:hover {
    color: var(--highlight);
    text-decoration: underline;
}

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

.wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-4);
}

.prose {
    max-width: 65ch;
    font-size: var(--text-lg);
    line-height: var(--leading-relaxed);
}

.prose h2 { margin-top: var(--space-12); }
.prose h3 { margin-top: var(--space-8); }
.prose p { margin-bottom: var(--space-6); }
.prose ul, .prose ol { margin-bottom: var(--space-6); padding-left: var(--space-6); }
.prose li { margin-bottom: var(--space-2); }
.prose blockquote {
    border-left: 4px solid var(--accent);
    padding-left: var(--space-4);
    margin: var(--space-6) 0;
    font-style: italic;
    color: var(--text-muted);
}

/* Components */

/* Buttons */
.btn, .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-2) var(--space-4);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: 600;
    line-height: 1;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn-primary, .button.primary {
    background-color: var(--accent);
    color: white;
    border: none;
}

.btn-primary:hover, .button.primary:hover {
    background-color: var(--highlight);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-secondary, .button.secondary {
    background-color: var(--surface);
    color: var(--text);
    border-color: var(--border);
}

.btn-secondary:hover, .button.secondary:hover {
    background-color: var(--surface-hover);
    border-color: var(--border-dark);
}

.btn-ghost, .button.ghost {
    background-color: transparent;
    color: var(--text);
}

.btn-ghost:hover, .button.ghost:hover {
    background-color: var(--surface);
}

/* Cards */
.card {
    background-color: var(--bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: var(--space-6);
    transition: all var(--transition);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card.featured {
    background: linear-gradient(135deg, var(--surface) 0%, var(--bg) 100%);
    border: 2px solid var(--accent);
}

/* Chips / Badges */
.chip, .badge, .category-badge {
    display: inline-block;
    padding: var(--space-1) var(--space-3);
    font-family: var(--font-sans);
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: var(--radius-full);
    background-color: var(--accent);
    color: white;
}

.chip.secondary {
    background-color: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

/* Forms */
input, textarea, select {
    width: 100%;
    padding: var(--space-3);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    color: var(--text);
    background-color: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(15, 76, 117, 0.1);
}

/* Grid Layouts */
.grid {
    display: grid;
    gap: var(--space-6);
}

.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* Navigation */
.site-header {
    background-color: var(--primary);
    color: white;
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    box-shadow: var(--shadow);
}

.nav-link {
    color: rgba(255, 255, 255, 0.9);
    font-family: var(--font-sans);
    font-weight: 500;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius);
    transition: all var(--transition-fast);
}

.nav-link:hover, .nav-link.active {
    color: white;
    background-color: rgba(255, 255, 255, 0.1);
    text-decoration: none;
}

/* Article Styles */
.article-header {
    margin-bottom: var(--space-8);
}

.article-title {
    font-size: var(--text-4xl);
    line-height: var(--leading-tight);
    margin-bottom: var(--space-4);
}

.article-meta, .meta {
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    color: var(--text-muted);
    display: flex;
    gap: var(--space-4);
    align-items: center;
}

.muted {
    color: var(--text-muted);
}

.article-body {
    font-size: var(--text-lg);
    line-height: var(--leading-relaxed);
}

/* Footer */
.site-footer {
    background-color: var(--primary);
    color: white;
    padding: var(--space-12) 0 var(--space-8);
    margin-top: var(--space-16);
    font-family: var(--font-sans);
}

.site-footer a {
    color: rgba(255, 255, 255, 0.8);
    transition: color var(--transition-fast);
}

.site-footer a:hover {
    color: white;
    text-decoration: none;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-cols-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    :root {
        --text-4xl: 2rem;
        --text-3xl: 1.5rem;
        --text-2xl: 1.25rem;
    }
    
    .container, .wrap { padding: 0 var(--space-3); }
    .grid-cols-2 { grid-template-columns: 1fr; }
    .grid-cols-3 { grid-template-columns: 1fr; }
    .grid-cols-4 { grid-template-columns: 1fr; }
    
    .hide-mobile { display: none; }
}

@media (max-width: 480px) {
    :root { font-size: 14px; }
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

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

.animate-fadeIn { animation: fadeIn var(--transition-slow) ease-out; }
.animate-pulse { animation: pulse 2s infinite; }
.animate-slideIn { animation: slideInRight var(--transition) ease-out; }

/* Loading States */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--accent);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

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

/* Print Styles */
@media print {
    body { font-size: 12pt; }
    .no-print, .site-header, .site-footer { display: none; }
    a { color: inherit; text-decoration: underline; }
}
