/* TEAM: a full-size map with compact control surfaces.
   Interface colours follow the Better Places Lab; data colours live in js/palette.js. */

:root {
  color-scheme: light;
  --navy: #0c0c48;
  --ink: #15252e;
  --ink-soft: #3b4d56;
  --muted: #55646c;
  --paper: #f7f3ea;
  --surface: #ffffff;
  --wash: #f3f4f1;
  --line: rgba(18, 52, 67, 0.14);
  --line-strong: rgba(18, 52, 67, 0.28);
  --accent: #1f6178;
  --track: #ecebe6;
  --bar: #2a78d6;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(12, 12, 72, 0.12);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #e6e6e3;
  color: var(--ink);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: absolute; top: -60px; left: 12px; z-index: 50; padding: 8px 12px; background: var(--navy); color: #fff; border-radius: 0 0 8px 8px; text-decoration: none; }
.skip-link:focus { top: 0; }

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

/* ------------------------------------------------------------------ panel */

.panel {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  z-index: 10;
  display: flex;
  flex-direction: column;
  width: 364px;
  max-height: calc(100% - 24px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.brand { display: flex; align-items: center; gap: 8px; padding: 14px 12px 12px 14px; border-bottom: 1px solid var(--line); }
.brand-mark { flex: 0 0 auto; width: 36px; height: 36px; }
.brand-text { flex: 1 1 auto; min-width: 0; }
.brand h1 { margin: 0; color: var(--navy); font-size: 22px; font-weight: 800; letter-spacing: 0.08em; line-height: 1; }
.brand p { margin: 3px 0 0; font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tagline { color: var(--muted); }
/* The one-line answer when the panel is folded: allowed two lines, so the
   fare and time, which are what changed, are not cut off. */
.brand .mini {
  display: none;
  color: var(--navy);
  font-weight: 600;
  white-space: normal;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
body[data-panel="collapsed"] .tagline { display: none; }
body[data-panel="collapsed"] .brand .mini { display: -webkit-box; }
.text-button { padding: 6px 4px; border: 0; background: none; color: var(--accent); font-size: 13px; font-weight: 600; }
.text-button:hover { color: var(--navy); text-decoration: underline; }
.icon-button { display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--muted); }
.icon-button:hover { background: var(--wash); color: var(--navy); }
.panel-toggle svg { transition: transform 160ms ease; }
body[data-panel="collapsed"] .panel-toggle svg { transform: rotate(180deg); }
body[data-panel="collapsed"] .panel-body, body[data-panel="collapsed"] .panel-foot { display: none; }

.panel-body { display: flex; flex-direction: column; gap: 14px; min-height: 0; padding: 12px 14px 8px; overflow-y: auto; overscroll-behavior: contain; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-head { display: flex; align-items: baseline; gap: 8px; }
.field-label { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: 0.01em; }
.field-value { color: var(--navy); font-size: 13px; font-weight: 700; }
.field-head .text-button { margin-left: auto; font-size: 12px; }
input[type="range"] { width: 100%; accent-color: var(--navy); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 32px; padding: 5px 11px; border: 1px solid var(--line-strong); border-radius: 999px; background: #fff; color: var(--ink); font-size: 13px; font-weight: 500; }
.chip:hover { border-color: var(--navy); }
.chip[aria-checked="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.chips-compact .chip { min-height: 30px; padding: 4px 10px; font-size: 12.5px; }

/* Each tab as wide as its label, so none wraps onto two lines. */
.tabs { display: flex; justify-content: space-between; margin: 2px -14px 0; padding: 0 10px; border-bottom: 1px solid var(--line); }
.tabs button { min-height: 42px; padding: 8px 6px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; }
.tabs button[aria-selected="true"] { border-bottom-color: var(--navy); color: var(--navy); }
.tabs button:hover { color: var(--navy); }

.view { display: flex; flex-direction: column; gap: 14px; }
.hero-figure { color: var(--navy); font-size: 48px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
.hero-text { margin: 6px 0 0; font-size: 15px; line-height: 1.4; }
.hero-sub { margin: 6px 0 0; color: var(--ink-soft); font-size: 13px; }
.note { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }

.legend { display: flex; flex-direction: column; gap: 6px; }
.legend-scale { display: grid; gap: 2px; }
.legend-step { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.legend-swatch { display: block; height: 12px; }
.legend-step:first-child .legend-swatch { border-radius: 3px 0 0 3px; }
.legend-step:last-child .legend-swatch { border-radius: 0 3px 3px 0; }
.legend-step.is-divider { border-left: 2px solid var(--navy); padding-left: 2px; margin-left: -2px; }
.legend-label { color: var(--muted); font-size: 11px; line-height: 1.2; }

.check { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; }
.check input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--navy); }

.chart { display: flex; flex-direction: column; gap: 6px; }
.chart-caption { margin: 0; color: var(--muted); font-size: 12px; font-weight: 600; }
.bars { display: flex; flex-direction: column; gap: 5px; }
.bar-row { display: grid; grid-template-columns: 124px 1fr minmax(42px, auto); align-items: center; gap: 8px; font-size: 12.5px; }
.bar-label { overflow: hidden; color: var(--ink-soft); text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 10px; background: var(--track); border-radius: 2px; }
.bar-fill { display: block; height: 100%; background: var(--bar); border-radius: 0 4px 4px 0; opacity: 0.55; }
.bar-row.is-emphasis .bar-fill { opacity: 1; }
.bar-row.is-emphasis .bar-label { color: var(--ink); font-weight: 600; }
.bar-value { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-detail { color: var(--muted); font-weight: 400; }

.reason-list { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; }
.reason-row { display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; text-align: left; }
.reason-row:hover { border-color: var(--navy); }
.reason-row.is-focus { border-color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy); }
.reason-swatch { width: 12px; height: 12px; border-radius: 3px; }
.reason-text { display: flex; flex-direction: column; min-width: 0; }
.reason-text strong { font-size: 13px; font-weight: 600; }
.reason-fix { color: var(--muted); font-size: 12px; }
.reason-count { font-variant-numeric: tabular-nums; font-weight: 600; }

.rank-list { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; counter-reset: rank; }
.rank-list li { counter-increment: rank; }
.rank-row { display: grid; grid-template-columns: 20px 1fr auto; grid-template-areas: "n name meta" "n reason reason"; gap: 2px 8px; width: 100%; padding: 7px 6px; border: 0; border-radius: 8px; background: none; text-align: left; }
.rank-row::before { content: counter(rank); grid-area: n; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.rank-row:hover { background: var(--wash); }
.rank-name { grid-area: name; font-weight: 600; }
.rank-meta { grid-area: meta; color: var(--ink-soft); font-size: 12px; font-variant-numeric: tabular-nums; }
.areas .rank-reason { color: var(--muted); font-size: 12px; }
.area-actions { display: flex; gap: 14px; justify-content: space-between; }
.rank-reason { grid-area: reason; display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.reason-dot { width: 8px; height: 8px; border-radius: 50%; }

.panel-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11.5px; }
.panel-foot { flex-wrap: wrap; gap: 2px 10px; }
.lab-link { display: inline-flex; align-items: center; gap: 6px; color: var(--navy); font-weight: 600; text-decoration: none; white-space: nowrap; }
.share-button { flex: 0 0 auto; margin-left: auto; font-size: 12px; }
.foot-note { flex: 1 0 100%; font-size: 11px; line-height: 1.4; }
.lab-link:hover { text-decoration: underline; }

/* ------------------------------------------------------------------ place panel */

.place {
  position: absolute;
  top: calc(max(12px, env(safe-area-inset-top)) + 52px);
  right: max(12px, env(safe-area-inset-right));
  z-index: 11;
  display: flex;
  flex-direction: column;
  width: 340px;
  max-height: calc(100% - 118px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.place-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 14px 14px 10px; border-bottom: 1px solid var(--line); }
.eyebrow { margin: 0 0 2px; color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.place-head h2 { margin: 0; color: var(--navy); font-size: 18px; line-height: 1.2; }
.place-sub { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.place-body { padding: 4px 14px 14px; overflow-y: auto; overscroll-behavior: contain; }
.place-section { padding: 12px 0; border-bottom: 1px solid var(--line); }
.place-section:last-child { border-bottom: 0; }
.place-section h3 { margin: 0 0 8px; font-size: 13px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; font-size: 12.5px; }
.kv-key { color: var(--ink-soft); }
.kv-value { text-align: right; font-variant-numeric: tabular-nums; }

.service-row { border-radius: 8px; }
.service-row + .service-row { margin-top: 2px; }
.service-row summary { display: grid; grid-template-columns: 58px 1fr auto; align-items: center; gap: 8px; padding: 6px 4px; list-style: none; cursor: pointer; font-size: 12.5px; }
.service-row summary::-webkit-details-marker { display: none; }
.service-row summary:hover { background: var(--wash); border-radius: 8px; }
.badge { padding: 2px 6px; border-radius: 999px; font-size: 11px; font-weight: 700; text-align: center; }
.is-met .badge { background: #dbe8f8; color: #184f95; }
.is-missed .badge { background: #fbe3d6; color: #833607; }
.is-reference .badge { background: var(--track); color: var(--ink-soft); }
.service-name { font-weight: 600; }
.service-time { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.service-reason, .service-nearest, .service-standard { margin: 4px 4px 0 70px; color: var(--ink-soft); font-size: 12px; }
.mode-grid { display: grid; grid-template-columns: 1fr auto; gap: 1px 12px; margin: 6px 4px 6px 70px; font-size: 12px; }
.mode-name { color: var(--muted); }
.mode-time { text-align: right; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ map tools */

.map-tools { position: absolute; top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); z-index: 12; display: flex; align-items: flex-start; gap: 8px; }
.search { position: relative; }
.search input { width: 220px; height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: 0 2px 12px rgba(12, 12, 72, 0.08); }
.search-results { position: absolute; top: 42px; left: 0; right: 0; margin: 0; padding: 4px; list-style: none; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.search-results li { display: flex; flex-direction: column; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.search-results li.is-active, .search-results li:hover { background: var(--wash); }
.search-board { color: var(--muted); font-size: 11.5px; }
.segmented { display: inline-flex; padding: 3px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 2px 12px rgba(12, 12, 72, 0.08); }
.segmented button { min-height: 30px; padding: 4px 10px; border: 0; border-radius: 7px; background: none; color: var(--ink-soft); font-size: 12.5px; font-weight: 600; }
.segmented button[aria-pressed="true"] { background: var(--navy); color: #fff; }
.layers { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 2px 12px rgba(12, 12, 72, 0.08); }
.layers summary { min-height: 36px; padding: 8px 12px; color: var(--ink-soft); font-size: 12.5px; font-weight: 600; list-style: none; cursor: pointer; }
.layers summary::-webkit-details-marker { display: none; }
.layer-list { display: flex; flex-direction: column; gap: 6px; padding: 0 12px 10px; white-space: nowrap; }

.tooltip { position: absolute; top: 0; left: 0; z-index: 30; display: flex; flex-direction: column; gap: 1px; max-width: 260px; padding: 8px 10px; background: rgba(12, 12, 72, 0.94); color: #fff; border-radius: 8px; font-size: 12px; pointer-events: none; }
.tooltip strong { font-size: 12.5px; }
.tooltip-hint { margin-top: 3px; color: rgba(255, 255, 255, 0.72); font-size: 11.5px; }
.loading { position: absolute; left: 50%; bottom: 40px; z-index: 40; padding: 10px 14px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); transform: translateX(-50%); font-size: 13px; }

.maplibregl-ctrl-bottom-right { bottom: env(safe-area-inset-bottom); }
.maplibregl-ctrl-group button { width: 36px; height: 36px; }

/* ------------------------------------------------------------------ about */

.about { width: min(640px, 94vw); max-height: 88dvh; padding: 26px 28px; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); color: var(--ink); overflow-y: auto; }
.about::backdrop { background: rgba(12, 12, 72, 0.45); }
.about h2 { margin: 0 0 10px; color: var(--navy); font-size: 22px; }
.about h3 { margin: 20px 0 6px; font-size: 14px; }
.about p, .about li { font-size: 14px; line-height: 1.55; }
.about ul { padding-left: 18px; }
.about-close-form { position: sticky; top: 0; float: right; margin: -8px -10px 0 0; }
.about-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.about-table th, .about-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.about-table th { color: var(--muted); font-weight: 600; }
.about-links a { color: var(--accent); font-weight: 600; }

/* ------------------------------------------------------------------ small screens */

@media (max-width: 1100px) {
  .search input { width: 170px; }
}

@media (max-width: 760px) {
  .panel {
    top: auto;
    left: 8px;
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    width: auto;
    max-height: 62dvh;
    border-radius: 16px;
  }
  body[data-place="open"] .panel { display: none; }
  /* A bottom sheet opens upwards, so the arrow points up while it is folded. */
  .panel-toggle svg { transform: rotate(180deg); }
  body[data-panel="collapsed"] .panel-toggle svg { transform: none; }
  .brand { padding: 10px 10px 8px 12px; }
  .brand h1 { font-size: 19px; }
  .hero-figure { font-size: 40px; }
  .place { top: auto; left: 8px; right: 8px; bottom: max(8px, env(safe-area-inset-bottom)); width: auto; max-height: 62dvh; }
  .map-tools { left: 8px; right: 8px; flex-wrap: wrap; }
  .search { flex: 1 1 140px; }
  .search input { width: 100%; }
  .basemaps { order: 3; }
  input[type="search"] { font-size: 16px; }
  .maplibregl-ctrl-bottom-right { bottom: calc(62dvh + 20px); }
  body[data-panel="collapsed"] .maplibregl-ctrl-bottom-right { bottom: 90px; }
}

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


/* Fare budget and traveller ------------------------------------------------ */

.ticks {
  position: relative;
  height: 14px;
  margin: -2px 0 2px;
}

.ticks .tick {
  position: absolute;
  transform: translateX(-50%);
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  line-height: 14px;
}

.ticks .tick::before {
  content: "";
  display: block;
  width: 1px;
  height: 4px;
  margin: 0 auto 1px;
  background: var(--line);
}

.note.is-fare {
  margin-top: -4px;
  color: var(--ink-soft);
}

/* Settings fold into one line that says what is set ------------------- */

.settings {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.settings > summary {
  display: flex;
  gap: 8px;
  align-items: baseline;
  padding: 9px 12px;
  cursor: pointer;
  list-style: none;
}

.settings > summary::-webkit-details-marker { display: none; }

.settings-summary {
  flex: 1;
  min-width: 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.4;
}

.settings-change {
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}

.settings[open] .settings-change { visibility: hidden; }
.settings[open] > summary { border-bottom: 1px solid var(--line); }

.settings-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 12px;
}

.measure-field {
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.traveller {
  padding: 10px 0 2px;
  border-top: 1px solid var(--line);
}

.traveller > summary {
  display: flex;
  gap: 8px;
  align-items: baseline;
  cursor: pointer;
  list-style: none;
}

.traveller > summary::-webkit-details-marker { display: none; }

.traveller > summary::after {
  content: "change";
  margin-left: auto;
  color: var(--accent);
  font-size: 12px;
}

.traveller[open] > summary::after { content: "done"; }

.traveller-summary {
  color: var(--ink-soft);
  font-size: 13px;
}

.traveller-body {
  padding-top: 8px;
}

.traveller-body .field { margin-bottom: 8px; }


/* Method notes: a line anyone can open, and most people will not ---------- */

.method {
  margin: 8px 0 2px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.method > summary {
  display: flex;
  gap: 7px;
  align-items: center;
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  list-style: none;
}

.method > summary::-webkit-details-marker { display: none; }
.method > summary:hover { color: var(--accent); }

.method-mark {
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  flex: none;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 10px;
  font-style: italic;
  font-weight: 700;
  line-height: 1;
}

.method[open] > summary { color: var(--ink); font-weight: 600; }

.method-text {
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.5;
}


/* Urban area picker, where the suburb search used to be ------------------- */

.city-picker select {
  appearance: none;
  min-width: 170px;
  padding: 9px 30px 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface) url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 8l5 5 5-5' fill='none' stroke='%2355646c' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 9px center/15px;
  box-shadow: var(--shadow);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
}

.city-picker select:hover { border-color: var(--line-strong); }

/* The opening view: every place, before anything heavy is downloaded ------ */

.start {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(12, 12, 72, 0.35);
  backdrop-filter: blur(3px);
}

.start-card {
  width: min(820px, 100%);
  max-height: 90vh;
  overflow: auto;
  padding: 26px 28px 20px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

/* The mark sits level with the name and tagline as one block. */
.start-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; }
.start-mark { display: block; width: 46px; height: 46px; }
.start-titles h1 { margin: 0; color: var(--navy); font-size: 28px; font-weight: 800; letter-spacing: 0.08em; line-height: 1; }
.start-tagline { margin: 5px 0 0; color: var(--muted); font-size: 13px; line-height: 1.2; }
.start-lab { align-self: start; display: inline-flex; align-items: center; gap: 6px; color: var(--navy); font-size: 12px; font-weight: 600; text-decoration: none; }
.start-lab:hover { text-decoration: underline; }
.start-lede { max-width: 62ch; margin: 18px 0 12px; color: var(--ink); font-size: 16px; line-height: 1.5; }
.start-actions { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.start-button { padding: 7px 14px; border: 1px solid var(--line-strong); border-radius: 999px; background: #fff; color: var(--navy); font-size: 13px; font-weight: 600; cursor: pointer; }
.start-button:hover { border-color: var(--navy); }

.start-featured { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.start-feature {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  height: 100%;
  padding: 10px 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.start-feature:hover { border-color: var(--navy); box-shadow: var(--shadow); }
.start-open { margin-top: auto; padding-top: 4px; color: var(--accent); font-size: 13px; font-weight: 600; }
.start-open::after { content: " →"; transition: margin-left 0.15s; }
.start-feature:hover .start-open { color: var(--navy); text-decoration: underline; }
.start-feature:hover .start-open::after { margin-left: 3px; }
.start-thumb { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: contain; border-radius: 8px; background: var(--wash); }
.start-feature-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.start-city-name { color: var(--navy); font-size: 17px; font-weight: 700; }
.start-city-people { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.start-stats { display: grid; grid-template-columns: max-content 1fr; gap: 6px 10px; align-items: baseline; color: var(--ink-soft); font-size: 12.5px; line-height: 1.3; }
.start-stat { display: contents; }
.start-stat strong { color: var(--navy); font-size: 17px; font-variant-numeric: tabular-nums; }
.start-key { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin: 10px 0 0; color: var(--muted); font-size: 12px; }
.start-key > span { display: inline-flex; align-items: center; gap: 6px; }
.key-dot { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 2px; }
.key-dot.is-met { background: #2a78d6; }
.key-dot.is-missed { background: #eb6834; }

.start-sub { margin: 22px 0 4px; color: var(--navy); font-size: 14px; font-weight: 700; }
.start-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.7fr) minmax(0, 1.3fr) minmax(0, 1.3fr) 14px;
  gap: 14px;
  align-items: center;
  width: 100%;
  padding: 8px 6px;
  border: 0;
  border-top: 1px solid var(--line);
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.start-row:hover { background: var(--wash); }
.start-go { color: var(--muted); font-size: 20px; line-height: 1; text-align: right; }
.start-row:hover .start-go { color: var(--navy); }
.start-row .start-city-name { font-size: 15px; }
.start-row-head { border-top: 0; color: var(--muted); font-size: 11.5px; font-weight: 600; line-height: 1.3; cursor: default; }
.start-row-head:hover { background: none; }
.start-bar { display: grid; grid-template-columns: 4em 1fr; align-items: center; gap: 8px; }
.start-bar-value { color: var(--navy); font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.start-bar-fill { display: block; height: 6px; border-radius: 3px; background: #6da7ec; }
.start-bar-label { display: none; }
.start-note { margin-top: 14px; }

@media (max-width: 680px) {
  .start { padding: 10px; }
  .start-card { padding: 18px 16px 14px; max-height: 94vh; }
  .start-lab span { display: none; }
  .start-featured { grid-template-columns: 1fr; }
  .start-feature { display: grid; grid-template-columns: 104px minmax(0, 1fr); column-gap: 12px; row-gap: 10px; align-items: center; }
  .start-feature-head { flex-direction: column; align-items: flex-start; gap: 2px; }
  .start-stats, .start-open { grid-column: 1 / -1; }
  .start-row { grid-template-columns: minmax(0, 1fr) auto 14px; row-gap: 4px; }
  .start-row .start-bar { grid-column: 1 / 3; grid-template-columns: 4em minmax(0, 1fr) 8.5em; }
  .start-go { grid-column: 3; grid-row: 1 / span 3; align-self: center; }
  .start-bar-label { display: block; color: var(--muted); font-size: 11.5px; }
  .start-row-head { display: none; }
}

@media (max-width: 760px) {
  .city-picker select { min-width: 132px; }
}


/* Who misses out: the split, and which way access leans ------------------ */

.split {
  margin: 10px 0 2px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.split-row {
  display: flex;
  gap: 8px;
  align-items: baseline;
  padding: 9px 11px;
  font-size: 13px;
  line-height: 1.35;
}

.split-row + .split-row { border-top: 1px solid var(--line); }
.split-row strong { color: var(--navy); font-size: 15px; font-variant-numeric: tabular-nums; }
.split-row span { color: var(--ink-soft); }

.lean {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin: 10px 0 2px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.4;
}

.lean-dot {
  width: 9px;
  height: 9px;
  flex: none;
  border-radius: 50%;
  transform: translateY(-1px);
}

.lean-dot.is-toward { background: #1a7f5a; }
.lean-dot.is-away { background: #c2452d; }
.lean-dot.is-even { background: var(--line-strong); }


/* The second row of destinations sits under the kind it belongs to -------- */

.chips-sub {
  margin-top: 5px;
  padding-left: 10px;
  border-left: 2px solid var(--line);
}

.chips-sub .chip {
  padding: 5px 10px;
  font-size: 12.5px;
}


/* Modes kept for comparison sit apart from the ones that count ------------ */

.compare-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
}

.compare-label {
  flex: none;
  color: var(--muted);
  font-size: 11.5px;
}

.chips-quiet .chip {
  border-style: dashed;
  color: var(--muted);
}

.chips-quiet .chip[aria-checked="true"] {
  border-style: solid;
  color: #fff;
}


/* A key that fills itself from whatever layers are switched on ----------- */

.map-key {
  display: grid;
  gap: 5px;
  max-width: 230px;
  padding: 9px 11px;
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.key-row { display: flex; gap: 8px; align-items: center; }
.key-label { color: var(--ink-soft); font-size: 12px; line-height: 1.3; }

.key-swatch { flex: none; }
.key-line { width: 18px; height: 0; border-top: 3px solid var(--swatch); border-radius: 2px; }
.key-dash { width: 18px; height: 0; border-top: 2px dashed var(--swatch); }
.key-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--swatch); }
.key-ring {
  width: 10px;
  height: 10px;
  border: 1.5px solid var(--swatch);
  border-radius: 50%;
  background: #fff;
}

.point-popup .maplibregl-popup-content {
  padding: 9px 26px 10px 11px;
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.point-card { display: grid; gap: 2px; }
.point-card strong { color: var(--navy); font-size: 13px; }
.point-card span { color: var(--ink-soft); font-size: 12px; }

@media (max-width: 760px) {
  .map-key { max-width: 170px; padding: 7px 9px; }
  .key-label { font-size: 11px; }
}

/* Line charts: a few series read against each other ----------------------- */
.line-chart { width: 100%; height: auto; overflow: visible; }
.line-chart .grid { stroke: var(--line); stroke-width: 1; }
.line-chart .marker { stroke: var(--navy); stroke-width: 1; stroke-dasharray: 3 3; }
.line-chart .axis { fill: var(--muted); font-size: 9px; }
.line-chart .series { fill: none; stroke-width: 1.6; opacity: 0.8; }
.line-chart .series.is-emphasis { stroke-width: 2.4; opacity: 1; }
.line-chart .series-label { font-size: 9.5px; font-weight: 600; }
.robust { border-top: 1px solid var(--line); padding-top: 8px; }
.robust > summary { cursor: pointer; color: var(--accent); font-size: 13px; font-weight: 600; }
.robust-body { display: flex; flex-direction: column; gap: 10px; padding-top: 8px; }
.robust-row { display: grid; grid-template-columns: 52px 1fr; gap: 8px; align-items: baseline; font-size: 13px; }
.robust-row strong { color: var(--navy); font-size: 17px; font-variant-numeric: tabular-nums; }

/* Rest homes and villages, and NORC suburbs, on Where they live ---------- */

.village-key { display: flex; align-items: flex-start; gap: 8px; }
.village-swatch { width: 12px; height: 12px; flex: none; border-radius: 2px; margin-top: 2px; }
.rank-name .tag {
  display: inline-block;
  padding: 0 5px;
  border-radius: 3px;
  background: var(--navy);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 16px;
  vertical-align: 1px;
}

/* The areas around the one the panel is for, under the headline ---------- */

.hero-whole { margin: 6px 0 0; font-size: 13px; line-height: 1.5; color: var(--muted); }
.hero-whole-item {
  padding: 0;
  border: 0;
  background: none;
  color: var(--navy);
  font: inherit;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
  cursor: pointer;
}
.hero-whole-item:hover { text-decoration-color: currentColor; }
.hero-whole-item strong { font-weight: 700; }
