:root {
    --bg-page: #f6f0e7;
    --bg-page-alt: #efe3d3;
    --bg-card: rgba(255, 252, 246, 0.92);
    --bg-card-strong: #fffaf2;
    --bg-elevated: #ffffff;

    --bg-ink: #13233c;
    --text-primary: #13233c;
    --text-secondary: #354963;
    --text-muted: #5a6b82;

    --border-color: rgba(19, 35, 60, 0.14);
    --border-subtle: rgba(19, 35, 60, 0.08);

    --accent-primary: #0f766e;
    --accent-secondary: #d97706;
    --accent-china: #c83a33;
    --accent-wb: #2166c2;
    --accent-mocca: #c9b29b;
    --accent-mocca-deep: #7f6650;

    --accent-primary-soft: rgba(15, 118, 110, 0.12);
    --accent-china-soft: rgba(200, 58, 51, 0.14);
    --accent-wb-soft: rgba(33, 102, 194, 0.14);
    --accent-mocca-soft: rgba(169, 134, 103, 0.22);

    --radius-xl: 26px;
    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-sm: 8px;

    --shadow-soft: 0 18px 45px rgba(19, 35, 60, 0.12);
    --shadow-hover: 0 24px 56px rgba(19, 35, 60, 0.18);

    --container-max: 1240px;
    --gap: 1.25rem;

    /* Reading mode */
    --space-reading-xs: 0.5rem;
    --space-reading-sm: 1rem;
    --space-reading-md: 2rem;
    --space-reading-lg: 3.5rem;
    --space-reading-xl: 5rem;

    /* Analysis mode */
    --space-analysis-xs: 0.3rem;
    --space-analysis-sm: 0.65rem;
    --space-analysis-md: 1.2rem;
    --space-analysis-lg: 1.8rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Space Grotesk', 'Segoe UI', sans-serif;
    color: var(--text-primary);
    background:
        radial-gradient(1200px 700px at 0% -20%, rgba(33, 102, 194, 0.16), transparent 65%),
        radial-gradient(900px 640px at 100% -5%, rgba(217, 119, 6, 0.18), transparent 60%),
        linear-gradient(165deg, var(--bg-page) 0%, var(--bg-page-alt) 100%);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

body::before,
body::after {
    content: '';
    position: fixed;
    border-radius: 999px;
    z-index: -1;
    filter: blur(70px);
    opacity: 0.4;
    pointer-events: none;
}

body::before {
    width: 320px;
    height: 320px;
    top: 80px;
    right: -80px;
    background: rgba(15, 118, 110, 0.35);
}

body::after {
    width: 280px;
    height: 280px;
    bottom: 20px;
    left: -90px;
    background: rgba(200, 58, 51, 0.25);
}

.skip-link {
    position: absolute;
    top: -100px;
    left: 16px;
    background: var(--bg-ink);
    color: #fff;
    padding: 0.55rem 0.85rem;
    border-radius: 999px;
    z-index: 2000;
    text-decoration: none;
}

.skip-link:focus {
    top: 16px;
}

.dashboard {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 1.5rem 1.2rem 2.5rem;
}

.story-section {
    margin-bottom: var(--space-reading-xl);
    scroll-margin-top: 130px;
}

/* Page-level spacing defaults */
.story-section {
    padding-block: var(--space-reading-md);
}

.story-section.act-reveal-ready {
    opacity: 0;
    transform: translate3d(0, 48px, 0);
    will-change: opacity, transform;
}

.story-section.act-reveal-ready.act-visible {
    animation: act-rise-in 0.82s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}

.page-explorer .explorer-section {
    padding-block: var(--space-analysis-md);
}

.section-overline {
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.16em;
    font-weight: 700;
    margin-bottom: 0.4rem;
}

.section-headline {
    font-family: 'Fraunces', Georgia, serif;
    font-size: clamp(1.8rem, 3vw, 2.6rem);
    line-height: 1.1;
    color: var(--bg-ink);
    margin-bottom: 0.7rem;
}

.section-body {
    color: var(--text-secondary);
    font-size: 1.05rem;
    line-height: 1.75;
    margin-bottom: 0.9rem;
    max-width: 860px;
}

.metadata-text {
    font-size: 0.78rem;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

.hero-block {
    border-radius: var(--radius-xl);
    padding: 2.2rem;
    position: relative;
    overflow: hidden;
    background: linear-gradient(138deg,
            rgba(201, 178, 155, 0.95) 0%,
            rgba(201, 178, 155, 0.92) 62%,
            rgba(201, 178, 155, 0.9) 100%);
    border: 1px solid rgba(255, 255, 255, 0.24);
    box-shadow: var(--shadow-soft);
}

.hero-block::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 15% 20%, rgba(255, 248, 239, 0.22), transparent 44%),
        radial-gradient(circle at 85% 18%, rgba(237, 221, 205, 0.26), transparent 35%);
    pointer-events: none;
}

.hero-block>* {
    position: relative;
    z-index: 1;
}

.hero-block h1 {
    font-family: 'Fraunces', Georgia, serif;
    font-size: clamp(2.2rem, 4.5vw, 3.55rem);
    line-height: 1.04;
    color: #2f2014;
    margin-bottom: 0.8rem;
    max-width: 920px;
    text-wrap: balance;
}

.hero-block .section-overline,
.hero-block .section-body {
    color: rgba(42, 28, 17, 0.95);
}

.hero-takeaway {
    margin: 0.6rem 0 1.2rem;
    padding: 0.68rem 0.78rem;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.36);
    border: 1px solid rgba(106, 81, 60, 0.24);
    color: #3d2d20;
    font-size: 0.92rem;
    line-height: 1.55;
}

.hero-context {
    margin-top: 1.1rem;
    margin-bottom: 1.3rem;
    display: grid;
    gap: 0.28rem;
}

.hero-context p {
    color: rgba(48, 33, 21, 0.9);
    font-size: 0.83rem;
    line-height: 1.5;
}

.hero-caution {
    font-weight: 600;
}

.hero-highlights {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin: 1.4rem 0;
}

.hero-highlights span {
    display: inline-flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.34);
    color: #3d2d20;
    border: 1px solid rgba(106, 81, 60, 0.24);
    border-radius: 999px;
    padding: 0.42rem 0.85rem;
    font-size: 0.82rem;
    letter-spacing: 0.02em;
}

.hero-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.8rem;
    margin-bottom: 0.55rem;
}

.hero-metric {
    background: rgba(255, 255, 255, 0.35);
    border: 1px solid rgba(106, 81, 60, 0.26);
    border-radius: var(--radius-md);
    padding: 0.62rem 0.8rem;
}

.hero-metric-label {
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(70, 49, 33, 0.72);
    font-size: 0.66rem;
    margin-bottom: 0.22rem;
}

.hero-metric-value {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 1.24rem;
    color: #3a2717;
}

.hero-metric-caption {
    color: rgba(61, 45, 32, 0.8);
    font-size: 0.77rem;
    margin-bottom: 0.9rem;
}

.framing-btn,
.reset-btn,
.export-btn,
.sidebar-toggle,
.mode-btn,
.row-expand-toggle {
    border-radius: 999px;
    padding: 0.65rem 1rem;
    border: 1px solid rgba(19, 35, 60, 0.22);
    background: #fff;
    color: var(--text-primary);
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.framing-btn {
    border: 1px solid rgba(255, 255, 255, 0.32);
    background: linear-gradient(140deg, #f2ab42 0%, #dc7a1a 100%);
    color: #fff;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.26);
}

.framing-btn:hover,
.reset-btn:hover,
.export-btn:hover,
.sidebar-toggle:hover,
.mode-btn:hover,
.row-expand-toggle:hover {
    transform: translateY(-2px);
}

.section-nav {
    position: sticky;
    top: 12px;
    z-index: 100;
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    padding: 0.7rem;
    border-radius: var(--radius-lg);
    background: rgba(255, 250, 243, 0.72);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    box-shadow: 0 6px 14px rgba(19, 35, 60, 0.06);
}

.section-nav-kicker {
    margin-top: 1rem;
    margin-bottom: 0.35rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.67rem;
    font-weight: 700;
}

.section-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    padding: 0.38rem 0.78rem;
    border-radius: 999px;
    border: 1px solid transparent;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.section-link.active {
    background: var(--accent-primary-soft);
    color: var(--accent-primary);
    border-color: rgba(15, 118, 110, 0.35);
}

.explorer-link {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.48rem 1.1rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #3d2d20;
    background: #c9b29b;
    border: 1px solid rgba(115, 85, 56, 0.28);
    text-decoration: none;
    transition: opacity 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    white-space: nowrap;
}

.explorer-link:hover {
    opacity: 0.92;
    box-shadow: 0 10px 20px rgba(126, 95, 64, 0.2);
    transform: translateY(-1px);
}

/* Explorer page nav */
.explorer-nav {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    padding: 1.1rem 1.6rem;
    margin-bottom: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
}

.back-link {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-primary);
    text-decoration: none;
    white-space: nowrap;
}

.back-link:hover {
    text-decoration: underline;
}

.explorer-nav-title {
    font-family: var(--font-display);
    font-size: 1.35rem;
    color: var(--bg-ink);
    margin: 0;
}

.identification-diagram {
    margin-top: 1.1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
}

.identification-diagram svg {
    width: 100%;
    display: block;
    background: var(--bg-card-strong);
}

.diagram-caption {
    margin-top: 0.6rem;
    color: var(--text-secondary);
    font-size: 0.86rem;
    line-height: 1.55;
}

.evidence-panel {
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    padding: 2rem 1rem;
    background: rgba(255, 255, 255, 0.48);
    border-top: 1px solid rgba(19, 35, 60, 0.08);
    border-bottom: 1px solid rgba(19, 35, 60, 0.08);
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.evidence-panel.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.evidence-panel img {
    display: block;
    width: min(1280px, calc(100% - 2rem));
    margin: 0 auto;
    max-height: 560px;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    background: #fff;
}

.evidence-panel figcaption {
    max-width: 720px;
    margin: 0.9rem auto 0;
    text-align: center;
}

.evidence-label {
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.11em;
    font-weight: 700;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.evidence-panel figcaption p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

.evidence-source {
    display: block;
    margin-top: 0.45rem;
    font-size: 0.76rem;
    color: var(--text-muted);
}

.headline-finding {
    background: var(--bg-card);
    border: 1px solid rgba(127, 102, 80, 0.26);
    border-left: 5px solid rgba(127, 102, 80, 0.65);
    border-radius: var(--radius-lg);
    box-shadow: 0 22px 42px rgba(19, 35, 60, 0.14);
    padding: 1.35rem 1.35rem;
    margin-bottom: 1rem;
}

.headline-finding h3 {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 1.6rem;
    margin-bottom: 0.34rem;
}

.insights-section {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--gap);
    margin-bottom: 1.1rem;
}

.insight-card {
    background: var(--bg-card);
    border: 1px solid rgba(19, 35, 60, 0.1);
    border-left: 4px solid rgba(166, 138, 111, 0.95);
    border-radius: var(--radius-lg);
    padding: 0.95rem;
    box-shadow: 0 10px 22px rgba(19, 35, 60, 0.08);
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.insight-card::before {
    content: none;
}

.insight-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 26px rgba(19, 35, 60, 0.1);
}

.insight-kicker {
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.11em;
    font-size: 0.71rem;
    font-weight: 700;
}

.insight-card h3 {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 1.06rem;
    line-height: 1.24;
    margin: 0.35rem 0 0.42rem;
    text-wrap: balance;
}

.insight-card p {
    color: var(--text-secondary);
    font-size: 0.84rem;
}

.insight-updating {
    opacity: 0.5;
    transform: scale(0.97);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--gap);
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 1.15rem;
    position: relative;
    overflow: hidden;
    transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.chart-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 190px;
    height: 150px;
    background: radial-gradient(circle at 100% 0%, rgba(15, 118, 110, 0.14), transparent 65%);
    pointer-events: none;
}

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

.chart-card.full-width {
    grid-column: 1 / -1;
}

.supporting-row {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1.45fr 0.95fr;
    gap: var(--gap);
    align-items: start;
}

.chart-header {
    margin-bottom: 0.95rem;
    padding-bottom: 0.78rem;
    border-bottom: 1px solid var(--border-subtle);
}

.chart-header h3 {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 1.34rem;
    line-height: 1.2;
    margin-bottom: 0.22rem;
}

.chart-header p {
    color: var(--text-secondary);
    font-size: 0.91rem;
}

.chart-container {
    position: relative;
    height: 350px;
}

.chart-container.compact {
    height: 290px;
}

.chart-container.tall {
    height: 520px;
}

.pretrend-note {
    margin-top: 0.7rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.58;
}

.chart-note-stack {
    margin-top: 0.6rem;
    display: grid;
    gap: 0.2rem;
}

.chart-note-stack p {
    font-size: 0.84rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.supporting-note-text {
    margin-top: 0.58rem;
    color: var(--text-secondary);
    font-size: 0.84rem;
    line-height: 1.5;
}

.supporting-interpretation {
    background: rgba(255, 252, 246, 0.86);
    border: 1px solid rgba(19, 35, 60, 0.12);
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 26px rgba(19, 35, 60, 0.09);
    padding: 1rem;
}

.supporting-interpretation h3 {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 1.06rem;
    margin-bottom: 0.4rem;
}

.supporting-interpretation p {
    color: var(--text-secondary);
    font-size: 0.86rem;
    line-height: 1.57;
}

.supporting-interpretation p+p {
    margin-top: 0.38rem;
}

#story-robustness.story-section-technical {
    background: linear-gradient(140deg, rgba(255, 255, 255, 0.45), rgba(229, 236, 243, 0.38));
    border: 1px solid rgba(19, 35, 60, 0.1);
    border-radius: var(--radius-xl);
    padding: 1.4rem;
}

.chart-provenance {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    padding-top: 0.6rem;
    margin-top: 0.8rem;
    border-top: 1px solid rgba(19, 35, 60, 0.08);
    font-size: 0.72rem;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

.provenance-sep {
    opacity: 0.6;
}

.limitations-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--gap);
}

.limit-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 1.2rem;
}

.limit-primary {
    border-color: rgba(127, 102, 80, 0.26);
    box-shadow: 0 18px 32px rgba(19, 35, 60, 0.13);
}

.limit-secondary {
    opacity: 0.92;
    box-shadow: 0 10px 20px rgba(19, 35, 60, 0.08);
}

.limit-card h3 {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 1.1rem;
    margin-bottom: 0.3rem;
}

.limit-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.limit-list {
    list-style: none;
    padding-left: 0;
    margin: 0.3rem 0 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.65;
}

.limit-list li+li {
    margin-top: 0.35rem;
}

.about-author-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--gap);
    margin-bottom: var(--gap);
}

.about-author-card {
    text-align: center;
}

.about-author-image {
    display: block;
    width: 100%;
    max-width: 180px;
    height: auto;
    margin: 0 auto 0.7rem;
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
}

.about-author-name {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
}

.about-author-role {
    margin-bottom: 0.2rem;
    color: var(--text-secondary);
}

.about-author-email {
    color: var(--accent-primary);
    text-decoration: none;
}

.about-author-email:hover {
    text-decoration: underline;
}

.about-lab-card h3 {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 1.18rem;
    margin-bottom: 0.4rem;
}

.about-lab-link {
    color: inherit;
    text-decoration: none;
}

.about-lab-link:hover {
    text-decoration: underline;
}

.about-lab-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.65;
    margin-bottom: 0.35rem;
}

.about-lab-logo {
    display: block;
    width: 100%;
    max-width: 230px;
    height: auto;
    margin: 0.9rem auto 0;
}

.explorer-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 1rem;
    align-items: start;
}

.explorer-main {
    display: grid;
    gap: var(--space-analysis-lg);
}

.filters-section {
    margin-bottom: 0.2rem;
}

.filter-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 1rem;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.filter-group label {
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.11em;
    font-weight: 600;
}

.filter-select {
    background: #fff;
    border: 1px solid rgba(19, 35, 60, 0.2);
    border-radius: 11px;
    color: var(--text-primary);
    padding: 0.6rem 0.72rem;
    font-size: 0.92rem;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.filter-select:hover {
    border-color: rgba(15, 118, 110, 0.55);
}

.filter-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
}

.stats-section {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--gap);
}

.stat-card {
    background: var(--bg-card-strong);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 1rem;
    min-height: 142px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 0.35rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, rgba(201, 178, 155, 0.95), rgba(186, 164, 141, 0.95));
}

.stat-icon-wrap {
    width: 42px;
    height: 42px;
    border-radius: 11px;
    background: rgba(19, 35, 60, 0.07);
    display: grid;
    place-items: center;
}

.stat-icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.stat-value {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 2rem;
    line-height: 1;
    color: var(--accent-mocca-deep);
}

.stat-card.china .stat-value {
    color: var(--accent-mocca-deep);
}

.stat-card.worldbank .stat-value {
    color: var(--accent-mocca-deep);
}

.stat-label {
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.83rem;
    font-weight: 700;
}

.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 0.8rem;
}

.export-btn {
    background: #fff;
}

.summary-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: #fff;
    padding: 0.78rem;
    margin-bottom: 0.85rem;
}

.summary-card h4 {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 1.02rem;
    margin-bottom: 0.2rem;
}

.summary-card-grid {
    margin-top: 0.5rem;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
}

.summary-card-grid div {
    background: #f8f3ea;
    border-radius: var(--radius-sm);
    padding: 0.48rem;
}

.summary-card-grid span {
    display: block;
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.summary-card-grid strong {
    font-size: 0.96rem;
}

.table-container {
    overflow: auto;
    max-height: 560px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(19, 35, 60, 0.12);
    background: #fff;
}

#results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.86rem;
    background: #fff;
}

#results-table thead {
    position: sticky;
    top: 0;
    z-index: 20;
}

#results-table th {
    background: #f8f3ea;
    color: var(--text-secondary);
    font-size: 0.71rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    font-weight: 700;
    padding: 0.86rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid rgba(19, 35, 60, 0.13);
    white-space: nowrap;
}

#results-table th[data-sort] {
    cursor: pointer;
    user-select: none;
}

#results-table th[data-sort]::after {
    content: '↕';
    margin-left: 0.3rem;
    font-size: 0.72rem;
    opacity: 0.42;
}

#results-table th.sorted-asc::after {
    content: '↑';
    opacity: 0.9;
}

#results-table th.sorted-desc::after {
    content: '↓';
    opacity: 0.9;
}

#results-table th[data-sort]:hover {
    background: #f1e8d8;
}

#results-table td {
    padding: 0.9rem 0.78rem;
    border-bottom: 1px solid rgba(19, 35, 60, 0.08);
    color: var(--text-primary);
    vertical-align: top;
    background: #fff;
    line-height: 1.6;
}

#results-table tbody tr:hover {
    background: rgba(15, 118, 110, 0.05);
}

#results-table tbody tr:hover td {
    background: transparent;
}

.table-column-caption {
    margin-top: 0.55rem;
    color: var(--text-muted);
    font-size: 0.78rem;
    letter-spacing: 0.02em;
}

/* Sticky first two columns */
#results-table th:nth-child(1),
#results-table td:nth-child(1) {
    position: sticky;
    left: 0;
    z-index: 15;
    min-width: 72px;
    background: #fff;
}

#results-table thead th:nth-child(1) {
    background: #f8f3ea;
}

#results-table th:nth-child(2),
#results-table td:nth-child(2) {
    position: sticky;
    left: 72px;
    z-index: 14;
    min-width: 140px;
    background: #fff;
    box-shadow: 2px 0 0 rgba(19, 35, 60, 0.08);
}

#results-table thead th:nth-child(2) {
    background: #f8f3ea;
}

.funder-chip,
.model-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.2rem 0.56rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    margin-left: 0.3rem;
}

.funder-chip.china {
    background: var(--accent-china-soft);
    color: var(--accent-china);
}

.funder-chip.worldbank {
    background: var(--accent-wb-soft);
    color: var(--accent-wb);
}

.model-chip.model-dcdh-no-covariates {
    background: rgba(15, 118, 110, 0.14);
    color: #0f766e;
}

.model-chip.model-dcdh-with-covariates {
    background: rgba(31, 157, 143, 0.14);
    color: #1f9d8f;
}

.model-chip.model-twfe-no-covariates {
    background: rgba(217, 119, 6, 0.15);
    color: #9a5606;
}

.model-chip.model-twfe-with-covariates {
    background: rgba(180, 83, 9, 0.14);
    color: #8a4009;
}

.row-expand-toggle {
    width: 1.65rem;
    height: 1.65rem;
    min-width: 1.65rem;
    padding: 0;
    border-radius: 50%;
    font-size: 1rem;
    line-height: 1;
    border: 1px solid rgba(19, 35, 60, 0.18);
    background: #fff;
}

.row-expand-toggle[aria-expanded="true"] {
    background: var(--accent-primary-soft);
    border-color: rgba(15, 118, 110, 0.45);
}

.coefficient-cell {
    border-radius: var(--radius-sm);
}

.cell-positive {
    color: #0c7c42;
    font-weight: 700;
    background: rgba(12, 124, 66, 0.2);
}

.cell-negative {
    color: #6f2a28;
    font-weight: 700;
    background: rgba(111, 42, 40, 0.2);
}

.cell-insignificant {
    color: #5a6b82;
    background: rgba(107, 123, 147, 0.1);
}

.row-detail td {
    background: #f7f4ee;
    border-bottom: 1px solid rgba(19, 35, 60, 0.09);
    padding: 0.8rem 0.9rem;
}

.row-detail-content {
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.5;
}

.row-detail-content p {
    margin-bottom: 0.35rem;
}

.row-detail-content code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
    color: var(--bg-ink);
    font-size: 0.78rem;
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 1rem;
}

.methodology-sidebar {
    position: sticky;
    top: 120px;
    align-self: start;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    background: var(--bg-card);
    overflow: hidden;
}

.sidebar-toggle {
    width: 100%;
    border: none;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
    padding: 0.9rem 0.95rem;
    background: rgba(15, 118, 110, 0.08);
}

.sidebar-toggle svg {
    width: 18px;
    height: 18px;
    transition: transform 0.2s ease;
}

.sidebar-toggle[aria-expanded="true"] svg {
    transform: rotate(180deg);
}

.sidebar-content {
    padding: 0.85rem;
    display: grid;
    gap: 0.6rem;
}

.sidebar-content[hidden] {
    display: none !important;
}

.method-card {
    background: #fff;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.65rem;
}

.method-card h4 {
    font-size: 0.88rem;
    margin-bottom: 0.2rem;
}

.method-card p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.site-footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.82rem;
    padding-top: 1.2rem;
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1200;
}

.modal.active {
    display: grid;
    place-items: center;
    animation: fade-in 0.24s ease;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(13, 28, 48, 0.64);
    backdrop-filter: blur(4px);
}

.modal-container {
    position: relative;
    width: min(920px, 94%);
    max-height: 86vh;
    background: #fffaf3;
    border: 1px solid rgba(19, 35, 60, 0.16);
    border-radius: var(--radius-lg);
    box-shadow: 0 34px 80px rgba(13, 28, 48, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: lift-up 0.28s ease;
}

.modal-header {
    padding: 1.15rem 1.3rem;
    border-bottom: 1px solid rgba(19, 35, 60, 0.12);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(130deg, rgba(15, 118, 110, 0.1) 0%, rgba(33, 102, 194, 0.1) 100%);
}

.modal-header h2 {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 1.48rem;
}

.modal-close {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(19, 35, 60, 0.2);
    background: #fff;
    color: var(--text-secondary);
    font-size: 1.9rem;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.modal-close:hover {
    transform: rotate(90deg);
}

.modal-content {
    padding: 1.25rem;
    overflow-y: auto;
}

.modal-section {
    margin-bottom: 1rem;
    padding-bottom: 0.9rem;
    border-bottom: 1px solid rgba(19, 35, 60, 0.1);
}

.modal-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.modal-section h3 {
    font-size: 1.08rem;
    margin-bottom: 0.4rem;
}

.modal-section p {
    color: var(--text-secondary);
    font-size: 0.94rem;
}

.loading {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--text-secondary);
}

.loading::after {
    content: '';
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(19, 35, 60, 0.24);
    border-top-color: var(--accent-primary);
    animation: spin 0.7s linear infinite;
}

body.modal-open {
    overflow: hidden;
}

/* Explorer-page specific — no mode-based hiding needed, 
   explorer is a separate page now. */

:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(19, 35, 60, 0.08);
}

::-webkit-scrollbar-thumb {
    background: rgba(19, 35, 60, 0.25);
    border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(19, 35, 60, 0.4);
}

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

@keyframes fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes lift-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes act-rise-in {
    from {
        opacity: 0;
        transform: translate3d(0, 48px, 0);
    }

    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@media (max-width: 1220px) {
    .explorer-layout {
        grid-template-columns: 1fr;
    }

    .methodology-sidebar {
        position: static;
    }

    .explorer-link {
        width: 100%;
        justify-content: center;
    }

    .section-nav {
        align-items: stretch;
    }
}

@media (max-width: 1050px) {

    .insights-section,
    .limitations-grid,
    .stats-section,
    .charts-grid,
    .supporting-row {
        grid-template-columns: 1fr;
    }

    .filter-card {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hero-metrics {
        grid-template-columns: 1fr;
        max-width: 340px;
    }
}

@media (max-width: 760px) {
    .dashboard {
        padding: 1rem 0.75rem 1.8rem;
    }

    .hero-block {
        padding: 1.45rem;
    }

    .hero-block h1 {
        font-size: 1.9rem;
    }

    .section-nav {
        top: 6px;
    }

    .filter-card {
        grid-template-columns: 1fr;
    }

    .summary-card-grid {
        grid-template-columns: 1fr;
    }

    .chart-container {
        height: 300px;
    }

    .chart-container.tall {
        height: 390px;
    }

    .explorer-link {
        grid-column: 1 / -1;
        margin-left: 0;
    }
}

@media (max-width: 560px) {

    #results-table th,
    #results-table td {
        font-size: 0.78rem;
    }

    #results-table th:nth-child(1),
    #results-table td:nth-child(1) {
        min-width: 64px;
    }

    #results-table th:nth-child(2),
    #results-table td:nth-child(2) {
        min-width: 120px;
        left: 64px;
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}
