* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; }
body { font-family: var(--nv-font); color: var(--nv-ink); background: #fff; --nv-accent: #e9b83a; --nv-r: 6px; }
button { font: inherit; cursor: pointer; color: inherit; min-height: 44px; border: 1px solid var(--nv-line); border-radius: var(--nv-r); background: #fff; }
button:focus-visible { outline: 3px solid #e9b83a; outline-offset: 2px; }
svg:not(.leaflet-zoom-animated) { width: 20px; height: 20px; flex: 0 0 auto; vertical-align: middle; }
.hidden { display: none !important; }
#map { position: fixed; inset: calc(var(--nv-bar-h) + 56px) 380px 0 0; z-index: 0; }
.topbar { position: fixed; top: var(--nv-bar-h); left: 0; right: 380px; height: 56px; padding: 0 12px; align-items: center; background: #fff; border-bottom: 1px solid var(--nv-line); z-index: 500; display: flex; gap: 8px; min-width: 0; }
.filter-strip { display: flex; gap: 6px; min-width: 0; flex: 1; overflow-x: auto; scrollbar-width: none; -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 20px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 20px), transparent); }
.filter-btn { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; padding: 8px 12px; flex-shrink: 0; font-size: 13px; }
.filter-btn.active { background: #e9b83a; border-color: var(--nv-ink); color: var(--nv-ink); }
.chip-count { font-size: 11px; font-variant-numeric: tabular-nums; }
.topbar-btn, #panelClose, #dismissFlood { display: grid; place-items: center; width: 44px; flex-shrink: 0; }
.panel { position: fixed; top: var(--nv-bar-h); right: 0; bottom: 0; width: 380px; max-width: 100%; z-index: 600; display: flex; flex-direction: column; background: #fff; border-left: 1px solid var(--nv-line); }
.panel-header { padding: 8px 12px; border-bottom: 1px solid var(--nv-line); min-width: 0; }
.status-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--nv-muted); }
#updatedLabel.stale { color: var(--nv-bad); }
.panel-tabs { display: flex; overflow-x: auto; gap: 4px; min-width: 0; scrollbar-width: none; }
.ptab { flex: 0 0 auto; font-size: 12px; border: none; padding: 8px; }
.ptab.active { background: #e9b83a; }
.panel-body { flex: 1; min-height: 0; min-width: 0; overflow: auto; overscroll-behavior: contain; padding: 0 16px; }
.traffic-card { width: 100%; min-width: 0; display: block; text-align: left; border: 0; border-bottom: 1px solid var(--nv-line); border-radius: 0; background: #fff; padding: 16px 0; overflow-wrap: anywhere; }
.traffic-card strong { display: block; font-size: 14px; line-height: 1.45; }
.traffic-card p { margin: 6px 0; color: var(--nv-muted); font-size: 13px; line-height: 1.5; }
.traffic-card small { color: var(--nv-muted); font-size: 12px; }
.empty-state { padding: 20px 0; line-height: 1.5; color: var(--nv-muted); font-size: 14px; }
.source-note { padding: 10px 16px; margin: 0; font-size: 11px; color: var(--nv-muted); border-top: 1px solid var(--nv-line); }
.sheet-handle { display: none; }
.traffic-location { position: fixed; right: 392px; bottom: 24px; z-index: 500; width: 52px; height: 52px; padding: 0; display: grid; place-items: center; background: #fff; border-color: var(--nv-line); color: var(--nv-ink); border-radius: var(--nv-r); box-shadow: 0 1px 3px rgba(0,0,0,.18); }
.panel-open-btn { position: fixed; right: 12px; bottom: 84px; z-index: 500; padding: 8px 12px; }
.flood-banner { position: fixed; top: calc(var(--nv-bar-h) + 68px); left: 12px; right: 392px; z-index: 550; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; background: #fff; border: 2px solid #e9b83a; border-radius: var(--nv-r); font-size: 13px; }
.map-marker, .map-cluster { display: grid; place-items: center; width: 36px; height: 36px; background: #fff; border: 2px solid #e9b83a; border-radius: var(--nv-r); color: var(--nv-ink); }
.map-cluster { background: #e9b83a; font-weight: 700; }
.leaflet-popup-content { max-width: min(300px, calc(100vw - 70px)); overflow-wrap: anywhere; line-height: 1.5; }
.camera-image { display: block; width: 100%; height: auto; min-height: 100px; margin: 8px 0; background: var(--nv-line); }
.skeleton { height: 12px; margin: 14px 0; background: var(--nv-line); border-radius: var(--nv-r); animation: skeleton-pulse 1.5s ease-in-out infinite alternate; }
.skeleton:nth-child(2) { width: 75%; }
.skeleton:nth-child(3) { width: 50%; }
@keyframes skeleton-pulse { to { opacity: .4; } }
@media (max-width: 767px) {
 #map { inset: calc(var(--nv-bar-h) + 56px) 0 0; }
 .topbar { right: 0; }
 .panel { top: auto; bottom: 0; width: 100%; height: var(--sheet-height, var(--ns-half)); border: 1px solid var(--nv-line); border-radius: var(--nv-r) var(--nv-r) 0 0; transition: height .18s ease; }
 .panel.dragging { transition: none; }
 .sheet-handle { display: grid; place-items: center; width: 100%; min-height: 44px; border: 0; background: transparent; touch-action: none; flex-shrink: 0; }
 .sheet-handle span { width: 40px; height: 4px; background: var(--nv-muted); border-radius: var(--nv-r); }
 .panel-header { padding-top: 0; }
 .traffic-location { right: 12px; bottom: calc(var(--sheet-height, var(--ns-half)) + 12px); transition: bottom .18s ease; }
 .panel.dragging ~ .traffic-location { transition: none; }
 .flood-banner { right: 12px; }
 .source-note { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
 .leaflet-control-zoom { display: none; }
 /* Below the tall sheet state the list gets the room; sources and the FAQ show once the sheet is open. */
 .panel:not([data-sheet="2"]) .source-note, .panel:not([data-sheet="2"]) .page-about-inline { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.traffic-more { width: 100%; margin: 12px 0 16px; min-height: 44px; font-size: 13px; font-weight: 600; }
.leaflet-popup-content strong:first-child { padding-right: 28px; }

/* Congestion legend: ink (slow) to yellow (fast), with the km/h range printed on every step. */
.cong-legend { position: fixed; left: 12px; bottom: 88px; z-index: 500; width: 188px; background: #fff; border: 1px solid var(--nv-line); border-radius: var(--nv-r); box-shadow: 0 1px 3px rgba(0,0,0,.18); font-size: 12px; }
.cong-legend summary { display: flex; align-items: center; min-height: 44px; padding: 0 12px; font-weight: 600; cursor: pointer; }
.cong-legend summary:focus-visible { outline: 3px solid #e9b83a; outline-offset: 2px; }
.cong-body { padding: 0 12px 10px; }
.cong-legend[open] .cong-body { animation: cong-in .28s cubic-bezier(.16, 1, .3, 1); }
.cong-scale { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; font-variant-numeric: tabular-nums; }
.cong-scale li { display: flex; align-items: center; gap: 8px; }
.cong-swatch { width: 28px; height: 8px; border-radius: 4px; border: 1px solid rgba(18, 19, 22, .35); }
.cong-unit { color: var(--nv-muted); }
.cong-fresh, .cong-note { margin: 8px 0 0; color: var(--nv-muted); line-height: 1.4; }
@keyframes cong-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Expressway board: total minutes first, direction second. */
.exp-card { position: relative; padding-right: 76px; transition: background-color .15s ease-out, transform .15s cubic-bezier(.16, 1, .3, 1); }
.exp-card:hover { background: #fbf6e6; }
.exp-card:active { transform: scale(.985); }
.exp-card.is-picked { background: #fbf0cc; }
.exp-card:focus-visible { outline: 3px solid #e9b83a; outline-offset: -3px; }
.exp-time { position: absolute; top: 14px; right: 0; display: inline-block; padding: 4px 10px; border-radius: var(--nv-r); background: #e9b83a; color: var(--nv-ink); font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
.exp-towards { font-weight: 400; color: var(--nv-muted); }
.exp-card.is-new { animation: exp-in .4s cubic-bezier(.16, 1, .3, 1) both; animation-delay: calc(var(--i, 0) * 40ms); }
@keyframes exp-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Taxi count and nearest stand sit above the list while a taxi layer is on. */
.taxi-summary { padding: 10px 16px; border-bottom: 1px solid var(--nv-line); font-size: 13px; line-height: 1.5; }
.taxi-summary p { margin: 0; }
.ts-count { display: inline-block; min-width: 1ch; font-size: 20px; font-variant-numeric: tabular-nums; }
.ts-stand { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 6px; color: var(--nv-muted); }
.ts-stand-open { min-height: 44px; padding: 0 12px; font-size: 13px; font-weight: 600; transition: transform .15s cubic-bezier(.16, 1, .3, 1); }
.ts-stand-open:active { transform: scale(.97); }
.filter-btn:active { transform: scale(.97); }
@media (max-width: 767px) {
  .cong-legend { bottom: calc(var(--sheet-height, var(--ns-half)) + 12px); transition: bottom .18s ease; }
  .cong-legend:not([open]) { width: auto; }
  .panel[data-sheet="0"] .taxi-summary { display: none; }
}
@media (prefers-reduced-motion: reduce) { .cong-legend[open] .cong-body, .exp-card.is-new { animation: none !important; } }

/* Short phones: at full height the sheet leaves under 100px of map, so the locate button would sit on the filter chips. It returns as soon as the sheet is lowered. */
@media (max-width: 767px) and (max-height: 760px) { .panel[data-sheet="2"] ~ .traffic-location { display: none; } }

/* Desktop: the panel floats on the left like Bike, Recycling and Sea. */
@media (min-width: 768px) {
  #map { inset: calc(var(--nv-bar-h) + 56px) 0 0 0; }
  .topbar { right: 0; }
  .panel { top: calc(var(--nv-bar-h) + 56px + 12px); right: auto; left: 12px; bottom: 12px; border: 1px solid var(--nv-line); border-radius: var(--nv-r); box-shadow: 0 8px 28px -12px rgba(28, 36, 56, .35); }
  .traffic-location { right: 12px; bottom: 112px; }
  .panel-open-btn { right: auto; left: 12px; bottom: auto; top: calc(var(--nv-bar-h) + 68px); }
  .flood-banner { left: 384px; right: 12px; }
}
