/* BCSFA Supply Chain Impact Map — stylesheet
   Brand tokens measured on bcsalmonfarmers.ca (2026-09-28). Light theme.
   Contrast: every text token on its background meets WCAG 2.1 AA; focus and selection rings meet 3:1 against adjacent fills. */

/* One file per family serves both weights (the files are variable-weight fonts; the 400 and 500/600 downloads were identical). */
@font-face { font-family: "Familjen Grotesk"; font-style: normal; font-weight: 400 500; font-display: swap; src: url("fonts/FamiljenGrotesk-400.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/Poppins-500.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/Poppins-600.woff2") format("woff2"); }
@font-face { font-family: "Open Sans"; font-style: normal; font-weight: 400 600; font-display: swap; src: url("fonts/OpenSans-400.woff2") format("woff2"); }

:root {
  --bc-navy: #113149;
  --bc-navy-700: #24607A;
  --bc-teal-600: #3A8497;
  --bc-teal-400: #7FBAC3;
  --bc-teal-200: #B3D9DC;
  --bc-teal-100: #DFEFEF;
  --bc-coral: #F28679;
  --bc-coral-ink: #B84C3F;
  --bc-blush: #F7D9DB;
  --bc-grey: #5E6B64;
  --bc-grey-2: #969696;
  --bc-surface-0: #FFFFFF;
  --bc-surface-1: #F3F6F5;
  --bc-surface-2: #F0F4F3;

  --bc-text: var(--bc-navy);
  --bc-text-muted: var(--bc-grey);
  --bc-link: var(--bc-coral-ink);
  --bc-border: rgba(17, 49, 73, 0.12);
  --bc-border-strong: rgba(17, 49, 73, 0.24);
  --bc-focus: var(--bc-navy);

  --map-water: #E6F1F2;
  --map-land: #FFFFFF;
  --map-neighbour: #EDF1F0;
  --map-coast: rgba(17, 49, 73, 0.28);
  --map-er-line: rgba(17, 49, 73, 0.18);
  --map-fill-low: #C9E3E5;
  --map-fill-mid: #B3D9DC;
  --map-fill-high: #7FBAC3;
  --map-bubble: #113149;
  --map-bubble-hover: #24607A;
  --map-select: #B84C3F;

  --font-display: "Familjen Grotesk", "Helvetica Neue", Arial, sans-serif;
  --font-label: "Poppins", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Open Sans", "Helvetica Neue", Arial, sans-serif;

  --r-pill: 100px;
  --r-card: 20px;
  --r-card-sm: 12px;
  --shadow-card: 0 1px 2px rgba(17,49,73,0.06), 0 8px 24px rgba(17,49,73,0.08);
  --shadow-float: 0 4px 16px rgba(17,49,73,0.14);

  --topbar-h: 64px;
  --sidebar-w: 380px;
}

*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; }
body {
  min-height: 100%; margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--bc-text);
  background: var(--bc-surface-1);
  -webkit-font-smoothing: antialiased;
  overflow: auto; /* the app fills the viewport; when the fixed bars no longer fit (320px / 400% zoom) the page scrolls instead of clipping */
}
a { color: var(--bc-link); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--bc-navy); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--bc-focus); outline-offset: 2px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 8px; top: -48px; background: var(--bc-navy); color: #fff; padding: 8px 14px; border-radius: var(--r-pill); z-index: 100; }
.skip-link:focus { top: 8px; }

/* ---------- App frame ---------- */
.app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; min-height: 0; }

/* ---------- Top bar ---------- */
.topbar {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  min-height: var(--topbar-h);
  padding: 10px 16px;
  background: var(--bc-surface-0);
  border-bottom: 1px solid var(--bc-border);
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-logo { height: 32px; width: auto; display: block; flex: 0 0 auto; }
.brand-text { min-width: 0; }
.eyebrow {
  font-family: var(--font-label); font-weight: 600; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--bc-text-muted); line-height: 1.2; margin: 0;
}
.brand-title {
  font-family: var(--font-display); font-weight: 400; font-size: 20px; line-height: 1.15; letter-spacing: -0.01em;
  color: var(--bc-navy); margin: 2px 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand-title em { font-style: normal; color: var(--bc-coral-ink); }
.controls { display: flex; align-items: center; gap: 12px; margin-left: auto; flex-wrap: wrap; }

.segmented { display: inline-flex; background: var(--bc-surface-2); border-radius: var(--r-pill); padding: 4px; gap: 2px; }
.segmented button {
  border: 0; background: transparent; border-radius: var(--r-pill);
  font-family: var(--font-label); font-weight: 500; font-size: 13px; color: var(--bc-navy);
  padding: 8px 16px; min-height: 36px; cursor: pointer; white-space: nowrap;
  transition: background-color .15s ease, color .15s ease;
}
.segmented button:hover { background: var(--bc-blush); }
.segmented button[aria-pressed="true"] { background: var(--bc-navy); color: #fff; }
.segmented button:focus-visible { outline: 2px solid var(--bc-navy); outline-offset: 2px; }

.list-btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--bc-border-strong); background: var(--bc-surface-0); color: var(--bc-navy);
  border-radius: var(--r-pill); font-family: var(--font-label); font-weight: 500; font-size: 13px; padding: 0 14px 0 12px; min-height: 40px; cursor: pointer;
}
.list-btn:hover { background: var(--bc-blush); }
.list-btn[aria-expanded="true"] { background: var(--bc-navy); color: #fff; border-color: var(--bc-navy); }
.list-btn svg { width: 16px; height: 16px; }

.search { position: relative; }
.search input {
  width: 240px; max-width: 100%; height: 40px; border-radius: var(--r-pill);
  border: 1px solid var(--bc-border-strong); background: var(--bc-surface-0); color: var(--bc-navy);
  font-family: var(--font-body); font-size: 14px; padding: 0 14px 0 38px;
}
.search input::placeholder { color: var(--bc-grey); opacity: 1; }
.search input:focus { border-color: var(--bc-navy); outline: 2px solid var(--bc-navy); outline-offset: 1px; }
.search-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--bc-navy); pointer-events: none; }
.search-list {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; min-width: 260px; max-height: 300px; overflow-y: auto;
  background: var(--bc-surface-0); border-radius: var(--r-card-sm); box-shadow: var(--shadow-float);
  border: 1px solid var(--bc-border); padding: 6px; margin: 0; list-style: none; z-index: 30;
}
.search-list[hidden] { display: none; }
.search-list li { padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; display: flex; justify-content: space-between; gap: 12px; }
.search-list li span.kind { font-family: var(--font-label); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--bc-text-muted); }
.search-list li:hover { background: var(--bc-blush); }
.search-list li[aria-selected="true"] { background: var(--bc-blush); box-shadow: inset 0 0 0 2px var(--bc-navy); }
.search-list li.empty { color: var(--bc-text-muted); cursor: default; }

/* ---------- Map stage ---------- */
.stage { position: relative; flex: 1 1 auto; min-height: 240px; overflow: hidden; background: var(--map-water); }
#map { width: 100%; height: 100%; display: block; touch-action: none; }
html.embed #map { touch-action: pan-x pan-y; } /* one finger scrolls the host page; two fingers move the map */
html.embed.fs #map { touch-action: none; }
#map.grabbing { cursor: grabbing; }

/* Loading skeleton: a soft shimmer over the map area until the script has drawn the first frame. */
body:not(.ready) #map { visibility: hidden; }
body:not(.ready) .quickzoom, body:not(.ready) .zoom-controls, body:not(.ready) .legend, body:not(.ready) .legend-toggle { visibility: hidden; }
body:not(.ready) .stage::after {
  content: ""; position: absolute; inset: 0; z-index: 5;
  background: linear-gradient(100deg, var(--map-water) 30%, #F2F8F8 50%, var(--map-water) 70%); background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

.geo .neighbour { fill: var(--map-neighbour); stroke: none; }
.geo .land { fill: var(--map-land); }
.geo .coast { fill: none; stroke: var(--map-coast); vector-effect: non-scaling-stroke; stroke-width: 0.8px; }
.geo .er-line { fill: none; stroke: var(--map-er-line); vector-effect: non-scaling-stroke; stroke-width: 0.8px; stroke-dasharray: 3 3; }
.geo .macro { stroke: var(--bc-navy); stroke-opacity: 0.5; vector-effect: non-scaling-stroke; stroke-width: 1px; cursor: pointer; transition: fill-opacity .15s ease, fill .2s ease; }
.geo .macro.low { fill: var(--map-fill-low); }
.geo .macro.mid { fill: var(--map-fill-mid); }
.geo .macro.high { fill: var(--map-fill-high); }
.geo .macro:hover { fill-opacity: 0.75; }
.geo .macro.selected { stroke: var(--map-select); stroke-width: 2.5px; stroke-opacity: 1; }
.geo .macro:focus { outline: none; }
.geo .macro:focus-visible { stroke: var(--bc-navy); stroke-width: 3.5px; stroke-opacity: 1; }

.overlay .bubble { fill: var(--map-bubble); stroke: #fff; stroke-width: 1.5px; pointer-events: none; transition: fill .15s ease; }
.overlay .bubble.cluster { stroke-width: 2.5px; stroke-dasharray: 5 3; }
.overlay .bubble-g:hover .bubble { fill: var(--map-bubble-hover); }
.overlay .bubble.selected { stroke: var(--map-select); stroke-width: 3px; }
.overlay .hit { fill: transparent; stroke: none; cursor: pointer; pointer-events: all; }
.overlay .hit:focus { outline: none; }
.overlay .hit:focus-visible { stroke: var(--bc-navy); stroke-width: 3px; }
.overlay .count { font-family: var(--font-label); font-weight: 600; font-size: 12px; fill: #fff; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.overlay .label { font-family: var(--font-label); font-weight: 500; font-size: 12px; fill: var(--bc-navy); pointer-events: none; paint-order: stroke; stroke: #fff; stroke-width: 3px; stroke-linejoin: round; }
.overlay .label.value { font-family: var(--font-display); font-weight: 500; font-size: 13px; }
.overlay .label.value.big { font-size: 18px; stroke-width: 4px; }
.overlay .macro-label.compact .label.value.big { font-size: 15px; }
.overlay .macro-label.compact .label:not(.value) { font-size: 11px; }
.overlay .label.region { font-size: 12px; fill: var(--bc-grey); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.overlay .label.hidden { display: none; }
.overlay .macro-label { pointer-events: none; }
.overlay .macro-label.hidden { display: none; }

.map-hint {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  background: rgba(17,49,73,0.92); color: #fff; font-family: var(--font-label); font-size: 13px;
  padding: 8px 14px; border-radius: var(--r-pill); pointer-events: none; opacity: 0; transition: opacity .2s ease; z-index: 8; max-width: calc(100% - 32px); text-align: center;
}
.map-hint.show { opacity: 1; }

/* Floating controls */
.zoom-controls { position: absolute; right: 16px; top: 16px; display: flex; flex-direction: column; gap: 6px; z-index: 6; }
.zoom-controls button, .icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--bc-border);
  background: var(--bc-surface-0); color: var(--bc-navy); cursor: pointer; box-shadow: var(--shadow-card);
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.zoom-controls button:hover, .icon-btn:hover { background: var(--bc-blush); }
.zoom-controls svg, .icon-btn svg { width: 18px; height: 18px; }
.expand-btn { display: none !important; }
.expand-btn .ic-collapse { display: none; }
html.fs .expand-btn .ic-collapse { display: block; }
html.fs .expand-btn .ic-expand { display: none; }

.quickzoom { position: absolute; left: 16px; top: 16px; display: flex; gap: 6px; flex-wrap: wrap; z-index: 6; max-width: calc(100% - 80px); }
.chip {
  border: 1px solid var(--bc-border-strong); background: var(--bc-surface-0); color: var(--bc-navy);
  font-family: var(--font-label); font-weight: 500; font-size: 12px; padding: 6px 12px; min-height: 32px;
  border-radius: var(--r-pill); cursor: pointer; box-shadow: var(--shadow-card);
}
.chip:hover { background: var(--bc-blush); }
.chip[aria-pressed="true"] { background: var(--bc-navy); color: #fff; border-color: var(--bc-navy); }
.mini {
  border: 1px solid var(--bc-border-strong); background: var(--bc-surface-0); color: var(--bc-navy); border-radius: var(--r-pill);
  font-family: var(--font-label); font-weight: 500; font-size: 12px; padding: 4px 10px; min-height: 28px; cursor: pointer;
}
.mini:hover { background: var(--bc-blush); }
.mini[aria-pressed="true"] { background: var(--bc-navy); color: #fff; border-color: var(--bc-navy); }
@media (pointer: coarse) { .chip, .legend-toggle, .zoom-controls button, .icon-btn { min-height: 44px; } .zoom-controls button, .icon-btn { width: 44px; height: 44px; } .mini { min-height: 36px; } }

.metric-switch { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin: 0 0 8px; }
.metric-switch .metric-label { font-family: var(--font-label); font-weight: 600; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--bc-text-muted); margin-right: 4px; }

/* Legend */
.legend {
  position: absolute; left: 16px; bottom: 16px; z-index: 6; max-width: 300px;
  background: var(--bc-surface-0); border-radius: var(--r-card-sm); box-shadow: var(--shadow-card); border: 1px solid var(--bc-border);
  padding: 12px 14px; font-size: 13px; line-height: 1.4;
}
.legend .eyebrow { margin-bottom: 6px; }
.legend-row { display: flex; align-items: center; gap: 10px; margin: 4px 0; }
.legend-swatch { width: 14px; height: 14px; border-radius: 50%; flex: 0 0 auto; background: var(--map-bubble); border: 1.5px solid #fff; box-shadow: 0 0 0 1px var(--bc-border); }
.legend-swatch.sq { border-radius: 3px; border: 1px solid rgba(17,49,73,0.5); box-shadow: none; }
.legend-swatch.high { background: var(--map-fill-high); }
.legend-swatch.mid { background: var(--map-fill-mid); }
.legend-swatch.low { background: var(--map-fill-low); }
.legend-sizes { display: flex; align-items: flex-end; gap: 10px; margin-top: 6px; }
.legend-sizes .sz { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; color: var(--bc-text-muted); }
.legend-sizes .sz i { display: block; border-radius: 50%; background: var(--map-bubble); border: 1.5px solid #fff; box-shadow: 0 0 0 1px var(--bc-border); }
.legend-sizes .sz.label-only { align-self: center; }
.legend-toggle { display: none; position: absolute; left: 12px; bottom: 12px; z-index: 7; }

/* Ranked list (rail) */
.rail {
  position: absolute; left: 16px; top: 64px; bottom: 16px; width: 320px; max-width: calc(100% - 32px); z-index: 8;
  background: var(--bc-surface-0); border-radius: var(--r-card); box-shadow: var(--shadow-float); border: 1px solid var(--bc-border);
  display: flex; flex-direction: column; overflow: hidden;
}
.rail[hidden] { display: none; }
.rail-head { display: flex; align-items: flex-start; gap: 8px; padding: 16px 16px 8px; }
.rail-head .titles { flex: 1 1 auto; min-width: 0; }
.rail-title { font-family: var(--font-display); font-weight: 400; font-size: 20px; line-height: 1.15; margin: 2px 0 0; color: var(--bc-navy); }
.rail-title:focus { outline: none; }
#railMetric { padding: 0 16px; }
#railMetric .metric-switch { margin-bottom: 6px; }
.rail-list { list-style: none; margin: 0; padding: 4px 8px 6px; overflow-y: auto; flex: 1 1 auto; }
.rail-row {
  display: grid; grid-template-columns: 24px 1fr auto; gap: 0 10px; align-items: center; width: 100%; text-align: left;
  border: 0; background: none; padding: 8px; border-radius: 10px; cursor: pointer; font: inherit; color: var(--bc-navy);
}
.rail-row:hover { background: var(--bc-surface-2); }
.rail-row.current { background: var(--bc-teal-100); }
.rail-row .rank { font-family: var(--font-label); font-weight: 500; font-size: 12px; color: var(--bc-text-muted); }
.rail-name { font-size: 13px; line-height: 1.3; min-width: 0; }
.rail-bar { display: block; height: 5px; border-radius: 3px; background: var(--bc-surface-2); margin-top: 5px; overflow: hidden; }
.rail-row.current .rail-bar { background: rgba(17,49,73,0.12); }
.rail-bar i { display: block; height: 100%; width: 0; background: var(--bc-navy); border-radius: 3px; }
.rail-val { font-family: var(--font-display); font-weight: 500; font-size: 15px; color: var(--bc-navy); text-align: right; white-space: nowrap; }
.rail-val small { display: block; font-family: var(--font-body); font-weight: 400; font-size: 11px; color: var(--bc-text-muted); }
.rail-foot { font-size: 12px; color: var(--bc-text-muted); margin: 0; padding: 8px 16px 14px; border-top: 1px solid var(--bc-border); line-height: 1.4; }
.stage.rail-open .legend, .stage.rail-open .legend-toggle { display: none; }

/* Start card (shown until the first selection) */
.start-card {
  position: absolute; top: 16px; right: 16px; width: var(--sidebar-w); max-width: calc(100% - 32px); z-index: 9;
  background: var(--bc-surface-0); border-radius: var(--r-card); box-shadow: var(--shadow-float); border: 1px solid var(--bc-border);
  padding: 14px 18px 16px;
}
.start-card[hidden] { display: none; }
.start-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.start-close { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--bc-border); background: var(--bc-surface-0); color: var(--bc-navy); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; flex: 0 0 auto; }
.start-close:hover { background: var(--bc-blush); }
.start-close svg { width: 14px; height: 14px; }
.start-text { font-size: 15px; line-height: 1.45; margin: 4px 0 12px; }
.start-text strong { font-family: var(--font-display); font-weight: 500; font-size: 18px; }
.start-picks { display: flex; flex-wrap: wrap; gap: 6px; }
.start-picks .chip { box-shadow: none; background: var(--bc-surface-2); border-color: transparent; }
.start-picks .chip:hover { background: var(--bc-blush); }
/* On narrower stages the card becomes a strip along the bottom and the legend steps aside until it is dismissed. */
@media (max-width: 1000px) {
  .start-card { top: auto; bottom: 16px; left: 16px; right: 16px; width: auto; max-width: none; padding: 10px 16px 12px; }
  .stage.rail-open .start-card { display: none; }
  .stage.start-visible .map-hint { z-index: 11; }
}
@media (min-width: 641px) and (max-width: 1000px) {
  .stage.start-visible .legend { display: none; }
}
/* Keep the zoom column clear of the start card and the open panel on wider stages. */
@media (min-width: 1001px) { .stage.start-visible .zoom-controls { right: calc(var(--sidebar-w) + 32px); } }
@media (min-width: 641px) {
  .stage.panel-open .zoom-controls { right: calc(var(--sidebar-w) + 32px); }
  .stage.panel-open .quickzoom { max-width: calc(100% - var(--sidebar-w) - 48px); }
}

/* Tooltip (visual only; aria-hidden in markup) */
.tooltip {
  position: absolute; z-index: 9; pointer-events: none; opacity: 0; visibility: hidden; transition: opacity .12s ease, visibility .12s;
  background: var(--bc-surface-0); border-radius: var(--r-card-sm); box-shadow: var(--shadow-float); border: 1px solid var(--bc-border);
  padding: 10px 12px; font-size: 13px; line-height: 1.35; max-width: 260px;
}
.tooltip.show { opacity: 1; visibility: visible; }
.tooltip strong { font-family: var(--font-label); font-weight: 600; display: block; margin-bottom: 2px; }
.tooltip .muted { color: var(--bc-text-muted); font-size: 12px; }

/* ---------- Side panel ---------- */
.panel {
  position: absolute; top: 16px; right: 16px; bottom: 16px; width: var(--sidebar-w); max-width: calc(100% - 32px);
  background: var(--bc-surface-0); border-radius: var(--r-card); box-shadow: var(--shadow-float); border: 1px solid var(--bc-border);
  z-index: 10; display: flex; flex-direction: column; overflow: hidden;
  transform: translateX(calc(100% + 24px)); transition: transform .25s ease; visibility: hidden;
}
.panel.open { transform: none; visibility: visible; }
.sheet-handle { display: none; }
.panel-head { padding: 20px 20px 12px; display: flex; align-items: flex-start; gap: 8px; }
.panel-head .titles { flex: 1 1 auto; min-width: 0; }
.panel-title { font-family: var(--font-display); font-weight: 400; font-size: 26px; line-height: 1.15; margin: 2px 0 0; color: var(--bc-navy); }
.panel-title:focus { outline: none; }
.panel-title:focus-visible { outline: 2px solid var(--bc-navy); outline-offset: 4px; }
.panel-body { padding: 0 20px 20px; overflow-y: auto; flex: 1 1 auto; }
.panel-close, .panel-share { flex: 0 0 auto; }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 16px; }
.kpi { background: var(--bc-surface-2); border-radius: var(--r-card-sm); padding: 12px 14px; }
.kpi.full { grid-column: 1 / -1; }
.kpi-value { font-family: var(--font-display); font-weight: 400; font-size: 30px; line-height: 1; color: var(--bc-navy); letter-spacing: -0.01em; }
.kpi-label { font-family: var(--font-label); font-weight: 500; font-size: 12px; color: var(--bc-text-muted); margin-top: 6px; line-height: 1.3; }
.def-toggle { display: inline-block; border: 0; background: none; padding: 0; margin-top: 6px; font-family: var(--font-label); font-weight: 500; font-size: 11px; color: var(--bc-coral-ink); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.def-toggle:hover { color: var(--bc-navy); }
.def-text { font-size: 12px; line-height: 1.4; color: var(--bc-text); margin: 6px 0 0; }
.def-text[hidden] { display: none; }
.kpis.mt { margin-top: 14px; }
.panel h3 { font-family: var(--font-label); font-weight: 600; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--bc-text-muted); margin: 18px 0 8px; }
.rowlist { list-style: none; margin: 0; padding: 0; }
.rowlist li { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--bc-border); font-size: 14px; }
.rowlist li:last-child { border-bottom: 0; }
.rowlist .num { font-family: var(--font-label); font-weight: 500; font-size: 12px; color: var(--bc-text-muted); }
.rowlist .name { min-width: 0; }
.rowlist .name small { display: block; color: var(--bc-text-muted); font-size: 12px; }
.rowlist .val { font-family: var(--font-display); font-weight: 500; font-size: 16px; color: var(--bc-navy); white-space: nowrap; }
.rowlist li.total { border-top: 2px solid var(--bc-border-strong); font-weight: 600; }
.linky { border: 0; background: none; padding: 0; text-align: left; color: var(--bc-navy); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; font: inherit; }
.linky:hover { color: var(--bc-coral-ink); }
.links { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.links li { padding: 6px 0; border-bottom: 1px solid var(--bc-border); }
.links li:last-child { border-bottom: 0; }
.note { font-size: 13px; color: var(--bc-text-muted); margin: 10px 0 0; }
.source { font-size: 12px; color: var(--bc-text-muted); margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--bc-border); }
.chip-count { display: inline-block; background: var(--bc-teal-100); color: var(--bc-navy); border-radius: var(--r-pill); font-family: var(--font-label); font-weight: 600; font-size: 12px; padding: 2px 10px; }
.datatable { width: 100%; border-collapse: collapse; font-size: 13px; margin: 6px 0 12px; }
.datatable th, .datatable td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--bc-border); vertical-align: top; }
.datatable th { font-family: var(--font-label); font-weight: 600; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--bc-text-muted); }
.datatable td.n, .datatable th.n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.datatable tfoot td { font-weight: 600; border-top: 2px solid var(--bc-border-strong); }
.datatable tfoot td small { display: block; font-weight: 400; font-size: 12px; color: var(--bc-text-muted); }

/* Share-of-total bars */
.shares { margin: 2px 0 4px; }
.share-row { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; align-items: baseline; margin: 7px 0; font-size: 13px; }
.share-row .share-label { color: var(--bc-text-muted); }
.share-row .share-pct { font-family: var(--font-display); font-weight: 500; font-size: 16px; color: var(--bc-navy); text-align: right; }
.share-track { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--bc-surface-2); overflow: hidden; }
.share-fill { height: 100%; width: 0; background: var(--bc-navy); border-radius: 3px; }
.share-note { font-size: 12px; color: var(--bc-text-muted); margin: 6px 0 0; }
#citeFallback { flex-basis: 100%; }
.copy-fallback { width: 100%; margin-top: 10px; font: 13px var(--font-body); padding: 8px 10px; border: 1px solid var(--bc-border-strong); border-radius: 8px; color: var(--bc-navy); background: var(--bc-surface-2); }

.btn {
  display: inline-flex; align-items: center; gap: 8px; border-radius: var(--r-pill); border: 1px solid var(--bc-navy);
  background: var(--bc-navy); color: #fff; font-family: var(--font-label); font-weight: 500; font-size: 14px;
  padding: 0 18px; min-height: 40px; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--bc-navy-700); border-color: var(--bc-navy-700); color: #fff; }
.btn.secondary { background: var(--bc-surface-0); color: var(--bc-navy); }
.btn.secondary:hover { background: var(--bc-blush); }
.btn.small { min-height: 34px; font-size: 13px; padding: 0 14px; }
.btn svg { width: 16px; height: 16px; }

/* ---------- Story strip (full page, tall viewports only) ---------- */
.story { display: none; flex: 0 0 auto; background: var(--bc-surface-1); border-top: 1px solid var(--bc-border); padding: 10px 16px 10px; }
@media (min-height: 1000px) and (min-width: 1100px) { html:not(.embed) .story:not([hidden]) { display: block; } }
.story-inner .eyebrow { margin-bottom: 6px; }
.story-beats { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.beat { background: var(--bc-surface-0); border: 1px solid var(--bc-border); border-radius: var(--r-card-sm); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.beat-year { font-family: var(--font-label); font-weight: 600; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--bc-coral-ink); }
.beat-figure { font-family: var(--font-display); font-weight: 400; font-size: 28px; line-height: 1; color: var(--bc-navy); letter-spacing: -0.01em; margin-top: 2px; }
.beat-head { font-family: var(--font-label); font-weight: 600; font-size: 13px; color: var(--bc-navy); margin-top: 4px; line-height: 1.3; }
.beat-text { font-size: 13px; line-height: 1.4; color: var(--bc-text); }
.beat-src { font-size: 11px; color: var(--bc-text-muted); margin-top: 4px; }
.story .beat-figure { font-size: 24px; }
.story .beat-text { font-size: 12px; }
.story-more { margin-top: 6px; font-size: 12px; color: var(--bc-coral-ink); }
@media (max-width: 760px) { .story-beats { grid-template-columns: 1fr 1fr; } }
@media (max-width: 420px) { .story-beats { grid-template-columns: 1fr; } }

/* ---------- Summary band ---------- */
.summary {
  flex: 0 0 auto; background: var(--bc-surface-0); border-top: 1px solid var(--bc-border);
  padding: 10px 16px 8px; display: flex; align-items: center; gap: 6px 22px; flex-wrap: wrap; z-index: 20;
}
.hero { display: flex; flex-direction: column; min-width: 0; }
.hero-value { font-family: var(--font-display); font-weight: 400; font-size: 40px; line-height: 1; color: var(--bc-navy); letter-spacing: -0.02em; }
.squiggle { width: 96px; height: 10px; color: var(--bc-coral); margin: 3px 0 2px; display: block; }
.hero-label { font-family: var(--font-label); font-weight: 500; font-size: 12px; color: var(--bc-text-muted); line-height: 1.25; max-width: 210px; }
.stats { display: flex; gap: 6px 22px; flex-wrap: wrap; align-items: flex-start; }
.stat { min-width: 0; }
.stat-value { font-family: var(--font-display); font-weight: 400; font-size: 24px; line-height: 1; color: var(--bc-navy); letter-spacing: -0.01em; }
.stat-label { font-family: var(--font-label); font-weight: 500; font-size: 12px; color: var(--bc-text-muted); margin-top: 3px; line-height: 1.2; max-width: 150px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 280px; min-width: 0; align-items: center; }
.info-chip { display: inline-block; background: var(--bc-surface-2); color: var(--bc-navy); border-radius: 14px; font-size: 12px; line-height: 1.35; padding: 6px 12px; }
.info-chip.potential { background: var(--bc-teal-100); max-width: 560px; }
.info-chip .muted { color: var(--bc-text-muted); }
.summary .btn { margin-left: auto; }
.summary .source { margin: 0; padding: 0; border: 0; flex-basis: 100%; font-size: 12px; line-height: 1.3; }
.source-link { color: var(--bc-link); }

/* ---------- About dialog ---------- */
.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(17, 49, 73, 0.45); }
.modal-card {
  position: relative; width: min(1080px, 100%); max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px);
  background: var(--bc-surface-0); border-radius: var(--r-card); box-shadow: 0 24px 64px rgba(17,49,73,0.28);
  display: flex; flex-direction: column; overflow: hidden;
}
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 24px 28px 8px; }
.modal-head .titles { flex: 1 1 auto; }
.modal-body { padding: 8px 28px 28px; overflow-y: auto; }
.modal-body .intro { margin: 0 0 8px; font-size: 15px; max-width: 90ch; }
.vintage { font-family: var(--font-label); font-weight: 500; font-size: 12px; color: var(--bc-text-muted); margin: 0 0 6px; }
.about-nav { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 0; position: sticky; top: -8px; background: var(--bc-surface-0); padding: 8px 0; z-index: 2; }
.about-nav .chip { box-shadow: none; font-size: 12px; padding: 5px 10px; min-height: 30px; display: inline-flex; align-items: center; gap: 6px; }
.about-nav .chip .num { color: var(--bc-coral-ink); font-weight: 600; letter-spacing: .06em; font-size: 11px; }
.about-section { margin-top: 14px; padding-top: 16px; border-top: 1px solid var(--bc-border); scroll-margin-top: 92px; } /* lands below the sticky section index */
.about-section > h3.sec { font-family: var(--font-display); font-weight: 400; font-size: 22px; letter-spacing: -0.01em; text-transform: none; color: var(--bc-navy); margin: 0 0 12px; line-height: 1.2; }
.about-section > h3.sec .num { font-family: var(--font-label); font-weight: 600; font-size: 12px; letter-spacing: .08em; color: var(--bc-coral-ink); margin-right: 10px; vertical-align: 3px; }
h3.sec:focus { outline: none; }
h3.sec:focus-visible { outline: 2px solid var(--bc-navy); outline-offset: 4px; }
.about-section h4 { font-family: var(--font-label); font-weight: 600; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--bc-text-muted); margin: 10px 0 8px; }
.glossary { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 10px 28px; margin: 0; }
.glossary div { font-size: 14px; line-height: 1.45; }
.glossary dt { font-family: var(--font-label); font-weight: 600; font-size: 13px; color: var(--bc-navy); margin: 0 0 2px; }
.glossary dd { margin: 0; color: var(--bc-text); }
.about-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 8px 36px; align-items: start; }
.about-grid .datatable { font-size: 14px; margin: 0 0 6px; }
.about-grid .datatable th, .about-grid .datatable td { padding: 6px 8px; }
.about-grid .datatable td:first-child, .about-grid .datatable th:first-child { padding-left: 0; }
.members-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
.members-cols .datatable { margin: 0; }
.findings { padding-left: 18px; margin: 6px 0 0; font-size: 14px; }
.findings li { margin: 4px 0; }
.about-section .intro { max-width: none; margin: 0 0 6px; font-size: 14px; }
.about-section .source { margin-top: 14px; }
.about-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; align-items: center; }
.cite-wrap { margin-top: 10px; }
.cite-wrap[hidden] { display: none; }
.cite-box { width: 100%; font: 13px/1.45 var(--font-body); padding: 10px 12px; border: 1px solid var(--bc-border-strong); border-radius: 10px; color: var(--bc-navy); background: var(--bc-surface-2); resize: vertical; min-height: 72px; }
body.modal-open { overflow: hidden; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 140px 1fr; gap: 0 18px; padding: 10px 0; border-bottom: 1px solid var(--bc-border); }
.timeline li:last-child { border-bottom: 0; }
.tl-date { font-family: var(--font-label); font-weight: 600; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--bc-coral-ink); padding-top: 3px; }
.tl-body strong { font-family: var(--font-label); font-weight: 600; font-size: 14px; color: var(--bc-navy); display: block; }
.tl-body p { margin: 2px 0 0; font-size: 14px; line-height: 1.45; max-width: 80ch; }
.tl-body small { display: block; font-size: 11px; color: var(--bc-text-muted); margin-top: 2px; }

/* Questions and answers */
.faq-item { border-bottom: 1px solid var(--bc-border); }
.faq-item summary { cursor: pointer; padding: 10px 28px 10px 0; font-family: var(--font-label); font-weight: 600; font-size: 14px; color: var(--bc-navy); list-style: none; position: relative; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: ""; position: absolute; right: 8px; top: 50%; width: 8px; height: 8px; border-right: 2px solid var(--bc-navy); border-bottom: 2px solid var(--bc-navy); transform: translateY(-70%) rotate(45deg); transition: transform .15s ease; }
.faq-item[open] summary::after { transform: translateY(-30%) rotate(-135deg); }
.faq-item summary:hover { color: var(--bc-coral-ink); }
.faq-a { padding: 0 0 12px; font-size: 14px; line-height: 1.5; max-width: 80ch; }
.faq-a p { margin: 0; }
.faq-a small { display: block; font-size: 11px; color: var(--bc-text-muted); margin-top: 4px; }

/* First Nations card (shown only when enabled in the data file) */
.fn-kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.fn-kpis .kpi-value { font-size: 26px; }
.scope { font-size: 11px; color: var(--bc-text-muted); }

/* ---------- Error / noscript ---------- */
.fallback {
  position: absolute; inset: 0; display: none; align-items: center; justify-content: center; padding: 24px; text-align: center; z-index: 15;
  background: var(--bc-surface-1);
}
.fallback.show { display: flex; }
.fallback .card { background: var(--bc-surface-0); border-radius: var(--r-card); box-shadow: var(--shadow-card); padding: 24px; max-width: 520px; }

/* Netlify's free-plan badge is injected by the host as a fixed iframe; keep it off the map. */
#nl-badge-frame, iframe[id^="nl-badge"] { display: none !important; }

/* ---------- Embed mode ---------- */
html.embed .brand-title, html.embed .brand-logo, html.embed .brand .eyebrow { display: none; }
html.embed .topbar { min-height: 56px; }
html.embed .controls { margin-left: 0; }
html.embed .expand-btn { display: inline-flex !important; }
/* Full screen from inside the embed: bring the brand row back and behave like the full page. */
html.embed.fs .brand-title, html.embed.fs .brand-logo, html.embed.fs .brand .eyebrow { display: block; }
html.embed.fs .topbar { min-height: var(--topbar-h); }
html.embed.fs .controls { margin-left: auto; }
html.fs body { background: var(--bc-surface-1); }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  :root { --sidebar-w: 360px; }
  .brand-title { font-size: 18px; }
  .search input { width: 200px; }
}
@media (max-width: 760px) {
  .modal { padding: 0; align-items: stretch; }
  .modal-card { width: 100%; max-height: none; height: 100%; border-radius: 0; }
  .modal-head { padding: 16px 16px 4px; }
  .modal-body { padding: 4px 16px 24px; }
  .about-grid { grid-template-columns: 1fr; gap: 6px; }
  .members-cols { grid-template-columns: 1fr; }
  .about-grid .datatable { font-size: 13px; table-layout: auto; }
  .about-grid .datatable th, .about-grid .datatable td { padding: 6px 4px; }
  .about-grid .datatable th { white-space: normal; line-height: 1.25; }
  .about-grid .datatable td.n, .about-grid .datatable th.n { white-space: normal; }
  .modal-body .intro { font-size: 14px; }
  .about-section > h3.sec { font-size: 20px; }
  .about-nav { position: static; }
  .about-section { scroll-margin-top: 8px; }
}
@media (max-width: 640px) {
  .topbar { padding: 10px 12px; gap: 10px; }
  .controls { margin-left: 0; width: 100%; justify-content: space-between; gap: 8px; }
  html.embed.fs .controls { margin-left: 0; }
  .search { flex: 1 1 100%; }
  .search input { width: 100%; }
  .segmented button { padding: 8px 12px; font-size: 12px; }
  .list-btn { padding: 0 12px; }
  .list-btn span { display: none; }
  .brand-title { font-size: 16px; white-space: normal; }
  .brand .eyebrow { display: none; }
  /* Full page on a phone: let the page scroll so the map keeps a usable height; the embed keeps the fixed layout. */
  html:not(.embed) .app { height: auto; min-height: 100vh; min-height: 100dvh; }
  html:not(.embed) .stage { flex: 0 0 auto; height: 58vh; height: 58dvh; min-height: 320px; }
  html.embed .chips { display: none; }
  .quickzoom { top: 12px; left: 12px; max-width: calc(100% - 24px); }
  .zoom-controls { top: auto; bottom: 12px; right: 12px; flex-direction: row; }
  .legend-toggle { display: inline-flex; }
  .legend { display: none; left: 12px; bottom: 56px; max-width: calc(100% - 24px); padding: 10px 12px; font-size: 12px; }
  .legend.open { display: block; }
  .legend .legend-sizes { display: none; }
  .rail { left: 12px; right: 12px; top: 12px; bottom: 12px; width: auto; max-width: none; }
  .stage.rail-open .quickzoom, .stage.rail-open .start-card, .stage.rail-open .zoom-controls { display: none; }
  .start-card { bottom: 62px; left: 12px; right: 12px; padding: 8px 12px 10px; max-height: 46%; overflow: auto; }
  .start-text { font-size: 13px; line-height: 1.35; margin: 2px 0 6px; }
  .start-text strong { font-size: 15px; }
  .start-picks { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
  .start-picks .chip { flex: 0 0 auto; }
  .summary .source { display: none; }
  .panel {
    top: auto; left: 12px; right: 12px; bottom: 12px; width: auto; max-width: none; max-height: max(72%, 260px);
    transform: translateY(calc(100% + 24px));
  }
  .panel.open { transform: none; }
  .panel.peek { max-height: max(44%, 220px); }
  .panel.peek .panel-body { overflow: hidden; -webkit-mask-image: linear-gradient(#000 65%, transparent); mask-image: linear-gradient(#000 65%, transparent); }
  .sheet-handle { display: flex; justify-content: center; align-items: flex-start; width: 100%; min-height: 36px; padding: 8px 0 0; margin-bottom: -22px; position: relative; z-index: 1; background: none; border: 0; cursor: pointer; }
  .sheet-handle span { display: block; width: 44px; height: 4px; border-radius: 2px; background: var(--bc-grey); }
  .panel-head { padding-top: 22px; cursor: pointer; }
  .panel-head .icon-btn { cursor: pointer; }
  .panel-title { font-size: 22px; }
  .kpi-value { font-size: 26px; }
  .summary { padding: 10px 12px 10px; gap: 8px 16px; }
  .hero-value { font-size: 32px; }
  .squiggle { width: 80px; }
  .hero-label { max-width: 160px; }
  .stats { gap: 6px 16px; }
  .stat-value { font-size: 22px; }
  .stat-label { max-width: 130px; }
  .chips { flex-basis: 100%; }
  .info-chip.potential { max-width: none; }
  .summary .btn { margin-left: 0; }
  .timeline li { grid-template-columns: 1fr; }
  .tl-date { padding-top: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

@media print {
  .topbar .controls, .zoom-controls, .quickzoom, .map-hint, .tooltip, .summary .btn, .legend-toggle, .start-card, .rail, .panel:not(.open) { display: none !important; }
  body { overflow: visible; }
  .app { height: auto; }
  .stage { height: 70vh; }
  #map { width: 100%; height: 100%; }
  .panel.open { position: static; transform: none; width: auto; max-width: none; max-height: none; box-shadow: none; visibility: visible; }
}
