/* Roads page additions on top of the shared map styles (app.css, same as Capital Projects) */
.roads-legend{min-width:250px}
.roads-legend .switch{display:flex;align-items:center;gap:8px;margin-top:8px}
.lk{display:inline-block;flex:0 0 auto}
.lk-rep{width:10px;height:10px;border-radius:50%;background:#0F5BB5;border:2px solid #fff;box-shadow:0 0 0 1px rgba(15,91,181,.3)}
.lk-bike{width:20px;height:4px;border-radius:2px;background:#4E9A2A}
.lk-plan{width:20px;height:6px;border-radius:3px;background:#16233F}
.pci{display:flex;margin:6px 0 0 44px;border-radius:2px;overflow:hidden}
.pci span{flex:1 1 0;font-size:14px;color:#3B4458;padding-top:9px;position:relative;text-align:center;letter-spacing:.01em}
.pci span::before{content:"";position:absolute;left:0;right:0;top:0;height:6px;background:var(--c)}
.roads-legend.off-cond .pci{opacity:.35}
.mini{margin-top:6px;font-size:clamp(14px,calc(var(--u,1vh)*.9),17px);line-height:1.45;color:var(--ink)}
.mini b{color:var(--navy)}
.cond-bar{display:flex;height:12px;border-radius:3px;overflow:hidden;margin-top:8px}
.cond-bar i{display:block;height:100%;background:var(--c);width:calc(var(--v) * 100%)}
.cond-key{display:flex;flex-wrap:wrap;gap:4px 12px;margin-top:6px;font-size:clamp(14px,calc(var(--u,1vh)*.8),15px);color:var(--grey)}
.cond-key span::before{content:"";display:inline-block;width:9px;height:9px;border-radius:2px;background:var(--c);margin-right:5px;vertical-align:-1px}
.sel-path{fill:none;stroke:#8DC63F;stroke-linecap:round;stroke-linejoin:round;stroke-width:6;filter:drop-shadow(0 0 3px rgba(141,198,63,.6))}
.sel-pt{fill:#16233F;stroke:#8DC63F;stroke-width:4}
.pci-score{display:inline-block;margin-left:8px;padding:2px 8px;border-radius:999px;color:#fff;font-size:14px;font-weight:700;vertical-align:middle}
.kd{display:inline-block;width:9px;height:9px;border-radius:50%;margin-right:7px;vertical-align:0}

/* By year / All years switch and the repair type filter, along the top of the map */
.mode{display:flex;background:#fff;border:2px solid var(--blue);border-radius:999px;padding:3px;box-shadow:0 6px 18px rgba(22,35,63,.1)}
.mode button{border:0;background:none;color:var(--blue);font-weight:700;font-size:clamp(14px,calc(.85 * var(--vw)),16px);padding:7px 16px;border-radius:999px;cursor:pointer;letter-spacing:.02em}
.mode button[aria-selected="true"]{background:var(--blue);color:#fff}
.mode button:focus-visible{outline:2px solid var(--green);outline-offset:2px}
.chips{display:flex;flex-wrap:wrap;gap:6px}
.chips button{display:inline-flex;align-items:center;gap:7px;border:1px solid #CFD9E5;background:rgba(255,255,255,.95);color:var(--ink);border-radius:999px;padding:6px 12px;
  font-size:clamp(14px,calc(.78 * var(--vw)),15px);font-weight:700;cursor:pointer;box-shadow:0 3px 10px rgba(22,35,63,.06);transition:background .2s,color .2s,border-color .2s}
.chips button i{width:9px;height:9px;border-radius:50%}
.chips button span{color:var(--grey);font-weight:400}
.chips button:hover{border-color:var(--blue)}
.chips button[aria-pressed="true"]{background:var(--navy);border-color:var(--navy);color:#fff}
.chips button[aria-pressed="true"] span{color:#C9D6E6}
.chips button:focus-visible{outline:2px solid var(--blue);outline-offset:2px}
.lk-res{width:20px;height:6px;border-radius:3px;background:#0E8C8A}
.mini.muted{color:var(--grey);font-size:max(14px,.9em)}
.rail:not(.cum) .years::after{transform:scaleX(0)!important}
.rail.cum .years a.done .ry{color:var(--navy)}

/* ---------- controls along the top of the map: view switch, search, council district, repair type ---------- */
.cip-meta{display:none}
.ctrl{position:absolute;z-index:7;top:clamp(10px,1.6vh,20px);left:calc(var(--panelW) + var(--gut) + 28px);right:calc(var(--gut) + 56px);display:flex;flex-direction:column;gap:8px;pointer-events:none}
.ctrl>*{pointer-events:auto}
.ctrl-row{display:flex;flex-wrap:wrap;align-items:center;gap:8px}
.ctrl .mode,.ctrl .chips{position:static;left:auto;right:auto;top:auto}
.search{position:relative;flex:1 1 240px;max-width:380px}
.search input{width:100%;height:42px;border:2px solid #CFD9E5;border-radius:999px;background:#fff;padding:0 16px;font:inherit;font-size:15px;color:var(--ink);box-shadow:0 6px 18px rgba(22,35,63,.08)}
.search input:focus{outline:none;border-color:var(--blue)}
.search ul{position:absolute;left:0;right:0;top:46px;margin:0;padding:6px 0;list-style:none;background:#fff;border-radius:10px;box-shadow:0 14px 34px rgba(22,35,63,.2);max-height:320px;overflow:auto}
.search li{display:flex;justify-content:space-between;gap:12px;padding:9px 16px;font-size:15px;cursor:pointer}
.search li small{color:var(--grey);font-size:14px;text-transform:uppercase;letter-spacing:.06em;align-self:center}
.search li[aria-selected="true"],.search li[data-i]:hover{background:#EEF4FB;color:var(--blue)}
.search li.none{color:var(--grey);cursor:default}
.area-pick select{height:42px;border:2px solid #CFD9E5;border-radius:999px;background:#fff;padding:0 34px 0 16px;font:inherit;font-size:15px;font-weight:700;color:var(--blue);cursor:pointer;box-shadow:0 6px 18px rgba(22,35,63,.08);
  appearance:none;-webkit-appearance:none;background-image:linear-gradient(45deg,transparent 50%,#0F5BB5 50%),linear-gradient(135deg,#0F5BB5 50%,transparent 50%);background-position:calc(100% - 19px) 18px,calc(100% - 13px) 18px;background-size:6px 6px;background-repeat:no-repeat}
.area-pick select:focus-visible{outline:2px solid var(--blue);outline-offset:2px}
.skip{position:absolute;left:-9999px;top:8px;z-index:100;background:#fff;color:var(--blue);padding:8px 12px;font-weight:700}
.skip:focus{left:8px}

/* repair counts per neighborhood, the chosen area and the search pin */
.bub{cursor:pointer;outline:none}
.bub circle{fill:#0F5BB5;fill-opacity:.78;stroke:#fff;stroke-width:2;transition:fill-opacity .2s}
.bub text{fill:#fff;font-size:14px;font-weight:700;text-anchor:middle;dominant-baseline:central;pointer-events:none}
.bub:hover circle,.bub:focus-visible circle{fill:#16233F;fill-opacity:1}
.bub:focus-visible circle{stroke:#8DC63F;stroke-width:3.5}
.area-line{fill:rgba(141,198,63,.07);stroke:#16233F;stroke-width:2.5;stroke-dasharray:7 5;pointer-events:none}
.pin path{fill:#B93A2A;stroke:#fff;stroke-width:2}.pin circle{fill:#fff}
.area-tag{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:10px;padding:8px 8px 8px 14px;background:var(--navy);color:#fff;border-radius:999px;font-weight:700;font-size:15px}
.area-tag button{border:0;border-radius:999px;background:#fff;color:var(--blue);font:inherit;font-size:14px;font-weight:700;padding:6px 12px;cursor:pointer;white-space:nowrap}
.area-tag button:hover,.area-tag button:focus-visible{background:var(--green);color:var(--navy)}
.zoom{top:clamp(120px,16vh,150px)}

/* ---------- phones and tablets: map on top, then controls, the year's data and the legend ---------- */
@media (max-width:860px){
  .app{height:auto;display:block;overflow:visible}
  .stage{display:flex;flex-direction:column;overflow:visible;background:#fff}
  .map,.dots{position:absolute;top:0;left:0;right:auto;bottom:auto;width:100%}
  .dots{touch-action:none}
  .veil{display:none}
  .zoom{top:12px;right:12px}
  .ctrl{position:static;order:1;margin-top:calc(56vh + 14px);padding:0 16px;left:auto;right:auto}
  .search{flex:1 1 100%;max-width:none;order:-1}
  .search input,.area-pick select{font-size:16px;height:46px}
  .area-pick{flex:1 1 auto}.area-pick select{width:100%}
  .chips{flex-wrap:nowrap;overflow-x:auto;padding-bottom:4px;-webkit-overflow-scrolling:touch}
  .chips button{flex:0 0 auto;font-size:16px;padding:8px 14px}
  .mode button{font-size:16px;padding:9px 16px}
  .panel{position:relative;order:2;left:auto;top:auto;bottom:auto;width:auto;margin-top:0;padding:18px 16px 8px;background:#fff}
  .pane{overflow:visible}
  .roads-legend{position:static;order:3;margin:8px 16px 22px;right:auto;bottom:auto;top:auto;box-shadow:none;border:1px solid var(--line);padding:14px 16px}
  .roads-legend .switch,.roads-legend .lg-h{font-size:16px}
  .pci span{font-size:14px}
  .mini,.bars li,.bars button,.top button,.d-p,.facts dd,.cond-key,.mean,.search li{font-size:16px}
  .sec-h,.label,.eyebrow,.facts dt,.src,.spark-h,.d-year,.d-note,.mini.muted{font-size:14px}
  .rail{position:sticky;bottom:0;padding:10px 12px 14px}
  .rail-btns{display:none}
  .years{gap:0;justify-content:space-between;padding:0 2px}
  .years::before,.years::after{display:none}
  .ry{font-size:14px}
  .years a[aria-current] .ry{transform:scale(1.2)}
  .tip{display:none}
}

/* desktop: controls sit on one line each (toolbar runs to the side margin, zoom buttons sit below it) */
@media (min-width:861px){
  .ctrl{right:var(--gut)}
  .search{flex:1 1 180px}
  .area-pick select{width:210px}
  .chips button{padding:6px 10px}
  /* pavement condition key: the color bar carries the scale, labels only at the two ends */
  .pci span{color:transparent}
  .pci span:first-child{color:#3B4458;text-align:left}
  .pci span:last-child{color:#3B4458;text-align:right}
}

/* district menu steps back; view switch and search lead (matches Capital Improvement Projects) */
@media (min-width:861px){
  .area-pick select{width:auto;max-width:200px;border-width:1px;box-shadow:none;background-color:rgba(255,255,255,.9);font-weight:400;color:var(--ink)}
  .search{max-width:none}
}

/* ===== mobile pass 2026-11-18: spacing and touch sizes ===== */
@media (max-width:860px){
  .statcard{margin-top:12px;padding:16px 16px 16px 18px}
  .sec-h{margin-top:26px;padding-bottom:8px}
  .bars button,.top button{min-height:46px}
  .mode button{min-height:44px;font-size:16px;padding:9px 16px}
  .d-clear{min-height:44px}
  .d-body .sec-h{margin-top:22px}
  .facts{gap:6px 18px}
  .mini{margin-top:10px;line-height:1.5}
  .cond-bar{margin-top:12px}
}
@media (max-width:860px){
  .chips button{min-height:44px}
  .years a{padding:8px 0;min-width:28px}
}

/* 2026-11-24: the map never shows through or over the panel and controls */
@media (min-width:861px){
  .panel{background:#fff;box-shadow:0 0 0 14px #fff}
}
@media (max-width:860px){
  .dots{overflow:hidden}
  .ctrl{position:relative;z-index:8;background:#fff}
}

/* ===== mobile pass 2026-11-24 (same as CIP): controls on top, map under them filling the first screen ===== */
@media (max-width:860px){
  .ctrl{order:0;margin-top:0;padding:14px 16px 12px}
  .map,.dots{top:var(--mapTop,0px);height:var(--mapH,56vh)}
  .zoom{top:calc(var(--mapTop,0px) + 12px)}
  .panel{order:2;margin-top:calc(var(--mapH,56vh) + 2px)}
}

/* 2026-11-24: the open item reads in solid blue with a white edge (no green) */
.sel-path{stroke:#0F5BB5;stroke-width:7;filter:drop-shadow(0 0 2px #fff) drop-shadow(0 0 2px #fff)}
.sel-pt{fill:#0F5BB5;stroke:#fff;stroke-width:3}

/* 2026-11-24: desktop: the repair chips stay on one row (tighter; scroll sideways only on very narrow windows) */
@media (min-width:861px){
  .chips{flex-wrap:nowrap;gap:5px;overflow-x:auto;scrollbar-width:none}
  .chips::-webkit-scrollbar{display:none}
  .chips button{flex:0 0 auto;padding:5px 10px;gap:6px;white-space:nowrap}
}
@media (min-width:861px){
  .ctrl{right:var(--gut)}
  .chips button{padding:4px 9px}
  .chips{gap:4px}
}

/* chips: never cut off. One row when it fits (short labels), wrap otherwise */
@media (min-width:861px){
  .chips{flex-wrap:wrap;overflow:visible}
}

/* ===== proof fixes 2026-11-24 ===== */
@media (max-width:860px){
  /* layer switches box: back in the flow under the panel (it was shifted up behind it) */
  .roads-legend{transform:none;position:relative;z-index:6;background:#fff}
  /* chips wrap, never run off the edge; space is held before they load so the map does not jump */
  .chips{flex-wrap:wrap;overflow:visible;padding-bottom:0;min-height:94px;align-content:flex-start}
  .d-top{top:var(--mastStick,64px);z-index:3;background:#fff}
}

/* ===== 2026-11-24 round 2 ===== */
@media (max-width:520px){
  /* phones: chips without the counts (the counts are in the list below) so they fit two rows and the map gets the space */
  .chips button span{display:none}
  .chips{min-height:94px}
}
@media (max-width:860px){
  .zoom button{width:44px;height:44px}
  .years a{position:relative}
  .years a::after{content:"";position:absolute;left:-3px;right:-3px;top:-8px;bottom:-8px}
}
