/*
  16th & 24th Street BART Plaza Working Group — Activation Dashboard
  Design system: San Francisco Digital Services
  https://design-system.sf.gov/

  Typography: Rubik (Light 300, Regular 400, Semibold 600)
  Colors: SF Design System primary, secondary, and chart palettes

  Every text/background pair below was checked against the WCAG relative-
  luminance contrast formula and clears at least 4.5:1. Non-text elements
  (chart lines, dividers) clear the 3:1 non-text-contrast minimum.
*/

@import url('https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@400&family=Rubik:wght@300;400;600&display=swap');

:root {
  --font-sans: Rubik, ui-sans-serif, sans-serif;
  --font-mono: "Roboto Mono", monospace;

  /* SF Design System Primary Colors */
  --slate: #002B48;      /* Slate L4 - primary text */
  --muted: #5A7A92;      /* Slate L2 - secondary text */
  --black: #212123;      /* Very dark gray (labels) */
  --page-bg: #F4F4F6;
  --surface: #FFFFFF;
  --border: #E5E7EB;

  /* SF Design System Action Color */
  --action-blue: #495ED4; /* Action blue - links, buttons, actionable UI */
  --blue-text: #495ED4;   /* Alias for action blue */

  /* SF Design System Secondary Colors (L1-L4 shades) */
  --purple-bg: #EDE9FE; --purple-text: #5A3D8A; --purple-line: #7B5BA6;
  --amber-bg:  #FEF3C7; --amber-text:  #92610E; --amber-line:  #B8860B;
  --green-bg:  #DCFCE7; --green-text:  #1B6B3A; --green-line:  #2E8B57;
  --teal-bg:   #CCFBF1; --teal-text:   #0F766E; --teal-line:   #0F766E;
  --red-bg:    #FEE2E2; --red-text:    #B91C1C;

  /* SF Design System Chart Colors - Qualitative Palette */
  --chart-blue: #1F5182;     /* Primary qualitative - dark blue */
  --chart-orange: #D85B2A;   /* Primary qualitative - orange */
  --chart-teal: #108080;     /* Additional qualitative */
  --chart-purple: #6A4C93;   /* Additional qualitative */
  --chart-gold: #C4961A;     /* Additional qualitative */
  --chart-green: #2D6A4F;    /* Additional qualitative */

  /* SF Design System Label Colors */
  --label-primary: #212123;   /* Primary labels */
  --label-secondary: #59595C; /* Secondary labels */

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 3px rgba(16,24,40,.04), 0 2px 8px rgba(16,24,40,.08);
  --shadow-hover: 0 4px 12px rgba(16,24,40,.10), 0 2px 4px rgba(16,24,40,.06);
  --shadow-lg: 0 4px 16px rgba(16,24,40,.12), 0 2px 6px rgba(16,24,40,.08);
  --focus: #1D4ED8;
  --max-width: 1000px;
  --transition: 0.15s ease;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--slate);
  background: var(--page-bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  left: -999px; top: auto; width: 1px; height: 1px; overflow: hidden;
  background: var(--slate); color: #fff; padding: 0.5rem 1rem; z-index: 100;
  border-radius: 6px;
}
.skip-link:focus {
  position: fixed; left: 1rem; top: 1rem; width: auto; height: auto;
  outline: 3px solid var(--focus);
}

a { color: var(--blue-text); text-decoration: underline; text-underline-offset: 2px; transition: color var(--transition); }
a:hover { text-decoration-thickness: 2px; color: #1e40af; }

a:focus-visible, button:focus-visible, summary:focus-visible, .partner-pill:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Header ---------- */
.app-header { background: var(--slate); color: #fff; padding: 2.25rem 1.25rem 1.75rem; }
.app-header__inner { max-width: var(--max-width); margin: 0 auto; }
.app-header__eyebrow {
  text-transform: uppercase; letter-spacing: .07em; font-size: .78rem;
  font-weight: 700; color: #93C5FD; margin: 0;
}
.app-header h1 { margin: .35rem 0 .5rem; font-size: 2rem; font-weight: 800; }
.app-header__sub { margin: 0 0 1.25rem; color: #E2E8F0; max-width: 66ch; font-size: 1.02rem; }

.update-pills { display: flex; flex-wrap: wrap; gap: .6rem; }
.update-pill {
  display: flex; flex-direction: column; gap: .1rem;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 8px;
  padding: .5rem .85rem;
}
.update-pill__label {
  font-size: .78rem; text-transform: uppercase; letter-spacing: .05em;
  color: #93C5FD; font-weight: 700;
}
.update-pill__value { font-size: .92rem; font-weight: 600; color: #fff; }

/* ---------- Objective-at-a-glance pills ---------- */
.objective-pills-wrap { background: var(--page-bg); border-bottom: 1px solid var(--border); padding: 1.1rem 0; }
.objective-pills-inner { max-width: var(--max-width); margin: 0 auto; }
.objective-pills {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .85rem;
  padding: 0 1.25rem;
}
@media (max-width: 640px) {
  .objective-pills { grid-template-columns: 1fr; }
}
.objective-pill {
  display: flex; flex-direction: column; gap: .35rem;
  color: var(--slate);
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--blue);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.1rem 1.1rem;
  transition: box-shadow var(--transition), transform var(--transition);
}
.objective-pill:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}
.objective-pill.accent-purple { border-top-color: var(--purple-line); }
.objective-pill.accent-amber  { border-top-color: var(--amber-line); }
.objective-pill.accent-blue   { border-top-color: var(--blue-text); }
.objective-pill.accent-green  { border-top-color: var(--green-line); }
.objective-pill.accent-teal   { border-top-color: var(--teal-line); }
.objective-pill__eyebrow {
  text-transform: uppercase; letter-spacing: .05em; font-size: .78rem; font-weight: 800; color: var(--muted);
  margin: 0;
}
.objective-pill__title { font-weight: 800; font-size: 1rem; color: var(--slate); margin: .1rem 0 .2rem; }
.objective-pill__title a { color: inherit; text-decoration: none; }
.objective-pill__title a:hover,
.objective-pill__title a:focus-visible { text-decoration: underline; }
.objective-pill__kr-list { list-style: none; margin: .2rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.objective-pill__kr-row { padding-top: .5rem; }
.objective-pill__kr-row:first-child { padding-top: 0; }
.objective-pill__kr-row:not(:first-child) { border-top: 1px solid var(--border); }
.objective-pill__kr-row { position: relative; }
.objective-pill__kr-link { display: block; text-decoration: none; }
.objective-pill__kr-link:hover .objective-pill__kr-name { color: var(--blue-text); }
.objective-pill__kr-link:hover .kr-jump-arrow { opacity: 1; color: var(--blue-text); }
.objective-pill__kr-name { display: block; font-size: .8rem; font-weight: 700; color: var(--muted); margin-bottom: .2rem; transition: color 0.15s; }
.kr-jump-arrow { position: absolute; top: 0; right: 0; opacity: 0.3; font-size: .75rem; color: var(--muted); transition: opacity 0.15s, color 0.15s; }
.objective-pill__kr-line { display: flex; align-items: baseline; gap: .4rem; flex-wrap: wrap; }
.objective-pill__value { font-size: 1.15rem; font-weight: 800; color: var(--slate); font-variant-numeric: tabular-nums; }
.objective-pill__value--pending { font-size: .82rem; font-weight: 700; color: var(--muted); font-style: italic; }
.objective-pill__unit { font-size: .8rem; color: var(--muted); }
.objective-pill .trend-badge { font-size: .78rem; }

/* ---------- Nav ---------- */
nav.objective-nav { background: var(--surface); border-bottom: 1px solid var(--border); }
nav.objective-nav ul {
  list-style: none; display: flex; flex-wrap: wrap; gap: .5rem;
  margin: 0 auto; padding: .65rem 1.25rem; max-width: var(--max-width);
}
nav.objective-nav a {
  display: inline-flex; align-items: center;
  padding: .45rem 1rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--page-bg);
  color: var(--slate); font-weight: 600; font-size: .85rem;
  text-decoration: none;
  transition: all var(--transition);
  min-height: 44px;
}
nav.objective-nav a:hover, nav.objective-nav a:focus-visible {
  border-color: var(--blue-text); color: var(--blue-text); background: #EFF6FF;
  transform: translateY(-1px);
}

main { display: block; }
.app-main { max-width: var(--max-width); margin: 0 auto; padding: 2rem 1.25rem 3rem; }
/* Overview sits above the objective pills band; the section's own padding is
   enough breathing room, so drop the column's extra bottom padding. */
.app-main--intro { padding-bottom: 0; }

section { padding: 1.75rem 0; }

.section-label {
  text-transform: uppercase; letter-spacing: .07em; font-size: 1.05rem;
  font-weight: 800; color: var(--muted); margin: 0 0 1rem; border: none; padding: 0;
}
/* The nav's heading sits outside .app-main, so it needs that column's
   max-width and gutter to line up with the Overview heading above it. */
.objective-nav__label {
  max-width: var(--max-width); margin: 0 auto 1rem; padding: 0 1.25rem;
}
h3 { color: var(--slate); font-size: 1.1rem; }

/* ---------- Generic surface card ---------- */
.surface-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem 1.6rem;
}
.intro-card p { font-size: 1.03rem; max-width: 70ch; margin: 0 0 .9rem; }
.callout-goal {
  font-weight: 700; font-size: 1.08rem; color: var(--slate);
  border-left: 3px solid var(--blue); padding-left: .9rem;
}

.partners-label {
  text-transform: uppercase; letter-spacing: .05em; font-size: .74rem;
  font-weight: 700; color: var(--muted); margin: 1.1rem 0 .5rem;
}
.partner-pills { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 .5rem; padding: 0; }
.partner-pill {
  background: #EFF6FF; color: var(--blue-text); border: 1px solid #BFDBFE;
  border-radius: 999px; padding: .35rem .85rem; font-size: .82rem; font-weight: 700;
  cursor: default;
  transition: background var(--transition), transform var(--transition);
}
.partner-pill:hover {
  background: #DBEAFE;
  transform: translateY(-1px);
}

.status-banner {
  background: var(--amber-bg); color: var(--amber-text);
  border: 1px solid #F3D08A; border-radius: 8px;
  padding: .9rem 1.1rem; margin: 1.1rem 0 0; font-size: .95rem;
}

.how-to-read {
  background: var(--page-bg); border: 1px solid var(--border); border-radius: 8px;
  padding: .85rem 1.1rem; font-size: .95rem; max-width: 68ch; margin: 1.1rem 0 0;
}

/* ---------- Collapsible objective sections ---------- */
.objective-details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow var(--transition);
}
.objective-details:hover { box-shadow: var(--shadow-hover); }
.objective-details[open] { box-shadow: var(--shadow-lg); }

.objective-details.accent-purple { --accent-bg: var(--purple-bg); --accent-text: var(--purple-text); --accent-line: var(--purple-line); }
.objective-details.accent-amber  { --accent-bg: var(--amber-bg);  --accent-text: var(--amber-text);  --accent-line: var(--amber-line); }
.objective-details.accent-blue   { --accent-bg: #DBEAFE;          --accent-text: var(--blue-text);    --accent-line: var(--blue-text); }
.objective-details.accent-green  { --accent-bg: var(--green-bg);  --accent-text: var(--green-text);  --accent-line: var(--green-line); }
.objective-details.accent-teal   { --accent-bg: var(--teal-bg);   --accent-text: var(--teal-text);   --accent-line: var(--teal-line); }

.objective-summary {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
  padding: 1.1rem 1.4rem;
  cursor: pointer;
  list-style: none;
  border-left: 5px solid var(--accent-line, var(--blue));
  background: var(--surface);
  transition: background var(--transition);
}
.objective-summary::-webkit-details-marker { display: none; }
.objective-summary:hover { background: var(--page-bg); }
.objective-details[open] .objective-summary { border-bottom: 1px solid var(--border); }

.objective-summary__eyebrow {
  text-transform: uppercase; letter-spacing: .06em; font-size: .7rem; font-weight: 800;
  color: var(--accent-text, var(--muted)); background: var(--accent-bg, var(--page-bg));
  padding: .2rem .6rem; border-radius: 999px;
}
.objective-summary__title { font-size: 1.15rem; font-weight: 700; color: var(--slate); flex: 1; }
.objective-summary__status { display: flex; align-items: center; gap: .6rem; }
.objective-summary__count {
  font-size: .78rem; font-weight: 600; color: var(--muted);
  background: var(--page-bg); padding: .2rem .6rem; border-radius: 999px;
}
.objective-summary__toggle {
  width: 1.25rem; height: 1.25rem;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 1.1rem; transition: transform var(--transition);
}
.objective-summary__toggle::before { content: "▸"; }
.objective-details[open] .objective-summary__toggle { transform: rotate(90deg); }

/* ---------- Objective cards ---------- */
.objective-card {
  background: var(--surface);
  border: none;
  border-left: 5px solid var(--blue-line, var(--blue));
  border-radius: 0;
  box-shadow: none;
  padding: 1.75rem 1.85rem 2rem;
}
.objective-details .objective-card {
  border-left: none;
  padding: 1.5rem 1.6rem 1.75rem;
}
.objective-details .objective-card:hover { box-shadow: none; }
.objective-card.accent-purple { --accent-bg: var(--purple-bg); --accent-text: var(--purple-text); border-left-color: var(--purple-line); }
.objective-card.accent-amber  { --accent-bg: var(--amber-bg);  --accent-text: var(--amber-text);  border-left-color: var(--amber-line); }
.objective-card.accent-blue   { --accent-bg: #DBEAFE;          --accent-text: var(--blue-text);    border-left-color: var(--blue-text); }
.objective-card.accent-green  { --accent-bg: var(--green-bg);  --accent-text: var(--green-text);  border-left-color: var(--green-line); }
.objective-card.accent-teal   { --accent-bg: var(--teal-bg);   --accent-text: var(--teal-text);   border-left-color: var(--teal-line); }
.objective-card.accent-neutral { --accent-bg: var(--page-bg);  --accent-text: var(--slate);        border-left-color: var(--slate); }

.objective-card__eyebrow {
  display: inline-block;
  text-transform: uppercase; letter-spacing: .06em; font-size: .8rem; font-weight: 800;
  color: var(--accent-text); background: var(--accent-bg);
  padding: .2rem .6rem; border-radius: 999px; margin: 0 0 .5rem;
}
.objective-card__title { margin: 0 0 .5rem; font-size: 1.4rem; color: var(--slate); }
.obj-summary { color: var(--muted); font-size: 1rem; margin: 0 0 1.4rem; max-width: 68ch; }
.obj-note {
  background: var(--page-bg); border: 1px dashed var(--border); border-radius: 8px;
  padding: .7rem 1rem; font-size: .88rem; color: var(--muted); max-width: 68ch;
  margin: -0.5rem 0 1.4rem;
}
.obj-story {
  background: var(--accent-bg); border-left: 3px solid var(--accent-text);
  border-radius: 8px; padding: .9rem 1.1rem 1rem; max-width: 68ch;
  margin: -0.3rem 0 1.5rem;
}
.obj-story__heading {
  margin: 0 0 .35rem; font-weight: 800; font-size: .82rem; text-transform: uppercase;
  letter-spacing: .04em; color: var(--accent-text);
}
.obj-story__text { margin: 0 0 .5rem; font-size: .92rem; color: var(--slate); }
.obj-story__source { margin: 0; font-size: .8rem; color: var(--muted); }

.methodology-note { margin: 0 0 .75rem; font-size: .86rem; }
.methodology-note summary { cursor: pointer; color: var(--blue-text); font-weight: 600; }
.methodology-note p { color: var(--muted); margin: .5rem 0 0; }
.methodology-card { margin: 0 0 1.1rem; background: var(--page-bg); }
.methodology-card .dataset-idea__name { margin: 0 0 .3rem; }
.methodology-card .dataset-idea__text { margin: 0; }

.metric-group-label {
  text-transform: uppercase; letter-spacing: .05em; font-size: .8rem; font-weight: 800;
  color: var(--muted); margin: 1.6rem 0 .75rem; padding-top: 1rem; border-top: 1px solid var(--border);
}
.metric-group-label:first-of-type { margin-top: 0; padding-top: 0; border-top: none; }

/* ---------- Charts ---------- */
.chart-block {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.25rem 1.35rem 1.5rem;
  margin-bottom: 1.35rem;
  background: var(--page-bg);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.chart-block:hover {
  border-color: #d1d5db;
  box-shadow: 0 2px 8px rgba(16,24,40,.05);
}
.chart-block__head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: .75rem; flex-wrap: wrap; margin-bottom: .35rem;
}
.chart-block h4 { margin: 0; font-size: 1.05rem; font-weight: 700; }
.chart-block h4 a { text-decoration: none; color: var(--slate); transition: color var(--transition); }
.chart-block h4 a:hover { text-decoration: underline; color: var(--blue-text); }
.chart-block h4 a::after { content: " ›"; color: var(--blue-text); font-weight: 700; opacity: 0.7; transition: opacity var(--transition); }
.chart-block h4 a:hover::after { opacity: 1; }
.chart-meta { color: var(--muted); font-size: .88rem; margin: 0 0 .85rem; line-height: 1.5; }
.chart-subhead { font-size: .9rem; font-weight: 600; color: var(--text-muted); margin: 1.25rem 0 .5rem; }
.chart-figure { margin: 0 0 .85rem; background: var(--surface); border-radius: var(--radius-sm); padding: .65rem .5rem; border: 1px solid rgba(0,0,0,.03); }
.chart-figure svg { display: block; max-width: 100%; height: auto; }
.chart-figure--large svg { max-width: 720px; }

table.chart-table { font-size: .85rem; margin: 0; background: var(--surface); }
table.chart-table th[scope="col"] { text-align: center; }
table.chart-table td { text-align: center; }
table.chart-table caption a { font-size: .82rem; font-weight: 600; }

/* Scouting report table (location × shift grid) */
table.scouting-table { max-width: 600px; }
table.scouting-table th[scope="row"] { text-align: left; font-weight: 500; white-space: nowrap; }
table.scouting-table th[scope="col"] { text-align: center; font-size: .8rem; }
table.scouting-table td { text-align: center; min-width: 70px; }

/* Scouting Mapbox map */
.scouting-map { width: 100%; height: 400px; border-radius: var(--radius); }
.scouting-map-figure { margin-bottom: .5rem; }
.scouting-svg-fallback { display: none; }
.scouting-marker {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  font-size: 14px; font-weight: 700;
  border: 2px solid; cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.scouting-popup .mapboxgl-popup-content {
  padding: 8px 12px; font-size: 13px; border-radius: 6px;
}
.scouting-trend {
  padding: 1.5rem; margin-bottom: 1.5rem;
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); text-align: center;
}
.scouting-trend__title {
  font-size: .85rem; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: 1rem;
}
.scouting-trend__months {
  display: flex; justify-content: center; align-items: center; gap: 1rem;
  flex-wrap: wrap;
}
.scouting-trend__month {
  display: flex; flex-direction: column; align-items: center;
  padding: .75rem 1.25rem; background: #f3f4f6; border-radius: var(--radius);
}
.scouting-trend__month--current {
  background: var(--primary); color: white;
}
.scouting-trend__month--current .scouting-trend__label { color: rgba(255,255,255,.8); }
.scouting-trend__value {
  font-size: 2rem; font-weight: 700; line-height: 1;
}
.scouting-trend__label {
  font-size: .8rem; color: var(--text-muted); margin-top: .25rem;
}
.scouting-trend__arrow {
  font-size: 1.5rem; color: var(--text-muted);
}
.scouting-trend__change {
  font-size: .9rem; margin-top: 1rem; font-weight: 500;
}
.scouting-trend__change--up { color: #15803d; }
.scouting-trend__change--down { color: #b91c1c; }
.scouting-legend {
  display: flex; gap: 1.5rem; margin-bottom: 1rem; font-size: .85rem;
}
.scouting-legend__item { display: flex; align-items: center; gap: .4rem; }
.scouting-legend__swatch {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 20px; border-radius: 4px;
  font-size: 11px; font-weight: 700; color: #fff;
  border: 1.5px solid;
}
.scouting-filter {
  display: flex; align-items: center; gap: .75rem;
  margin-bottom: 1rem; padding: .75rem 1rem;
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border);
}
.scouting-filter__label {
  font-size: .85rem; font-weight: 600; color: var(--text-muted);
}
.scouting-filter__select {
  padding: .4rem .75rem; font-size: .9rem;
  border: 1px solid var(--border); border-radius: 6px;
  background: #fff; color: var(--text);
  cursor: pointer; min-width: 160px;
}
.scouting-filter__select:focus {
  outline: none; border-color: var(--blue-text);
  box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.15);
}

/* ---------- Related public-data ideas ---------- */
.data-ideas-toggle {
  margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border);
}
.data-ideas-toggle > summary {
  cursor: pointer; font-weight: 700; color: var(--blue-text); font-size: .95rem;
  list-style: none;
}
.data-ideas-toggle > summary::-webkit-details-marker { display: none; }
.data-ideas-toggle > summary::before { content: "▸ "; }
.data-ideas-toggle[open] > summary::before { content: "▾ "; }
.dataset-ideas { list-style: none; margin: .9rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .75rem; }
.dataset-idea {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: .8rem 1rem;
}
.dataset-idea__name { margin: 0 0 .3rem; font-weight: 700; }
.dataset-idea__org { font-weight: 400; color: var(--muted); font-size: .85rem; }
.dataset-idea__text { margin: 0; color: var(--muted); font-size: .92rem; }
.sibling-list { padding-left: 1.2rem; }
.sibling-list li { margin-bottom: .4rem; }

/* ---------- Trend badges (icon + word, never color alone) ---------- */
.trend-badge {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .78rem; font-weight: 700; padding: .25rem .6rem;
  border-radius: 999px; white-space: nowrap;
  transition: transform var(--transition);
}
.trend-badge:hover { transform: scale(1.02); }
.trend-badge--good   { background: var(--green-bg); color: var(--green-text); }
.trend-badge--bad    { background: #F3F4F6; color: #6B7280; }
.trend-badge--nodata { background: var(--border);   color: var(--muted); }
.trend-badge--neutral { background: #E0E7FF; color: #4338CA; }

/* Explicit "this number isn't real yet" flag — always visible, never just a
   note buried in a collapsed methodology panel, so a reader can't mistake a
   placeholder figure for a confirmed one. */
.trend-badge--placeholder { background: var(--amber-bg); color: var(--amber-text); border: 1px solid #F3D08A; }

/* ---------- Accessible data tables ---------- */
table.metrics {
  width: 100%;
  border-collapse: collapse;
  margin: .75rem 0 0;
  font-size: .95rem;
}
table.metrics caption { text-align: left; font-weight: 700; color: var(--slate); padding-bottom: .5rem; }
table.metrics th, table.metrics td {
  border: 1px solid var(--border); padding: .55rem .7rem; text-align: left; vertical-align: top;
}
table.metrics thead th { background: var(--slate); color: #fff; }
table.metrics tbody tr:nth-child(even) { background: var(--page-bg); }
table.metrics td.value { font-weight: 700; white-space: nowrap; }
table.metrics td.pending { color: var(--muted); font-style: italic; font-weight: 400; }
table.metrics td.placeholder-value { color: var(--amber-text); background: var(--amber-bg); }
table.metrics caption strong { color: var(--amber-text); font-weight: 700; }

/* ---------- Case studies & initiative spotlights ----------
   Deliberately NOT a separate design system: each case study reuses the
   exact .objective-card component the objective sections already use
   (same border, padding, eyebrow pill, title, shadow, radius), so it looks
   like the rest of the page instead of a one-off layout. A small local nav
   bar (styled like the page's own .objective-nav) sits above the stack so
   a reader can jump straight to one. */
.section-intro { color: var(--muted); margin: 0 0 1.1rem; max-width: 68ch; }

.case-study-nav { margin: .75rem 0 1.25rem; }
.case-study-nav ul {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: .6rem;
}
.case-study-nav a {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .65rem 1.25rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--slate); font-weight: 600; font-size: .92rem;
  text-decoration: none;
  transition: all var(--transition);
  min-height: 44px;
}
.case-study-nav a:hover, .case-study-nav a:focus-visible {
  border-color: var(--blue-text); color: var(--blue-text); background: #EFF6FF;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(29,78,216,.12);
}
.case-study-nav__dot {
  display: inline-block; width: .45rem; height: .45rem; border-radius: 50%;
  background: currentColor; flex-shrink: 0;
}

.case-study-stack { display: flex; flex-direction: column; gap: 1.5rem; }

.case-study-media { margin: 0 0 1.2rem; border-radius: 8px; overflow: hidden; display: grid; grid-template-columns: 1fr; max-width: 22rem; }
.case-study-media--multi { grid-template-columns: 1fr 1fr; gap: 2px; }
.case-study-media__img { display: block; width: 100%; height: 130px; object-fit: cover; }
.case-study-media--multi .case-study-media__img { height: 100%; }
.case-study-media--placeholder {
  height: 130px; max-width: 22rem; background: var(--page-bg); border: 1px dashed var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: .85rem;
}
.case-study-media__caption { margin: -0.9rem 0 1.2rem; max-width: 22rem; font-size: .82rem; color: var(--muted); font-style: italic; }
.case-study-gallery {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .5rem;
  margin: 0 0 1.2rem; max-width: 100%;
}
.case-study-img {
  width: 100%; height: 140px; object-fit: cover; border-radius: 6px;
  cursor: pointer; transition: transform 0.2s, box-shadow 0.2s;
}
.case-study-img:hover { transform: scale(1.02); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }

.lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,0.9);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; opacity: 0; visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s; cursor: zoom-out;
}
.lightbox.active { opacity: 1; visibility: visible; }
.lightbox img {
  max-width: 90vw; max-height: 90vh; border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.case-study-stats { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.case-study-stat-chip {
  display: inline-flex; align-items: baseline; gap: .35rem;
  background: #EFF6FF; border-radius: 999px; padding: .3rem .75rem;
}
.case-study-stat-value { font-weight: 800; font-size: 1rem; color: var(--slate); }
.case-study-stat-label { font-weight: 400; font-size: .8rem; color: var(--muted); }

/* ---------- Detail toggle ---------- */
details.data-note { margin-top: .75rem; font-size: .92rem; }
details.data-note summary { cursor: pointer; color: var(--blue-text); font-weight: 700; }

/* ---------- Footer ---------- */
.app-footer { max-width: var(--max-width); margin: 0 auto; padding: 1rem 1.25rem 3rem; color: var(--muted); }
.app-footer .section-label { color: var(--muted); }
.app-footer a { color: var(--blue-text); }
.app-footer ul { padding-left: 1.2rem; }
.app-footer small { font-size: .85rem; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Route filter (CSS-only, no JS) ---------- */
.route-filter { margin-top: .5rem; }
.route-filter__fieldset {
  border: none; margin: 0 0 .75rem; padding: 0;
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .9rem;
}
.route-filter__legend {
  font-weight: 800; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); padding: 0; margin-right: .3rem;
}
.route-filter__option { display: inline-flex; align-items: center; gap: .3rem; }
.route-filter__radio { margin: 0; accent-color: var(--blue-text); }
.route-filter__label { font-size: .88rem; color: var(--slate); cursor: pointer; }
.route-filter__radio:checked ~ .route-filter__label { font-weight: 800; color: var(--blue-text); }
.route-filter__radio:focus-visible ~ .route-filter__label { outline: 2px solid var(--focus); outline-offset: 2px; }

.route-panel { display: none; }
.route-panel .trend-badge { margin-bottom: .4rem; }
/* Each radio's id ends in -r<route> (or -rALL for the "All routes" option);
   when checked, show only the matching panel. This uses :has() on the
   shared .route-filter ancestor (rather than a plain "~" sibling selector)
   because the radio is nested inside a fieldset/label wrapper, not a direct
   sibling of .route-panels — a plain sibling combinator can't reach across
   that nesting, which was the bug that kept every panel hidden. :has()
   checks the whole subtree instead, so it doesn't care how deep the checked
   input is nested, and it still scopes correctly to each metric's own
   .route-filter (it won't match a checked radio belonging to a different
   metric's filter). With CSS disabled entirely, the display:none rule above
   doesn't apply either, so every route's chart and table show at once —
   nothing is hidden from a no-CSS or screen-reader-only reading of the
   page. :has() has full support in every current evergreen browser
   (Chrome/Edge, Firefox, Safari) as of 2026. */
.route-filter:has(input[id$="-rALL"]:checked) .route-panel[data-route="ALL"] { display: block; }
.route-filter:has(input[id$="-r14"]:checked) .route-panel[data-route="14"] { display: block; }
.route-filter:has(input[id$="-r49"]:checked) .route-panel[data-route="49"] { display: block; }
.route-filter:has(input[id$="-r22"]:checked) .route-panel[data-route="22"] { display: block; }
.route-filter:has(input[id$="-r55"]:checked) .route-panel[data-route="55"] { display: block; }
.route-filter:has(input[id$="-r14R"]:checked) .route-panel[data-route="14R"] { display: block; }
.route-filter:has(input[id$="-r27"]:checked) .route-panel[data-route="27"] { display: block; }
.route-filter:has(input[id$="-r67"]:checked) .route-panel[data-route="67"] { display: block; }
.route-filter:has(input[id$="-r12"]:checked) .route-panel[data-route="12"] { display: block; }
.route-filter:has(input[id$="-r36"]:checked) .route-panel[data-route="36"] { display: block; }

.route-legend {
  list-style: none; margin: .6rem 0 1rem; padding: 0;
  display: flex; flex-wrap: wrap; gap: .5rem 1rem;
}
.route-legend__item { display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--slate); }
.route-legend__swatch {
  display: inline-block; width: .85rem; height: .85rem; border-radius: 3px;
  border: 1px solid rgba(0,0,0,.15); flex-shrink: 0;
}

@media (max-width: 640px) {
  .app-header { padding: 1.75rem 1rem 1.5rem; }
  .app-header h1 { font-size: 1.5rem; }
  .app-header__sub { font-size: .95rem; }
  .update-pills { gap: .5rem; }
  .update-pill { padding: .45rem .7rem; }

  .objective-pills { gap: .7rem; padding: 0 1rem; }
  .objective-pill { padding: .85rem .95rem 1rem; }
  .objective-pill__value { font-size: 1.05rem; }

  nav.objective-nav ul { padding: .6rem 1rem; gap: .4rem; }
  nav.objective-nav a { padding: .5rem .85rem; font-size: .82rem; min-height: 44px; }
  .objective-nav__label { padding: 0 1rem; }

  .app-main { padding: 1.5rem 1rem 2.5rem; }
  section { padding: 1.25rem 0; }

  .surface-card { padding: 1.2rem 1.1rem; }
  .objective-card { padding: 1.25rem 1.15rem 1.4rem; }
  .objective-card__title { font-size: 1.25rem; }

  .objective-summary { padding: .9rem 1rem; gap: .5rem; }
  .objective-summary__eyebrow { font-size: .65rem; padding: .15rem .5rem; }
  .objective-summary__title { font-size: 1rem; }
  .objective-details .objective-card { padding: 1.1rem 1rem 1.25rem; }

  .chart-block { padding: 1rem 1rem 1.25rem; margin-bottom: 1.1rem; }
  .chart-block h4 { font-size: .98rem; }
  .chart-figure { padding: .5rem .25rem; }

  table.metrics { font-size: .84rem; }
  table.metrics th, table.metrics td { padding: .45rem .55rem; }

  .case-study-nav a { padding: .55rem 1rem; font-size: .88rem; }
  .case-study-stat-chip { padding: .25rem .65rem; }
  .case-study-stat-value { font-size: .95rem; }

  .route-filter__fieldset { gap: .35rem .7rem; }
  .route-filter__label { font-size: .85rem; min-height: 44px; display: inline-flex; align-items: center; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
