/* ========================================
   ECV Explorer - Editorial Design System
   Clean, Warm, Data-Journalism Inspired
   ======================================== */

:root {
    /* Color Palette - Warm & Editorial */
    --bg-body: #FDFBF7;
    --bg-card: #FFFFFF;
    --bg-sidebar: #FDFBF7;
    --bg-input: #F5F3EF;
    --bg-hover: #EDEAE4;
    
    --text-primary: #1a1a1a;
    --text-secondary: #4a4a4a;
    --text-muted: #8a8a8a;
    
    /* Terracotta/Rust accent - distinctive and warm */
    --accent: #c45d3e;
    --accent-light: #fef3ef;
    --accent-dark: #9a4830;
    --accent-gradient: linear-gradient(135deg, #c45d3e, #d97a5e);
    
    --border: #e8e4de;
    --border-focus: #c45d3e;
    
    /* Chart palette - sophisticated & distinct */
    --chart-1: #c45d3e;
    --chart-2: #2d6a7a;
    --chart-3: #8b7355;
    --chart-4: #5c7a5e;
    --chart-5: #9a6b8c;
    
    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-serif: 'Source Serif 4', 'Georgia', 'Times New Roman', serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', 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;
    
    /* Radius - more subtle */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    --radius-full: 9999px;
    
    /* Shadows - softer, warmer */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.04);
    --shadow-md: 0 2px 8px -2px rgb(0 0 0 / 0.08);
    --shadow-lg: 0 8px 24px -8px rgb(0 0 0 / 0.12);
    --shadow-xl: 0 16px 40px -12px rgb(0 0 0 / 0.15);
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

input, button, select, textarea, option {
    font-family: var(--font-sans) !important;
}

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

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

/* ========================================
   Global Navigation Bar
   ======================================== */
.navbar {
    background: var(--bg-body);
    border-bottom: 1px solid var(--border);
    padding: 0 var(--space-8);
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.95rem;
    letter-spacing: -0.01em;
}

.navbar-logo {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
}

.navbar-logo svg {
    width: 22px;
    height: 22px;
}

.navbar-center {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.navbar-link {
    padding: var(--space-2) var(--space-3);
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: color var(--transition-fast);
}

.navbar-link:hover {
    color: var(--text-primary);
}

.navbar-link.active {
    color: var(--text-primary);
    font-weight: 600;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.lang-toggle {
    display: flex;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.lang-toggle button {
    padding: var(--space-1) var(--space-3);
    border: none;
    background: transparent;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
    letter-spacing: 0.02em;
}

.lang-toggle button:first-child {
    border-right: 1px solid var(--border);
}

.lang-toggle button:hover {
    color: var(--text-primary);
    background: var(--bg-input);
}

.lang-toggle button.active {
    background: var(--text-primary);
    color: var(--bg-body);
}

/* ========================================
   Landing Page
   ======================================== */
.landing-header {
    padding: var(--space-4) var(--space-8);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
}

/* ========================================
   Subtle Background Pattern
   ======================================== */
.bg-gradient-orbs {
    display: none;
}

.orb {
    display: none;
}

.orb-1 {
    display: none;
}

.orb-2 {
    display: none;
}

.orb-3 {
    display: none;
}

.orb-4 {
    display: none;
}

/* Grid Pattern Overlay */
.bg-grid {
    position: fixed;
    inset: 0;
    background-image: 
        linear-gradient(rgba(196, 93, 62, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(196, 93, 62, 0.04) 1px, transparent 1px);
    background-size: 80px 80px;
    pointer-events: none;
    z-index: 1;
}

/* Subtle Noise Texture */
.bg-noise {
    position: fixed;
    inset: 0;
    opacity: 0.03;
    pointer-events: none;
    z-index: 2;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

.landing-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 3;
}

.landing-hero {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-8);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.landing-content {
    position: relative;
    z-index: 1;
    max-width: 720px;
}

/* Simple entrance animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.landing-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: var(--space-8);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    animation: fadeInUp 0.6s ease-out forwards;
    opacity: 0;
}

.landing-badge svg {
    width: 14px;
    height: 14px;
    color: var(--accent);
}

.landing-title {
    font-family: var(--font-serif);
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 600;
    line-height: 1.05;
    margin-bottom: var(--space-6);
    letter-spacing: -0.02em;
    color: var(--text-primary);
    animation: fadeInUp 0.6s ease-out 0.1s forwards;
    opacity: 0;
}

.landing-title .highlight {
    color: var(--accent);
    font-style: italic;
}

.landing-subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: var(--space-10);
    animation: fadeInUp 0.6s ease-out 0.2s forwards;
    opacity: 0;
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
}

.landing-actions {
    display: flex;
    gap: var(--space-3);
    justify-content: center;
    flex-wrap: wrap;
    animation: fadeInUp 0.6s ease-out 0.3s forwards;
    opacity: 0;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all var(--transition-base);
    cursor: pointer;
    border: none;
}

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

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

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

.btn-secondary:hover {
    border-color: var(--text-primary);
    background: var(--bg-input);
}

.btn svg {
    width: 18px;
    height: 18px;
}

.landing-footer {
    padding: var(--space-6) var(--space-8);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
    animation: fadeIn 0.6s ease-out 0.4s forwards;
    opacity: 0;
}

.landing-footer p {
    margin: 0;
    line-height: 1.6;
}

.landing-footer #footer-desc {
    margin-bottom: var(--space-2);
}

.landing-footer .footer-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-2);
    color: var(--text-muted);
}

.landing-footer .footer-links span {
    opacity: 0.4;
}

.landing-footer a {
    color: var(--text-secondary);
    text-decoration: underline;
    text-decoration-color: var(--border);
    text-underline-offset: 2px;
}

.landing-footer a:hover {
    color: var(--accent);
    text-decoration-color: var(--accent);
}

/* ========================================
   Explorer Page Layout
   ======================================== */
.explorer-layout {
    display: grid;
    grid-template-columns: 25% 1fr;
    min-height: calc(100vh - 56px);
}

/* Sidebar */
.explorer-sidebar {
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    padding: var(--space-5);
    overflow-y: auto;
    height: calc(100vh - 56px);
    position: sticky;
    top: 56px;
}

.sidebar-section {
    margin-bottom: var(--space-5);
}

.sidebar-section:last-child {
    margin-bottom: 0;
}

.sidebar-title {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    margin-bottom: var(--space-3);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.sidebar-title svg {
    width: 12px;
    height: 12px;
}

/* Control groups */
.control-group {
    margin-bottom: var(--space-5);
}

.control-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
    display: flex;
    align-items: center;
    gap: 6px;
}

.control-label svg {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.control-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: var(--space-2);
}

/* Select dropdown */
.select-wrapper {
    position: relative;
}

select {
    width: 100%;
    padding: var(--space-3);
    background: var(--bg-input);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    color: var(--text-primary);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2352525b' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--space-3) center;
    transition: all var(--transition-fast);
}

select:hover {
    background-color: var(--bg-hover);
}

select:focus {
    outline: none;
    border-color: var(--accent);
    background-color: white;
    box-shadow: 0 0 0 3px var(--accent-light);
}

/* Multi-Select Dropdown */
.multi-select-wrapper {
    position: relative;
}

.multi-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3);
    background: var(--bg-input);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.multi-select-trigger:hover {
    background: var(--bg-hover);
}

.multi-select-trigger.open {
    border-color: var(--accent);
    background: white;
    box-shadow: 0 0 0 3px var(--accent-light);
}

.multi-select-text {
    font-size: 0.875rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.multi-select-arrow {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    transition: transform var(--transition-fast);
    flex-shrink: 0;
}

.multi-select-trigger.open .multi-select-arrow {
    transform: rotate(180deg);
}

.multi-select-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    max-height: 300px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all var(--transition-fast);
}

.multi-select-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.multi-select-option {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    cursor: pointer;
    transition: background var(--transition-fast);
    border-bottom: 1px solid var(--border);
}

.multi-select-option:last-of-type {
    border-bottom: none;
}

.multi-select-option:hover {
    background: var(--bg-input);
}

.multi-select-option:has(input:checked) {
    background: var(--accent-light);
}

.multi-select-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
    flex-shrink: 0;
}

.multi-select-option label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1.4;
    flex: 1;
}

.multi-select-option:has(input:checked) label {
    color: var(--accent-dark);
    font-weight: 500;
}

/* Pill separator */
.pill-separator {
    width: 100%;
    height: 1px;
    background: var(--border);
    padding: 0 !important;
    margin: var(--space-1) 0;
}

/* Toggle switches */
.toggle-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.toggle-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2) var(--space-3);
    background: var(--bg-input);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.toggle-item:hover {
    background: var(--bg-hover);
}

.toggle-item.active {
    background: var(--accent-light);
}

.toggle-item-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.toggle-item.active .toggle-item-label {
    color: var(--accent-dark);
}

.toggle-switch {
    width: 36px;
    height: 20px;
    background: var(--border);
    border-radius: 10px;
    position: relative;
    transition: all var(--transition-fast);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.toggle-item.active .toggle-switch {
    background: var(--accent);
}

.toggle-item.active .toggle-switch::after {
    left: 18px;
}

/* Checkbox pills (for stats/age/sex) */
.pill-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.pill {
    display: flex;
    align-items: center;
}

.pill input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.pill label {
    padding: 6px 10px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    user-select: none;
    border: 1px solid transparent;
}

.pill label:hover {
    background: var(--bg-hover);
    border-color: var(--border);
}

.pill input:checked + label {
    background: var(--text-primary);
    color: var(--bg-body);
    border-color: var(--text-primary);
}

/* Chart type selector */
.chart-type-selector {
    display: flex;
    flex-wrap: wrap;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 3px;
    gap: 2px;
}

.chart-type-btn {
    flex: 1 1 calc(50% - 2px);
    min-width: 0;
    padding: 6px 4px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all var(--transition-fast);
}

.chart-type-btn:hover {
    color: var(--text-primary);
}

.chart-type-btn.active {
    background: white;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.chart-type-btn svg {
    width: 14px;
    height: 14px;
}

/* Year Range Slider - Dual Handle */
.year-range-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.year-range-display {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.9rem;
}

.year-range-display span {
    font-weight: 600;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

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

.range-slider-dual {
    position: relative;
    height: 24px;
    display: flex;
    align-items: center;
}

.range-slider-dual input[type="range"] {
    position: absolute;
    width: 100%;
    height: 6px;
    background: transparent;
    pointer-events: none;
    appearance: none;
    -webkit-appearance: none;
    z-index: 3;
}

.range-slider-dual input[type="range"]::-webkit-slider-thumb {
    pointer-events: auto;
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid white;
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-fast);
}

.range-slider-dual input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.range-slider-dual input[type="range"]::-moz-range-thumb {
    pointer-events: auto;
    width: 18px;
    height: 18px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid white;
    box-shadow: var(--shadow-md);
}

.range-track {
    position: absolute;
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    z-index: 1;
}

.range-track-fill {
    position: absolute;
    height: 6px;
    background: var(--accent);
    border-radius: 3px;
    z-index: 2;
}

/* Year checkboxes - compact grid */
.year-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-1);
}

.year-chip {
    display: flex;
    align-items: center;
    justify-content: center;
}

.year-chip input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.year-chip label {
    width: 100%;
    padding: var(--space-2);
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.year-chip label:hover {
    background: var(--bg-hover);
}

.year-chip input:checked + label {
    background: var(--accent);
    color: white;
}

/* Select all / none buttons */
.selection-actions {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.selection-btn {
    padding: var(--space-1) var(--space-2);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.selection-btn:hover {
    background: var(--bg-input);
    color: var(--text-secondary);
}

/* ========================================
   Main Chart Area
   ======================================== */
.explorer-main {
    padding: var(--space-5);
    background: var(--bg-body);
    display: flex;
    flex-direction: column;
}

.chart-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    flex: 1;
    min-height: 600px;
    display: flex;
    flex-direction: column;
    position: relative;
}

.chart-header {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.chart-title {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
}

.chart-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: var(--space-1);
}

.info-banner {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-3) var(--space-4);
    flex: 1;
    min-width: 280px;
}

.info-banner-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}

.info-banner-header svg {
    width: 14px;
    height: 14px;
    color: var(--accent);
    flex-shrink: 0;
}

.info-banner-header span {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.info-banner p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

.chart-container {
    flex: 1;
    padding: var(--space-4);
    padding-bottom: var(--space-2);
    min-height: 500px;
}

.chart-footer {
    padding: var(--space-3) var(--space-5);
    border-top: 1px solid var(--border);
    background: var(--bg-input);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.chart-footer p {
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0;
}

.chart-footer b {
    color: var(--text-secondary);
    font-weight: 600;
}

/* ========================================
   Docs/Methodology Page with Sidebar TOC
   ======================================== */

/* Wrapper layout */
.docs-wrapper {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: calc(100vh - 56px);
    max-width: 1200px;
    margin: 0 auto;
}

/* Table of Contents Sidebar */
.docs-toc {
    position: sticky;
    top: 56px;
    height: calc(100vh - 56px);
    padding: var(--space-5);
    border-right: 1px solid var(--border);
    background: var(--bg-body);
    overflow-y: auto;
}

.toc-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--border);
}

.toc-header svg {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

.toc-header span {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.toc-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-nav li {
    margin-bottom: var(--space-1);
}

.toc-nav a {
    display: block;
    padding: var(--space-2) var(--space-3);
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    border-left: 2px solid transparent;
}

.toc-nav a:hover {
    color: var(--text-primary);
    background: var(--bg-input);
}

.toc-nav a.active {
    color: var(--text-primary);
    background: var(--bg-input);
    border-left-color: var(--accent);
    font-weight: 500;
}

/* Main content area */
.docs-main {
    padding: var(--space-8) var(--space-10);
    max-width: 720px;
}

/* Content styling */
.docs-content {
    line-height: 1.75;
}

.docs-content h1 {
    font-family: var(--font-serif);
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: var(--space-6);
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.docs-content h2 {
    font-family: var(--font-serif);
    font-size: 1.35rem;
    font-weight: 600;
    margin-top: var(--space-10);
    margin-bottom: var(--space-4);
    padding-top: var(--space-6);
    border-top: 1px solid var(--border);
    color: var(--text-primary);
    scroll-margin-top: 80px;
}

.docs-content h2:first-of-type {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.docs-content h3 {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: var(--space-6);
    margin-bottom: var(--space-3);
    color: var(--text-primary);
}

.docs-content p {
    margin-bottom: var(--space-4);
    color: var(--text-secondary);
}

.docs-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

.docs-content ul,
.docs-content ol {
    margin-bottom: var(--space-4);
    padding-left: var(--space-6);
    color: var(--text-secondary);
}

.docs-content li {
    margin-bottom: var(--space-2);
    line-height: 1.7;
}

.docs-content code {
    font-family: var(--font-mono);
    background: var(--bg-input);
    padding: 0.15em 0.4em;
    border-radius: var(--radius-sm);
    font-size: 0.85em;
    color: var(--accent-dark);
}

.docs-content pre {
    background: var(--bg-input);
    padding: var(--space-4);
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: var(--space-4) 0;
}

.docs-content pre code {
    background: transparent;
    padding: 0;
}

.docs-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: var(--space-8) 0;
}

/* Tables */
.docs-content table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--space-6) 0;
    font-size: 0.85rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.docs-content th,
.docs-content td {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.docs-content th {
    background: var(--bg-input);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.docs-content tr:last-child td {
    border-bottom: none;
}

.docs-content tr:hover td {
    background: var(--bg-input);
}

.docs-content td code {
    font-size: 0.8rem;
}

/* Blockquotes */
.docs-content blockquote {
    background: var(--surface);
    border-left: 3px solid var(--border);
    padding: var(--space-4) var(--space-5);
    margin: var(--space-6) 0;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.docs-content blockquote p {
    color: var(--text-secondary);
    margin: 0;
}

/* Callout */
.docs-content .callout {
    background: #fefce8;
    border: 1px solid #fef08a;
    border-radius: 8px;
    padding: 16px 20px;
    margin: 24px 0;
}

.docs-content .callout-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
    color: #a16207;
    margin-bottom: 8px;
}

.docs-content .callout-title svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.docs-content .callout-content {
    color: #713f12;
    font-size: 14px;
    line-height: 1.6;
}

.docs-content .callout-content p {
    margin: 0;
}

/* Links */
.docs-content a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-color: var(--accent-light);
    text-underline-offset: 2px;
}

.docs-content a:hover {
    text-decoration-color: var(--accent);
}

/* Loading state */
.docs-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    padding: var(--space-16);
    color: var(--text-muted);
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Footer */
.docs-footer {
    margin-top: var(--space-12);
    padding: var(--space-6);
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    text-align: center;
}

.docs-footer p {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin: 0;
}

.docs-footer a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-color: transparent;
}

.docs-footer a:hover {
    text-decoration-color: var(--accent);
}

/* Mobile TOC toggle */
.toc-mobile-toggle {
    display: none;
    position: fixed;
    bottom: var(--space-6);
    right: var(--space-6);
    width: 48px;
    height: 48px;
    background: var(--text-primary);
    color: var(--bg-body);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

.toc-mobile-toggle svg {
    width: 20px;
    height: 20px;
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 1024px) {
    .explorer-layout {
        grid-template-columns: 1fr;
    }
    
    .explorer-sidebar {
        position: fixed;
        left: -280px;
        top: 56px;
        width: 280px;
        height: calc(100vh - 56px);
        z-index: 100;
        transition: left var(--transition-slow);
        box-shadow: var(--shadow-xl);
    }
    
    .explorer-sidebar.open {
        left: 0;
    }
    
    .mobile-toggle {
        display: flex;
    }
    
    .navbar-center {
        display: none;
    }
}

@media (max-width: 640px) {
    .navbar {
        padding: 0 var(--space-4);
    }
    
    .landing-hero {
        padding: var(--space-6);
    }
    
    .landing-title {
        font-size: 2.25rem;
    }
    
    .landing-subtitle {
        font-size: 1rem;
    }
    
    .landing-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .landing-decoration {
        display: none;
    }
    
    .methodology-content {
        padding: var(--space-5);
    }
    
    .year-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .info-banner {
        min-width: 0;
        order: 3;
    }
    
    .chart-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Mobile sidebar toggle */
.mobile-toggle {
    display: none;
    position: fixed;
    bottom: var(--space-6);
    right: var(--space-6);
    height: 48px;
    padding: 0 20px;
    gap: 8px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 100px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(196, 93, 62, 0.35);
    z-index: 99;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
}

.mobile-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(196, 93, 62, 0.45);
}

.mobile-toggle:active {
    transform: translateY(0);
}

.mobile-toggle svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.mobile-toggle span {
    white-space: nowrap;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    top: 56px;
    background: rgba(0, 0, 0, 0.4);
    z-index: 99;
}

.sidebar-overlay.show {
    display: block;
}

@media (max-width: 1024px) {
    .mobile-toggle {
        display: flex;
    }
    
    /* Docs layout responsive */
    .docs-wrapper {
        grid-template-columns: 1fr;
    }
    
    .docs-toc {
        position: fixed;
        left: -260px;
        top: 56px;
        width: 260px;
        height: calc(100vh - 56px);
        z-index: 100;
        transition: left var(--transition-slow);
        box-shadow: var(--shadow-xl);
        border-right: 1px solid var(--border);
    }
    
    .docs-toc.open {
        left: 0;
    }
    
    .toc-mobile-toggle {
        display: flex;
    }
    
    .toc-overlay {
        display: none;
        position: fixed;
        inset: 0;
        top: 56px;
        background: rgba(0, 0, 0, 0.4);
        z-index: 99;
    }
    
    .toc-overlay.show {
        display: block;
    }
}

/* ========================================
   Utilities
   ======================================== */
.divider {
    height: 1px;
    background: var(--border);
    margin: var(--space-4) 0;
}

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

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Loading state */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    color: var(--text-muted);
}

.loading::after {
    content: '';
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: var(--space-3);
}

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