/* Triage Times. A statistical broadsheet: warm paper, black ink, hairline rules.
   Helvetica Neue / Helvetica / Arial only, hierarchy by weight. Colour appears only in data:
   blue for better than expected, brick red for worse, grey for within the expected range. */
:root {
  --paper: #faf9f6;
  --ink: #141414;
  --ink2: #474542;
  --muted: #74716b;
  --rule: #d8d4cc;
  --faint: #eeebe4;
  --above: #1d5a94;
  --above2: #7fa6cb;
  --below: #b2432c;
  --below2: #dba08f;
  --within: #a9a59c;
  --band: #ece8df;
  --band2: #f3f1ec;
  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --w: 1120px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 16px/1.5 var(--font); font-feature-settings: "tnum" 1; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.wrap { max-width: var(--w); margin: 0 auto; padding: 0 24px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; background: var(--paper); padding: 6px 10px; z-index: 10; }

/* Masthead */
.mast { border-bottom: 1px solid var(--ink); }
.mast .wrap { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; padding-top: 18px; padding-bottom: 12px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 26px; letter-spacing: -0.025em; text-decoration: none; line-height: 1; }
.brand:hover { text-decoration: none; }
.mast nav { display: flex; gap: 22px; font-size: 15px; flex-wrap: wrap; }
.mast nav a { text-decoration: none; color: var(--ink2); }
.mast nav a:hover, .mast nav a[aria-current] { color: var(--ink); text-decoration: underline; }
.edition { border-bottom: 1px solid var(--rule); font-size: 13px; color: var(--muted); }
.edition .wrap { display: flex; justify-content: space-between; gap: 16px; padding-top: 7px; padding-bottom: 7px; flex-wrap: wrap; }

/* Type */
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.018em; line-height: 1.12; }
h1 { font-size: clamp(32px, 5vw, 54px); letter-spacing: -0.03em; max-width: 17ch; }
h2 { font-size: 28px; }
h3 { font-size: 18px; letter-spacing: -0.01em; }
p { margin: 0 0 14px; }
.dek { font-size: 19px; line-height: 1.45; color: var(--ink2); max-width: 46ch; }
.lead { font-size: clamp(20px, 2.3vw, 27px); line-height: 1.38; letter-spacing: -0.01em; max-width: 34em; }
.lead b { font-weight: 700; }
.small { font-size: 13px; color: var(--muted); }
.note { font-size: 14px; color: var(--muted); max-width: 70ch; }
.label { font-size: 14px; font-weight: 700; color: var(--ink); }
.num { font-variant-numeric: tabular-nums; }

/* Sections */
section { padding: 40px 0; border-top: 1px solid var(--ink); }
section.first { border-top: 0; padding-top: 36px; }
.section-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: end; margin-bottom: 22px; }
.section-head p { margin: 0; color: var(--ink2); max-width: 52ch; }
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px; }
.hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 48px; align-items: end; }

/* Search */
.find { position: relative; max-width: 460px; }
.find label { display: block; margin-bottom: 6px; }
.find input { width: 100%; font: 400 18px var(--font); padding: 11px 12px 11px 38px; border: 1px solid var(--ink); background: #fff; color: var(--ink); border-radius: 0; }
.find svg { position: absolute; left: 12px; bottom: 15px; }
.find ul { position: absolute; z-index: 5; left: 0; right: 0; top: 100%; margin: 0; padding: 0; list-style: none; background: #fff; border: 1px solid var(--ink); border-top: 0; max-height: 340px; overflow: auto; }
.find li a { display: flex; justify-content: space-between; gap: 12px; padding: 9px 12px; text-decoration: none; }
.find li a span { color: var(--muted); font-size: 14px; white-space: nowrap; }
.find li a:hover, .find li a.on { background: var(--faint); }

/* Controls */
.controls { display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: center; margin-bottom: 16px; }
.seg { display: inline-flex; border: 1px solid var(--ink); }
.seg button { font: 400 15px var(--font); padding: 7px 13px; border: 0; background: transparent; color: var(--ink); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); font-weight: 700; }
select { font: 400 15px var(--font); padding: 7px 28px 7px 10px; border: 1px solid var(--ink); background: #fff; color: var(--ink); border-radius: 0; }
.yearpick { display: flex; align-items: center; gap: 12px; flex: 1 1 320px; }
.yearpick output { font-weight: 700; font-size: 20px; min-width: 4.5ch; }
input[type=range] { flex: 1; accent-color: var(--ink); }

/* Charts */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--font); fill: var(--muted); font-size: 12px; }
.chart .axis line, .chart .axis path { stroke: var(--rule); }
.chart .tick-strong { stroke: var(--ink); }
.reading { font-size: 18px; line-height: 1.4; margin: 14px 0 6px; max-width: 60ch; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 14px; color: var(--ink2); margin-top: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.legend i.line { width: 18px; height: 0; border-top: 1px solid var(--ink); border-radius: 0; vertical-align: 3px; }
.legend i.dash { width: 18px; height: 0; border-top: 1px dashed var(--ink2); border-radius: 0; vertical-align: 3px; }
.legend i.box { border-radius: 0; width: 14px; }
.tip { position: absolute; pointer-events: none; background: #fff; border: 1px solid var(--ink); padding: 8px 10px; font-size: 14px; line-height: 1.35; min-width: 180px; max-width: 280px; z-index: 4; display: none; }
.tip b { display: block; margin-bottom: 2px; }
.tip span { color: var(--muted); }

/* Lists and tables */
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 8px 10px 8px 0; border-bottom: 1px solid var(--rule); vertical-align: baseline; }
th { font-size: 14px; font-weight: 700; color: var(--ink); border-bottom: 1px solid var(--ink); }
td svg { display: block; }
#stateTable td:nth-child(4), #stateTable th:nth-child(4) { padding-left: 24px; }
td.r, th.r { text-align: right; padding-right: 0; padding-left: 10px; }
tbody tr:hover { background: var(--faint); }
.scroll { overflow-x: auto; }
.rank { list-style: none; margin: 0; padding: 0; }
.rank li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.rank li a { font-weight: 700; text-decoration: none; }
.rank li a:hover { text-decoration: underline; }
.rank .why { grid-column: 1 / -1; font-size: 14px; color: var(--muted); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; vertical-align: 0; margin-right: 6px; }
.c2, .c1 { color: var(--above); } .c-1, .c-2 { color: var(--below); }
.bg2 { background: var(--above); } .bg1 { background: var(--above2); } .bg0 { background: var(--within); } .bg-1 { background: var(--below2); } .bg-2 { background: var(--below); }

/* Hospital page */
.crumbs { font-size: 14px; color: var(--muted); margin-bottom: 14px; }
.crumbs a { color: var(--ink2); }
.facts { display: flex; flex-wrap: wrap; gap: 6px 28px; font-size: 15px; color: var(--ink2); margin-top: 14px; }
.facts b { color: var(--ink); }
.verdict { font-size: clamp(20px, 2.2vw, 26px); line-height: 1.38; letter-spacing: -0.01em; max-width: 36em; margin: 0; }
.verdict + .small { margin-top: 10px; }
.strip { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 3px; margin-top: 8px; }
.strip span { height: 10px; }
.actions { display: flex; gap: 18px; flex-wrap: wrap; font-size: 15px; }
button.link { font: inherit; background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; cursor: pointer; }

/* Prose pages */
.prose { max-width: 70ch; }
.prose h2 { font-size: 24px; margin: 34px 0 12px; }
.prose h3 { margin: 24px 0 8px; }
.prose li { margin-bottom: 6px; }
.prose code { font-family: var(--font); background: var(--faint); padding: 1px 4px; }
.formula { font-size: 17px; padding: 10px 0 10px 18px; border-left: 0; margin: 10px 0 16px; background: var(--band2); }
blockquote { margin: 12px 0 16px; padding: 0 0 0 18px; border-left: 0; color: var(--ink2); font-size: 17px; }
blockquote cite { display: block; font-size: 13px; color: var(--muted); font-style: normal; margin-top: 4px; }

/* Map */
.mapwrap { position: relative; height: min(72vh, 720px); border: 1px solid var(--ink); background: #f1efe9; }
#map { position: absolute; inset: 0; }
.maplibregl-ctrl-attrib { font: 11px var(--font) !important; }

/* Footer */
footer { border-top: 1px solid var(--ink); margin-top: 24px; padding: 24px 0 40px; font-size: 14px; color: var(--ink2); }
footer .wrap { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 32px; }
footer p { margin: 0 0 8px; max-width: 62ch; }
footer nav { display: flex; flex-wrap: wrap; gap: 8px 20px; align-content: start; }

@media (max-width: 860px) {
  .hero, .cols, .section-head, footer .wrap { grid-template-columns: 1fr; gap: 24px; }
  section { padding: 30px 0; }
}
@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
  .mast nav { gap: 14px; font-size: 14px; }
  .brand { font-size: 23px; }
  h2 { font-size: 23px; }
  .chart text { font-size: 11px; }
  .strip span { height: 8px; }
}
@media print {
  .mast nav, .find, .controls, .actions, footer nav { display: none; }
  body { background: #fff; }
}
.maplibregl-popup-content { border-radius: 0 !important; border: 1px solid var(--ink); box-shadow: none !important; font: 14px/1.4 var(--font); padding: 8px 10px !important; background: #fff; }
.maplibregl-popup-tip { display: none; }
.nw { white-space: nowrap; }
.maplibregl-ctrl-group { border-radius: 0 !important; box-shadow: none !important; border: 1px solid var(--ink); background: #fff; }
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--ink) !important; }
.maplibregl-ctrl-attrib.maplibregl-compact { border-radius: 0 !important; background: rgba(250,249,246,.9) !important; }
#funnelChart { min-height: 340px; }
#sotChart, #h4Chart { min-height: 260px; }
#timeChart { min-height: 240px; }
#stateSot, #stateH4, #stateMed { min-height: 300px; }
