/* Reset & Variables */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --text-primary: #333333;
    --text-secondary: #666666;
    --accent: #1a73e8;
    --temp-cold: #2166ac;
    --temp-hot: #b2182b;
    --north-color: #d73027;
    --south-color: #4575b4;
    --font-stack: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --nav-height: 60px;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-stack);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Navbar */
#navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: var(--bg-primary);
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    z-index: 1000;
}

.nav-brand {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 20px;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--accent);
}

/* Sections */
.section {
    min-height: 100vh;
    padding: calc(var(--nav-height) + 40px) 40px 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.section:nth-child(even) {
    background: var(--bg-secondary);
}

.section-content {
    max-width: 1200px;
    width: 100%;
    text-align: center;
}

h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

h2 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.5rem;
    color: var(--temp-hot);
    margin-bottom: 2rem;
}

.section-desc {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.cta {
    margin-top: 2rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Chart containers */
#spiral-chart,
#timeline-chart,
#heatmap-chart,
#hemispheres-chart,
#decades-chart,
#emissions-chart,
#race-chart,
#world-map-chart,
#co2-growth-chart,
#correlation-chart {
    width: 100%;
    height: 620px;
    margin: 20px auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

#spiral-chart {
    height: 1100px;
}

#world-map-chart {
    height: 650px;
}

#heatmap-chart {
    height: 650px;
}

#spiral-chart svg,
#timeline-chart svg,
#hemispheres-chart svg,
#emissions-chart svg,
#race-chart svg,
#correlation-chart svg {
    max-width: 100%;
}

/* Buttons */
.btn {
    background: var(--accent);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn:hover {
    background: #1557b0;
}

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

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

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

/* Controls */
.controls {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

/* Slider */
input[type="range"] {
    width: 400px;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: #ddd;
    border-radius: 4px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

#map-year-label {
    font-size: 1.5rem;
    font-weight: 700;
    min-width: 60px;
}

#country-details {
    min-height: 60px;
    padding: 15px;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin-top: 20px;
}

/* Legend */
.legend {
    display: flex;
    gap: 24px;
    justify-content: center;
    margin-top: 16px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 2px;
}

/* Insights */
.insight {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-top: 20px;
    font-weight: 500;
}

/* Tooltip */
.tooltip {
    position: absolute;
    background: var(--text-primary);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.85rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 100;
}

/* Footer */
footer {
    background: var(--bg-secondary);
    padding: 40px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

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

footer p {
    margin: 8px 0;
}
