/* ============================================================
   TOKENS
   The entire visual language lives here. Swapping this block
   swaps the design; no component rule contains a raw colour.
   ============================================================ */
:root {
  --paper:      #FFFFFF;
  --panel:      #F3F2F1;
  --panel-2:    #E8E8E8;
  --ink:        #0B0C0C;
  --ink-2:      #505A5F;
  --ink-3:      #6F777B;
  --line:       #B1B4B6;
  --line-2:     #D8D8D8;
  --accent:     #1D70B8;
  --accent-dark:#003078;
  --accent-ink: #FFFFFF;
  --focus:      #FFDD00;

  --c1: #00703C;
  --c2: #B45309;
  --c3: #C2410C;
  --c4: #B91C1C;
  --c5: #7F1D1D;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --max: 1020px;
}

[data-theme="dark"] {
  --paper:      #0B0C0C;
  --panel:      #1D1F20;
  --panel-2:    #26292B;
  --ink:        #F3F2F1;
  --ink-2:      #B1B4B6;
  --ink-3:      #8A8F93;
  --line:       #3A3D3F;
  --line-2:     #2A2D2F;
  --accent:     #5694CA;
  --accent-dark:#8FB8DE;
  --accent-ink: #0B0C0C;
  --focus:      #FFDD00;

  --c1: #4CAF6E;
  --c2: #E3A33C;
  --c3: #F08A4B;
  --c4: #F26D6D;
  --c5: #FF9B9B;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 20px; }

a { color: var(--accent); }
a:hover { color: var(--accent-dark); }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 0;
  box-shadow: 0 0 0 6px var(--ink);
}

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 62px;
}

.service-name {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 19px;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -.01em;
  white-space: nowrap;
}

.service-name svg { display: block; flex: none; }

.header-nav {
  display: flex;
  gap: 20px;
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
}

.header-nav::-webkit-scrollbar { display: none; }

.header-nav a {
  font-size: 15px;
  color: var(--ink-2);
  text-decoration: none;
  padding: 6px 0;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}

.header-nav a:hover { color: var(--ink); border-bottom-color: var(--line); }
.header-nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

.theme-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 7px 11px;
  cursor: pointer;
  white-space: nowrap;
}

.theme-btn:hover { background: var(--panel); }

/* ============================================================
   MAIN
   ============================================================ */
main { padding: 34px 0 0; }

h1 {
  font-size: clamp(28px, 4vw, 38px);
  line-height: 1.1;
  letter-spacing: -.02em;
  font-weight: 700;
  margin: 0;
}

.lede {
  font-size: 19px;
  color: var(--ink-2);
  margin: 12px 0 0;
  max-width: 60ch;
}

/* form */
.route-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 16px;
  align-items: end;
  margin-top: 26px;
}

.field label {
  display: block;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  height: 46px;
  padding: 0 12px;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 0;
}

.field input::placeholder { color: var(--ink-3); }

.btn {
  height: 46px;
  padding: 0 22px;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  color: var(--accent-ink);
  background: var(--accent);
  border: 2px solid transparent;
  border-radius: 0;
  box-shadow: 0 3px 0 var(--accent-dark);
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover { background: var(--accent-dark); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--accent-dark); }

.form-note {
  font-size: 14px;
  color: var(--ink-2);
  margin: 12px 0 0;
}

/* section heading */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: 40px 0 12px;
}

h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.01em;
  margin: 0;
}

.section-head .meta {
  font-size: 14px;
  color: var(--ink-2);
  white-space: nowrap;
}

/* ============================================================
   MAP
   ============================================================ */
.map-shell {
  position: relative;
  height: 520px;
  border: 1px solid var(--line);
  background: var(--panel);
  overflow: hidden;
}

#map { position: absolute; inset: 0; }

.map-controls {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 5;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.map-controls.right { left: auto; right: 12px; }

.toggle {
  font: inherit;
  font-size: 13px;
  padding: 6px 11px;
  background: var(--paper);
  color: var(--ink-2);
  border: 1px solid var(--line);
  cursor: pointer;
}

.toggle[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.legend {
  position: absolute;
  left: 12px;
  bottom: 86px;
  z-index: 5;
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 9px 11px;
}

.legend .title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-2);
  margin-bottom: 7px;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--ink-2);
  padding: 2px 0;
}

.legend-row i {
  width: 18px;
  height: 4px;
  display: block;
  flex: none;
}

.scrubber {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 5;
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 10px 14px 8px;
}

.scrub-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

.scrub-head .label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-2);
}

.scrub-head .value { font-size: 14px; font-weight: 700; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--line-2);
  outline: none;
  margin: 0;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  background: var(--accent);
  border: 2px solid var(--paper);
  box-shadow: 0 0 0 1px var(--ink);
  cursor: grab;
}

input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px;
  background: var(--accent);
  border: 2px solid var(--paper);
  box-shadow: 0 0 0 1px var(--ink);
  cursor: grab;
}

.scrub-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 5px;
}

/* ============================================================
   TABLE
   ============================================================ */
.table-scroll { overflow-x: auto; border: 1px solid var(--line); }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  min-width: 620px;
}

thead th {
  text-align: left;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
  padding: 10px 14px;
  border-bottom: 2px solid var(--ink);
  white-space: nowrap;
}

tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--panel); }

td.r, th.r { text-align: right; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  white-space: nowrap;
}

.status i {
  width: 10px;
  height: 10px;
  display: block;
  flex: none;
}

.muted { color: var(--ink-3); }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  margin-top: 56px;
  border-top: 1px solid var(--line);
}

.footer-art {
  margin: 0;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  line-height: 0;
  overflow: hidden;
}

.footer-art svg { display: block; width: 100%; height: auto; }

.ink-line { stroke: var(--ink); fill: none; }
.ink-soft { stroke: var(--ink); fill: none; opacity: .45; }
.ink-faint { stroke: var(--ink); fill: none; opacity: .2; }
.ink-solid { fill: var(--ink); }

/* Three columns: brand, then two link lists. The brand and the column
   headings share a baseline so the block reads as one unit. */
.footer-links {
  display: grid;
  grid-template-columns: 1.7fr 1fr 1fr;
  gap: 40px;
  padding: 40px 0 34px;
  align-items: start;
}

.footer-brand .service-name {
  display: inline-flex;
  margin-bottom: 14px;
}

.footer-brand p {
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink-2);
  margin: 0;
  max-width: 36ch;
}

.footer-links h3 {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 14px;
  color: var(--ink);
}

.footer-links a {
  display: block;
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink-2);
  text-decoration: none;
  padding: 5px 0;
}

.footer-links a:hover { color: var(--ink); text-decoration: underline; }

.footer-bottom {
  border-top: 1px solid var(--line);
  padding: 18px 0 30px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-2);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px 32px;
  flex-wrap: wrap;
}

.footer-bottom p { margin: 0; }
.footer-bottom p:last-child { color: var(--ink-3); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 860px) {
  .route-form { grid-template-columns: 1fr; }
  .btn { width: 100%; }
  .footer-links { grid-template-columns: 1fr 1fr; gap: 28px 24px; }
  .footer-brand { grid-column: 1 / -1; }
  .map-shell { height: 420px; }
  .legend { display: none; }
  main { padding-top: 26px; }
}

@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
  .header-inner { gap: 14px; min-height: 56px; }
  .service-name { font-size: 17px; }
  .header-nav { gap: 16px; }
  .header-nav a { font-size: 14px; }
  .theme-btn span { display: none; }
  .map-shell { height: 360px; }
  .lede { font-size: 17px; }
  h2 { font-size: 19px; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 2px; }
}

/* ============================================================
   SKIP LINK
   ============================================================ */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 16px;
  font-size: 15px;
  text-decoration: none;
}

.skip-link:focus {
  left: 8px;
  top: 8px;
}

/* ============================================================
   PAGE HEAD (secondary pages)
   ============================================================ */
.page-head { padding: 34px 0 6px; }

.page-head h1 {
  font-size: clamp(26px, 3.6vw, 34px);
  line-height: 1.12;
  letter-spacing: -.02em;
  font-weight: 700;
  margin: 0;
}

.page-head .lede { margin-top: 10px; }

/* ============================================================
   PROSE (about, privacy)
   ============================================================ */
.prose {
  max-width: 68ch;
  padding: 18px 0 0;
}

.prose h2 {
  font-size: 19px;
  font-weight: 700;
  margin: 32px 0 8px;
  letter-spacing: -.01em;
}

.prose h2:first-child { margin-top: 8px; }

.prose p {
  margin: 0 0 14px;
  color: var(--ink-2);
  font-size: 16px;
  line-height: 1.65;
}

.prose a { color: var(--accent); }

/* ============================================================
   LOADING STATES
   ============================================================ */
.skeleton {
  display: block;
  height: 14px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--panel) 25%, var(--panel-2) 37%, var(--panel) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

.skeleton-text { width: 60%; }

.skeleton-row td { padding: 14px; }

@keyframes shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  display: inline-block;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; border-top-color: var(--line); }
}

.map-loading {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--panel);
  color: var(--ink-2);
  font-size: 14px;
  transition: opacity .25s ease;
}

.map-loading[hidden] { display: none; }

/* ============================================================
   CAMERA GRID
   ============================================================ */
.cam-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 4px;
}

.cam {
  border: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
}

.cam-frame {
  position: relative;
  aspect-ratio: 640 / 352;
  background: var(--panel);
}

.cam-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .3s ease;
}

.cam-frame img.is-loaded { opacity: 1; }

.cam-frame .skeleton {
  position: absolute;
  inset: 0;
  height: 100%;
  border-radius: 0;
}

.cam-name {
  padding: 9px 11px;
  font-size: 13px;
  border-top: 1px solid var(--line);
  min-height: 38px;
}

/* ============================================================
   LIST (incidents)
   ============================================================ */
.list { border-top: 1px solid var(--line); }

.list-item {
  display: flex;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line-2);
}

.list-item .tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 3px 7px;
  height: fit-content;
  white-space: nowrap;
  border: 1px solid currentColor;
}

.list-item .body { flex: 1; }
.list-item .title { font-size: 15px; line-height: 1.4; }
.list-item .meta { font-size: 13px; color: var(--ink-3); margin-top: 3px; }

/* ============================================================
   404
   ============================================================ */
.notfound { padding: 64px 0 40px; max-width: 60ch; }

.notfound h1 {
  font-size: clamp(30px, 4.4vw, 42px);
  letter-spacing: -.02em;
  margin: 10px 0 0;
}

.notfound-links {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 28px;
}

.link-quiet {
  font-size: 15px;
  color: var(--ink-2);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  padding-bottom: 2px;
}

.link-quiet:hover { color: var(--ink); border-bottom-color: var(--ink); }

/* ============================================================
   MOBILE: keep the CTA above the fold
   ============================================================ */
@media (max-width: 560px) {
  .hero { padding: 20px 0 16px; }
  .hero h1 { font-size: 27px; line-height: 1.1; }
  .hero .lede { font-size: 15px; margin-top: 8px; }
  .route-form { margin-top: 16px; gap: 10px; }
  .field input { height: 44px; }
  .btn { height: 44px; }
  .form-note { margin-top: 8px; font-size: 13px; }
  .page-head { padding: 22px 0 4px; }
  .notfound { padding: 40px 0 28px; }
}

/* ============================================================
   SHOW MORE
   ============================================================ */
.more-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
}

.more-btn {
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--line);
  padding: 10px 18px;
  cursor: pointer;
}

.more-btn:hover { border-color: var(--accent); }

.more-note { font-size: 14px; color: var(--ink-3); }
