/* Case map component (templates/_case_map.html): map stage, toolbar, legend, figures, ranked table,
   case list. Linked in place of the former inline <style> block, so the cascade order is unchanged. */
.dgm-wrap{max-width:1080px;margin:0 auto}
/* Compact (home page) mode: the band's own .container already sets the measure, so the component
   must not impose a second, narrower one on top of it. */
.dgm-wrap-fluid{max-width:none}
.dgm-lede{max-width:70ch}
.dgm-lede-note{margin-top:.35rem;font-size:.9rem;color:#475569}
.dgm-toolbar{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin:14px 0 10px}
.dgm-btn{font:inherit;padding:8px 14px;border-radius:999px;border:1px solid #cbd5e1;background:#fff;color:#1f2937;cursor:pointer}
.dgm-btn[aria-pressed="true"]{background:var(--primary);border-color:var(--primary);color:#fff}
.dgm-view-toggle{display:inline-flex;gap:6px;padding:3px;border-radius:999px;background:#eef2f6}
.dgm-view-toggle .dgm-btn{padding:6px 12px;border-color:transparent;background:transparent}
.dgm-view-toggle .dgm-btn[aria-pressed="true"]{background:var(--primary);border-color:var(--primary)}
.dgm-hint{font-size:.9rem;color:#64748b}
.dgm-map-stage{position:relative;overflow:hidden}
.dgm-map-stage svg{max-width:100%!important;display:block;margin:0 auto}
.dgm-map{height:460px;border-radius:14px;background:#eef2f6;border:1px solid #dbe3ea;z-index:0}
.dgm-map[hidden]{display:none}
/* Flat view: inline SVG choropleth (see buildMap in _case_map_js.html). Height follows the viewBox. */
.dgm-map.dgm-flat{height:auto!important;padding:6px;position:relative}
.dgm-map-stage svg.dgm-svgmap{max-width:820px!important;width:100%;height:auto}
.dgm-svgmap .dgm-st{stroke:#fff;stroke-width:1;stroke-linejoin:round;pointer-events:none}
.dgm-svgmap .dgm-st:focus{outline:none}
.dgm-svgmap .dgm-st:focus-visible{stroke:#0f172a;stroke-width:2.5}
.dgm-svgmap .dgm-inset-frame{fill:#f8fafc;stroke:#94a3b8;stroke-width:1}
.dgm-svgmap .dgm-inset-cap{font-size:11px;font-weight:700;fill:#475569;pointer-events:none}
.dgm-svgmap .dgm-svg-label{font-weight:700;text-anchor:middle;dominant-baseline:central;pointer-events:none}
.dgm-svgmap .dgm-hl{fill:none;stroke:#0f172a;pointer-events:none;stroke-linejoin:round}
.dgm-svgmap .dgm-hl-hover{stroke-width:2}
.dgm-svgmap .dgm-hl-sel{stroke-width:2.6}
.dgm-svgmap.dgm-hit{cursor:pointer}
.dgm-svg-tip{position:absolute;pointer-events:none;background:#0f172a;color:#fff;font-size:.82rem;padding:5px 9px;
  border-radius:6px;transform:translate(-50%,-130%);white-space:nowrap;z-index:3}
.dgm-svg-tip[hidden]{display:none}
.dgm-map3d{position:relative;overflow:hidden}
.dgm-map3d canvas{display:block;touch-action:pan-y}
.dgm-3d-caption{position:absolute;left:12px;bottom:10px;font-size:.78rem;color:#64748b;
  background:rgba(255,255,255,.82);padding:3px 9px;border-radius:999px;pointer-events:none;z-index:2}
.dgm-3d-tip{position:absolute;pointer-events:none;background:#0f172a;color:#fff;font-size:.82rem;
  padding:5px 9px;border-radius:6px;transform:translate(-50%,-115%);white-space:nowrap;z-index:3;display:none}
/* Tile grid map: every state is one equal-size cell (a "tilegram"/"statebins" layout), positioned
   roughly where the state sits geographically. Unlike the choropleth, cell size never depends on
   land area, so every state - Rhode Island as much as Montana - can always show its abbreviation
   AND its exact count. This is what makes it the readable "exact numbers" view on a phone; it is
   NOT a replacement for the geographic 3D/Flat views, which stay for showing spatial pattern.
   Column count is fixed (11) so grid-template-columns:repeat(11,1fr) always divides evenly into
   the container's own width - the grid can never overflow horizontally, at any viewport, without
   any JS-computed scaling. Row height is a fixed px (not tied to width) since only horizontal
   overflow is disallowed. */
.dgm-map.dgm-grid-view{height:auto;min-height:0;background:transparent;border:none;padding:6px 0 2px;overflow:visible}
.dgm-grid{display:grid;grid-template-columns:repeat(11,1fr);grid-auto-rows:44px;gap:3px;max-width:640px;margin:0 auto}
.dgm-grid-cell{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;
  border-radius:6px;border:1px solid rgba(15,23,42,.14);cursor:pointer;user-select:none;
  transition:transform .1s ease,box-shadow .1s ease}
.dgm-grid-cell:hover{transform:scale(1.06);box-shadow:0 2px 6px rgba(15,23,42,.25);z-index:1}
.dgm-grid-cell:focus-visible{outline:2px solid #0f172a;outline-offset:1px;z-index:1}
.dgm-grid-cell.dgm-grid-selected{box-shadow:0 0 0 2.5px #0f172a inset;z-index:1}
.dgm-grid-abbr{font-weight:700;font-size:11px;line-height:1}
.dgm-grid-count{font-size:9px;line-height:1;opacity:.9}
@media (min-width:577px){.dgm-grid{grid-auto-rows:52px}.dgm-grid-abbr{font-size:13px}.dgm-grid-count{font-size:10.5px}}
.dgm-legend{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin:12px 0 4px;font-size:.85rem;color:#475569}
.dgm-legend i{display:inline-block;width:16px;height:16px;border-radius:3px;border:1px solid #cbd5e1;margin-right:6px;vertical-align:-3px}
.dgm-legend-note{font-size:.82rem;color:#475569;font-style:italic}
/* Ranked table: the exact per-state count, always readable regardless of map size or zoom - this
   is what replaces per-state leader-line callouts entirely (see dgm-labels.js). Capped height on
   mobile with an internal scroll plus a "show all" button that lifts the cap. */
.dgm-table-scroll{max-height:420px;overflow-y:auto;border:1px solid #e2e8f0;border-radius:12px;margin-bottom:10px}
.dgm-table-scroll.dgm-expanded{max-height:none}
.dgm-state-table{width:100%;border-collapse:collapse;font-size:.92rem}
.dgm-state-table thead th{position:sticky;top:0;background:#fff;text-align:left;padding:8px 14px;
  border-bottom:1px solid #e2e8f0;font-weight:700;color:#0f172a;z-index:1}
.dgm-state-table thead th.text-end{text-align:right}
.dgm-state-table td,.dgm-state-table th[scope="row"]{padding:7px 14px;border-bottom:1px solid #eef2f6;font-weight:400}
.dgm-state-table tbody tr:last-child td,.dgm-state-table tbody tr:last-child th{border-bottom:none}
.dgm-row-code{color:#5F6E7C;font-size:.8rem;margin-left:4px}   /* was #94a3b8: 3.0:1 on white, under AA */
.dgm-row-zero th,.dgm-row-zero td{color:#5F6E7C}
@media (max-width:576px){.dgm-table-scroll{max-height:320px}}
.dgm-figures{display:flex;gap:26px;flex-wrap:wrap;margin:18px 0 6px}
.dgm-figure{display:flex;flex-direction:column}
.dgm-figure-num{font-size:1.7rem;font-weight:700;color:var(--primary);line-height:1.1}
.dgm-figure-label{font-size:.85rem;color:#64748b}
.dgm-subhead{margin-top:26px}
/* The state list now sits lower on the page, below the charts. Two columns halve its height on
   desktop so a reader scrolling to it is not faced with 39 stacked rows. */
.dgm-list{display:grid;grid-template-columns:repeat(auto-fit,minmax(340px,1fr));gap:0 12px;align-items:start}
@media (max-width:760px){.dgm-list{grid-template-columns:1fr}}
#cases-by-state-list{scroll-margin-top:84px}
.dgm-jump{margin:10px 0 0;font-size:.95rem}
.dgm-jump a{font-weight:600}
.dgm-group{border:1px solid #e2e8f0;border-radius:12px;margin:0 0 10px;background:#fff;overflow:hidden}
.dgm-group[hidden]{display:none}
.dgm-group[open]{border-color:#c7d7e4;box-shadow:0 1px 2px rgba(15,23,42,.05)}
.dgm-group-head{display:flex;justify-content:space-between;gap:12px;align-items:baseline;margin:0;
  padding:12px 16px;font-size:1rem;cursor:pointer;list-style:none;user-select:none}
.dgm-group-head::-webkit-details-marker{display:none}
.dgm-group-head:hover{background:#f6f9fc}
.dgm-group-head:focus-visible{outline:2px solid #1f5c86;outline-offset:-2px}
.dgm-state-name{font-weight:600;color:#0f172a}
.dgm-state-count{font-size:.85rem;color:#64748b;font-weight:400;white-space:nowrap}
/* chevron that rotates when the state opens */
.dgm-group-head::after{content:"";width:9px;height:9px;flex:0 0 9px;align-self:center;
  border-right:2px solid #64748b;border-bottom:2px solid #64748b;transform:rotate(-45deg);transition:transform .18s ease}
.dgm-group[open] .dgm-group-head::after{transform:rotate(45deg)}
.dgm-panel{padding:2px 16px 14px}
.dgm-empty{margin:10px 0 0;padding:14px 16px;border-radius:10px;background:#f1f5f9;color:#475569}
.dgm-cases{margin:0;padding-left:20px}
.dgm-cases li{margin:8px 0}
.dgm-case-link{color:#1d4ed8;text-decoration:none;font-weight:600}
.dgm-case-link:hover{text-decoration:underline}
.dgm-case-meta{display:block;font-size:.85rem;color:#64748b;font-weight:400}
.dgm-case-blurb{display:block;font-size:.88rem;color:#475569;margin-top:2px;max-width:78ch}
@media (max-width:576px){
  .dgm-map{height:320px}
  .dgm-figures{gap:16px}
  .dgm-group-head{padding:12px 14px}
  .dgm-panel{padding:2px 14px 12px}
}

/* Touch and tap-size rules. Buttons and the state list meet the 44px target at 8px spacing. */
.dgm-btn{min-height:44px;min-width:44px}
.dgm-view-toggle{gap:8px}
.dgm-hit{cursor:pointer!important}
.dgm-states{margin-top:16px}
.dgm-states>summary{display:flex;align-items:center;min-height:44px;padding:0 4px;font-weight:600;color:#0f172a;cursor:pointer}
.dgm-states-list{list-style:none;margin:8px 0 0;padding:0;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.dgm-states-list li{max-width:none!important;margin:0}
.dgm-states-list a{display:flex;justify-content:space-between;align-items:center;gap:8px;min-height:44px;padding:4px 12px;
  border:1px solid #cbd5e1;border-radius:8px;background:#fff;color:#0f172a;text-decoration:none;line-height:1.25}
.dgm-states-list a:hover{border-color:var(--primary);background:#f6f9fc}
.dgm-states-n{font-variant-numeric:tabular-nums;color:#475569;font-size:.9rem}
@media (min-width:768px){.dgm-states-list{grid-template-columns:repeat(4,minmax(0,1fr))}}
@media (max-width:768px){.dgm-wrap-fluid .dgm-view-toggle,.dgm-wrap-fluid .dgm-legend-note{display:none}}
.dgm-wrap-fluid .dgm-toolbar{margin:0 0 8px}
@media (max-width:576px){.dgm-wrap-fluid .dgm-map{height:236px}}
.dgm-states>summary{justify-content:space-between;text-align:left;list-style:none}
.dgm-states>summary::-webkit-details-marker{display:none}
.dgm-states>summary::after{content:"";width:9px;height:9px;border-right:2px solid #475569;border-bottom:2px solid #475569;transform:rotate(45deg);margin:-4px 8px 0 12px;transition:transform .18s ease}
.dgm-states[open]>summary::after{transform:rotate(-135deg);margin-top:4px}
@media print{
  .dgm-group .dgm-panel{display:block !important}
}
