:root {
    --primary-blue: #004ea1;
    --primary-red: #e61e2b;
    --bg-light: #f8fafc;
    --nav-bg: #ffffff;
    --text-main: #1e293b;
}
 
body {
    margin: 0;
    /* padding-top is now set dynamically by nav-loader.js to match the fixed bar height */
    padding-top: 95px;
    font-family: 'Poor Story', cursive;
    background-color: var(--bg-light);
    color: var(--text-main);
}
 
/* Wrapper to fix both Header and Nav together at the top */
.fixed-top {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    background: var(--nav-bg);
    border-bottom: 1px solid #e2e8f0;
}
 
header {
    padding: 10px 15px;
    text-align: center;
}
 
header h2 { margin: 0; font-size: 1.2rem; }
 
header h2 a {
    text-decoration: none;
    color: var(--primary-blue);
}
 
/* Scrollable Navigation stays inside the fixed top area */
nav {
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    background-image: linear-gradient(to right, white 85%, rgba(255, 255, 255, 0) 100%);
    background-position: right center;
    background-repeat: no-repeat;
    background-size: 20px 100%;
}
 
nav::-webkit-scrollbar { display: none; }
 
nav ul {
    display: inline-flex;
    list-style: none;
    padding: 8px 10px;
    margin: 0;
}
 
nav li { padding: 0 4px; }
 
nav a {
    text-decoration: none;
    color: #64748b;
    font-size: 0.95rem;
    padding: 6px 12px;
    border-radius: 20px;
}
 
nav a.active {
    background: var(--primary-blue);
    color: white;
    font-weight: bold;
}
 
nav ul li:first-child a {
    padding: 6px 10px;
}
 
/* Exception for the Home Emoji — no blue pill background */
nav ul li:first-child a.active {
    background: transparent;
    color: inherit;
}
 
#nav-index.active {
    background: transparent !important;
    color: inherit !important;
    text-shadow: 0 0 8px rgba(0, 78, 161, 0.4);
}
 
main { padding: 15px; }
 
.card {
    background: white;
    padding: 18px;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    margin-bottom: 15px;
}
 
.portal-grid {
    display: grid;
    gap: 15px;
    padding: 10px;
}
 
.election-card {
    background: white;
    text-decoration: none;
    color: inherit;
    padding: 20px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 5px solid var(--primary-blue);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}
 
.election-card:active { transform: scale(0.98); }
 
.date-tag {
    font-size: 0.8rem;
    color: #64748b;
    display: block;
    margin-bottom: 5px;
}
 
.election-card h3 { margin: 0; font-size: 1.1rem; }
.election-card p { margin: 5px 0 0 0; font-size: 0.9rem; color: #475569; }
.arrow { color: var(--primary-blue); font-weight: bold; font-size: 1.2rem; }
 
.portal-title {
    color: var(--primary-blue);
    transition: color 0.3s ease;
}
 
/* --- Outlink Button (replaces inline styles) --- */
.outlink-btn {
    display: block;
    text-align: center;
    background: #e2e8f0;
    padding: 10px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--primary-blue);
    margin-top: 8px;
}
 
/* --- Dark Mode --- */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-light: #0f172a;
        --nav-bg: #1e293b;
        --text-main: #f8fafc;
    }
 
    .portal-title {
        color: #93c5fd !important;
        text-shadow: 0 0 15px rgba(147, 197, 253, 0.3);
    }
 
    header h2 a {
        color: #93c5fd;
    }
 
    .card, .election-card {
        background: #1e293b;
        /* Preserve the left accent border in dark mode */
        border-left: 5px solid var(--primary-blue);
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    }
 
    .date-tag {
        color: #94a3b8;
    }
 
    nav {
        background-image: linear-gradient(to right, var(--nav-bg) 85%, rgba(30, 41, 59, 0) 100%);
    }
 
    nav a.active {
        background: #3b82f6;
    }
 
    /* Dark mode outlink button */
    .outlink-btn {
        background: #334155;
        color: #93c5fd;
    }
}
