/* VoteGR.org map page: find your polling place anywhere in Kent County and
   a route there around the known plate cameras. */

@font-face {
  font-family: "Hanken Grotesk";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("fonts/hankengrotesk-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215;
}

:root {
  /* Slate, not /simple's near-black: a full-screen map reads heavier. */
  --bg: #191d25;
  --panel: #212630;
  --raise: #2a303b;
  --fg: #eceef2;
  --dim: #aab3c0;
  --line: #39414f;
  --accent: #7cc4ff;
  --warn: #ffcf70;
  --poll: #3ddc84;
  --danger: #ff7a7a;
  --good: #6ee7a5;
  --route-fastsel: #b0565b;
  --route-avoid: #12e07a;
  --case: #12151b;          /* casing under route lines */
  --pin-ring: #12151b;
  --shadow: 0 2px 8px rgba(0,0,0,.45);
  --header-h: 72px;
  /* Column tint. Not --raise, which sits 1.05:1 from the light page; every
     text colour stays above AA on this. */
  --tint: #35383f;
  /* Bevel edges, and the hover on --tint (--raise would be darker than it). */
  --bevel-hi: rgba(255,255,255,.08);
  --bevel-lo: rgba(0,0,0,.22);
  --tint-hover: #43464c;
  /* The one small uppercase label style; rules that step off it say why. */
  --label-size: .74rem;
  --label-track: .1em;
}
/* Light: system preference unless dark was chosen, or an explicit choice.
   Keep both blocks identical; the palette matches simple/lookup.css. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #fbfbfd;
    --panel: #ffffff;
    --raise: #f4f6fa;
    --fg: #1a1d23;
    --dim: #4d5560;
    --line: #dde1e8;
    --accent: #0b62b0;
    --warn: #8a5b00;
    --poll: #178f4a;
    --danger: #b3261e;
    --good: #0f7a43;
    --route-fastsel: #8f2b31;
    --route-avoid: #00963f;
    --case: #ffffff;
    --pin-ring: #ffffff;
    --shadow: 0 2px 8px rgba(20,25,35,.16);
    --tint: #dfe0e3;
    --bevel-hi: rgba(255,255,255,.95);
    --bevel-lo: rgba(20,25,35,.16);
    --tint-hover: #d1d2d6;
  }
}
:root[data-theme="light"] {
  --bg: #fbfbfd;
  --panel: #ffffff;
  --raise: #f4f6fa;
  --fg: #1a1d23;
  --dim: #4d5560;
  --line: #dde1e8;
  --accent: #0b62b0;
  --warn: #8a5b00;
  --poll: #178f4a;
  --danger: #b3261e;
  --good: #0f7a43;
  --route-fastsel: #8f2b31;
  --route-avoid: #00963f;
  --case: #ffffff;
  --pin-ring: #ffffff;
  --shadow: 0 2px 8px rgba(20,25,35,.16);
  --tint: #dfe0e3;
  --bevel-hi: rgba(255,255,255,.95);
  --bevel-lo: rgba(20,25,35,.16);
  --tint-hover: #d1d2d6;
}

* { box-sizing: border-box; }
html { height: 100%; }
/* A viewport-tall flex column keeps the footer at the bottom of short pages. */
body {
  margin: 0; min-height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--bg); color: var(--fg);
  font-family: "Hanken Grotesk", ui-sans-serif, system-ui, -apple-system,
    "Segoe UI", sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

/* Visited links look unvisited: no link here means "you clicked this". */
a, a:visited {
  color: var(--fg); text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--dim) 80%, transparent);
  text-underline-offset: 2px;
}
a:hover, a:focus-visible { color: var(--accent); text-decoration-color: var(--accent); }

/* No tap flash: each of these has a press or open state of its own. */
summary, .vi-dest, .pp-place, .box-open, .box-list li[data-pick],
.section-nav button, .ac-item, ol.steps li {
  -webkit-tap-highlight-color: transparent;
}

/* ---- Column and map ---- */
#col {
  max-width: 34rem;
  width: 100%;
  margin: 0 auto;
  padding: 0 1.25rem 2rem;
  flex: 1 0 auto;
  display: flex; flex-direction: column;
}

/* Asking state (no .has-result). Scaled padding, not flex centring:
   centring pushes the field below the fold on a phone. */
#col:not(.has-result) { padding-top: clamp(1.25rem, 8vh, 4.5rem); }
#col.has-result { padding-top: 1rem; }
/* On a phone the header, countdown and search box share the first screen. */
@media (max-width: 700px) {
  #col:not(.has-result) { padding-top: .9rem; }
}

.map-section { padding: 16px 0 4px; }
/* .map-only: the section is open just to show the map, for pin picking. */
#routeBlock.map-only > h2,
#routeBlock.map-only > #destPick,
#routeBlock.map-only > .routes,
#routeBlock.map-only > #unavoid,
#routeBlock.map-only > #steps { display: none; }

.map-status {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 9px;
  margin: 0 0 4px 4px;
  font-size: var(--label-size); font-weight: 700;
  letter-spacing: var(--label-track);
  text-transform: uppercase; color: var(--accent); white-space: nowrap;
  box-shadow: 0 1px 5px rgba(0,0,0,.22);
}
.map-status:empty { display: none; }
/* z-index 0 makes #map a stacking context, so on a phone Leaflet's panes and
   controls (200 to 1000) cannot paint over the sticky search bar (z-index 5)
   and take its taps. Raising the bar instead would collide with the modals. */
#map {
  height: 320px;
  background: var(--raise);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;   /* keeps Leaflet's tiles inside the rounded corner */
  position: relative; z-index: 0;
}
.map-note {
  font-size: .82rem; color: var(--dim); line-height: 1.45;
}
.pin-cue {
  margin: 0 0 10px; padding: 9px 12px; border-radius: 8px;
  font-size: .92rem; line-height: 1.45; color: var(--fg);
  background: color-mix(in srgb, var(--accent) 12%, var(--raise));
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line));
}

@media (max-width: 600px) {
  #map { height: 280px; }
  #col { padding-left: 1rem; padding-right: 1rem; }
}

/* ---- Two-pane answer, 640px and up ---- */
@media (min-width: 640px) {
  #col.has-result { max-width: 74rem; }

  #routeBlock:not(.map-only) {
    display: grid;
    grid-template-columns: minmax(14.5rem, 23rem) minmax(0, 1fr);
    column-gap: clamp(16px, 3vw, 30px);
    align-items: start;
  }
  #routeBlock:not(.map-only) > h2,
  #routeBlock:not(.map-only) > #destPick,
  #routeBlock:not(.map-only) > .routes,
  #routeBlock:not(.map-only) > #unavoid,
  #routeBlock:not(.map-only) > #steps { grid-column: 1; }
  #routeBlock:not(.map-only) > .map-section {
    grid-column: 2;
    grid-row: 1 / span 9;   /* overshoot; empty implicit rows cost nothing */
    /* 72px: the sticky search bar's height here. Inert today: the map section
       is taller than the directions column, so it has no room to stick. */
    position: sticky; top: 72px;
    padding-top: 0;
  }
  #map { height: clamp(300px, 64vh, 620px); }
}

/* ---- Map key ---- */
/* Under the map, so nothing of ours covers a camera. The empty #mapNote still
   sets the key's position, so it stays in index.html. */
.map-foot {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-top: 8px;
}
.map-foot .map-note { flex: 1 1 16rem; }
.route-key {
  display: flex; align-items: center; gap: 13px;
  font-size: .74rem; line-height: 1.4; flex: none;
}
.rk-row {
  display: flex; align-items: center; gap: 6px;
  color: var(--dim); font-weight: 600;
  letter-spacing: .02em; white-space: nowrap;
}
.rk-row.on { color: var(--fg); font-weight: 800; }
.rk-sw { width: 23px; height: 4.5px; border-radius: 2px; flex: none; opacity: .75; }
.rk-row.on .rk-sw { height: 6px; opacity: 1; }
.route-toggle .sw.avoid, .rk-sw.avoid { background: var(--route-avoid); }
.route-toggle .sw.fast, .rk-sw.fast {
  background: repeating-linear-gradient(115deg,
    var(--route-fastsel) 0 5px, #fff 5px 8px);
}

/* ---- Election day countdown ---- */
/* Left on the lede's 31rem measure, not centred: in the #col flex column,
   margin: 0 auto would shrink-wrap the card to its digits. */
.countdown {
  margin: 0 0 20px;
  padding: 13px 15px 14px;
  background: var(--raise);
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  border-radius: 10px;
  max-width: 31rem;
  text-align: center;
}

/* hidden must beat our display rules; one left an empty "Directions" heading on the desktop start page. */
[hidden] { display: none !important; }

/* Off --label-size: it titles the card. Stays below .cd-num and at or above
   .cd-for and .cd-when (tests/test_page.mjs). Its longest text, "Polls Have
   Closed:", sizes the 400px step-down. */
.cd-label {
  margin: 0 0 10px;
  font-weight: 700; font-size: 1.25rem; letter-spacing: .05em;
  text-transform: uppercase; color: var(--accent);
}

.cd-clock { display: flex; align-items: flex-start; justify-content: center; }
.cd-unit {
  display: flex; flex-direction: column; gap: 3px;
  /* The first unit too, or the centred row sits half a gutter off axis. */
  padding: 0 clamp(11px, 4vw, 20px);
}
.cd-unit + .cd-unit { border-left: 1px solid var(--line); }
.cd-num {
  font-size: clamp(1.5rem, 7vw, 2.1rem);
  font-weight: 700; line-height: 1; letter-spacing: -.02em;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
/* Off --label-size: a caption under its figure, so smaller. */
.cd-lab {
  font-size: .62rem; font-weight: 700; letter-spacing: var(--label-track);
  text-transform: uppercase; color: var(--dim);
}

.cd-today {
  font-size: clamp(1.5rem, 7vw, 2.1rem);
  font-weight: 700; line-height: 1; letter-spacing: -.02em;
  color: var(--poll);
}

.cd-note { margin: 12px 0 0; line-height: 1.5; }
.cd-for, .cd-when {
  font-size: .95rem; font-weight: 700; letter-spacing: -.01em;
}
.cd-for { color: var(--accent); }
.cd-when { color: var(--fg); }

/* Visually hidden, not display:none, so screen readers still get it. */
.cd-said {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}

#col.has-result .countdown { display: none; }

@media (max-width: 400px) {
  .countdown { padding: 11px 12px 12px; }
  .cd-unit { padding: 0 clamp(8px, 3.5vw, 14px); }
  .cd-num, .cd-today { font-size: 1.4rem; }
  .cd-lab { font-size: .58rem; letter-spacing: .07em; }
  .cd-label { font-size: 1.05rem; letter-spacing: .04em; }
  .cd-for, .cd-when { font-size: .87rem; }
}

/* ---- Intro ---- */
.ask { padding: 0 0 26px; }
.ask .lede {
  margin: 0;
  font-size: 1.03rem;
  line-height: 1.62;
  color: var(--dim);
  max-width: 31rem;
}

/* Padding comes from the #resultBlock, #routeBlock rule further down. */
.block { border-top: 1px solid var(--line); }
/* Off the label scale, in --fg: a section title, not one more label. */
.block h2 {
  margin: 0 0 16px; font-size: 1.28rem; font-weight: 800;
  letter-spacing: .06em; text-transform: uppercase; color: var(--fg);
}
@media (max-width: 640px) {
  .block h2 { font-size: 1.12rem; letter-spacing: .05em; }
}
.block h2.dir-head { text-align: center; color: var(--accent); }

/* ---- Address input ---- */
.field { position: relative; }
.field input {
  width: 100%; background: var(--raise); color: var(--fg);
  border: 1.5px solid var(--line); border-radius: 8px;
  /* Room on the left for the pin inside the box. */
  padding: 12px 13px 12px 38px; font: inherit; font-size: 1rem;
}
.field-pin {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--dim); pointer-events: none;
}
.field:focus-within .field-pin { color: var(--accent); }
.field input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.field input::placeholder { color: var(--dim); opacity: .8; }
.hint { font-size: .85rem; color: var(--dim); margin-top: 8px; line-height: 1.45; }
.hint:empty { display: none; }

.section-nav { display: none; }
/* 640, not 700: the pills serve the one-column answer, which ends where the
   two-pane grid begins, and one bound keeps the map's sticky top at 72px. */
@media (max-width: 639.98px) {
  #col.has-result .section-nav:not([hidden]) {
    display: flex; gap: 8px; margin-top: 10px;
  }
  /* 44px, the touch-target floor on both platforms. */
  .section-nav button {
    flex: 1; font: inherit; font-size: .84rem; font-weight: 600;
    color: var(--fg); background: var(--raise); border: 1px solid var(--line);
    border-radius: 999px; padding: 7px 8px; cursor: pointer;
    min-height: 44px;
  }
  .section-nav button:active { border-color: var(--accent); color: var(--accent); }
  .section-nav button.is-current {
    color: var(--accent); border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 15%, var(--raise));
  }
}

/* ---- Voting info ---- */
.vi-rows { display: flex; flex-direction: column; gap: 16px; }
/* app.js adds a "live" class to some labels; it is a hook with no style. */
.vi-lbl {
  font-size: var(--label-size); font-weight: 700;
  letter-spacing: var(--label-track); text-transform: uppercase;
  color: var(--accent); line-height: 1.5; margin-bottom: 2px;
}
/* Text size, not numeral size: "Plainfield Township" would outgrow the rail. */
.vi-name {
  font-size: 1.05rem; font-weight: 700; letter-spacing: -.012em; line-height: 1.25;
}
.vi-num {
  font-size: 1.42rem; font-weight: 700; letter-spacing: -.022em;
  line-height: 1.22;
}
.vi-val { font-size: 1.05rem; font-weight: 600; line-height: 1.35; }

/* Columns are placed explicitly: a row can lack its where-cell, and auto-flow
   would pull the next row's cell into the gap. */
.vi-grid {
  display: grid; grid-template-columns: auto 1fr 1fr;
  gap: 18px 24px; align-items: stretch;
}
/* The rail spans every row. align-items and text-align are both needed: the
   first centres the rows, the second each value under its own label. */
.vi-rail { grid-column: 1; grid-row: 1 / -1; display: flex;
           flex-direction: column; gap: 18px; align-items: center; }
.vi-rail > div { text-align: center; }
.vi-where { grid-column: 2; }
.vi-when { grid-column: 3; }
.vi-grid .vi-full { grid-column: 2 / -1; }
/* No negative margins on these cells: a pull-out overflowed the column and
   closed the row gap. */
.vi-grid .vi-where,
.vi-grid .vi-when {
  background: var(--tint); border-radius: 8px; padding: 12px 14px;
  box-shadow: inset 0 1px 0 var(--bevel-hi), inset 0 -1px 0 var(--bevel-lo);
}
/* Gated on a real pointer: a phone tap sets :hover and leaves it set. */
@media (hover: hover) {
  .vi-grid .pp-place:hover { background: var(--tint-hover); }
}

/* .vi-dest cells pick which address the route goes to; .is-dest marks it. */
.vi-dest { cursor: pointer; }
/* Transitions only under a pointer: an animated tap looked undecided. */
@media (hover: hover) {
  .vi-dest { transition: background .12s, box-shadow .12s; }
  .vi-card, .vi-fold { transition: background-color .16s ease, box-shadow .16s ease; }
}
/* A 1.5px hover ring, thinner than .is-dest's 2px, so the two states differ. */
@media (hover: hover) {
  .vi-dest:hover {
    background: var(--tint-hover);
    box-shadow: inset 0 0 0 1.5px var(--accent),
                inset 0 1px 0 var(--bevel-hi), inset 0 -1px 0 var(--bevel-lo);
  }
  .vi-dest:hover .pp-name { color: var(--accent); }
}
.vi-dest:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.vi-dest.is-dest,
.vi-dest.is-dest:hover {
  box-shadow: inset 0 0 0 2px var(--accent),
              inset 0 1px 0 var(--bevel-hi), inset 0 -1px 0 var(--bevel-lo);
}
/* The reader's own pick: dashed and outside, as a cell can also be .is-dest. */
.vi-where.is-custom { outline: 2px dashed var(--warn); outline-offset: 3px; }
.vi-where.is-custom .vi-lbl { color: var(--warn); }

/* The way of voting in person that is happening today (nowKind in app.js):
   green, so it never reads as the accent ring of the routed pick, which the
   drop box usually holds at the same time. */
.vi-lbl-row { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; }
.vi-now {
  font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  line-height: 1.5; padding: 0 .55em; border-radius: 999px;
  background: var(--good); color: var(--bg);
}
.vi-grid .vi-when.is-now {
  background: color-mix(in srgb, var(--good) 14%, var(--tint));
  box-shadow: inset 4px 0 0 var(--good),
              inset 0 1px 0 var(--bevel-hi), inset 0 -1px 0 var(--bevel-lo);
}

/* A way of voting not open yet or over (early voting outside its window):
   still said, since silence would read as no early voting at all, but greyed
   out, and app.js gives it nothing to click. */
.vi-grid .is-off { opacity: .55; }
.vi-grid .is-off .vi-lbl { color: var(--dim); }

/* Hover inside a selected cell must not paint over the ring's inner edge. */
@media (hover: hover) {
  .vi-dest.is-dest .pp-place:hover { background: var(--tint-hover); }
}

.vi-hours-lbl { color: var(--dim); font-weight: 600; }
.ev-hours-lbl { font-size: .88rem; margin-top: 12px; }
.ev-hours-lbl + .ev-hours { margin-top: 2px; }
/* Off --label-size: these head whole columns, Ward and Precinct included. */
.vi-grid .vi-lbl {
  font-size: .88rem; letter-spacing: .07em; margin-bottom: 4px;
}
/* Too narrow for days beside times, so they stack. */
.vi-grid .ev-hours { grid-template-columns: 1fr; gap: .1rem 0; }
.vi-grid .ev-hours span:nth-child(even) { margin-bottom: .3rem; }
/* 700px, matches isPhone() in app.js, which writes rows as folding cards.
   Where the two disagree, card markup lands on the desktop grid. */
@media (max-width: 700px) {
  .vi-grid { grid-template-columns: 1fr; gap: 16px; }
  /* .vi-grid-prefixed to match the rules above; bare, .vi-full kept 2 / -1
     and pushed the closed-state row off the left edge. */
  .vi-grid .vi-when, .vi-grid .vi-where,
  .vi-grid .vi-full, .vi-grid .vi-rail { grid-column: auto; grid-row: auto; }
  /* Ward and Precinct side by side. stretch, not center: in a row, centring
     takes the three labels off their shared line. */
  .vi-rail { flex-direction: row; gap: 32px; align-items: stretch; }
  .vi-card {
    background: var(--tint); border-radius: 8px;
    box-shadow: inset 0 1px 0 var(--bevel-hi), inset 0 -1px 0 var(--bevel-lo);
  }
  .vi-card .vi-when, .vi-card .vi-where {
    background: none; box-shadow: none; border-radius: 0;
  }
  .vi-card .vi-when { padding: 12px 14px 10px; }
  .vi-card .vi-when .vi-lbl { margin-bottom: 3px; }
  .vi-card .vi-when .vi-val { font-size: 1.12rem; font-weight: 700; }
  .vi-card .vi-when .pp-note { margin-top: 8px; padding-top: 8px; }
  /* The 2.4rem right padding is spare: the chevron it made room for is gone. */
  .vi-card .vi-where {
    padding: 10px 2.4rem 12px 14px; border-top: 1px solid var(--line);
  }
  .vi-card .vi-where .vi-lbl { color: var(--dim); }
  .vi-fold > summary {
    cursor: pointer; list-style: none; display: flex; align-items: center;
  }
  .vi-fold > summary::-webkit-details-marker { display: none; }
  .vi-fold > summary > .vi-when { flex: 1; min-width: 0; }
  .vi-fold > summary::after {
    content: '\203a'; flex: 0 0 auto; margin-left: 6px;
    width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    font-size: 2.1rem; line-height: 1; color: var(--dim);
    transform: rotate(90deg); transition: transform .15s ease, color .15s ease;
  }
  .vi-fold[open] > summary::after { transform: rotate(-90deg); color: var(--fg); }
  .vi-fold[open] {
    display: block; border-radius: 8px;
    background: var(--tint-hover);
    box-shadow: inset 0 1px 0 var(--bevel-hi), inset 0 -1px 0 var(--bevel-lo);
  }
  .vi-fold > summary:active { background: color-mix(in srgb, var(--fg) 9%, transparent); }
  /* The card, not its .vi-when, whose background is cleared above. The open
     fold paints over the card, so it carries the mark too. */
  .vi-card .vi-when.is-now { background: none; box-shadow: none; }
  /* On the card as a whole, not each half, or the fade would compound. */
  .vi-card .is-off { opacity: 1; }
  .vi-card.is-off { opacity: .55; }
  .vi-card.is-now { background: color-mix(in srgb, var(--good) 14%, var(--tint)); }
  .vi-card.is-now,
  .vi-card.is-now .vi-fold[open] {
    box-shadow: inset 4px 0 0 var(--good),
                inset 0 1px 0 var(--bevel-hi), inset 0 -1px 0 var(--bevel-lo);
  }
  .vi-card.is-now .vi-fold[open] {
    background: color-mix(in srgb, var(--good) 14%, var(--tint-hover));
  }
  .vi-fold[open] > summary { border-bottom: 1px solid var(--line); }
  .vi-fold-body > .pp-note, .vi-fold-body > .ev-hours { margin: 0 14px 12px; }
  .vi-fold-body > .ev-hours-lbl { margin-left: 14px; margin-right: 14px; }
  .vi-fold-body > .pp-note { padding-top: 10px; border-top: 1px solid var(--line); }
  @media (hover: hover) {
    .vi-grid .pp-place:hover { background: var(--raise); }
  }
}
/* One line: the 7 AM to 8 PM window is set by state law, the same every day. */
.vi-hours { font-size: .88rem; color: var(--dim); margin-top: 4px; }

/* Matches .ev-hours in simple/lookup.css. */
.ev-hours {
  display: grid; grid-template-columns: auto 1fr;
  gap: .25rem 1.1rem; margin-top: 12px;
  font-size: .88rem; color: var(--dim);
}
.ev-hours .is-today { color: var(--fg); font-weight: 600; }
/* The polling place block is also the show-on-map control. */
.pp-place { cursor: pointer; border-radius: 8px; margin: 0 -8px; padding: 2px 8px; }
/* Its hover background is set by the .vi-grid rules above. */
@media (hover: hover) {
  .pp-place:hover .pp-name { color: var(--accent); }
}
.pp-place:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.pp-name {
  font-size: 1.42rem; font-weight: 700; line-height: 1.22;
  letter-spacing: -.022em; margin-top: 2px;
}
.pp-addr { font-size: .93rem; color: var(--dim); line-height: 1.55; margin-top: 4px; }
.pp-meta { margin-top: 8px; font-size: .93rem; line-height: 1.55; color: var(--fg); }
.pp-meta > div + div { margin-top: 2px; }
.pp-loc { color: var(--fg); }
.pp-loc-l { font-weight: 600; }
.pp-note {
  font-size: .87rem; margin-top: 12px; padding-top: 12px;
  border-top: 1px solid var(--line); color: var(--dim); line-height: 1.5;
}

.box-open {
  margin-top: 12px; font: inherit; font-size: .87rem; color: var(--fg);
  background: none; border: 1px solid var(--dim); border-radius: 999px;
  padding: 5px 12px; cursor: pointer;
}
@media (hover: hover) {
  .box-open:hover { color: var(--accent); border-color: var(--accent); }
}
.box-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.vi-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.vi-actions .box-open { margin-top: 0; }

/* ---- Place lists ---- */
.box-list { list-style: none; margin: 0; padding: 0; }
.box-list li {
  display: grid; gap: 1px; padding: 10px 12px; border-radius: 8px;
  font-size: .92rem; line-height: 1.45;
}
.box-list li + li { margin-top: 2px; }
/* data-pick is written by placeListHtml in app.js on every routable row. */
.box-list li[data-pick] { cursor: pointer; transition: background .12s; }
@media (hover: hover) {
  .box-list li[data-pick]:hover { background: var(--raise); }
  .box-list li[data-pick]:hover .bx-name { color: var(--accent); }
}
.box-list li[data-pick]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
.bx-name { font-weight: 650; display: flex; justify-content: space-between;
            align-items: baseline; gap: 12px; }
/* Straight-line distance; the drive appears once a place is chosen. */
.bx-dist { font-weight: 400; font-size: .82rem; color: var(--dim);
           white-space: nowrap; }
.bx-addr { color: var(--dim); font-size: .87rem; }
.bx-where { color: var(--fg); font-size: .87rem; margin-top: 3px; }
/* .bx-hours-odd: a box that is not open 24/7. */
.bx-hours { color: var(--fg); font-size: .87rem; }
.bx-hours-odd { color: var(--warn); font-size: .87rem; font-weight: 600; }
.box-list li.is-chosen { background: var(--tint); }
.box-list li.is-chosen .bx-name { color: var(--accent); }

.box-list li.bx-noroute { opacity: .72; cursor: default; }
/* Above an early voting list whose window has not opened: the day it does. */
.bx-lead {
  margin: 0 0 10px; padding: 0 12px; font-size: .87rem; font-weight: 600;
  color: var(--warn);
}

.advisory {
  font-size: .87rem; color: var(--warn); line-height: 1.5; margin-top: 12px;
  padding-left: 12px; border-left: 2px solid var(--warn);
}
.advisory a { color: inherit; }
.err { font-size: .93rem; color: var(--warn); line-height: 1.55; }

/* ---- Route cards ---- */
.routes { display: flex; flex-direction: column; gap: 10px; }
.cam-big { color: var(--danger); font-weight: 700; }
.cam-zero { color: var(--good); font-weight: 700; }
.verdict {
  margin-top: 9px; padding-top: 9px; border-top: 1px solid var(--line);
  font-size: .9rem; color: var(--fg); line-height: 1.5;
}
.unavoid {
  font-size: .88rem; color: var(--warn); margin-top: 12px; line-height: 1.55;
  padding-left: 12px; border-left: 2px solid var(--warn);
}

/* ---- Map legend ---- */
.map-legend {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 7px 16px; font-size: .78rem; color: var(--fg);
}
.how-link {
  color: var(--accent); font-weight: 700; text-decoration: underline;
  text-underline-offset: 3px; text-decoration-thickness: 1.5px;
  white-space: nowrap;
}
.how-link:hover { text-decoration-thickness: 2.5px; }
.how-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

.map-legend .lg-label { font-weight: 700; letter-spacing: .04em; }
.map-legend .lg { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.map-legend .k {
  display: inline-block; width: 26px; height: 5px; border-radius: 2.5px;
}
/* Filled by paintLegendCamera() in app.js with the real marker SVG. */
.map-legend .dotk {
  display: inline-flex; width: 18px; height: 18px;
  align-items: center; justify-content: center;
}

/* Dark theme: brighten the basemap, our own canvas (map.js) in the tile pane.
   The --lg-* legend swatches are not filtered, so in dark they do not match. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .leaflet-tile-pane {
    filter: brightness(1.72) contrast(.82) saturate(1.15);
  }
}
:root[data-theme="dark"] .leaflet-tile-pane {
  filter: brightness(1.72) contrast(.82) saturate(1.15);
}

/* ---- Map furniture ---- */
.leaflet-container { font-family: inherit; background: var(--raise); }
.leaflet-control-attribution {
  background: color-mix(in srgb, var(--panel) 86%, transparent) !important;
  color: var(--dim) !important; font-size: 11px !important;
}
.leaflet-control-attribution a { color: var(--dim) !important; }
.leaflet-bar a {
  background: var(--panel) !important; color: var(--fg) !important;
  border-bottom-color: var(--line) !important;
}
.leaflet-bar a:hover { background: var(--raise) !important; }

.route-flow { animation: flow 2.4s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -28; } }
@media (prefers-reduced-motion: reduce) {
  .route-flow { animation: none; }
}

@media (max-width: 380px) {
  #col { padding: 0 .75rem 2.5rem; }
}

/* Origin and destination are the same place; sized like a route summary. */
.here { padding: 16px 0 4px; }
.here-h { font-size: 1.18rem; font-weight: 700; letter-spacing: -.015em; }
.here-b { margin-top: 6px; color: var(--dim); line-height: 1.55; }

/* ---- ?debug panel ---- */
.debug-panel {
  margin: 14px 0 6px; padding: 12px 14px 14px;
  border: 1px dashed var(--warn); border-radius: 10px; background: var(--raise);
}
.dbg-head { font-weight: 700; font-size: .95rem; margin-bottom: 8px; }
.dbg-sub { font-weight: 400; font-size: .82rem; color: var(--dim); margin-left: 8px; }
.dbg-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.dbg-row label { flex: 1 1 220px; font-size: .78rem; color: var(--dim);
                 text-transform: uppercase; letter-spacing: .05em;
                 /* The suggestion list's positioned ancestor. */
                 position: relative; }
/* The list would inherit the label's uppercase tracking. */
.debug-panel .ac { text-transform: none; letter-spacing: normal; }
.debug-panel .ac-item { font-size: .92rem; color: var(--fg); }
.dbg-row input {
  display: block; width: 100%; margin-top: 3px;
  background: var(--bg); color: var(--fg); border: 1.5px solid var(--line);
  border-radius: 8px; padding: 9px 11px; font: inherit; font-size: .95rem;
}
.dbg-row input:focus { outline: none; border-color: var(--accent); }
.dbg-actions { margin-top: 10px; align-items: center; }
.dbg-actions button {
  font: inherit; font-size: .87rem; font-weight: 600; color: var(--fg);
  background: none; border: 1px solid var(--dim); border-radius: 999px;
  padding: 6px 14px; cursor: pointer;
}
.dbg-actions button:hover { color: var(--accent); border-color: var(--accent); }
.dbg-status { font-size: .85rem; color: var(--dim); }
.dbg-out {
  margin: 12px 0 0; padding: 10px 12px; max-height: 55vh; overflow: auto;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap; word-break: break-word; color: var(--fg);
}

/* ---- Address type-ahead ---- */
/* Positioned against .field, or the field's label in the ?debug panel. */
.ac {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 900;
  background: var(--panel); border: 1.5px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); overflow: hidden; max-height: 300px; overflow-y: auto;
}
.ac-item {
  display: flex; align-items: baseline; width: 100%;
  padding: 10px 13px; background: none; border: 0; cursor: pointer;
  font: inherit; text-align: left; color: var(--fg);
  border-bottom: 1px solid var(--line);
}
.ac-item:last-child { border-bottom: 0; }
.ac-item:hover, .ac-item.active { background: var(--raise); }
.ac-item .ac-pin {
  flex: 0 0 auto; align-self: center; display: flex; color: var(--dim);
  margin-right: 9px;
}
.ac-item:hover .ac-pin, .ac-item.active .ac-pin { color: var(--accent); }
/* Margins, not a flex gap: number and street want just a word space. */
.ac-item .num {
  font-weight: 700; font-variant-numeric: tabular-nums; margin-right: .3em;
}
.ac-item .st { flex: 1; }
.ac-item .why { margin-left: 9px; }
/* Off the label role: a quiet hint inside a suggestion list. */
.ac-item .why, .ac-item .ac-where {
  font-size: .76rem; color: var(--dim); letter-spacing: .04em;
  text-transform: uppercase; white-space: nowrap;
}
.ac-item .ac-where { margin-left: 9px; }
/* 24px clears the pin: 15px (PIN_SVG in app.js) plus its 9px margin. */
@media (max-width: 700px) {
  .ac-item { flex-wrap: wrap; }
  .ac-item .ac-where {
    flex: 0 0 100%; margin: 3px 0 0 24px; white-space: normal;
  }
}

/* ---- Marker detail ---- */
/* Touch screens show detail here, under the map, rather than in a popup. */
.map-detail {
  position: relative;
  margin-top: 10px;
  padding: 13px 40px 13px 15px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  font-size: .88rem; line-height: 1.45;
}
.detail-x {
  position: absolute; top: 6px; right: 6px;
  width: 30px; height: 30px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  background: none; border: 0; border-radius: 6px;
  color: var(--dim); font-size: 1.3rem; cursor: pointer;
}
.detail-x:hover { background: var(--raise); color: var(--fg); }

/* A hover pointer gets a popup instead (bindDetail in app.js). */
.cam-popup .leaflet-popup-content-wrapper {
  background: var(--panel); color: var(--fg);
  border: 1.5px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
}
.cam-popup .leaflet-popup-tip { background: var(--panel); border: 1.5px solid var(--line); }
.cam-popup .leaflet-popup-content { margin: 12px 14px; font-size: .88rem; line-height: 1.4; }
.cam-popup a.leaflet-popup-close-button { color: var(--dim); }

.campop .ctitle {
  font-size: var(--label-size); font-weight: 700;
  letter-spacing: var(--label-track);
  text-transform: uppercase; color: var(--danger); margin-bottom: 9px;
}
.campop .cf {
  display: flex; gap: 10px; padding: 3px 0; align-items: baseline;
}
.campop .ck { color: var(--dim); flex: none; min-width: 92px; }
.campop .cv { font-weight: 600; }
.campop .cfoot {
  margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--line);
  font-size: .78rem; color: var(--dim);
}

/* ---- Footer ---- */
#siteFooter {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px 16px; padding: 12px 18px;
  background: var(--panel);
  border-top: 1px solid var(--line);
}
#siteFooter .theme-switch { grid-column: 1; justify-self: start; }
#siteFooter .sf-links { grid-column: 2; justify-self: end; }
.sf-links { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sf-links .about-btn { text-decoration: none; }
@media (max-width: 640px) {
  #siteFooter { padding: 12px 18px 14px; }
  body.has-result #siteFooter { display: none; }
}

.cam-count {
  font-size: .88rem; color: var(--dim); line-height: 1.5;
  margin-bottom: 10px;
}

/* ---- Destination segmented control ---- */
.seg { display: flex; gap: 0; margin-bottom: 12px; border: 1.5px solid var(--line);
       border-radius: 8px; overflow: hidden; }
.seg button {
  flex: 1; background: var(--raise); border: 0; color: var(--dim);
  padding: 9px 8px; font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer;
  border-right: 1px solid var(--line);
}
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--panel); color: var(--accent); }

/* ---- Turn-by-turn ---- */
ol.steps { list-style: none; margin: 12px 0 0; padding: 0; }
ol.steps li {
  position: relative; display: flex; align-items: baseline; gap: 10px;
  padding: 10px 0 10px 30px; border-bottom: 1px solid var(--line);
  font-size: .92rem; line-height: 1.45; cursor: pointer;
}
ol.steps li:last-child { border-bottom: 0; }
ol.steps li .glyph {
  position: absolute; left: 0; top: 9px; width: 20px;
  text-align: center; font-size: 15px; line-height: 1.2;
  color: var(--accent); font-weight: 700;
}
ol.steps li.arrive::before {
  content: '⚑'; position: absolute; left: 0; top: 11px;
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; color: var(--warn);
}
ol.steps .stext { flex: 1; }
ol.steps li:hover { background: var(--raise); }
ol.steps li.cur, ol.steps li:hover, ol.steps li.arrive { font-weight: 700; }
ol.steps li.cur {
  background: var(--raise);
  box-shadow: inset 3px 0 0 var(--accent);
}
ol.steps .sd { color: var(--dim); font-size: .85rem; white-space: nowrap; }
ol.steps .scam {
  color: var(--danger); font-size: .78rem; font-weight: 700; white-space: nowrap;
}

/* ---- Camera markers ---- */
.cam-icon { background: none; border: 0; }
.cam-pulse { animation: campulse 1.9s ease-in-out infinite; transform-origin: center; }
@keyframes campulse { 0%,100% { opacity: .95; } 50% { opacity: .28; } }
@media (prefers-reduced-motion: reduce) { .cam-pulse { animation: none; opacity: .7; } }
.campop .cago { color: var(--dim); font-weight: 400; }

/* ---- Site header ---- */
/* tests/test_page.mjs checks the bar comes out exactly --header-h tall. */
#siteHeader {
  min-height: var(--header-h);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px; padding: 0 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: relative; z-index: 700;
}
#siteHeader .brand { grid-column: 2; justify-self: center; }
@media (max-width: 640px) {
  #siteHeader {
    grid-template-columns: 1fr;
    padding: 10px 18px;
    justify-items: center;
  }
  #siteHeader .brand { grid-column: 1; justify-self: center; }
}
.brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--fg);
  min-width: 0;
}
.brand-mark { width: 32px; height: 32px; flex: none; color: var(--accent); }
.brand-mi { width: 38px; height: 38px; flex: none; color: var(--accent); }
.brand-text {
  font-size: 1.8rem; letter-spacing: -.018em; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* Breakpoints here are not in source order, so the wordmark's steps stay
   together, widest first; a rule in a later @media block would win. */
@media (max-width: 640px) {
  .brand-mark { width: 28px; height: 28px; }
  .brand-mi { width: 34px; height: 34px; }
  .brand-text { font-size: 1.55rem; }
}
@media (max-width: 380px) {
  .brand-mark { width: 24px; height: 24px; }
  .brand-mi { width: 28px; height: 28px; }
  .brand-text { font-size: 1.32rem; }
}
.brand-text b { font-weight: 800; }
.brand:hover .brand-text { color: var(--accent); }
.brand:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* ---- Theme switch ---- */
.theme-switch {
  display: flex; gap: 0; background: var(--panel);
  border: 1.5px solid var(--line); border-radius: 8px;
  box-shadow: var(--shadow); overflow: hidden;
}
.theme-switch button {
  background: none; border: 0; color: var(--dim); cursor: pointer;
  font: inherit; font-size: .76rem; font-weight: 600;
  padding: 6px 10px; min-height: 32px; line-height: 1;
  border-right: 1px solid var(--line);
}
.theme-switch button:last-child { border-right: 0; }
.theme-switch button:hover { color: var(--fg); }
.theme-switch button.on { color: var(--accent); background: var(--raise); }
.theme-switch button svg { display: block; width: 15px; height: 15px; }
/* Kept together and widest first, for the same reason as the wordmark's. */
@media (max-width: 900px) {
  .theme-switch button { min-height: 34px; }
}
@media (max-width: 520px) {
  .theme-switch button { padding: 6px 9px; }
}
@media (max-width: 380px) {
  .theme-switch button { padding: 5px 8px; }
}

/* ---- About button and modal ---- */
.about-btn {
  display: inline-flex; align-items: center; text-decoration: none;
  background: none; border: 1.5px solid var(--line); color: var(--dim);
  font: inherit; font-size: .88rem; font-weight: 600;
  padding: 7px 14px; border-radius: 9px; cursor: pointer;
  transition: color .12s, border-color .12s;
}
.about-btn:hover { color: var(--accent); border-color: var(--accent); }

/* Above #siteHeader (z-index 700), or the masthead covers the close button. */
.modal-wrap { position: fixed; inset: 0; z-index: 1000; }
.modal-veil { position: absolute; inset: 0; background: rgba(6, 8, 12, .55); }
.modal {
  position: absolute; inset: 0; margin: auto;
  width: min(660px, calc(100vw - 32px));
  height: min(78dvh, 900px);
  background: var(--panel); color: var(--fg);
  border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 18px 60px rgba(0,0,0,.45);
  display: flex; flex-direction: column; overflow: hidden;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px; border-bottom: 1px solid var(--line); flex: none;
}
.modal-head h2 { margin: 0; font-size: 1.1rem; }
.modal-x {
  background: none; border: 0; color: var(--dim); font-size: 1.5rem;
  line-height: 1; cursor: pointer; padding: 4px 8px; border-radius: 6px;
}
.modal-x:hover { color: var(--fg); background: var(--raise); }
.modal-body { overflow-y: auto; padding: 20px 22px 26px; }
.modal-body h3 {
  font-size: var(--label-size); letter-spacing: var(--label-track);
  text-transform: uppercase; color: var(--dim); margin: 22px 0 10px;
}
.modal-body h3:first-child { margin-top: 0; }
.why-list { margin: 0; padding-left: 22px; }
.why-list h4 {
  margin: 0 0 8px; font-size: 1.05rem; font-weight: 600; line-height: 1.4;
  color: var(--fg);
}
.why-list p { margin: 0 0 10px; }
.why-list p:last-child { margin-bottom: 0; }
.why-list blockquote {
  margin: 10px 0; padding: 8px 12px; border-left: 3px solid var(--line);
  color: var(--dim); font-size: .92rem; line-height: 1.55;
}
.why-list li { margin-bottom: 20px; }
.why-list li:last-child { margin-bottom: 0; }
.modal-tagline {
  margin: 0 0 2px; font-size: 1.3rem; font-weight: 600;
  letter-spacing: -.01em; color: var(--fg);
}
.modal-tagline + h3 { margin-top: 18px; }
.modal-credit {
  margin: 22px 0 0; padding-top: 14px; border-top: 1px solid var(--line);
  font-size: .9rem; line-height: 1.55; color: var(--dim); text-align: center;
}
.modal-credit a, .modal-credit a:visited {
  color: var(--fg); text-decoration: underline;
  text-decoration-color: var(--dim); text-underline-offset: 2px;
}
.modal-credit a:hover, .modal-credit a:focus-visible {
  color: var(--accent); text-decoration-color: var(--accent);
}

@media (max-width: 900px) {
  .modal { width: 100%; height: 100dvh; border-radius: 0; border: 0; }
  .about-btn { padding: 8px 12px; min-height: 40px; }
}

/* ---- Search bar ---- */
/* Cap the contents, not .searchbar, so the sticky bar still spans the column. */
@media (min-width: 601px) {
  .searchbar .field-label,
  .searchbar .field-row,
  .searchbar .hint {
    max-width: 30rem;
    margin-left: auto; margin-right: auto;
  }
}

/* ---- Pin drop ---- */
.field-row { display: flex; gap: 8px; align-items: stretch; }
.field-row .field { flex: 1; }
.pin-btn {
  flex: none; width: 46px; border-radius: 8px; cursor: pointer;
  background: var(--raise); border: 1.5px solid var(--line); color: var(--dim);
  display: flex; align-items: center; justify-content: center;
  transition: color .12s, border-color .12s;
}
.pin-btn svg { width: 20px; height: 20px; }
.pin-btn .push-pin { width: 18px; height: 18px; }
.pin-btn:hover { color: var(--accent); border-color: var(--accent); }
.pin-btn.armed {
  color: var(--accent); border-color: var(--accent); background: var(--panel);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
#map.pin-armed {
  cursor: crosshair;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent),
              0 0 0 5px color-mix(in srgb, var(--accent) 20%, transparent);
}
/* While the pin is armed, markers, popups and the status pass taps to the map.
   Set on the elements, with #map, to beat leaflet.css's pointer-events: auto.
   Controls are left out on purpose: zoom and the gear still frame the spot. */
#map.pin-armed .leaflet-marker-icon,
#map.pin-armed .leaflet-marker-shadow,
#map.pin-armed .leaflet-popup,
#map.pin-armed .leaflet-popup-tip,
#map.pin-armed .leaflet-tooltip,
#map.pin-armed .map-status { pointer-events: none; }

/* ---- Source links ---- */
.bx-prov a, .bx-prov a:visited {
  color: var(--fg); text-decoration: underline;
  text-decoration-color: var(--dim); text-underline-offset: 2px;
}
.bx-prov a:hover, .bx-prov a:focus-visible {
  color: var(--accent); text-decoration-color: var(--accent);
}
.bx-prov {
  margin: 10px 0 0; font-size: .82rem; line-height: 1.6; color: var(--dim);
}

/* ---- Destination popup ---- */
.destpop .dt {
  font-size: var(--label-size); font-weight: 700;
  letter-spacing: var(--label-track);
  text-transform: uppercase; color: var(--warn); margin-bottom: 7px;
}
.destpop .dn { font-size: 1rem; font-weight: 700; line-height: 1.3; }
.destpop .da { font-size: .88rem; color: var(--dim); margin-top: 3px; }
.destpop .de { font-size: .88rem; color: var(--fg); margin-top: 5px; }
.destpop .dw {
  margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--line);
  font-size: var(--label-size); font-weight: 700;
  letter-spacing: var(--label-track);
  text-transform: uppercase; color: var(--accent);
}
.destpop .dw + .dw { margin-top: 3px; padding-top: 0; border-top: 0; }

/* ---- Asking and answer states ---- */
.field-label {
  display: block; margin: 0 0 9px;
  font-size: 1.25rem; font-weight: 700; letter-spacing: -.01em; color: var(--fg);
}
#col.has-result .field-label { display: none; }
#col.has-result .searchbar {
  position: sticky; top: 0; z-index: 5;
  background: var(--bg);
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
#col:not(.has-result) .field input {
  font-size: 1.06rem;
  padding: 15px 16px; padding-left: 40px;
}
/* Toggled by .has-result, not [hidden], whose !important would keep it hidden for good. */
.reset-btn { display: none; }
#col.has-result .reset-btn { display: flex; }
#col.has-result #intro { display: none; }
#col.has-result .searchbar .hint { display: none; }

#resultBlock, #routeBlock { padding: 16px 0; }

/* ---- Route toggle ---- */
.route-toggle {
  display: flex; border: 1.5px solid var(--line); border-radius: 9px;
  overflow: hidden; margin-bottom: 10px;
}
.route-toggle button {
  flex: 1; background: var(--raise); border: 0; border-right: 1px solid var(--line);
  color: var(--dim); cursor: pointer; font: inherit; padding: 9px 8px;
  text-align: left; min-height: 46px;
}
.route-toggle button:last-child { border-right: 0; }
.route-toggle button.on { background: var(--panel); }
.route-toggle .rt-top {
  display: flex; align-items: center; gap: 7px;
  font-size: .85rem; font-weight: 700; color: var(--dim);
}
.route-toggle button.on .rt-top { color: var(--fg); }
.route-toggle .sw { width: 18px; height: 4px; border-radius: 2px; flex: none; }
.route-toggle button > span { display: block; }
.route-toggle .rt-sub {
  font-size: .8rem; margin-top: 3px; color: var(--dim); white-space: nowrap;
}
.route-toggle button.on.avoid { box-shadow: inset 0 -3px 0 var(--route-avoid); }
.route-toggle button.on.fast { box-shadow: inset 0 -3px 0 var(--route-fastsel); }

.one-route { font-size: .95rem; color: var(--fg); }
.one-route b { font-weight: 700; }

@media (max-width: 520px) {
  .about-btn { padding: 7px 10px; }
}

/* ---- Legend swatches ---- */
/* --lg-* come from map.js's palette; the fallback only covers first paint. */
.map-legend .k.prec {
  height: 0; border-top: 2.5px dashed var(--lg-precinct, #b5a6f0); background: none;
}

/* Filled by paintLegendSites() in app.js with the map's own marks. */
.map-legend .sitek { width: 17px; height: 17px; margin-right: 6px; }

/* ---- Voting place marks ---- */
/* One shape per kind, so they separate without relying on colour. */
@keyframes poll-pulse {
  0% { box-shadow: 0 0 0 0 rgba(35, 190, 105, .85); }
  100% { box-shadow: 0 0 0 26px rgba(35, 190, 105, 0); }
}
.site-mark.pulse { border-radius: 50%; animation: poll-pulse 1s ease-out 3; }

.site-mark { background: none; border: 0; color: var(--poll); }
.site-mark svg { display: block; width: 100%; height: 100%; overflow: visible; }
.site-mark .sm-face {
  fill: color-mix(in srgb, var(--panel) 78%, transparent);
  stroke: currentColor; stroke-width: 2.4;
  paint-order: stroke fill;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.4));
}
.site-mark .sm-ink {
  stroke: currentColor; stroke-width: 2.2;
  stroke-linecap: round; stroke-linejoin: round;
}
.site-early { color: var(--accent); }
.site-dropbox { color: var(--warn); }
.site-mark.active .sm-face {
  fill: color-mix(in srgb, currentColor 34%, var(--panel));
  stroke-width: 2.8;
}
.site-mark.active .sm-ink { stroke-width: 2.6; }
.site-mark:hover .sm-face { fill: var(--panel); }

/* ---- Map layer toggles ---- */
.map-gear { position: relative; }
.gear-btn {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  background: var(--panel); color: var(--fg);
  border: 0; cursor: pointer; border-radius: 4px;
}
.gear-btn:hover { color: var(--accent); }
.gear-sec {
  margin: 10px 0 6px; padding-top: 9px;
  border-top: 1px solid var(--line);
  /* Off the label role: .74rem headings would crowd the dense gear panel. */
  font-size: .68rem; font-weight: 700; letter-spacing: var(--label-track);
  text-transform: uppercase; color: var(--dim);
}
.gear-panel .cam-count { font-size: .78rem; margin-bottom: 2px; max-width: 15rem; }

.gear-panel {
  position: absolute; top: 40px; right: 0; z-index: 900;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: var(--shadow);
  padding: 8px 14px;
  min-width: 228px;
}

.layer-toggles {
  display: flex; flex-direction: column; gap: 2px;
  margin: 0 0 14px; padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.layer-toggles .lyr {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 0; min-height: 34px;
}
.layer-toggles label {
  font-size: .9rem; color: var(--fg); cursor: pointer; flex: 1;
}
.layer-toggles input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.map-legend .k.wardk {
  height: 15px; border-radius: 3px; border: 1px solid var(--line);
  background: linear-gradient(90deg,
    var(--lg-ward1, hsl(265,54%,50%)) 0 25%,
    var(--lg-ward2, hsl(190,54%,50%)) 25% 50%,
    var(--lg-ward3, hsl(32,54%,50%)) 50% 75%,
    var(--lg-scope, hsl(210,54%,50%)) 75%);
}
.map-legend .k.bordk {
  height: 0; border-top: 3px solid var(--lg-border, #ffd76a); border-radius: 2px;
}
