/* STAND: a full-size map with compact control surfaces.
   Interface colours follow the Better Places Lab (as in TEAM and ALTO); data colours live in js/app.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;
  --dock: #d81b7a;
  --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; }
.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;
}
/* the skip link's targets (the panel, or on a phone an open site's sheet): a mouse click inside draws no ring */
.panel:focus, .place:focus { outline: none; }
.panel:focus-visible, .place:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: var(--radius); }
.brand { display: flex; flex-wrap: wrap; align-items: center; gap: 0 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 0; min-width: 0; }  /* basis 0: the name's row never wraps the buttons below it */
/* "SPAN › Bike parking": where STAND sits in SPAN. A row of its own above the name, in line with it (past the 36 px
   mark and the 8 px gap), so it has the header's whole width. The links reach 5 px above and below the line, for a
   larger target than the text */
.crumbs { display: flex; flex: 1 0 100%; align-items: center; gap: 5px; margin: 0 0 5px; padding-left: 44px; color: var(--muted); font-size: 11.5px; font-weight: 600; line-height: 14px; white-space: nowrap; }
.crumb { display: inline-flex; align-items: center; gap: 4px; margin: -5px 0; padding: 5px 0; color: var(--ink-soft); text-decoration: none; }
a.crumb:hover { color: var(--navy); text-decoration: underline; }
.crumb img { flex: none; width: 13px; height: 13px; }
body[data-panel="collapsed"] .crumbs { display: none; }
.brand h1 { margin: 0; color: var(--navy); font-size: 22px; font-weight: 800; letter-spacing: 0.08em; line-height: 1; }
.brand h1 abbr { text-decoration: none; cursor: help; }  /* the name's expansion shows on hover and is read out */
.brand p { margin: 3px 0 0; font-size: 11.5px; line-height: 1.3; }
.tagline { color: var(--muted); text-wrap: balance; }  /* the whole line, on two lines where the header is narrow */
.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; flex: none; 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; margin-left: auto; font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; accent-color: var(--navy); }
.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); }

.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; }

.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 { padding: 2px 0; }
.hero-figure { color: var(--navy); font-size: 48px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; font-variant-numeric: tabular-nums; }
.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-title { color: var(--muted); font-size: 12px; font-weight: 600; }
.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-label { color: var(--muted); font-size: 11px; line-height: 1.2; }
.legend-keys { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.legend-key { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-soft); }
.key-dot { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.15); }
.key-dot.is-dock { width: 14px; height: 14px; background: var(--dock); }
.key-dot.is-possible { width: 12px; height: 12px; background: #fff; border: 2px dashed var(--dock); box-shadow: none; }
.key-sq { width: 10px; height: 10px; border-radius: 2px; }
.key-line { flex: none; width: 18px; height: 3px; border-radius: 2px; }

.rank-list { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }
.rank-row { display: grid; grid-template-columns: 26px 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:hover, .rank-row.is-focus { background: var(--wash); }
.rank-n { grid-area: n; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--dock); color: #fff; font-size: 12px; font-weight: 700; }
.rank-name { grid-area: name; font-weight: 600; line-height: 1.25; }
.rank-meta { grid-area: meta; color: var(--ink-soft); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rank-reason { grid-area: reason; color: var(--muted); font-size: 12px; }

.weights { display: flex; flex-direction: column; gap: 8px; }
.weight-row { display: grid; grid-template-columns: 132px 1fr 34px; align-items: center; gap: 8px; font-size: 12.5px; }
.weight-row label { color: var(--ink-soft); line-height: 1.25; }
.weight-row output { text-align: right; font-variant-numeric: tabular-nums; color: var(--navy); font-weight: 600; }
.area-actions { display: flex; gap: 14px; justify-content: space-between; align-items: center; }

.bars { display: flex; flex-direction: column; gap: 5px; }
.bar-row { display: grid; grid-template-columns: 132px 1fr minmax(42px, auto); align-items: center; gap: 8px; font-size: 12.5px; }
.bar-label { color: var(--ink-soft); line-height: 1.25; }
.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-value { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.panel-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2px 10px; padding: 9px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11.5px; }
.lab-link { display: inline-flex; align-items: center; gap: 6px; color: var(--navy); font-weight: 600; text-decoration: none; white-space: nowrap; }
a.lab-link:hover { text-decoration: underline; }
.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; }

/* ------------------------------------------------------------------ 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; }
.eyebrow.is-dock { color: var(--dock); }
.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; }
.place-section p { margin: 0 0 6px; font-size: 13px; line-height: 1.45; }
.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; }
.badge { padding: 2px 6px; border-radius: 999px; font-size: 11px; font-weight: 700; text-align: center; }
.badge.is-good { background: #dbe8f8; color: #184f95; }
.badge.is-poor { background: #fbe3d6; color: #833607; }
.badge.is-dock { background: #fbe0ee; color: #9b0f55; }

/* ------------------------------------------------------------------ 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; }
.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; }
.segmented-full { display: flex; box-shadow: none; }
.segmented-full button { flex: 1 1 auto; padding: 4px 6px; font-size: 12px; }
.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; }
.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); }

.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; width: max-content; max-width: calc(100% - 32px); 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); }
/* the scale bar: beside the panel, not under it (the panel is 364 px wide plus its margin); a collapsed panel is only
   its header, so then it goes back to the corner */
.maplibregl-ctrl-bottom-left { bottom: env(safe-area-inset-bottom); left: calc(max(12px, env(safe-area-inset-left)) + 364px); }
body[data-panel="collapsed"] .maplibregl-ctrl-bottom-left { left: 0; }
/* the open credits wrap to the right of the scale bar (at most 120 px, plus its margin and a gap: 190 px) instead of
   running under it and the panel; with the panel collapsed the scale bar is back in the corner */
@media (min-width: 761px) {
  .maplibregl-ctrl-attrib.maplibregl-compact-show { max-width: calc(100vw - max(12px, env(safe-area-inset-left)) - 364px - 190px); }
  body[data-panel="collapsed"] .maplibregl-ctrl-attrib.maplibregl-compact-show { max-width: calc(100vw - 190px); }
  /* an open site's panel ends 18 px above the open credits (their height in --credits, set by js/app.js) */
  .place { max-height: calc(100% - 64px - max(54px, var(--credits, 0px) + 18px)); }
}
.maplibregl-ctrl-group button { width: 36px; height: 36px; }
.maplibregl-popup-content { font: 12.5px/1.4 var(--font); }

/* ------------------------------------------------------------------ about */
.about { width: min(680px, 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; vertical-align: top; }
.about-table th { color: var(--muted); font-weight: 600; width: 38%; }
.about p a { color: var(--accent); font-weight: 600; }
.about code { font-size: 12.5px; background: var(--wash); padding: 1px 5px; border-radius: 4px; }

/* ------------------------------------------------------------------ small screens */
@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; }
  .panel:focus-visible { border-radius: 16px; }
  /* a bottom sheet: the chevron points down to collapse it and up to expand it */
  .panel-toggle svg { transform: rotate(-90deg); }
  body[data-panel="collapsed"] .panel-toggle svg { transform: rotate(90deg); }
  .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; }
  /* the map controls and the scale bar sit just above whichever sheet is up: the panel, its collapsed header, or a site */
  .maplibregl-ctrl-bottom-right, .maplibregl-ctrl-bottom-left { bottom: calc(62dvh + 20px); }
  .maplibregl-ctrl-bottom-left { left: 0; }
  body[data-panel="collapsed"] .maplibregl-ctrl-bottom-right, body[data-panel="collapsed"] .maplibregl-ctrl-bottom-left { bottom: 90px; }
  body[data-place="open"] .maplibregl-ctrl-bottom-right, body[data-place="open"] .maplibregl-ctrl-bottom-left { bottom: calc(62dvh + 20px); }
  .loading { bottom: 90px; }  /* above the collapsed panel's header, which the phone starts with */
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
