/* D3 — research lab visual system */
body:has(.economic-charts){background:#f4f6f8;color:#102b42;font-family:Arial,'Segoe UI',sans-serif}
.economic-charts{max-width:1160px;padding:clamp(18px,4vw,48px)}
.economic-charts>h1{font-size:clamp(2.2rem,4vw,3.7rem);line-height:1.18;letter-spacing:-.03em;max-width:900px;color:#102b42}
.economic-charts>p{color:#526578;max-width:860px}
.d3-lab-controls{display:flex;align-items:end;flex-wrap:wrap;gap:12px;background:#fff;border:1px solid #dbe5ec;border-radius:16px;padding:20px;margin:26px 0;box-shadow:0 8px 22px #15334b0a}
.d3-lab-controls label{font-weight:700;color:#173b51}
.d3-lab-controls select{background:#f9fcfd;color:#102b42;border:1px solid #bacdd8;border-radius:9px;min-width:min(100%,210px);margin:0 16px 0 0}
.d3-chart-panel,.d3-data-panel{background:#fff;border:1px solid #dbe5ec;border-radius:16px;padding:clamp(16px,3vw,28px);margin:24px 0;box-shadow:0 8px 22px #15334b0a}
.d3-chart-panel h2,.d3-data-panel h2{font-size:1.35rem;color:#102b42}
.d3-chart-panel svg{background:linear-gradient(#f9fcfd,#fff);border:1px solid #e0e9ef;border-radius:12px}
.d3-data-panel table th{background:#edf7f6;color:#102b42}
.d3-data-panel table td{color:#26475b}
.d3-source{border-right:3px solid #23b7a4;padding:12px 16px;background:#eaf7f5;border-radius:8px}
.d3-source a{color:#087d73}
@media(max-width:650px){.d3-lab-controls{display:grid}.d3-lab-controls select{width:100%;margin:0}.d3-chart-panel,.d3-data-panel{padding:14px}}
@media(prefers-reduced-motion:reduce){body:has(.economic-charts) *{scroll-behavior:auto!important}}

.d4-chart-legend{font-size:.95rem;color:#31576c;margin:10px 0 16px}.d4-chart-legend span{color:#087d73;font-weight:800}

/* Contrast for links and chart explanations on light panels. */
body:has(.economic-charts) .economic-charts a{color:#075d66;text-decoration-color:currentColor}
body:has(.economic-charts) .economic-charts a:hover{color:#064651}
body:has(.economic-charts) .d4-chart-legend{color:#27485d}

/* Research lab panels: explicit text contrast independent of the dark shared theme. */
body:has(.economic-charts) :is(.d3-lab-controls,.d3-chart-panel,.d3-data-panel) :is(h1,h2,h3,h4,strong,label,th){color:#102b42}
body:has(.economic-charts) :is(.d3-lab-controls,.d3-chart-panel,.d3-data-panel) :is(p,small,td,caption){color:#40566a}
