/* IAUC Paper Database – Editorial Research Aesthetic */

:root {
    --navy: #1a2332;
    --navy-light: #243044;
    --slate: #2c3e50;
    --copper: #c4895c;
    --copper-light: #d4a574;
    --copper-glow: rgba(196, 137, 92, 0.10);
    --teal: #2e7d6f;
    --teal-light: #35937f;
    --blue-steel: #4a7fb5;
    --violet: #7c5cbf;
    --surface: #f8f5f0;
    --surface-warm: #f5f1eb;
    --card: #fffefa;
    --border: #e2ddd5;
    --border-light: #ebe7e0;
    --text: #1a2332;
    --text-secondary: #5e6b72;
    --text-tertiary: #8a9199;
    --red-soft: #c0392b;
    --font-display: 'DM Serif Display', Georgia, serif;
    --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 3px rgba(26, 35, 50, 0.05), 0 1px 2px rgba(26, 35, 50, 0.03);
    --shadow-md: 0 4px 12px rgba(26, 35, 50, 0.07), 0 1px 4px rgba(26, 35, 50, 0.03);
    --shadow-lg: 0 12px 40px rgba(26, 35, 50, 0.10);
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    /* Super-theme palette */
    --st-thermal: #d96d39;
    --st-pollution: #177e89;
    --st-meteorology: #5e7c4d;
    --st-form: #c65b7c;
    --st-intervention: #b88a15;
    --st-hydro: #3d5a80;
    --st-climate: #7aa7c7;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: var(--font-body);
    background-color: var(--surface);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}










/* ===================== LOADING ===================== */
.loading-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 80vh;
}
.loading-overlay.hidden { display: none; }
.loading-inner { text-align: center; }

.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--copper);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ===================== NAVBAR ===================== */
.site-nav {
    background: var(--navy);
    padding: 0 1rem;
    height: 52px;
    display: flex;
    align-items: center;
}
.site-nav-inner {
    display: flex;
    align-items: center;
    width: 100%;
}
.site-nav-brand {
    font-family: var(--font-display);
    font-size: 1.05rem;
    color: #fff;
    letter-spacing: 0.01em;
    white-space: nowrap;
}
.site-nav-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-left: auto;
}

.nav-pill {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.7);
    font-size: 0.78rem;
    font-weight: 500;
    padding: 0.3rem 0.85rem;
    border-radius: 20px;
    cursor: pointer;
    transition: background-color var(--transition), border-color var(--transition), color var(--transition);
}
.nav-pill:hover {
    border-color: rgba(255,255,255,0.4);
    color: #fff;
}
.nav-pill.active {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.3);
    color: #fff;
}
.nav-pill-ghost {
    border-color: transparent;
    color: rgba(255,255,255,0.5);
}
.nav-pill-ghost:hover {
    color: rgba(255,255,255,0.8);
    border-color: rgba(255,255,255,0.15);
}

/* Browse toolbar export buttons */
.browse-export {
    display: flex;
    gap: 0.35rem;
    flex-shrink: 0;
}
.browse-export-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--surface);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.3rem 0.65rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.browse-export-btn:hover {
    background: var(--copper-glow);
    border-color: var(--copper);
    color: var(--text);
}
.browse-export-btn svg { flex-shrink: 0; }

/* ===================== DASHBOARD ===================== */
.dash-wrap {
    padding: 2rem 2.5rem;
    max-width: 1400px;
}
.dash-hero { margin-bottom: 1.5rem; }
.dash-title {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    color: var(--navy);
    margin-bottom: 0.25rem;
}
.dash-subtitle {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-bottom: 0;
    max-width: 52ch;
    line-height: 1.5;
}

/* Inline stat strip */
.stat-strip {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-bottom: 1.75rem;
}
.strip-item {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
}
.strip-value {
    font-family: var(--font-display);
    font-size: clamp(1.4rem, 2.5vw, 1.9rem);
    line-height: 1;
    font-variant-numeric: tabular-nums;
    color: var(--navy);
}
.strip-label {
    font-size: 0.82rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.strip-dot {
    font-size: 1.4rem;
    color: var(--border);
    line-height: 1;
    user-select: none;
}

/* Section rule (divider between corpus stats and themes) */
.section-rule {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2.5rem 0 1rem;
}

/* Panels (dashboard cards) */
.panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

/* Two-tier overview layout */
.overview-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

/* Geographic profile consolidated panel */
.geo-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}
.geo-grid > :first-child,
.geo-grid > :nth-child(2) {
    grid-column: 1;
}
.geo-grid > :last-child {
    grid-column: 2;
    grid-row: 1 / span 2;
}
.geo-section-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 600;
}
.geo-stacked-bar {
    display: flex;
    height: 10px;
    border-radius: 5px;
    overflow: hidden;
    gap: 2px;
    margin-bottom: 0.5rem;
}
.geo-stacked-bar span {
    display: block;
    border-radius: 3px;
}
.geo-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
    font-size: 0.72rem;
    color: var(--text-secondary);
}
.geo-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}
.geo-legend-swatch {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    display: inline-block;
    flex-shrink: 0;
}

/* Panel header action link */
.panel-head-link {
    float: right;
    font-size: 0.75rem;
    color: var(--teal);
    text-decoration: none;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
}
.panel-head-link:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .overview-two-col { grid-template-columns: 1fr; }
    .geo-grid { grid-template-columns: 1fr; }
    .geo-grid > :first-child,
    .geo-grid > :nth-child(2),
    .geo-grid > :last-child { grid-column: auto; grid-row: auto; }
}

.panel-head {
    padding: 0.85rem 1.25rem;
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
}
.panel-body { padding: 1.25rem; }

/* Method breakdown bars */
.method-bar { margin-bottom: 0.85rem; }
.method-bar .method-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    margin-bottom: 0.3rem;
    color: var(--text);
}
.method-bar .method-label span:last-child {
    color: var(--text-secondary);
    font-size: 0.78rem;
}
.method-bar .progress {
    height: 6px;
    background: var(--border-light);
    border-radius: 3px;
    overflow: hidden;
}
.method-bar .progress-bar { border-radius: 3px; }

/* ===================== FILTER SIDEBAR ===================== */
.filter-sidebar {
    background: var(--card);
    border-right: 1px solid var(--border);
    padding: 1rem 0.9rem;
    height: calc(100vh - 52px - 32px);
    overflow-y: auto;
    font-size: 0.82rem;
}
.filter-sidebar-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--border);
}
.filter-sidebar-title {
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
}
.clear-btn {
    background: none;
    border: none;
    color: var(--copper);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    transition: background var(--transition);
}
.clear-btn:hover { background: var(--copper-glow); }

.filter-group {
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 0.6rem;
}
.filter-group-title {
    font-weight: 600;
    font-size: 0.78rem;
    margin-bottom: 0.4rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    color: var(--text);
    transition: color var(--transition);
}
.filter-group-title:hover { color: var(--copper); }
.filter-group-title::after {
    content: "\25B2";
    font-size: 0.5rem;
    color: var(--text-tertiary);
    transition: transform 0.2s;
}
.filter-group-title.collapsed::after { transform: rotate(180deg); }

.filter-group-body {
    max-height: 200px;
    overflow-y: auto;
}
.filter-group-body.hidden { display: none; }

.filter-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 2px 0;
}
.filter-item input[type="checkbox"] {
    accent-color: var(--copper);
    width: 13px;
    height: 13px;
}
.filter-item label {
    flex-grow: 1;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.8rem;
    color: var(--text);
}
.filter-item .filter-count {
    color: var(--text-tertiary);
    font-size: 0.7rem;
    flex-shrink: 0;
}
.filter-show-more {
    font-size: 0.75rem;
    color: var(--copper);
    cursor: pointer;
    margin-top: 0.2rem;
    font-weight: 500;
}
.filter-show-more:hover { text-decoration: underline; }

/* Year range filter */
.year-range-inputs {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.year-range-inputs input {
    width: 68px;
    font-size: 0.82rem;
    padding: 0.2rem 0.4rem;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 4px;
}
.year-range-inputs input:focus {
    border-color: var(--copper);
    outline: none;
    box-shadow: 0 0 0 2px var(--copper-glow);
}
.year-range-inputs span { color: var(--text-tertiary); }

/* Boolean toggle filter */
.bool-filter {
    display: flex;
    gap: 0.2rem;
    margin-bottom: 0.25rem;
}
.bool-filter .btn {
    font-size: 0.7rem;
    padding: 0.1rem 0.45rem;
    border-radius: 4px;
    font-weight: 500;
}

/* ===================== SEARCH BAR ===================== */
.search-wrap {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--card);
}
.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    pointer-events: none;
}
.search-input {
    padding-left: 2.25rem !important;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.85rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.search-input:focus {
    border-color: var(--copper);
    box-shadow: 0 0 0 3px var(--copper-glow);
}
.results-count {
    font-size: 0.78rem;
    color: var(--text-tertiary);
    white-space: nowrap;
}

/* ===================== DATA TABLE ===================== */
.data-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 0.8rem;
}
.data-table thead th {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 2;
    padding: 0.55rem 0.6rem;
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
    transition: background var(--transition);
}
.data-table thead th:hover { background: var(--border-light); }

.sort-indicator {
    margin-left: 3px;
    font-size: 0.6rem;
    opacity: 0.35;
}
th.sorted .sort-indicator { opacity: 1; color: var(--copper); }

.data-table tbody tr {
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition);
}
.data-table tbody tr:hover { background: var(--copper-glow); }
.data-table tbody td {
    padding: 0.4rem 0.6rem;
    vertical-align: middle;
}

/* Method badges */
.method-badge {
    display: inline-block;
    width: 22px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    border-radius: 3px;
    font-size: 0.6rem;
    font-weight: 700;
    color: white;
    margin-right: 1px;
    letter-spacing: 0.03em;
}
.method-badge.is { background: var(--teal); }
.method-badge.rs { background: var(--blue-steel); }
.method-badge.nm { background: var(--copper); }
.method-badge.ml { background: var(--violet); }
.method-badge.off { opacity: 0.12; }

/* Inclusion badge */
.incl-yes { color: var(--teal); font-weight: 600; }
.incl-no { color: var(--red-soft); }

/* Detail panel badges: full-width labels, not 2-letter abbreviations */
.detail-canvas .method-badge {
    width: auto;
    height: auto;
    line-height: normal;
    font-size: 0.8rem;
}

/* ===================== ABOUT ===================== */
.about-section { margin-bottom: 0.5rem; }
.about-section h2 {
    font-family: var(--font-display);
    font-size: 1.15rem;
    color: var(--navy);
    margin-bottom: 0.6rem;
}
.about-section p {
    font-size: 0.88rem;
    color: var(--slate);
    line-height: 1.65;
    margin-bottom: 0.8rem;
}
.about-section a {
    color: var(--copper);
    text-decoration: none;
}
.about-section a:hover { text-decoration: underline; }

/* Methodology pipeline (DOM-based) */
.pipe-flow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.25rem 0;
    margin-bottom: 1.2rem;
    padding: 0.2rem 0;
}
.pipe-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 6.5rem;
    flex: 1 1 0;
    padding: 0.55rem 0.4rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-align: center;
}
.pipe-node-end {
    border-color: var(--copper);
}
.pipe-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--navy);
    line-height: 1.2;
}
.pipe-node-end .pipe-label { color: var(--copper); }
.pipe-sub {
    font-size: 0.68rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
}
.pipe-arrow {
    flex-shrink: 0;
    width: 1.5rem;
    text-align: center;
    font-size: 1.1rem;
    color: var(--copper);
    line-height: 1;
}

/* Methodology disclosure */
.method-detail {
    margin-top: 0.4rem;
}
.method-detail summary {
    font-size: 0.84rem;
    font-weight: 500;
    color: var(--copper);
    cursor: pointer;
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}
.method-detail summary::-webkit-details-marker { display: none; }
.method-detail summary::before {
    content: '▸';
    font-size: 0.7rem;
    transition: transform var(--transition);
}
.method-detail[open] summary::before { transform: rotate(90deg); }
.method-detail-body {
    margin-top: 0.8rem;
    padding-left: 1rem;
    border-left: 2px solid var(--border-light);
}
.method-detail-body p {}
.method-detail-body code {
    font-size: 0.78rem;
    background: var(--surface-warm);
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
}

.about-cite-box {
    background: var(--card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--copper);
    border-radius: var(--radius);
    padding: 0.9rem 1.1rem;
    font-size: 0.85rem;
    color: var(--slate);
    line-height: 1.6;
}

/* Team tiers */
.about-tier { margin-bottom: 1.5rem; }
.tier-header {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    margin-bottom: 0.7rem;
}
.tier-title {
    font-family: var(--font-display);
    font-size: 1.05rem;
    color: var(--navy);
}
.tier-count {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}
.tier-subtitle {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: -0.35rem;
    margin-bottom: 0.6rem;
}

/* Person cards */
.about-team-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
}
.about-team-grid.single-col {
    grid-template-columns: 1fr;
    max-width: 480px;
}

.person-card {
    background: var(--card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 0.7rem 0.85rem;
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    transition: border-color var(--transition);
}
.person-card:hover { border-color: var(--copper); }
.person-card.lead { border-left: 3px solid var(--copper); }

.person-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--navy);
    color: var(--copper-light);
    font-family: var(--font-display);
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}

.person-info { flex: 1; min-width: 0; }
.person-name {
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--navy);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}
.person-orcid {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    opacity: 0.6;
    transition: opacity var(--transition);
}
.person-orcid:hover { opacity: 1; }

.person-affil {
    font-size: 0.72rem;
    color: var(--text-secondary);
    line-height: 1.35;
    margin-top: 0.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.person-role {
    display: inline-block;
    margin-top: 0.25rem;
    font-size: 0.62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--teal);
    background: rgba(46, 125, 111, 0.08);
    padding: 0.15rem 0.45rem;
    border-radius: 3px;
}
.person-role.role-lead {
    color: var(--copper);
    background: rgba(196, 137, 92, 0.1);
}
.person-email {
    margin-top: 0.3rem;
    font-size: 0.72rem;
}
.person-email a {
    color: var(--teal);
    text-decoration: none;
}
.person-email a:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .about-team-grid { grid-template-columns: 1fr; }
}

/* ===================== DETAIL PANEL ===================== */
.detail-canvas {
    border-left: 1px solid var(--border);
    box-shadow: -8px 0 30px rgba(26, 35, 50, 0.1);
}
.detail-canvas-head {
    border-bottom: 1px solid var(--border) !important;
    padding: 1rem 1.5rem;
}

.detail-section { margin-bottom: 1.5rem; }
.detail-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    margin-bottom: 0.5rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--border-light);
}
.detail-field {
    margin-bottom: 0.4rem;
    font-size: 0.82rem;
    line-height: 1.45;
}
.detail-field .field-label {
    font-weight: 600;
    color: var(--text-secondary);
}
.detail-field .field-value { color: var(--text); }
.detail-field .field-list {
    margin: 0.2rem 0 0;
    padding-left: 1.1rem;
}
.detail-field .field-list li { margin-bottom: 0.15rem; }

.detail-keywords .badge {
    margin: 0 0.2rem 0.25rem 0;
    background: var(--surface) !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
    font-weight: 500;
    font-size: 0.72rem;
    padding: 0.25rem 0.5rem;
}

/* IPCC score bars in detail */
.ipcc-score-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
    font-size: 0.8rem;
}
.ipcc-score-bar .ch-label {
    width: 35px;
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--text-secondary);
}
.ipcc-score-bar .progress {
    flex-grow: 1;
    height: 8px;
    background: var(--border-light);
    border-radius: 4px;
    overflow: hidden;
}
.ipcc-score-bar .progress-bar {
    border-radius: 4px;
}
.ipcc-score-bar .score-val {
    width: 40px;
    text-align: right;
    color: var(--text-tertiary);
    font-size: 0.78rem;
}

/* ===================== TOAST ===================== */
.site-toast {
    background: var(--navy);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

/* ===================== SCROLLBAR ===================== */
.filter-sidebar::-webkit-scrollbar,
.filter-group-body::-webkit-scrollbar {
    width: 5px;
}
.filter-sidebar::-webkit-scrollbar-track,
.filter-group-body::-webkit-scrollbar-track {
    background: transparent;
}
.filter-sidebar::-webkit-scrollbar-thumb,
.filter-group-body::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}
.filter-sidebar::-webkit-scrollbar-thumb:hover,
.filter-group-body::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* Browse table: always-visible scrollbar */
#tableContainer::-webkit-scrollbar {
    width: 8px;
}
#tableContainer::-webkit-scrollbar-track {
    background: var(--border-light);
    border-radius: 4px;
}
#tableContainer::-webkit-scrollbar-thumb {
    background: var(--text-tertiary);
    border-radius: 4px;
}
#tableContainer::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ===================== KEYBOARD NAVIGATION ===================== */
#tableBody tr.kb-selected {
    background: rgba(46, 125, 111, 0.10) !important;
    outline: 2px solid var(--teal);
    outline-offset: -2px;
}

.kb-help-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.kb-help-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 1.5rem 2rem;
    box-shadow: var(--shadow-lg);
    min-width: 280px;
}
.kb-help-card h6 {
    margin-bottom: 1rem;
    font-weight: 700;
    color: var(--navy);
}
.kb-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.3rem 0;
    font-size: 0.88rem;
}
.kb-row kbd {
    background: #f0f0f0;
    color: #333;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 0.15em 0.5em;
    font-size: 0.82rem;
    font-family: monospace;
    min-width: 1.6em;
    text-align: center;
    display: inline-block;
    box-shadow: 0 1px 0 #bbb;
}
.kb-row span { color: var(--text-secondary); }
.kb-hint {
    margin-top: 0.8rem;
    margin-bottom: 0;
    font-size: 0.75rem;
    color: var(--text-tertiary);
    text-align: center;
}

/* ===================== YEAR BARS (CSS-only chart) ===================== */
.year-bars {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 180px;
    padding: 0 4px;
}
.year-bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
    position: relative;
}
.year-bar-fill {
    width: 100%;
    min-height: 2px;
    border-radius: 3px 3px 0 0;
    background: var(--copper);
    opacity: 0.65;
    transition: opacity 0.15s ease;
}
.year-bar-col:hover .year-bar-fill { opacity: 0.92; }
.year-bar-label {
    font-size: 0.58rem;
    color: var(--text-tertiary);
    margin-top: 4px;
    text-align: center;
    line-height: 1;
}
.year-bar-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--navy);
    color: #fff;
    font-size: 0.72rem;
    padding: 3px 8px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    margin-bottom: 4px;
}
.year-bar-col:hover .year-bar-tooltip { opacity: 1; }

/* ===================== STACKED BARS (CSS-only, matches year-bars) ===================== */
.stacked-bars-row {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 180px;
    padding: 0 4px;
}
.stacked-bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    position: relative;
}
.stacked-bar-stack {
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column-reverse;
    border-radius: 3px 3px 0 0;
    overflow: hidden;
}
.stacked-bar-seg {
    width: 100%;
    min-height: 0;
    opacity: 0.7;
    transition: opacity 0.15s ease;
}
.stacked-bar-col:hover .stacked-bar-seg { opacity: 0.95; }
.stacked-bar-col .year-bar-tooltip {
    bottom: auto;
    top: 0;
    left: 0;
    transform: none;
    margin-bottom: 0;
    z-index: 10;
}
.stacked-bar-col:hover .year-bar-tooltip { opacity: 1; }
.stacked-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin-top: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}
.stacked-chart-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}
.stacked-chart-legend-swatch {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}

/* ===================== ENTRANCE ANIMATION ===================== */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.dash-wrap > *,
.dash-wrap > *:nth-child(1) { animation-delay: 0s; }
.dash-wrap > *:nth-child(2) { animation-delay: 0.06s; }
.dash-wrap > *:nth-child(3) { animation-delay: 0.08s; }
.dash-wrap > *:nth-child(4) { animation-delay: 0.12s; }
.dash-wrap > *:nth-child(5) { animation-delay: 0.16s; }
/* ===================== THEMES SECTION ===================== */

/* Section labels */
.theme-kicker {
    color: var(--copper);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 0.4rem;
}
.theme-heading {
    font-family: var(--font-display);
    font-size: clamp(1.3rem, 2.5vw, 1.8rem);
    color: var(--navy);
    margin: 0 0 0.3rem;
}
.theme-desc {
    font-size: 0.88rem;
    color: var(--text-secondary);
    max-width: 52ch;
    line-height: 1.5;
    margin: 0 0 1.25rem;
}

/* Condensation funnel */
.funnel-step {
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    background: var(--card);
    border: 1px solid var(--border-light);
    border-left: 3px solid var(--st-thermal);
    margin-bottom: 0.75rem;
}
.funnel-topline {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}
.funnel-topline strong {
    font-size: 0.88rem;
    font-weight: 600;
}
.funnel-value {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.funnel-detail {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
}

/* Hint grid (condensation stats) */
.theme-hint-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}
.theme-hint {
    padding: 0.85rem 1rem;
    border-radius: var(--radius);
    background: var(--card);
    border: 1px solid var(--border-light);
}
.theme-hint strong {
    display: block;
    font-family: var(--font-display);
    font-size: 1.15rem;
    margin-bottom: 0.2rem;
}
.theme-hint span {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.35;
}

/* Treemap browser */
.treemap-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.75rem;
    font-size: 0.82rem;
    min-height: 1.8rem;
}
.treemap-crumb {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius);
    border: none;
    background: none;
    font: inherit;
    font-size: 0.82rem;
    transition: background 0.15s ease, color 0.15s ease;
}
.treemap-crumb:hover { background: var(--surface); color: var(--text); }
.treemap-crumb.active { color: var(--text); font-weight: 600; cursor: default; }
.treemap-crumb.active:hover { background: none; }
.treemap-sep { color: var(--text-tertiary); font-size: 0.7rem; }

.treemap-container {
    position: relative;
    width: 100%;
    aspect-ratio: 2.2 / 1;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-light);
    background: var(--surface);
}
.treemap-cell {
    position: absolute;
    box-sizing: border-box;
    border: 2px solid rgba(255,255,255,0.85);
    border-radius: 4px;
    cursor: pointer;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 10px 12px;
    text-align: center;
    transition: filter 0.15s ease, transform 0.08s ease;
}
.treemap-cell:hover {
    filter: brightness(1.08);
    z-index: 2;
    border-color: rgba(26,35,50,0.35);
}
.treemap-cell-name {
    font-size: var(--name-size, 1rem);
    font-weight: 600;
    color: white;
    line-height: 1.3;
    text-shadow: 0 1px 4px rgba(0,0,0,0.4);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}
.treemap-cell-count {
    font-size: var(--count-size, 0.85rem);
    color: rgba(255,255,255,0.85);
    text-shadow: 0 1px 3px rgba(0,0,0,0.35);
    margin-top: 3px;
    font-variant-numeric: tabular-nums;
}
.treemap-cell.small .treemap-cell-name { font-size: 0.78rem; -webkit-line-clamp: 2; }
.treemap-cell.small .treemap-cell-count { font-size: 0.7rem; }
.treemap-cell.tiny .treemap-cell-name { display: none; }
.treemap-cell.tiny .treemap-cell-count { display: none; }

/* Treemap detail panel */
.treemap-detail {
    margin-top: 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-lg);
    background: var(--card);
    border: 1px solid var(--border-light);
}
.treemap-detail:empty { display: none; }
.treemap-detail .detail-kicker {
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    margin-bottom: 0.25rem;
}
.treemap-detail h3 {
    font-family: var(--font-display);
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    margin: 0 0 0.5rem;
    color: var(--navy);
}
.treemap-detail .detail-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.treemap-detail .detail-stat {
    padding: 0.5rem 0.7rem;
    border-radius: var(--radius);
    background: var(--surface);
}
.treemap-detail .detail-stat strong {
    display: block;
    font-size: 1rem;
    font-variant-numeric: tabular-nums;
}
.treemap-detail .detail-stat span {
    font-size: 0.72rem;
    color: var(--text-secondary);
}
.treemap-detail .theme-pill {
    display: inline-flex;
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--card-color), white 82%);
    color: color-mix(in srgb, var(--card-color), black 15%);
    font-size: 0.78rem;
    font-weight: 600;
    margin-right: 0.5rem;
}
.treemap-detail .theme-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

/* Treemap paper list */
.treemap-paper-list {
    margin-top: 1rem;
}
.treemap-paper-list:empty { display: none; }
.treemap-paper-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}
.treemap-paper-header h4 {
    font-family: var(--font-display);
    font-size: 1rem;
    margin: 0;
    color: var(--navy);
}
.treemap-browse-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text-secondary);
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
    font: inherit;
    font-size: 0.75rem;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease;
}
.treemap-browse-btn:hover { border-color: var(--text-tertiary); color: var(--text); }
.treemap-paper-scroll {
    max-height: 520px;
    overflow-y: auto;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    background: var(--card);
}
.treemap-paper-scroll table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}
.treemap-paper-scroll thead th {
    position: sticky;
    top: 0;
    background: var(--surface);
    padding: 0.5rem 0.6rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    z-index: 1;
}
.treemap-paper-scroll tbody tr {
    cursor: pointer;
    transition: background 0.1s ease;
}
.treemap-paper-scroll tbody tr:hover { background: var(--surface-warm); }
.treemap-paper-scroll tbody td {
    padding: 0.45rem 0.6rem;
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
}
/* Column widths */
.treemap-paper-scroll .col-author  { width: 140px; }
.treemap-paper-scroll .col-title   { width: auto; }
.treemap-paper-scroll .col-year    { width: 50px; text-align: center; }
.treemap-paper-scroll .col-country { width: 100px; }
.treemap-paper-scroll .col-methods { width: 110px; text-align: center; }
/* Truncate only text-heavy columns (author, title, country) */
.treemap-paper-scroll td:nth-child(-n+2),
.treemap-paper-scroll td:nth-child(4) {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 0;
}

/* Chips (used in treemap detail panel) */
.theme-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.75rem;
}
.theme-chip {
    padding: 0.35rem 0.6rem;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border-light);
    font-size: 0.78rem;
    color: var(--text);
}

/* Theme footer */
.theme-footer {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-light);
    color: var(--text-tertiary);
    font-size: 0.78rem;
}

/* ===================== MAP VIEW ===================== */
#mapView {
    position: relative;
    height: calc(100vh - 52px - 32px);
    overflow: hidden;
}
#mapContainer {
    position: absolute;
    inset: 0;
}
/* Match Leaflet background to CartoDB Positron ocean so edges blend seamlessly */
#mapContainer.leaflet-container {
    background: #d5dadc;
}

/* Floating controls overlay — top-left */
.map-controls {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 1000;
    pointer-events: none;
}
.map-controls-inner {
    pointer-events: auto;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.6rem 0.85rem;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.map-colour-toggle {
    display: flex;
    gap: 0.25rem;
}
.map-toggle-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 500;
    padding: 0.25rem 0.7rem;
    border-radius: 20px;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.map-toggle-btn:hover {
    border-color: var(--copper);
    color: var(--text);
}
.map-toggle-btn.active {
    background: var(--copper-glow);
    border-color: var(--copper);
    color: var(--text);
}
.map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
}
.map-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    color: var(--text-secondary);
    white-space: nowrap;
}
.map-legend-swatch {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Floating status badge — bottom-left */
.map-status {
    position: absolute;
    bottom: 28px;
    left: 12px;
    z-index: 1000;
    pointer-events: none;
}
.map-count {
    pointer-events: auto;
    display: inline-block;
    background: var(--navy);
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    letter-spacing: 0.02em;
    box-shadow: var(--shadow-md);
}

/* MarkerCluster overrides */
.map-cluster {
    display: flex;
    align-items: center;
    justify-content: center;
}
.map-cluster div {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    width: 100%;
    height: 100%;
    box-shadow: 0 0 0 4px rgba(46, 125, 111, 0.15);
    transition: transform 0.15s ease;
}
.map-cluster span {
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.72rem;
    color: #fff;
}
.map-cluster-small div {
    background: var(--teal);
    box-shadow: 0 0 0 4px rgba(46, 125, 111, 0.15);
}
.map-cluster-medium div {
    background: var(--copper);
    box-shadow: 0 0 0 5px rgba(196, 137, 92, 0.15);
}
.map-cluster-large div {
    background: var(--navy);
    box-shadow: 0 0 0 6px rgba(26, 39, 68, 0.15);
}

/* Map popup */
.map-popup .leaflet-popup-content-wrapper {
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    font-family: var(--font-body);
}
.map-popup .leaflet-popup-content {
    margin: 0.6rem 0.75rem;
    font-size: 0.82rem;
    line-height: 1.45;
}
.map-popup-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
}
.map-popup-title {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    display: block;
    margin-top: 0.2rem;
}

/* Hide default Leaflet zoom control chrome for custom positioning */
.leaflet-control-zoom {
    border: none !important;
    box-shadow: var(--shadow-md) !important;
    border-radius: var(--radius) !important;
    overflow: hidden;
}
.leaflet-control-zoom a {
    background: var(--card) !important;
    color: var(--text) !important;
    border-bottom: 1px solid var(--border-light) !important;
    width: 32px !important;
    height: 32px !important;
    line-height: 32px !important;
    font-size: 16px !important;
}
.leaflet-control-zoom a:hover {
    background: var(--bg) !important;
}

/* Reset-view button — matches zoom control style */
.map-reset-ctrl {
    margin-top: 4px !important;
    border: none !important;
    box-shadow: var(--shadow-md) !important;
    border-radius: var(--radius) !important;
    overflow: hidden;
}
.map-reset-ctrl a {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card) !important;
    color: var(--text) !important;
    width: 32px !important;
    height: 32px !important;
    font-size: 18px !important;
    text-decoration: none;
}
.map-reset-ctrl a:hover {
    background: var(--bg) !important;
}

/* ===================== SITE FOOTER ===================== */
.site-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1050;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    background: var(--navy);
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.72rem;
    letter-spacing: 0.01em;
}
.footer-about a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: color var(--transition);
}
.footer-about a:hover {
    color: var(--copper-light);
}
.footer-build a {
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    font-family: 'SFMono-Regular', 'Menlo', monospace;
    font-size: 0.68rem;
}
.footer-build a:hover {
    color: rgba(255, 255, 255, 0.8);
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 768px) {
    .filter-sidebar {
        height: auto !important;
        max-height: 300px;
    }
    #detailPanel {
        width: 100% !important;
        max-width: 100% !important;
    }
    .dash-wrap { padding: 1.25rem; }
}
