/* Shared appearance. Light is the default; a visitor's choice persists. */
:root {
  color-scheme: light;
  --page-bg: #fff;
  --surface: #fff;
  --surface-soft: #f5f7f8;
  --header-bg: rgba(255,255,255,.97);
  --control-line: #aabdc3;
  --deep: #132c36;
  --soft-teal: #edf3f1;
  --corn: #ad6616;
  --meal: #236b9a;
  --heat-low: #93c7b4;
  --heat-high: #e0a175;
  --heat-base: #f5f8f7;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page-bg: #11191f;
  --surface: #1c272f;
  --surface-soft: #23313a;
  --header-bg: rgba(17,25,31,.97);
  --ink: #edf2f5;
  --ink-light: #d0e1e6;
  --text: #afbec7;
  --line: #3c4b54;
  --paper: #162129;
  --accent: #91cbbb;
  --mint: #c0d7d1;
  --gold: #e0b460;
  --control-line: #637780;
  --deep: #14232c;
  --soft-teal: #213830;
  --corn: #e0b460;
  --meal: #86b8e2;
  --heat-low: #215b4e;
  --heat-high: #78472f;
  --heat-base: #24333c;
}
body { background: var(--page-bg); }
.site-header { background: var(--header-bg); }
.header-inner { gap: 24px; }
.theme-toggle {
  display: inline-flex; flex: none; align-items: center; justify-content: space-between;
  gap: 10px; min-width: 124px; min-height: 40px; padding: 4px 5px 4px 14px;
  border: 1px solid var(--control-line); border-radius: 24px; background: var(--surface-soft);
  color: var(--ink); font: 600 10px var(--sans); letter-spacing: .8px; text-transform: uppercase;
  cursor: pointer;
}
.theme-toggle[hidden] { display: none; }
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle:focus-visible { outline: 3px solid var(--gold); outline-offset: 4px; }
.theme-glyph { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--surface); }
.theme-glyph svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.theme-moon { display: none; }
[data-theme="dark"] .theme-moon { display: block; }
[data-theme="dark"] .theme-sun { display: none; }
[data-theme="dark"] .theme-glyph { order: -1; }
[data-theme="dark"] .theme-toggle { padding: 4px 14px 4px 5px; }
.hero, .contact, .area-ink, .study-scope { background: var(--deep); }
.light-button { color: #132c36; }
.skip, .publications-section, .project-preview-figure, .case-map, .footprint-card,
.footprint-table tbody th { background: var(--surface); }
.expertise-section, .publication-page-banner { background: var(--soft-teal); }
.project-button { background: var(--deep); color: #fff; }
.study-scope.pale { background: var(--paper); }
.footprint-table thead th { background: var(--deep); }
.footprint-table td, .footprint-table th { border-bottom-color: var(--surface); }
.footprint-table .footprint-value { border-left-color: var(--surface); }
.footprint-table .group-start > * { border-top-color: var(--surface); }
[data-theme="dark"] .area-teal { background: #235b50; }
[data-theme="dark"] .area-mint { background: #263c37; border-color: var(--line); }
[data-theme="dark"] .project-button:hover, [data-theme="dark"] .download-button:hover { background: #2c6558; }
[data-theme="dark"] .status { background: var(--soft-teal); }
[data-theme="dark"] .publication, [data-theme="dark"] .pub-group>.eyebrow,
[data-theme="dark"] .finding+.finding { border-color: var(--line); }
[data-theme="dark"] .brand .mark { outline: 1px solid #52656d; border-radius: 23%; }
.preview-night { display: none; }
[data-theme="dark"] .preview-day { display: none; }
[data-theme="dark"] .preview-night { display: block; }

/* Dashboard surfaces and chart labels share the website's appearance. */
.commodity-page, .explorer-page { background: var(--paper); }
.surface, .panel, .filter-panel, .notice, .load-message { background: var(--surface); border-radius: 0; }
.commodity-dashboard select, .commodity-dashboard input[type="number"], .dashboard select,
.outline-button, .presets button { background: var(--surface); color: var(--ink); border-color: var(--control-line); }
.commodity-dashboard th, .dashboard th { background: var(--surface-soft); }
.commodity-dashboard th, .commodity-dashboard td { border-color: var(--line); }
.cost-table th, .sensitivity-table th { background: var(--surface); }
.plot-axis, .chart-axis { fill: var(--text); }
.plot-grid, .chart-gridline { stroke: var(--line); }
.plot-hover, .chart-reference { stroke: var(--control-line); }
.chart-tooltip, .map-tooltip { background: var(--deep); color: #fff; border: 1px solid var(--control-line); }
.release-stamp, .commodity-methods, .methodology, .method-details details { border-color: var(--line); }
.series-line.corn, .bar-track .corn-segment { background: var(--corn); }
.series-line.meal, .bar-track .meal-segment { background: var(--meal); }
#corn-slider { accent-color: var(--corn); }
#meal-slider { accent-color: var(--meal); }
.chart-legend .national-key { border-color: var(--gold); }
.bar-track, .bar-row i { background: var(--surface-soft); }
.bar-row i>b, .source-dot { background: var(--accent); }
.bar-row[aria-pressed="true"] i>b { background: var(--gold); }
.readout, .location-note, .dataset-switch { background: var(--surface-soft); }
.dataset-switch button[aria-pressed="true"], .download-button { background: var(--deep); color: #fff; }
.dashboard select:disabled { background: var(--surface-soft); color: var(--text); }
.outline-button:hover, .presets button:hover { background: var(--soft-teal); border-color: var(--accent); }
.state-shape { stroke: var(--surface); }
.state-shape:hover, .state-shape:focus { stroke: var(--ink); }
.state-shape.selected { stroke: var(--gold); }
.sensitivity-table button { color: var(--ink); }
.sensitivity-table button[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--surface); }
.sensitivity-key i { background: linear-gradient(90deg,var(--heat-low),var(--heat-base),var(--heat-high)); }
.cost-impact { background: var(--soft-teal); border-color: var(--accent); }
[data-theme="dark"] .cost-impact.increase { background: #3b2b22; border-color: #e4a571; color: #f1c6a3; }
[data-theme="dark"] .cost-impact.decrease { background: #203a31; border-color: #91cbbb; color: #bee5d7; }
[data-theme="dark"] .input-error { background: #412a24; color: #ffc3a6; }
[data-theme="dark"] .dashboard tr.selected { background: #3b3326; }

@media (max-width: 1100px) {
  .header-inner { flex-wrap: wrap; gap: 10px 20px; }
  .brand { margin-right: auto; }
  .header-inner nav { order: 3; width: 100%; margin: 0; justify-content: space-between; }
  .theme-toggle { margin-left: auto; }
}
@media (max-width: 580px) {
  .header-inner { gap: 10px 8px; }
  .theme-toggle { min-width: 111px; min-height: 38px; gap: 7px; padding-left: 10px; font-size: 9px; }
  [data-theme="dark"] .theme-toggle { padding-right: 10px; }
  .theme-glyph { width: 28px; height: 28px; }
}
@media (max-width: 370px) {
  .site-header .wrap { padding-left: 14px; padding-right: 14px; }
  .brand { font-size: 13px; gap: 7px; }
  .brand .mark { width: 28px; height: 28px; }
  .theme-toggle { min-width: 104px; }
}
@media print {
  .theme-toggle { display: none; }
  :root[data-theme="dark"] { --page-bg:#fff; --surface:#fff; --paper:#f2f5f5; --surface-soft:#f5f7f8; --ink:#132c36; --text:#4c5e65; --line:#d9e1e3; --accent:#226c62; }
}
