@charset "UTF-8";

:root {
  /* Paper & ink — Sidewalk's real values: light-gray canvas, warm near-black */
  --bg: #f7f7f5;
  --paper: #ffffff;
  --surface: #ffffff;
  --surface-2: #f1f1ee;
  --rule: #262626;
  --border: #e6e3da;
  --border-soft: #efece4;
  --text: #262626;
  --text-muted: #505050;
  --text-soft: #737373;

  /* Signature Sidewalk yellow + its buttery cream tint (#fdf5d1) */
  --brand: #ffcf2b;
  --brand-strong: #f5b400;
  --brand-soft: #fdf5d1;
  --on-brand: #262626;

  /* Links & urgent accent (Sidewalk deep blue + brick red) */
  --link: #122e94;
  --link-hover: #0c1f63;
  --accent: #ba3535;
  --accent-soft: #f7e3e3;

  /* Severity — flat, AA on white */
  --severity-fatal: #ba3535;
  --severity-major: #ff5a00;
  --severity-minor: #9c7a16;
  --severity-property: #737373;

  /* Travel mode (Sidewalk's section accent family) */
  --mode-walking: #6a2db3;
  --mode-biking: #17b368;
  --mode-driving: #505050;
  --mode-transit: #122e94;

  /* Type — geometric sans display (Circular ~800) + serif body (Freight Text) */
  --font-display: "Avenir Next", Avenir, Futura, "Century Gothic",
    "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-sans: "Avenir Next", Avenir, "Helvetica Neue", Helvetica, Arial,
    sans-serif;
  --font-serif: Georgia, "Times New Roman", Times, serif; /* approximates Freight Text Pro */
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* Shape — pills + restrained rounding (Sidewalk used 100px + 8px) */
  --radius: 10px;
  --radius-sm: 8px;
  --radius-pill: 999px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-serif);
  font-feature-settings: "tnum";
  overflow-x: hidden;
}

a {
  color: var(--link);
}

a:hover {
  color: var(--link-hover);
}

button,
select,
input {
  font: inherit;
  font-family: var(--font-sans);
}

button,
select {
  min-height: 44px;
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
a:focus-visible,
#main:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

.skip-link {
  left: 12px;
  padding: 10px 12px;
  position: absolute;
  top: -60px;
  z-index: 1000;
  background: var(--rule);
  color: var(--paper);
}

.skip-link:focus {
  top: 12px;
}

.masthead {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 480px);
  gap: 24px;
  align-items: center;
  padding: 48px 32px 40px;
  border-top: 6px solid var(--brand);
  background: var(--paper);
}

.masthead h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 5vw, 3.6rem);
  line-height: 0.98;
  font-weight: 800;
  letter-spacing: -0.025em;
}

/* Sidewalk-style yellow highlight behind a key phrase */
.masthead h1 .mark,
.mark {
  background: linear-gradient(transparent 58%, var(--brand) 58%, var(--brand) 94%, transparent 94%);
  padding: 0 0.06em;
}

.title-with-badge {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 4px;
}

.editorial-seal {
  width: 58px;
  height: 58px;
  flex-shrink: 0;
}

.seal-svg {
  width: 100%;
  height: 100%;
}

.section-label {
  display: none;
}

.section-label::before {
  display: none;
}

.source-line {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

/* Landing insights band: accountability scorecard (A2) + concentration hero (A1) */
.insights-band {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 12px 32px 28px;
}

.insight {
  padding: 28px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.insight.scorecard {
  background: var(--brand-soft);
  border-color: var(--brand);
}

.insight .section-label {
  margin-bottom: 12px;
}

/* Scorecard fills its width: label on top, then figures beside the context
   paragraph on wide cards, wrapping to stacked on narrow ones. */
.scorecard {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  column-gap: 32px;
  row-gap: 14px;
}
.scorecard > .section-label {
  flex: 1 1 100%;
  margin-bottom: 2px;
}
.scorecard-figures {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 0;
  flex: 0 0 auto;
}
.scorecard > .insight-context {
  flex: 1 1 220px;
  margin: 0;
  align-self: center;
}

/* Narrower cards (incl. mobile): figures sit 2-up, context drops below. */
@media (max-width: 900px) {
  .scorecard-figures {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 14px 24px;
  }
  .scorecard > .insight-context {
    flex: 1 1 100%;
  }
}

.big-figure {
  display: flex;
  flex-direction: column;
}

.big-figure strong {
  font-family: var(--font-display);
  font-size: 3.2rem;
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.03em;
  color: var(--accent);
}

.big-figure span {
  margin-top: 4px;
  max-width: 18ch;
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.3;
}

.hin-headline {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 1.5rem;
  line-height: 1.25;
}

.hin-headline .pct {
  color: var(--accent);
  font-weight: 700;
}

.insight-context {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.insight-context a {
  color: var(--link);
}

@media (max-width: 720px) {
  .insights-band {
    grid-template-columns: 1fr;
  }
  .big-figure strong {
    font-size: 2.1rem;
  }
}

/* Hotspot teaser on the home tab: top corridors preview linking to hotspots.html */
.corridor-teaser {
  padding: 0 32px 28px;
}
.teaser-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.teaser-head .section-label {
  margin-bottom: 0;
}
.teaser-link {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--link);
  text-decoration: none;
  white-space: nowrap;
}
.teaser-link:hover {
  text-decoration: underline;
}
.corridor-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.corridor-card {
  display: block;
  padding: 20px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.corridor-card:hover,
.corridor-card:focus-visible {
  border-color: var(--rule);
  transform: translateY(-2px);
}
.corridor-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.corridor-rank {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
}
.corridor-priority {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid currentColor;
}
.corridor-priority.urgent {
  color: var(--severity-fatal);
}
.corridor-priority.high {
  color: var(--severity-major);
}
.corridor-name {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 1.15rem;
  line-height: 1.2;
}
.corridor-scope {
  margin: 0 0 10px;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.corridor-sev {
  margin: 0 0 6px;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--accent);
}
.corridor-fix {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.teaser-note {
  margin-top: 12px;
  font-size: 0.76rem;
}
@media (max-width: 720px) {
  .corridor-teaser {
    padding: 0 24px 24px;
  }
  .corridor-cards {
    grid-template-columns: 1fr;
  }
}

.toolbar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.sentence-filter {
  font-family: var(--font-display);
  font-size: 1.45rem;
  line-height: 1.65;
  color: var(--text);
}

.select-wrapper {
  position: relative;
  display: inline-block;
  margin: 0 4px;
}

.select-wrapper select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--brand-soft);
  border: none;
  border-bottom: 3px solid var(--brand-strong);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text);
  padding: 4px 24px 4px 8px;
  margin: 0;
  cursor: pointer;
  width: auto;
  min-height: 44px;
  transition: background 0.15s ease, border-bottom-color 0.15s ease;
}

.select-wrapper select:hover {
  background: var(--brand);
}

.select-wrapper select:focus-visible {
  outline: none;
  border-bottom-color: var(--text);
  background: var(--brand);
}

.select-wrapper::after {
  content: "\2193";
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 900;
  color: var(--text);
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  border-top: 1px dashed var(--border-soft);
  padding-top: 12px;
}

.toggle-control {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  min-height: 44px;
  user-select: none;
}

.toggle-control input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--link);
}

.toggle-label {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.violations-source-container {
  display: none;
  align-items: center;
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--text-muted);
}

body.violations-visible .violations-source-container {
  display: flex;
}

.violations-source-container .select-wrapper select {
  font-size: 1rem;
  font-weight: 700;
  padding: 4px 20px 4px 4px;
  color: var(--text);
  border-bottom-color: var(--text-muted);
}

.violations-source-container .select-wrapper::after {
  color: var(--text-muted);
}

.toolbar-actions button {
  margin-left: auto;
  width: auto;
  min-width: 140px;
  min-height: 44px;
  padding: 10px 22px;
  border: 2px solid var(--rule);
  border-radius: var(--radius-pill);
  background: var(--rule);
  color: var(--paper);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transition: background 0.15s ease, color 0.15s ease;
}

.toolbar-actions button:hover {
  background: var(--brand);
  border-color: var(--rule);
  color: var(--on-brand);
}

.kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  overflow-x: auto;
}

.kpi {
  min-width: 130px;
  padding: 12px 14px;
  border-right: 1px solid var(--border);
}

.kpi strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.7rem;
  line-height: 1;
}

.kpi span {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(360px, 30vw, 460px);
  height: max(620px, calc(100svh - 246px));
  min-height: 0;
}

.map-shell {
  position: relative;
  min-height: 0;
  border-right: 1px solid var(--rule);
}

#map {
  position: absolute;
  inset: 0;
  background: #e6e4dc;
}

.map-notice {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 450;
  max-width: min(460px, calc(100% - 24px));
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--rule);
  color: var(--text);
  font-size: 0.84rem;
  line-height: 1.35;
}

.detail-panel {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 16px;
  background: var(--paper);
  overflow-y: auto;
  min-width: 0;
}

.detail-panel h2 {
  margin: 0 0 10px;
  padding-bottom: 8px;
  border-bottom: 4px solid var(--brand);
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.detail-body {
  color: var(--text);
  line-height: 1.45;
  min-width: 0;
  overflow-wrap: anywhere;
}

.detail-body dl {
  display: grid;
  grid-template-columns: 128px 1fr;
  gap: 6px 10px;
  margin: 0 0 14px;
}

.detail-body dt {
  color: var(--text-muted);
  font-weight: 700;
}

.detail-body dd {
  margin: 0;
}

.panel-note {
  margin: 0 0 14px;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.hotspot-panel {
  padding-bottom: 4px;
}

.hotspot-group {
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.hotspot-group + .hotspot-group {
  margin-top: 14px;
}

.hotspot-group h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.08rem;
  line-height: 1.15;
}

.hotspot-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.hotspot-list li {
  margin: 0;
}

.hotspot-button {
  width: 100%;
  min-height: 44px;
  padding: 8px 0;
  border: 0;
  border-bottom: 1px solid var(--border-soft);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.hotspot-button:hover .hotspot-title,
.hotspot-button:focus-visible .hotspot-title {
  color: var(--link);
}

.hotspot-rank {
  display: inline-block;
  min-width: 2ch;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
}

.hotspot-title {
  display: block;
  margin-top: 2px;
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1.18;
}

.hotspot-meta {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.hotspot-score {
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 700;
}

.ward-rates-panel {
  padding-top: 16px;
  margin-top: 16px;
  border-top: 2px solid var(--rule);
}

.ward-rates-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.ward-rates-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.ward-rates-table th,
.ward-rates-table td {
  padding: 6px 4px;
  text-align: left;
  border-bottom: 1px solid var(--border-soft);
}

.ward-rates-table th {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.ward-rates-table th.num,
.ward-rates-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.ward-rates-table td.num.lead {
  color: var(--accent);
  font-weight: 700;
}

.ward-rates-table tbody tr:hover {
  background: var(--surface-2);
}

.ward-rates-caveat {
  margin-top: 12px;
  font-size: 0.78rem;
  color: var(--text-soft);
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pill.fatal {
  border-color: var(--severity-fatal);
  background: var(--severity-fatal);
  color: var(--paper);
}

.pill.major {
  border-color: var(--severity-major);
  color: var(--severity-major);
}

.details-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  table-layout: fixed;
}

.details-table th,
.details-table td {
  padding: 6px 4px;
  border-bottom: 1px solid var(--border-soft);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.details-table th {
  border-bottom-color: var(--rule);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.source-box {
  padding-top: 14px;
  border-top: 1px solid var(--rule);
}

.source-box ul {
  margin: 0;
  padding-left: 18px;
}

.source-box li + li {
  margin-top: 6px;
}

.source-box p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  border-top: 1px solid var(--rule);
  background: var(--paper);
  color: var(--text-muted);
  font-size: 0.78rem;
}

/* Safe Streets Law Tracker */
.laws-summary,
.laws-tools,
.law-grid,
.law-method {
  max-width: 1180px;
  margin: 0 auto;
}

.laws-summary {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 24px 32px 10px;
}

.law-kpi {
  min-width: 180px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--brand-soft);
}

.law-kpi strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.8rem;
  line-height: 1;
  font-weight: 800;
}

.law-kpi span {
  display: block;
  margin-top: 6px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.laws-tools {
  padding: 10px 32px 18px;
}

.law-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.law-filter {
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--paper);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.law-filter.active,
.law-filter:hover {
  border-color: var(--brand-strong);
  background: var(--brand);
  color: var(--on-brand);
}

.law-grid {
  display: grid;
  gap: 18px;
  padding: 0 32px 28px;
}

.law-card {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--paper);
}

.law-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.law-citation,
.law-date,
.law-delivery-label {
  margin: 0;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.law-card h2 {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-size: 1.45rem;
  line-height: 1.12;
  font-weight: 800;
}

.law-card h3 {
  margin: 18px 0 8px;
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1.2;
}

.law-status {
  flex: 0 0 auto;
  max-width: 240px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.law-summary {
  max-width: 78ch;
  margin: 14px 0 0;
  line-height: 1.5;
}

.law-card ul {
  margin: 0;
  padding-left: 20px;
}

.law-card li + li {
  margin-top: 6px;
}

.law-delivery {
  margin-top: 18px;
  padding: 16px;
  border-left: 5px solid var(--brand);
  background: var(--brand-soft);
}

.law-delivery a {
  display: inline-block;
  margin-top: 5px;
  font-family: var(--font-display);
  font-weight: 800;
}

.law-delivery p:last-child {
  margin: 6px 0 0;
  color: var(--text-muted);
  line-height: 1.45;
}

.law-card-foot {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border-soft);
}

.law-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.law-tag {
  padding: 4px 8px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.law-method {
  margin-bottom: 32px;
  padding: 24px 32px;
  border-top: 1px solid var(--border);
}

.law-method h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.4rem;
}

@media (max-width: 720px) {
  .laws-summary {
    display: grid;
    padding: 18px 16px 8px;
  }

  .laws-tools,
  .law-grid,
  .law-method {
    padding-left: 16px;
    padding-right: 16px;
  }

  .law-card {
    padding: 18px;
  }

  .law-card-head,
  .law-card-foot {
    display: grid;
  }

  .law-status {
    max-width: none;
    width: fit-content;
  }

  .law-tags {
    justify-content: flex-start;
  }
}

.leaflet-container {
  overflow: hidden;
  font-family: var(--font-sans);
}

.leaflet-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-container,
.leaflet-pane > svg,
.leaflet-pane > canvas,
.leaflet-zoom-box,
.leaflet-image-layer,
.leaflet-layer {
  position: absolute;
  top: 0;
  left: 0;
}

.leaflet-pane {
  z-index: 400;
}

.leaflet-tile-pane {
  z-index: 200;
}

.leaflet-overlay-pane {
  z-index: 400;
}

.leaflet-shadow-pane {
  z-index: 500;
}

.leaflet-marker-pane {
  z-index: 600;
}

.leaflet-tooltip-pane {
  z-index: 650;
}

.leaflet-popup-pane {
  z-index: 700;
}

.leaflet-map-pane canvas {
  z-index: 100;
}

.leaflet-tile {
  width: 256px;
  height: 256px;
  user-select: none;
  visibility: hidden;
}

.leaflet-tile-loaded {
  visibility: inherit;
}

.leaflet-zoom-animated {
  transform-origin: 0 0;
}

.leaflet-control-container .leaflet-top,
.leaflet-control-container .leaflet-bottom {
  position: absolute;
  z-index: 1000;
  pointer-events: none;
}

.leaflet-top {
  top: 0;
}

.leaflet-right {
  right: 0;
}

.leaflet-bottom {
  bottom: 0;
}

.leaflet-left {
  left: 0;
}

.leaflet-control {
  position: relative;
  z-index: 800;
  float: left;
  clear: both;
  pointer-events: auto;
}

.leaflet-right .leaflet-control {
  float: right;
}

.leaflet-top .leaflet-control {
  margin-top: 10px;
}

.leaflet-bottom .leaflet-control {
  margin-bottom: 10px;
}

.leaflet-left .leaflet-control {
  margin-left: 10px;
}

.leaflet-right .leaflet-control {
  margin-right: 10px;
}

.leaflet-control-zoom {
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--paper);
}

.leaflet-control-zoom a {
  display: block;
  width: 44px;
  height: 44px;
  color: var(--text);
  line-height: 44px;
  text-align: center;
  text-decoration: none;
  background: var(--paper);
  border-bottom: 1px solid var(--border);
}

.leaflet-control-zoom a:last-child {
  border-bottom: 0;
}

.leaflet-popup {
  position: absolute;
  margin-bottom: 20px;
  text-align: center;
}

.leaflet-popup-content-wrapper {
  padding: 1px;
  text-align: left;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  box-shadow: 0 6px 18px rgba(26, 26, 26, 0.16);
}

.leaflet-popup-content {
  margin: 12px;
  line-height: 1.35;
}

.leaflet-popup-tip-container,
.leaflet-popup-close-button {
  display: none;
}

.leaflet-popup-content {
  width: min(260px, calc(100vw - 64px));
  min-width: 0;
}

.popup-title {
  display: block;
  margin-bottom: 4px;
  font-family: var(--font-display);
  font-size: 1.1rem;
}

@media (max-width: 1179px) {
  .layout {
    grid-template-columns: minmax(0, 1fr) 350px;
  }
}

@media (max-width: 960px) {
  .masthead {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .map-shell {
    height: 62svh;
    min-height: 430px;
    max-height: 680px;
    border-right: 0;
    border-bottom: 1px solid var(--rule);
  }

  .detail-panel {
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 640px) {
  .masthead,
  .toolbar {
    padding-left: 16px;
    padding-right: 16px;
  }

  .masthead {
    padding-top: 16px;
  }

  .masthead h1 {
    font-size: clamp(1.8rem, 10vw, 2.6rem);
  }

  .title-with-badge {
    gap: 12px;
  }

  .editorial-seal {
    width: 46px;
    height: 46px;
  }

  .toolbar {
    padding: 16px;
    gap: 12px;
  }

  .sentence-filter {
    font-size: 1.15rem;
    line-height: 1.5;
  }

  .select-wrapper select {
    font-size: 1.15rem;
    padding-right: 14px;
  }

  .select-wrapper::after {
    font-size: 0.65rem;
    bottom: 4px;
  }

  .toolbar-actions {
    gap: 12px;
    padding-top: 8px;
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-actions button {
    width: 100%;
    margin-left: 0;
  }

  .kpi {
    min-width: 124px;
    padding: 10px 12px;
  }

  .kpi strong {
    font-size: 1.45rem;
  }

  .map-shell {
    height: 56svh;
    min-height: 360px;
    max-height: 520px;
  }

  .map-notice {
    left: 8px;
    right: 8px;
    bottom: 8px;
    max-width: none;
    font-size: 0.78rem;
  }

  .detail-panel {
    padding: 12px;
  }

  .detail-panel h2 {
    font-size: 1.25rem;
  }

  .site-footer {
    display: grid;
  }
}

@media (max-width: 380px) {
  .masthead h1 {
    font-size: 1.8rem;
  }

  .section-label,
  .kpi span {
    letter-spacing: 0.04em;
  }
}

/* Custom Case Docket and Typographic Redesign */

.case-docket-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  background: var(--paper);
  position: relative;
  overflow: hidden;
}

.case-docket-section .section-label {
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-soft);
  padding-bottom: 4px;
}

.docket-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--rule);
  padding-bottom: 8px;
}

.docket-header h2 {
  margin: 0;
  border: none;
  font-family: var(--font-display);
  font-size: 1.4rem !important;
  line-height: 1.15;
}

.docket-stamp {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 2px solid var(--text-muted);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  user-select: none;
  flex-shrink: 0;
}

.docket-stamp.empty {
  border-color: var(--text-soft);
  color: var(--text-soft);
  opacity: 0.6;
}

.docket-stamp.fatal {
  border-color: var(--severity-fatal);
  color: var(--severity-fatal);
  background: rgba(159, 29, 32, 0.05);
}

.docket-stamp.major {
  border-color: var(--severity-major);
  color: var(--severity-major);
  background: rgba(201, 74, 39, 0.05);
}

.docket-stamp.minor {
  border-color: var(--severity-minor);
  color: var(--severity-minor);
  background: rgba(185, 135, 24, 0.05);
}

.docket-stamp.property {
  border-color: var(--severity-property);
  color: var(--severity-property);
  background: rgba(115, 115, 115, 0.05);
}

.empty-docket-message {
  font-style: italic;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.45;
  margin: 12px 0;
}

.docket-status-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.status-pill {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.status-pill.speeding {
  border-color: var(--severity-major);
  color: var(--severity-major);
  background: rgba(201, 74, 39, 0.03);
}

.status-pill.ped-involved {
  border-color: var(--mode-walking);
  color: var(--mode-walking);
  background: rgba(75, 46, 131, 0.03);
}

.status-pill.bike-involved {
  border-color: var(--mode-biking);
  color: var(--mode-biking);
  background: rgba(11, 107, 80, 0.03);
}

.docket-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.docket-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.3;
}

.docket-row::after {
  content: "";
  flex: 1 1 auto;
  border-bottom: 1px dotted var(--border);
  margin: 0 8px;
  order: 2;
}

.docket-row .label {
  order: 1;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.docket-row .value {
  order: 3;
  font-weight: 500;
  color: var(--text);
  text-align: right;
  flex-shrink: 0;
}

.docket-details-separator {
  border-top: 1px dashed var(--border);
  margin: 16px 0;
}

.docket-loader {
  font-style: italic;
  color: var(--text-soft);
  font-size: 0.82rem;
  margin: 8px 0;
}

.docket-error {
  color: var(--accent);
  font-size: 0.82rem;
  margin: 8px 0;
}

/* KPI strip — Sidewalk stat row */
.kpis {
  border-bottom: 1px solid var(--border);
}

.kpi {
  border-right: 1px solid var(--border-soft);
  padding-top: 16px;
}

.kpi:last-child {
  border-right: none;
}

.kpi strong {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2rem;
  letter-spacing: -0.03em;
  box-shadow: inset 0 -0.28em 0 var(--brand);
}

.hotspot-button {
  transition: background-color 0.15s ease;
  padding: 10px 8px;
  border-radius: 2px;
}

.hotspot-button:hover {
  background-color: var(--surface-2);
}

/* Custom styled scrollbars for news desk look */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ============================================================
   Multi-page: shared nav + landing-page sections
   ============================================================ */

/* Shared top nav — clean Sidewalk header */
.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(8px, 2vw, 20px);
  padding: clamp(12px, 2vw, 18px) clamp(16px, 3vw, 40px);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-wrap: nowrap;
  min-height: 44px;
}
.site-nav .nav-brand {
  display: inline-flex;
  align-items: center;
  gap: clamp(4px, 1vw, 8px);
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.01em;
  font-size: clamp(0.8rem, 2vw, 1rem);
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
  white-space: nowrap;
}
.site-nav .nav-links {
  display: flex;
  gap: clamp(4px, 1.5vw, 12px);
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
}
.site-nav .nav-links a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: clamp(6px, 1vw, 10px) clamp(10px, 2vw, 18px);
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  text-decoration: none;
  font-size: clamp(0.75rem, 1.5vw, 0.9rem);
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 1;
}
.site-nav .nav-links a:hover {
  color: var(--text);
  background: var(--surface-2);
}
.site-nav .nav-links a[aria-current="page"] {
  color: var(--on-brand);
  background: var(--brand);
}

/* On narrow phones the brand + 4 links can't fit on one line (they overflowed to
   ~456px at 375px, forcing whole-page horizontal scroll). Let the link row wrap
   onto its own full-width line under the brand. Shared nav, so this fixes every
   page (hotspots, ANC, overview, map) at once. */
@media (max-width: 480px) {
  .site-nav {
    flex-wrap: wrap;
    row-gap: 8px;
  }
  .site-nav .nav-links {
    flex-basis: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }
}

/* Tab navigation */
.tabs-nav {
  display: flex;
  gap: 2px;
  padding: 0 32px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.tabs-nav::-webkit-scrollbar {
  display: none;
}
.tab-button {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 12px 24px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: color 0.2s, border-color 0.2s;
  white-space: nowrap;
}
.tab-button:hover {
  color: var(--text);
}
.tab-button.active {
  color: var(--text);
  border-bottom-color: var(--brand);
}
.tab-button:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: -4px;
}

/* Tab panels */
.tab-panel {
  display: none;
}
.tab-panel.active {
  display: block;
}

/* Landing: charts band (trend + mode share) */
.charts-band {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 0 32px 28px;
}
.chart-card {
  background: var(--paper);
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.chart-card h2 {
  margin: 2px 0 14px;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* Trend sparklines */
.trend-row {
  display: grid;
  gap: 6px;
  padding: 10px 0;
  border-top: 1px solid var(--border-soft);
}
.trend-row:first-child {
  border-top: 0;
}
.trend-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.trend-label {
  font-weight: 700;
  font-size: 0.9rem;
}
.trend-range {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}
.spark {
  width: 100%;
  height: 56px;
  display: block;
}
.trend-stats {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.trend-stats strong {
  color: var(--text);
}

/* Mode share bars */
.mode-row {
  display: grid;
  grid-template-columns: 8.5rem 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-top: 1px solid var(--border-soft);
}
.mode-row:first-child {
  border-top: 0;
}
.mode-name {
  font-size: 0.85rem;
}
.vru-tag {
  margin-left: 4px;
  padding: 1px 4px;
  border: 1px solid var(--mode-walking);
  color: var(--mode-walking);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.mode-bar {
  position: relative;
  height: 14px;
  background: var(--surface-2);
}
.mode-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--severity-major);
}
.mode-row.vulnerable .mode-fill {
  background: var(--severity-fatal);
}
.mode-val {
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
  white-space: nowrap;
}
.mode-pct {
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* Recommendations + organizations + countermeasures sections */
.recs-section,
.orgs-section,
.countermeasures-section {
  padding: 40px 32px;
  border-top: 1px solid var(--border);
}
.section-heading {
  margin: 4px 0 6px;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.025em;
}
.section-intro {
  max-width: 70ch;
  margin: 0 0 18px;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.5;
}
.recs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}
.rec-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--paper);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.rec-card:hover {
  box-shadow: 0 6px 22px rgba(26, 26, 26, 0.08);
}
.rec-head {
  display: block;
}
.rec-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.015em;
  line-height: 1.15;
  text-wrap: balance;
}
.rec-problem {
  margin: 0;
  font-size: 0.9rem;
}
.rec-confidence {
  margin: 0;
}
.rec-line {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.45;
}
.rec-key {
  display: inline-block;
  margin-right: 6px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
p.rec-key {
  margin: 4px 0 2px;
}
.rec-cms {
  margin: 0 0 4px;
  padding-left: 18px;
  font-size: 0.84rem;
}
.rec-evidence {
  font-size: 0.84rem;
}
.rec-evidence summary {
  cursor: pointer;
  color: var(--link);
}
.rec-evidence ul {
  margin: 6px 0;
  padding-left: 18px;
}
.rec-line.uncertainty {
  color: var(--text-soft);
}
.rec-actions {
  margin-top: auto;
}
.rec-map-link {
  font-weight: 700;
  font-size: 0.86rem;
  text-decoration: none;
}
.rec-map-link:hover {
  text-decoration: underline;
}

/* Badges */
.badge {
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.badge.conf-high {
  color: var(--mode-biking);
  border-color: var(--mode-biking);
}
.badge.conf-medium {
  color: var(--severity-minor);
  border-color: var(--severity-minor);
}
.badge.conf-low {
  color: var(--text-muted);
}
.badge.unverified {
  color: var(--severity-major);
  border-color: var(--severity-major);
}

/* Organizations section */
.orgs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}
.org-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--paper);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.org-card:hover {
  box-shadow: 0 6px 22px rgba(26, 26, 26, 0.08);
}
.org-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.org-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.015em;
  line-height: 1.15;
  text-wrap: balance;
}
.org-focus {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 0;
}
.org-focus-tag {
  display: inline-block;
  padding: 4px 10px;
  background: var(--brand-soft);
  border: 1px solid var(--brand-strong);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--on-brand);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.org-desc {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--text-muted);
}
.org-initiatives {
  margin: 8px 0 0;
  padding: 12px 0 0;
  border-top: 1px solid var(--border-soft);
}
.org-initiatives strong {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-soft);
  margin-bottom: 6px;
}
.org-initiatives ul {
  margin: 0;
  padding: 0 0 0 16px;
  font-size: 0.85rem;
  line-height: 1.4;
}
.org-initiatives li {
  margin: 4px 0;
  color: var(--text-muted);
}
.org-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.85rem;
  font-weight: 700;
}

/* Countermeasure library */
.cm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}
.cm-card {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--paper);
}
.cm-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.cm-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1rem;
}
.cm-type {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.cm-mech {
  margin: 8px 0;
  font-size: 0.84rem;
}
.cm-effect {
  margin: 0 0 8px;
  font-size: 0.82rem;
}
.cm-src {
  margin: 0;
  font-size: 0.78rem;
}

#snapshot-status.stale {
  color: var(--severity-major);
  font-weight: 700;
}

@media (max-width: 720px) {
  .charts-band {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   Mobile scroll reductions: accordion recs, condensed library,
   sticky section jump-nav, tighter spacing. Desktop unchanged.
   ============================================================ */

/* Recommendation accordion toggle (mobile only; hidden on desktop) */
.rec-more {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rec-more-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rec-more > summary {
  display: none; /* desktop: detail is always open, no toggle */
}
/* Desktop safety net: show detail even if a card is left collapsed (no-JS / missed resize) */
@media (min-width: 641px) {
  .rec-more:not([open]) > .rec-more-body {
    display: flex;
  }
}

/* Countermeasure "show all" toggle + organization toggle + section jump-nav: hidden on desktop */
.section-carousel {
  position: sticky;
  top: 0;
  z-index: 500;
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

/* Hide mobile-only toggles on desktop */
.cm-toggle,
.org-toggle {
  display: none;
}

.carousel-pill {
  flex: 0 0 auto;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 6px 16px;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.carousel-pill:hover {
  background: var(--brand);
  color: var(--on-brand);
}

.carousel-pill.active {
  background: var(--brand);
  color: var(--on-brand);
}

.carousel-content {
  display: none;
}

.carousel-content.active {
  display: block;
}

/* On desktop: show all carousel-content and hide nav */
@media (min-width: 641px) {
  .section-carousel {
    display: none;
  }
  .carousel-content {
    display: block !important;
  }
}

@media (max-width: 640px) {
  .section-carousel::-webkit-scrollbar {
    display: none;
  }
  #s-toll,
  #s-trends,
  #s-fixes,
  #s-library {
    scroll-margin-top: 54px;
  }

  /* Recommendation accordion: show title + problem, collapse the rest */
  .rec-more > summary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
    min-height: 44px;
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--brand-strong);
    background: var(--brand-soft);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    list-style: none;
  }
  .rec-more > summary::-webkit-details-marker {
    display: none;
  }
  .rec-more > summary::after {
    content: "\25BE";
    font-size: 0.7rem;
  }
  .rec-more[open] > summary::after {
    content: "\25B4";
  }

  /* Condensed countermeasure library: 2 cards + toggle on mobile for better scrolling */
  .cm-grid:not(.cm-expanded) .cm-card:nth-child(n + 3) {
    display: none;
  }
  .cm-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-top: 14px;
    min-height: 44px;
    padding: 10px 18px;
    border: 2px solid var(--rule);
    border-radius: var(--radius-pill);
    background: var(--paper);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
  }
  .cm-toggle:hover,
  .cm-toggle:active {
    background: var(--brand);
    border-color: var(--rule);
  }

  /* Condensed organization list: 1 card + toggle on mobile for better scrolling */
  .orgs-grid:not(.orgs-expanded) .org-card:nth-child(n + 2) {
    display: none;
  }
  .org-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-top: 14px;
    min-height: 44px;
    padding: 10px 18px;
    border: 2px solid var(--rule);
    border-radius: var(--radius-pill);
    background: var(--paper);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
  }
  .org-toggle:hover,
  .org-toggle:active {
    background: var(--brand);
    border-color: var(--rule);
  }

  /* Tighter spacing on phones */
  .insights-band {
    padding: 16px;
    gap: 14px;
  }
  .charts-band {
    padding: 0 16px 16px;
    gap: 14px;
  }
  .insight,
  .chart-card {
    padding: 18px;
  }
  .recs-section,
  .countermeasures-section {
    padding: 22px 16px;
  }
  .rec-card {
    padding: 18px;
  }
  .recs-grid {
    gap: 12px;
  }
  .cm-grid {
    gap: 10px;
  }
}

/* ============================================================
   Map detail panel (map.html): full rail on desktop; collapsible
   accordions with the case file first on mobile/stacked widths.
   ============================================================ */

.panel-more > summary {
  display: block;
  list-style: none;
}
.panel-more > summary::-webkit-details-marker {
  display: none;
}
.panel-more > summary > .section-label {
  margin-bottom: 6px;
}
.panel-more > summary > h2 {
  margin-top: 0;
}

/* Desktop rail: header is not a toggle, body always shown. */
@media (min-width: 961px) {
  .panel-more > summary {
    cursor: default;
  }
  .panel-more:not([open]) > .panel-more-body {
    display: block;
  }
}

/* Stacked panel (below the map): collapse references, case file first. */
@media (max-width: 960px) {
  .panel-more > summary {
    cursor: pointer;
    position: relative;
    padding-right: 30px;
    min-height: 44px;
  }
  .panel-more > summary::after {
    content: "\25BE";
    position: absolute;
    right: 4px;
    top: 2px;
    font-size: 0.85rem;
    color: var(--text-muted);
  }
  .panel-more:not([open]) > summary::after {
    content: "\25B8";
  }
  /* Deterministic collapse (don't rely on UA closed-details hiding). */
  .panel-more:not([open]) > .panel-more-body {
    display: none;
  }
  .detail-panel .case-docket-section {
    order: -1;
  }
}

/* ===== ANC Safety Brief (anc.html) ===== */
.anc-controls {
  max-width: 900px;
  margin: 0 auto;
  padding: 8px 32px 4px;
}
.anc-ward-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-soft);
  margin-bottom: 6px;
}
.anc-ward-select {
  width: 100%;
  max-width: 360px;
  padding: 12px 14px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
.anc-hint {
  margin: 10px 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.anc-hint a,
.anc-stats a {
  color: var(--link);
}

.anc-brief {
  max-width: 900px;
  margin: 0 auto;
  padding: 12px 32px 32px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.anc-block .section-label {
  margin-bottom: 12px;
}

/* Equal-width columns so the three big numbers align on one baseline row and
   the labels hang beneath them (instead of flex-packing into an uneven, awkward
   2 + 1 wrap). align-items: start keeps the numbers level even when one label
   wraps to two lines. */
.anc-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px 20px;
  align-items: start;
  margin-bottom: 24px;
  /* keep the three figures visually grouped on wide panels instead of spreading
     across the full width; still one label line per column at this size */
  max-width: 620px;
}
.anc-figure {
  display: flex;
  flex-direction: column;
}
.anc-figure strong {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 6vw, 2.6rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--text);
}
.anc-figure strong.fatal {
  color: var(--severity-fatal);
}
.anc-figure span {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.3;
}

.anc-recs,
.anc-corridor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.anc-corridor-more[hidden] {
  display: none;
}
.anc-corridor-more {
  margin-top: 18px;
}
.anc-show-all {
  margin-top: 16px;
  padding: 8px 16px;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--link);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  cursor: pointer;
}
.anc-show-all:hover {
  border-color: var(--rule);
}
.anc-corridor,
.anc-rec {
  padding: 18px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.anc-corridor-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.anc-fix-list {
  margin: 10px 0 0;
  padding-left: 18px;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.anc-fix-list li {
  margin-bottom: 4px;
}
.anc-effect {
  color: var(--text-soft);
}
.anc-rec {
  position: relative;
}
.anc-rec-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
  margin-bottom: 8px;
}
.anc-rec-title {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  line-height: 1.2;
}
.anc-rec-mech {
  margin: 0 0 10px;
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--text-muted);
}
.anc-rec-meta {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-soft);
}
.anc-recs-sub {
  grid-column: 1 / -1;
  margin: 6px 0 0;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
}

.anc-draft-block {
  background: var(--brand-soft);
  border: 1px solid var(--brand);
  border-radius: var(--radius);
  padding: 24px;
}
.anc-draft-heading {
  margin: 0 0 6px;
  font-family: var(--font-display);
}
.anc-draft {
  width: 100%;
  margin-top: 12px;
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  resize: vertical;
}
.anc-draft-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}
.anc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  font-size: 0.86rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--surface);
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
}
.anc-btn:hover {
  opacity: 0.9;
}
.anc-btn-ghost {
  color: var(--text);
  background: transparent;
}
.anc-copy-status {
  font-size: 0.8rem;
  color: var(--text-soft);
}
.anc-empty {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}
.anc-empty a {
  color: var(--link);
}
.anc-error {
  max-width: 900px;
  margin: 24px auto;
  padding: 0 32px;
  color: var(--severity-fatal);
}

@media (max-width: 720px) {
  .anc-controls,
  .anc-brief {
    padding-left: 20px;
    padding-right: 20px;
  }
  .anc-recs,
  .anc-corridor-grid {
    grid-template-columns: 1fr;
  }
}

@media print {
  .site-nav,
  .anc-controls,
  .anc-draft-actions,
  .site-footer,
  .skip-link {
    display: none !important;
  }
  .anc-draft-block {
    background: none;
    border: 1px solid #ccc;
  }
  .anc-corridors,
  .anc-recs {
    grid-template-columns: 1fr 1fr;
  }
}
