/* Death in America: county cause-of-death explorer (shared by both IHME pages) */
:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f3f6fa;
  --ink: #1a2a3a;
  --ink-2: #3c4f62;
  --muted: #5a6d80;
  --line: #d6e2ee;
  --line-strong: #9fb4c8;
  --navy: #0a3560;
  --accent: #14548c;
  --accent-ink: #ffffff;
  --map-stroke: rgba(26, 42, 58, 0.14);
  --state-stroke: #8496a8;
  --nodata: #d4d4d0;
  --select: #e8590c;
  --tip-bg: #0f1d2b;
  --tip-ink: #ffffff;
  --city-ink: #1a2a3a;
  --city-halo: rgba(255, 255, 255, 0.85);
  --s-county: #2a78d6;
  --s-state: #eb6834;
  --s-us: #1baf7a;
  --band: rgba(90, 109, 128, 0.16);
  --ui-band: rgba(42, 120, 214, 0.16);
  --grid: #e6edf4;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111a22;
    --surface: #16212b;
    --surface-2: #1d2a36;
    --ink: #e9eff5;
    --ink-2: #c6d2de;
    --muted: #9fb0c0;
    --line: #2c3c4b;
    --line-strong: #4b6176;
    --navy: #cfe1f5;
    --accent: #6da7ec;
    --accent-ink: #0b1620;
    --map-stroke: rgba(17, 26, 34, 0.55);
    --state-stroke: #111a22;
    --nodata: #3b3f42;
    --select: #ff8c42;
    --tip-bg: #f2f6fa;
    --tip-ink: #0f1d2b;
    --city-ink: #f2f6fa;
    --city-halo: rgba(17, 26, 34, 0.85);
    --s-county: #3987e5;
    --s-state: #d95926;
    --s-us: #199e70;
    --band: rgba(159, 176, 192, 0.16);
    --ui-band: rgba(57, 135, 229, 0.22);
    --grid: #233140;
  }
}
:root[data-theme="dark"] {
  --bg: #111a22; --surface: #16212b; --surface-2: #1d2a36; --ink: #e9eff5; --ink-2: #c6d2de; --muted: #9fb0c0;
  --line: #2c3c4b; --line-strong: #4b6176; --navy: #cfe1f5; --accent: #6da7ec; --accent-ink: #0b1620;
  --map-stroke: rgba(17, 26, 34, 0.55); --state-stroke: #111a22; --nodata: #3b3f42; --select: #ff8c42;
  --tip-bg: #f2f6fa; --tip-ink: #0f1d2b; --city-ink: #f2f6fa; --city-halo: rgba(17, 26, 34, 0.85);
  --s-county: #3987e5; --s-state: #d95926; --s-us: #199e70; --band: rgba(159, 176, 192, 0.16);
  --ui-band: rgba(57, 135, 229, 0.22); --grid: #233140;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; line-height: 1.55; }
a { color: var(--accent); }
.back { display: inline-block; margin: 14px 16px 0; font-size: 14px; }

header.hero { background: linear-gradient(135deg, #0a3560, #14548c 60%, #2f73b0); color: #fff; padding: 34px 16px 26px; }
header.hero .wrap { max-width: 1240px; margin: 0 auto; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: 12px; opacity: .85; margin: 0 0 8px; }
header.hero h1 { font-family: Georgia, serif; font-size: clamp(28px, 4.4vw, 42px); line-height: 1.1; margin: 0 0 10px; text-wrap: balance; }
.standfirst { font-size: 17.5px; line-height: 1.5; opacity: .95; margin: 0 0 10px; max-width: 800px; }
.meta { font-size: 13.5px; opacity: .85; margin: 0; }
.meta a { color: #fff; }

.app { max-width: 1240px; margin: 0 auto; padding: 18px 16px 8px; display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 20px; align-items: start; }
.sidebar { position: sticky; top: 10px; max-height: calc(100vh - 20px); overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.sidebar h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 0; padding: 12px 14px 6px; font-weight: 600; }
.sidebar .hint { font-size: 12px; color: var(--muted); padding: 0 14px 8px; margin: 0; }
.cause-list { list-style: none; margin: 0; padding: 0 6px 8px; }
.cause-list li.sep { font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 10px 8px 4px; border-top: 1px solid var(--line); margin-top: 6px; }
.cause-btn { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: baseline; text-align: left; background: none; border: 0; border-radius: 6px; padding: 6px 8px; cursor: pointer; color: var(--ink); font: inherit; font-size: 14px; line-height: 1.3; }
.cause-btn:hover { background: var(--surface-2); }
.cause-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.cause-btn .rate { font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.cause-btn.on { background: var(--accent); color: var(--accent-ink); }
.cause-btn.on .rate { color: var(--accent-ink); opacity: .85; }
.cause-select { display: none; }

.main { min-width: 0; }
.title-row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; margin: 0 0 4px; }
.title-row h2 { font-family: Georgia, serif; font-size: clamp(21px, 2.6vw, 27px); color: var(--navy); margin: 0; line-height: 1.2; }
.headline-stat { font-size: 14.5px; color: var(--ink-2); margin: 0 0 10px; }
.headline-stat strong { font-variant-numeric: tabular-nums; }

.controls { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin: 6px 0 10px; }
.btn { border: 1px solid var(--accent); background: var(--surface); color: var(--accent); border-radius: 999px; padding: 6px 15px; font-size: 14px; cursor: pointer; font-weight: 600; font-family: inherit; line-height: 1.2; }
.btn:hover { background: var(--surface-2); }
.btn.on { background: var(--accent); color: var(--accent-ink); }
.btn:focus-visible, .seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 999px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); color: var(--ink-2); padding: 6px 13px; font: inherit; font-size: 13.5px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.year-big { font-family: Georgia, serif; font-size: 30px; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; min-width: 2.6em; line-height: 1; }
.slider-row { display: flex; align-items: center; gap: 10px; flex: 1 1 320px; min-width: 240px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.slider-row input[type=range] { flex: 1; accent-color: var(--accent); min-width: 0; }
.search { position: relative; }
.search input { font: inherit; font-size: 14px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); width: 270px; max-width: 100%; }

.map-card { position: relative; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); overflow: hidden; }
.map-card svg.map { display: block; width: 100%; height: auto; touch-action: none; cursor: pointer; }
.map-card .county { stroke: var(--map-stroke); stroke-width: .35px; vector-effect: non-scaling-stroke; }
.map-card .county:hover { stroke: var(--ink); stroke-width: 1.4px; }
.map-card .states { fill: none; stroke: var(--state-stroke); stroke-width: 1px; vector-effect: non-scaling-stroke; pointer-events: none; }
.map-card .sel { fill: none; stroke: var(--select); stroke-width: 2.5px; vector-effect: non-scaling-stroke; pointer-events: none; }
.map-card .city text { font-size: 10px; fill: var(--city-ink); paint-order: stroke; stroke: var(--city-halo); stroke-width: 3px; stroke-linejoin: round; pointer-events: none; }
.map-card .city circle { fill: var(--city-ink); stroke: var(--city-halo); stroke-width: 1px; pointer-events: none; }
.map-tools { position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; gap: 4px; }
.map-tools button { width: 32px; height: 32px; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-size: 17px; cursor: pointer; line-height: 1; }
.map-tools button:focus-visible { outline: 2px solid var(--accent); }
.map-hint { position: absolute; left: 12px; top: 10px; font-size: 12px; color: var(--muted); background: var(--surface); padding: 2px 8px; border-radius: 999px; opacity: .92; pointer-events: none; }
.loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 15px; background: color-mix(in srgb, var(--surface) 60%, transparent); }
.loading[hidden] { display: none; }

.legend { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px 16px; padding: 10px 2px 2px; font-size: 12.5px; color: var(--ink-2); }
.legend .ttl { flex-basis: 100%; font-weight: 600; color: var(--ink); font-size: 13px; }
.legend .ramp { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; width: min(520px, 100%); position: relative; padding-bottom: 18px; }
.legend .ramp i { display: block; height: 12px; border-radius: 2px; box-shadow: inset 0 0 0 1px var(--line); }
.legend .ramp .ticks { position: absolute; left: 0; right: 0; bottom: 0; height: 16px; }
.legend .ramp .ticks span { position: absolute; transform: translateX(-50%); font-variant-numeric: tabular-nums; font-size: 11.5px; color: var(--muted); white-space: nowrap; line-height: 16px; }
.legend .ramp .ticks span::before { content: ""; position: absolute; left: 50%; top: -5px; height: 4px; border-left: 1px solid var(--line-strong); }
.legend .nd { display: flex; flex-direction: column; gap: 3px; padding-bottom: 18px; }
.legend .nd i { display: block; width: 40px; height: 12px; border-radius: 2px; background: var(--nodata); }
.legend .nd span { font-size: 11.5px; color: var(--muted); }
.stats { font-size: 13.5px; color: var(--muted); margin: 8px 0 0; }

.tip { position: fixed; z-index: 20; pointer-events: none; background: var(--tip-bg); color: var(--tip-ink); border-radius: 8px; padding: 9px 11px; font-size: 13px; line-height: 1.4; max-width: 280px; box-shadow: 0 8px 22px rgba(0,0,0,.22); }
.tip[hidden] { display: none; }
.tip b { font-size: 14px; }
.tip .v { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tip .s { opacity: .8; font-size: 12px; }

.lower { max-width: 1240px; margin: 0 auto; padding: 4px 16px 0; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 20px; }
.card { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 14px 16px; min-width: 0; }
.card h3 { margin: 0 0 2px; font-size: 16px; color: var(--navy); }
.card .sub { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--ink-2); margin: 0 0 4px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { display: inline-block; width: 16px; height: 3px; border-radius: 2px; }
.chart-legend i.band { height: 10px; }
svg.trend { width: 100%; height: auto; display: block; overflow: visible; }
svg.trend .grid line { stroke: var(--grid); }
svg.trend .axis text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
svg.trend .axis path, svg.trend .axis line { stroke: var(--line-strong); }
svg.trend .lbl { font-size: 11.5px; fill: var(--ink-2); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
svg.trend .yr { stroke: var(--line-strong); stroke-dasharray: 3 3; }
svg.trend .hover-line { stroke: var(--ink-2); stroke-width: 1px; }
.clear-sel { font-size: 12.5px; margin-left: 6px; }

table.rank { width: 100%; border-collapse: collapse; font-size: 13px; }
table.rank th, table.rank td { padding: 4px 6px; border-bottom: 1px solid var(--line); text-align: left; }
table.rank th { font-weight: 600; color: var(--muted); font-size: 12px; }
table.rank td.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.rank tr.pick { cursor: pointer; }
table.rank tr.pick:hover td { background: var(--surface-2); }
.rank-tabs { margin: 0 0 8px; }

.prose { max-width: 860px; margin: 0 auto; padding: 8px 16px 40px; }
.prose h2 { font-family: Georgia, serif; font-size: 24px; color: var(--navy); margin: 30px 0 8px; line-height: 1.25; }
.prose p { margin: 8px 0; font-size: 16.5px; }
.prose .small, .small { font-size: 14px; color: var(--muted); }
table.sources { border-collapse: collapse; width: 100%; font-size: 14px; margin: 12px 0; }
table.sources th, table.sources td { border: 1px solid var(--line); padding: 7px 9px; text-align: left; vertical-align: top; }
table.sources th { background: var(--surface-2); color: var(--navy); }
footer.wrap { max-width: 860px; margin: 0 auto; border-top: 1px solid var(--line); padding: 18px 16px 40px; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .cause-select { display: block; width: 100%; font: inherit; font-size: 15px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); margin: 0 0 8px; }
  .lower { grid-template-columns: 1fr; }
  .search input { width: 100%; }
  .search { flex: 1 1 100%; }
  .map-hint { display: none; }
  .map-tools { top: 6px; right: 6px; }
  .map-tools button { width: 28px; height: 28px; font-size: 15px; }
  .legend .ramp { width: 100%; }
}
