/* What's On My Ballot - Main Stylesheet */
/* Bloomberg/Axios-inspired professional design */

/* ============================================
   RESET & BASE
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Colors - Navy/Slate Blue theme */
    --primary: #1e3a5f;
    --primary-dark: #152a45;
    --primary-light: #2d5a8c;
    --accent: #4a90e2;
    --accent-hover: #357abd;
    
    /* Neutrals */
    --bg: #ffffff;
    --bg-alt: #f8f9fa;
    --bg-card: #ffffff;
    --border: #e1e4e8;
    --border-light: #f0f2f4;
    
    /* Text */
    --text: #24292e;
    --text-secondary: #586069;
    --text-tertiary: #6a737d;
    
    /* Semantic */
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --info: #17a2b8;
    
    /* Typography */
    --font-base: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Courier New', monospace;
    
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    
    /* Border radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    
    /* Max widths */
    --max-width: 1200px;
    --max-width-narrow: 800px;
    --max-width-wide: 1400px;
}

body {
    font-family: var(--font-base);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--primary-dark);
    margin-bottom: var(--space-md);
}

h1 { font-size: 2.5rem; letter-spacing: -0.02em; }
h2 { font-size: 2rem; letter-spacing: -0.01em; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p {
    margin-bottom: var(--space-md);
    color: var(--text-secondary);
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

strong { font-weight: 600; }
em { font-style: italic; }

/* ============================================
   HEADER & NAVIGATION
   ============================================ */
header {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

nav {
    max-width: var(--max-width-wide);
    margin: 0 auto;
    padding: var(--space-md) var(--space-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.logo:hover {
    text-decoration: none;
    color: var(--primary-dark);
}

.nav-links {
    display: flex;
    gap: var(--space-xl);
    list-style: none;
}

.nav-links a {
    color: var(--text);
    font-weight: 500;
    font-size: 0.9375rem;
    text-decoration: none;
    transition: color 0.2s ease;
}

.nav-links a:hover {
    color: var(--accent);
    text-decoration: none;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text);
}

/* Mobile nav */
@media (max-width: 768px) {
    .nav-toggle {
        display: block;
    }
    
    .nav-links {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg);
        flex-direction: column;
        padding: var(--space-lg);
        gap: var(--space-md);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow-md);
        display: none;
    }
    
    .nav-links.active {
        display: flex;
    }
}

/* ============================================
   HERO SECTION
   ============================================ */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    padding: var(--space-3xl) var(--space-lg);
    text-align: center;
}

.hero h1 {
    color: white;
    font-size: 3rem;
    margin-bottom: var(--space-lg);
    max-width: var(--max-width-narrow);
    margin-left: auto;
    margin-right: auto;
}

.hero p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.25rem;
    max-width: var(--max-width-narrow);
    margin: 0 auto var(--space-xl);
}

/* ============================================
   SEARCH BAR
   ============================================ */
.search-bar {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

.search-bar input {
    width: 100%;
    padding: var(--space-md) var(--space-lg);
    font-size: 1rem;
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.search-bar button {
    position: absolute;
    right: var(--space-sm);
    top: 50%;
    transform: translateY(-50%);
    background: var(--accent);
    color: white;
    border: none;
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.search-bar button:hover {
    background: var(--accent-hover);
}

/* ============================================
   CONTAINER & LAYOUT
   ============================================ */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.container-narrow {
    max-width: var(--max-width-narrow);
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.container-wide {
    max-width: var(--max-width-wide);
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

section {
    padding: var(--space-3xl) 0;
}

section.bg-alt {
    background: var(--bg-alt);
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

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

.card h3 {
    margin-bottom: var(--space-sm);
    font-size: 1.25rem;
}

.card p {
    font-size: 0.9375rem;
    margin-bottom: var(--space-sm);
}

/* ============================================
   GRID LAYOUTS
   ============================================ */
.grid {
    display: grid;
    gap: var(--space-lg);
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

/* ============================================
   RACE CARDS
   ============================================ */
.race-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    box-shadow: var(--shadow-sm);
}

.race-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border-light);
}

.race-state {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--primary);
}

.race-type {
    font-size: 0.875rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.race-candidates {
    margin-bottom: var(--space-md);
}

.candidate {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) 0;
}

.candidate-name {
    font-weight: 600;
    color: var(--text);
}

.candidate-party {
    font-size: 0.875rem;
    color: var(--text-tertiary);
    margin-left: var(--space-sm);
}

.candidate-poll {
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--primary);
}

.race-meta {
    display: flex;
    gap: var(--space-lg);
    font-size: 0.875rem;
    color: var(--text-tertiary);
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-light);
}

.trend {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
}

.trend.up { color: var(--success); }
.trend.down { color: var(--danger); }
.trend.stable { color: var(--text-tertiary); }

/* ============================================
   STATS BAR
   ============================================ */
.stats-bar {
    display: flex;
    gap: var(--space-2xl);
    justify-content: center;
    padding: var(--space-xl) 0;
    flex-wrap: wrap;
}

.stat {
    text-align: center;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
    margin-bottom: var(--space-sm);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-block;
    padding: var(--space-sm) var(--space-lg);
    font-weight: 600;
    font-size: 0.9375rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
    text-decoration: none;
}

.btn-secondary {
    background: var(--bg-alt);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border-light);
    text-decoration: none;
}

.btn-outline {
    background: transparent;
    color: var(--accent);
    border: 2px solid var(--accent);
}

.btn-outline:hover {
    background: var(--accent);
    color: white;
    text-decoration: none;
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
    margin-bottom: var(--space-lg);
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: var(--space-sm);
    color: var(--text);
}

input[type="text"],
input[type="email"],
input[type="tel"],
textarea,
select {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-base);
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

/* ============================================
   FOOTER
   ============================================ */
footer {
    background: var(--primary-dark);
    color: rgba(255, 255, 255, 0.8);
    padding: var(--space-2xl) 0 var(--space-lg);
    margin-top: var(--space-3xl);
}

.footer-content {
    max-width: var(--max-width-wide);
    margin: 0 auto;
    padding: 0 var(--space-lg);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-2xl);
}

.footer-section h4 {
    color: white;
    margin-bottom: var(--space-md);
    font-size: 1rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: var(--space-sm);
}

.footer-section a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 0.9375rem;
}

.footer-section a:hover {
    color: white;
    text-decoration: underline;
}

.footer-bottom {
    max-width: var(--max-width-wide);
    margin: var(--space-xl) auto 0;
    padding: var(--space-lg) var(--space-lg) 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    font-size: 0.875rem;
}

/* ============================================
   NEWSLETTER SIGNUP
   ============================================ */
.newsletter {
    background: var(--bg-alt);
    padding: var(--space-2xl);
    border-radius: var(--radius-lg);
    text-align: center;
}

.newsletter h3 {
    margin-bottom: var(--space-md);
}

.newsletter p {
    margin-bottom: var(--space-lg);
}

.newsletter-form {
    display: flex;
    gap: var(--space-sm);
    max-width: 500px;
    margin: 0 auto;
}

.newsletter-form input {
    flex: 1;
}

/* ============================================
   BADGES & TAGS
   ============================================ */
.badge {
    display: inline-block;
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: var(--radius-sm);
}

.badge-competitive { background: #fff3cd; color: #856404; }
.badge-safe { background: #d4edda; color: #155724; }
.badge-tossup { background: #f8d7da; color: #721c24; }
.badge-primary { background: var(--accent); color: white; }

/* ============================================
   ARTICLE / BLOG CONTENT
   ============================================ */
article {
    max-width: var(--max-width-narrow);
    margin: 0 auto;
    padding: var(--space-2xl) var(--space-lg);
}

article h1 {
    font-size: 2.5rem;
    margin-bottom: var(--space-md);
}

article .article-meta {
    color: var(--text-tertiary);
    font-size: 0.9375rem;
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--border-light);
}

article h2 {
    margin-top: var(--space-2xl);
    margin-bottom: var(--space-md);
}

article h3 {
    margin-top: var(--space-xl);
    margin-bottom: var(--space-md);
}

article ul, article ol {
    margin-bottom: var(--space-lg);
    padding-left: var(--space-xl);
}

article li {
    margin-bottom: var(--space-sm);
    color: var(--text-secondary);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    :root {
        --space-3xl: 2.5rem;
        --space-2xl: 2rem;
    }
    
    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero p {
        font-size: 1rem;
    }
    
    .stats-bar {
        gap: var(--space-lg);
    }
    
    .stat-value {
        font-size: 2rem;
    }
    
    .newsletter-form {
        flex-direction: column;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   UTILITIES
   ============================================ */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.mt-sm { margin-top: var(--space-sm); }
.mb-sm { margin-bottom: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mb-md { margin-bottom: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-lg { margin-bottom: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-xl { margin-bottom: var(--space-xl); }

.hidden { display: none; }
.show-mobile { display: none; }

@media (max-width: 768px) {
    .hide-mobile { display: none; }
    .show-mobile { display: block; }
}
