/* Safer Streets Dieppe — blueprint mode */
:root {
  --bp-bg: #071b32; --bp-bg2: #0c2944; --bp-ink: #dbe9f5; --bp-ink2: #9fbcd4; --bp-ink3: #6f8fab;
  --bp-line: rgba(127, 170, 210, .32); --bp-gold: #ffd56b; --bp-cyan: #4fd1e8;
  --bp-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --bp-left: calc(var(--panel-w) + var(--gap) + 8px);
  --bp-card-h: 0px;
}

/* ---------- HUD: Map | Blueprint ---------- */
.bp-hud {
  position: absolute; top: 12px; left: var(--bp-left); right: 64px; z-index: 1000;
  display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none;
}
.bp-hud > * { pointer-events: auto; }
.seg {
  display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px; background: rgba(255,255,255,.96);
  box-shadow: var(--shadow); border: 1px solid var(--line);
}
.seg button {
  border: 0; background: none; border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 600; color: var(--text-2);
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; line-height: 1.2; white-space: nowrap;
}
.seg button:hover { color: var(--text); }
.seg button[aria-checked="true"] { background: var(--text); color: #fff; }
.bp-hud-row { display: none; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: center; }
.bp-hud.is-bp .bp-hud-row { display: flex; }
.bp-hud.is-bp .seg { background: rgba(7,27,50,.88); border-color: var(--bp-line); box-shadow: 0 4px 18px rgba(0,0,0,.35); backdrop-filter: blur(6px); }
.bp-hud.is-bp .seg button { color: var(--bp-ink2); }
.bp-hud.is-bp .seg button:hover { color: #fff; }
.bp-hud.is-bp .seg-mode button[aria-checked="true"] { background: var(--bp-ink); color: var(--bp-bg); }
.seg-state button { padding: 4px 12px; font-size: 12px; }
.bp-hud.is-bp .seg-state button[aria-checked="true"][data-state="proposed"] { background: var(--bp-gold); color: #241a00; }
.bp-hud.is-bp .seg-state button[aria-checked="true"][data-state="existing"] { background: #8fb6d6; color: #06192d; }
.bp-jump select {
  height: 30px; border-radius: 999px; padding: 0 30px 0 12px; font-size: 12px; font-weight: 600; max-width: 260px;
  background: rgba(7,27,50,.88) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%239fbcd4' stroke-width='1.4'/%3E%3C/svg%3E") no-repeat right 11px center / 10px 6px;
  border: 1px solid var(--bp-line); color: var(--bp-ink); appearance: none; -webkit-appearance: none; box-shadow: 0 4px 18px rgba(0,0,0,.35);
}
.bp-jump select option { background: #0c2944; color: var(--bp-ink); }
.bp-loading { font: 600 11.5px var(--font); color: var(--bp-ink); background: rgba(7,27,50,.9); border: 1px solid var(--bp-line); padding: 4px 10px; border-radius: 999px; }
.bp-loading[hidden] { display: none; }

/* ---------- Blueprint chrome (only visible in .bp) ---------- */
.bp-frame, .bp-disclaimer, .bp-titleblock, .bp-north, .bp-grid { display: none; }
body.bp .bp-frame, body.bp .bp-disclaimer, body.bp .bp-north, body.bp .bp-grid { display: block; }
body.bp .bp-titleblock:not([hidden]) { display: block; }
body.bp #map, body.bp .leaflet-container { background: radial-gradient(ellipse at 60% 45%, #072039 0%, #071b32 60%, #061629 100%); }
.bp-grid { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.bp-frame {
  position: absolute; top: 8px; right: 8px; bottom: 8px; left: calc(var(--bp-left) - 8px); z-index: 650; pointer-events: none;
  border: 1px solid rgba(143,182,214,.38); box-shadow: inset 0 0 0 4px rgba(7,27,50,.0), inset 0 0 0 5px rgba(143,182,214,.14);
}
.bp-frame .tk { position: absolute; width: 14px; height: 14px; border-color: rgba(190,220,240,.7); border-style: solid; border-width: 0; }
.bp-frame .tl { top: -1px; left: -1px; border-top-width: 2px; border-left-width: 2px; }
.bp-frame .tr { top: -1px; right: -1px; border-top-width: 2px; border-right-width: 2px; }
.bp-frame .bl { bottom: -1px; left: -1px; border-bottom-width: 2px; border-left-width: 2px; }
.bp-frame .br { bottom: -1px; right: -1px; border-bottom-width: 2px; border-right-width: 2px; }

.bp-disclaimer {
  position: absolute; z-index: 1000; top: 18px; left: calc(var(--bp-left) + 8px); max-width: 250px;
  background: rgba(7,27,50,.88); border: 1px solid rgba(255,213,107,.55); border-left: 3px solid var(--bp-gold); border-radius: 4px;
  padding: 6px 10px; color: var(--bp-ink); pointer-events: none;
}
.bp-disclaimer b { display: block; font: 700 10.5px/1.3 var(--bp-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--bp-gold); }
.bp-disclaimer span { display: block; font-size: 11px; line-height: 1.35; color: var(--bp-ink2); margin-top: 2px; }

.bp-north { position: absolute; z-index: 1000; top: 124px; right: 12px; pointer-events: none; }
.bp-north svg { display: block; filter: drop-shadow(0 2px 6px rgba(0,0,0,.4)); }

.bp-titleblock {
  position: absolute; z-index: 1000; right: 12px; bottom: 26px; width: 340px; pointer-events: none;
  background: rgba(7,27,50,.92); border: 1px solid rgba(143,182,214,.5); border-radius: 3px; color: var(--bp-ink);
  font: 500 10.5px/1.35 var(--bp-mono);
}
.tb-h { padding: 5px 8px; border-bottom: 1px solid rgba(143,182,214,.35); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; font-size: 10px; color: #fff; }
.tb-g { display: grid; grid-template-columns: 1fr 1fr 1fr; }
.tb-g span { padding: 3px 8px 4px; border-right: 1px solid rgba(143,182,214,.22); border-bottom: 1px solid rgba(143,182,214,.22); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-g span:nth-child(3n) { border-right: 0; }
.tb-g span:nth-last-child(-n+3) { border-bottom: 0; }
.tb-g i { display: block; font-style: normal; font-size: 8.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--bp-ink3); }

/* Leaflet controls in blueprint */
body.bp .leaflet-bar a { background: rgba(7,27,50,.92) !important; color: var(--bp-ink) !important; border-bottom-color: rgba(143,182,214,.25) !important; }
body.bp .leaflet-bar a:hover { background: #12385a !important; }
body.bp .leaflet-bar a.leaflet-disabled { color: #4a6782 !important; }
body.bp .leaflet-bar { box-shadow: 0 4px 18px rgba(0,0,0,.35) !important; border: 1px solid var(--bp-line) !important; }
body.bp .leaflet-control-attribution { background: rgba(7,27,50,.82); color: var(--bp-ink3); }
body.bp .leaflet-control-attribution a { color: var(--bp-ink2); }
body.bp .leaflet-control-scale-line {
  background: rgba(7,27,50,.82); border-color: var(--bp-ink); color: var(--bp-ink); font: 600 10.5px var(--bp-mono); text-shadow: none; padding: 1px 6px;
}
body:not(.mob) .leaflet-bottom.leaflet-left { transition: left .2s; }
body.bp .leaflet-bottom.leaflet-left { left: calc(var(--bp-left) + 4px); }
.bp-coords {
  background: rgba(7,27,50,.82); color: var(--bp-ink2); font: 500 10.5px/1.3 var(--bp-mono); padding: 3px 8px; border-radius: 3px;
  border: 1px solid rgba(143,182,214,.25); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.bp-coords .k { color: var(--bp-ink3); text-transform: uppercase; font-size: 9px; letter-spacing: .08em; }
.bp-coords .sep { color: #3f5f7d; margin: 0 5px; }

/* Legend (shared control; normal vs blueprint body) */
.legend .lg-bp { display: none; }
body.bp .legend .lg-normal { display: none; }
body.bp .legend:not(.collapsed) .lg-bp { display: grid; }
body.bp .legend { background: rgba(7,27,50,.93); color: var(--bp-ink2); border: 1px solid var(--bp-line); box-shadow: 0 6px 22px rgba(0,0,0,.4); width: 232px; }
body.bp .legend-toggle { color: var(--bp-ink); }
body.bp .lg-sec h4 { color: var(--bp-ink3); font-family: var(--bp-mono); font-size: 9.5px; letter-spacing: .09em; }
.lg-sw { width: 24px; flex: none; border-radius: 1px; box-sizing: border-box; }
.lg-ic { width: 24px; height: 18px; flex: none; display: grid; place-items: center; }
.lg-ic svg { width: 18px; height: 18px; }
.lg-note { margin: 2px 0 0; font-size: 10.5px; line-height: 1.35; color: var(--bp-ink3); }

/* ---------- Site badges (hotspot markers) in blueprint ---------- */
body.bp .leaflet-marker-icon.hs-marker { width: 36px !important; height: 18px !important; margin-left: -18px !important; margin-top: -9px !important; }
body.bp .hs-dot {
  border-radius: 3px; background: #071b32 !important; border: 1.5px solid var(--bp-gold); color: #ffe7a6;
  font: 700 10px/1 var(--bp-mono) !important; letter-spacing: 0; box-shadow: 0 2px 8px rgba(0,0,0,.55);
}
body.bp .hs-marker:hover .hs-dot, body.bp .hs-marker.active .hs-dot { background: var(--bp-gold) !important; color: #1a1300; transform: scale(1.12); box-shadow: 0 0 0 2px #071b32, 0 0 0 3.5px var(--bp-gold); }
body.bp.bp-hi .leaflet-marker-pane .hs-marker { display: none; }

/* ---------- Drawing layers ---------- */
.bp-zooming .bp-anno { opacity: 0; }
.bp-anno { transition: opacity .18s; }
.leaflet-bpProp-pane path.leaflet-interactive, .leaflet-bpExist-pane path.leaflet-interactive { cursor: pointer; }

.bp-sym { background: none; border: 0; }
.bp-sym svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 1px 2px rgba(0,0,0,.65)); overflow: visible; }
.bp-sym:hover svg { filter: drop-shadow(0 0 4px rgba(255,213,107,.8)); }
body.bp-existing .bp-sym-note:not(.is-ex) { display: none; }

.bp-label { background: none; border: 0; pointer-events: none; }
.bp-plate, .bp-measure .bp-plate {
  display: inline-block; width: max-content; max-width: 210px; padding: 4px 8px 5px; border-radius: 3px;
  background: rgba(6,24,44,.9); border: 1px solid rgba(255,213,107,.45); border-left: 2px solid var(--bp-gold);
  box-shadow: 0 3px 12px rgba(0,0,0,.45); color: #eef5fb; font: 500 11.5px/1.32 var(--font); letter-spacing: -.003em;
  -webkit-font-smoothing: antialiased; white-space: normal;
}
.bp-plate .pt { display: flex; gap: 6px; align-items: baseline; font: 700 9.5px/1.3 var(--bp-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--bp-cyan); margin-bottom: 1px; }
.bp-plate .pd { color: var(--bp-gold); letter-spacing: .02em; text-transform: none; font-weight: 600; }
.bp-plate .pl { display: block; }
.bp-plate.k-note { border-left-color: var(--bp-cyan); border-color: rgba(79,209,232,.4); }
.bp-plate.is-ex { border-color: rgba(143,182,214,.45); border-left-color: #8fb6d6; }
.bp-measure { position: absolute; left: -9999px; top: 0; visibility: hidden; pointer-events: none; }

.bp-dim-ic { background: none; border: 0; }
.bp-dim { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; align-items: center; pointer-events: none; }
.bp-dim svg { display: block; overflow: visible; }
.bp-dim span { font: 600 9.5px/1 var(--bp-mono); color: #b8d4ea; background: rgba(11,41,69,.85); padding: 1px 4px; margin-top: 2px; white-space: nowrap; border-radius: 2px; }

/* tooltips */
.leaflet-tooltip.bp-tip {
  background: rgba(6,24,44,.96); color: #eef5fb; border: 1px solid rgba(143,182,214,.5); border-radius: 4px; box-shadow: 0 6px 20px rgba(0,0,0,.45);
  padding: 6px 9px; font: 500 12px/1.35 var(--font); max-width: 260px; white-space: normal; width: max-content;
}
.leaflet-tooltip.bp-tip::before { border-top-color: rgba(143,182,214,.6); }
.bp-tip .bt-k { display: block; font: 700 9.5px var(--bp-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--bp-cyan); }
.bp-tip b { display: block; font-weight: 600; }
.bp-tip .bt-d { display: block; font: 600 11px var(--bp-mono); color: var(--bp-gold); }
.bp-tip .bt-s { display: block; color: var(--bp-ink3); font-size: 11px; margin-top: 2px; }
body.bp .aadt-label { background: rgba(6,24,44,.95); color: #cfe3f2; }

/* ---------- Site card ---------- */
.bp-card {
  position: fixed; z-index: 1001; right: 16px; bottom: 128px; width: 340px;
  background: rgba(7,27,50,.95); color: var(--bp-ink); border: 1px solid rgba(143,182,214,.45); border-top: 2px solid var(--bp-gold);
  border-radius: 6px; box-shadow: 0 12px 40px rgba(0,0,0,.45); padding: 10px 12px 10px; backdrop-filter: blur(6px);
}
.bp-card[hidden] { display: none; }
.bpc-head { display: flex; align-items: center; gap: 8px; }
.bpc-id { font: 700 11px var(--bp-mono); color: #1a1300; background: var(--bp-gold); padding: 2px 6px; border-radius: 2px; box-shadow: inset 0 -2px 0 var(--c, transparent); }
.bpc-dwg { font: 500 10.5px var(--bp-mono); color: var(--bp-ink3); letter-spacing: .04em; flex: 1; }
.bpc-x { border: 0; background: none; color: var(--bp-ink2); font-size: 20px; line-height: 1; width: 26px; height: 26px; border-radius: 50%; cursor: pointer; }
.bpc-x:hover { background: rgba(255,255,255,.08); color: #fff; }
.bp-card h3 { margin: 5px 0 6px; font-size: 14.5px; line-height: 1.3; font-weight: 700; color: #fff; }
.bpc-meta { display: grid; grid-template-columns: 1.5fr .8fr .7fr 1.2fr; gap: 6px; margin-bottom: 6px; }
.bpc-meta span { font: 600 12px/1.25 var(--font); color: #fff; font-variant-numeric: tabular-nums; min-width: 0; }
.bpc-meta i { display: block; font: 500 8.5px var(--bp-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--bp-ink3); font-style: normal; margin-bottom: 1px; }
.bpc-els { margin: 0 0 8px; font-size: 11.5px; color: var(--bp-ink2); line-height: 1.4; }
.bpc-kinds { display: block; color: var(--bp-ink3); font-size: 11px; }
.bpc-act { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.bpc-act button {
  border: 1px solid rgba(143,182,214,.45); background: rgba(255,255,255,.04); color: var(--bp-ink); border-radius: 4px;
  padding: 5px 10px; font-size: 12px; font-weight: 600; cursor: pointer;
}
.bpc-act button:hover { background: rgba(255,255,255,.1); }
.bpc-act .btn-pri { background: var(--bp-gold); color: #1a1300; border-color: var(--bp-gold); }
.bpc-act .btn-pri:hover { background: #ffe08f; }
.bpc-nav { margin-left: auto; display: inline-flex; gap: 4px; }
.bpc-nav button { width: 28px; padding: 5px 0; font-size: 15px; line-height: 1; }

/* Method-tab intro card */
.bp-intro { background: linear-gradient(160deg, #0c2944, #071b32); color: #dbe9f5; border: 0; }
.bp-intro h3 { color: #fff; }
.bp-intro p, .bp-intro li { color: #b6cde0 !important; }
.bp-intro .bp-kv { display: grid; grid-template-columns: 28px 1fr; gap: 6px 8px; align-items: center; margin: 10px 0; font-size: 12.5px; color: #cfe3f2; }
.bp-intro .bp-kv i { display: block; height: 12px; border-radius: 1px; }
.bp-intro .bp-open { margin-top: 10px; border: 0; background: #ffd56b; color: #1a1300; font-weight: 700; padding: 7px 14px; border-radius: 6px; cursor: pointer; }
.bp-intro .bp-open:hover { background: #ffe08f; }
.bp-intro .bp-warn { margin-top: 10px; font: 600 11px/1.4 var(--bp-mono); letter-spacing: .03em; color: #ffd56b !important; }

/* ---------- Mobile ---------- */
@media (max-width: 760px) {
  :root { --bp-left: 8px; }
  body { --sheet-h: var(--sheet-collapsed); }
  body.sheet-min { --sheet-h: 132px; }
  body.sheet-expanded { --sheet-h: var(--sheet-expanded); }
  .bp-hud { top: 8px; left: 8px; right: 52px; align-items: flex-start; gap: 5px; }
  .seg button { padding: 5px 11px; font-size: 12.5px; }
  .seg-state button { padding: 3px 9px; font-size: 11.5px; }
  .bp-hud-row { justify-content: flex-start; gap: 6px; flex-wrap: nowrap; }
  .bp-jump select { max-width: 136px; height: 27px; font-size: 11.5px; padding: 0 24px 0 10px; background-position: right 8px center; }
  .bp-disclaimer { top: 84px; left: 10px; max-width: 300px; padding: 3px 7px; }
  .bp-disclaimer b { font-size: 9px; }
  .bp-disclaimer span { font-size: 9.5px; }
  .bp-frame { top: 4px; right: 4px; left: 4px; bottom: calc(var(--sheet-h) + 2px); transition: bottom .3s; }
  .bp-north { top: 118px; right: 10px; }
  .bp-north svg { width: 28px; height: 36px; }
  .bp-card { left: 8px; right: 8px; width: auto; bottom: calc(var(--sheet-h) + 6px); padding: 8px 10px; transition: bottom .3s; }
  body.sheet-expanded .bp-card { display: none; }
  .bp-card h3 { font-size: 13.5px; margin: 3px 0 4px; }
  .bpc-els { display: none; }
  .bpc-meta { margin-bottom: 6px; }
  .bpc-meta span { font-size: 11.5px; }
  .bpc-act button { padding: 4px 9px; font-size: 11.5px; }
  body.bp .leaflet-bottom.leaflet-left { left: 0; }
  body.bp .leaflet-bottom.leaflet-left, body.bp .leaflet-bottom.leaflet-right { bottom: calc(var(--sheet-h) + var(--bp-card-h) + 8px) !important; }
  body.bp.sheet-expanded .leaflet-bottom { bottom: var(--sheet-expanded) !important; }
  body.bp .legend { width: 200px; }
  body.bp .legend.collapsed { width: auto; }
  body.bp .legend.collapsed .legend-toggle { gap: 8px; padding: 6px 10px; }
  .bp-plate { max-width: 170px; font-size: 10.5px; padding: 3px 6px 4px; }
  .bp-plate .pt { font-size: 8.5px; }
  .bp-coords .px { display: none; }
  .bp-coords { font-size: 9.5px; padding: 2px 6px; }
  .bp-coords .k { display: none; }
  body.bp .leaflet-control-attribution { font-size: 9px; max-width: 70vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
@media (max-width: 760px) and (max-height: 700px) {
  .bp-disclaimer span { display: none; }
}
