/* Kamand Street View - layout and chrome.
   Dark chrome so the imagery is the bright thing on screen. */

:root{
  --bg:#0f1115; --panel:#171a21; --line:#262b36;
  --fg:#e8ecf3; --muted:#98a2b3; --accent:#3b82f6; --accentGlow:#60a5fa;
  --bar:52px;
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0; background:var(--bg); color:var(--fg); overflow:hidden;
  font:14px/1.45 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  -webkit-font-smoothing:antialiased;
}
button{font:inherit;color:inherit}

#app{height:100%;display:flex;flex-direction:column}

/* ---------- top bar ---------- */
#bar{
  height:var(--bar); flex:0 0 var(--bar); display:flex; align-items:center;
  justify-content:space-between; gap:12px; padding:0 12px;
  background:var(--panel); border-bottom:1px solid var(--line); z-index:20;
}
.brand{display:flex;align-items:center;gap:9px;min-width:0}
.brand .dot{width:9px;height:9px;border-radius:50%;background:var(--accent);
  box-shadow:0 0 0 4px rgba(59,130,246,.18);flex:0 0 auto}
.brand strong{font-weight:600;letter-spacing:.2px;white-space:nowrap}
.sub{color:var(--muted);font-size:12px;white-space:nowrap;overflow:hidden;
  text-overflow:ellipsis}
.tools{display:flex;align-items:center;gap:8px}

.seg{display:flex;background:#0e1116;border:1px solid var(--line);border-radius:8px;
  overflow:hidden}
.seg button{background:none;border:0;padding:6px 12px;cursor:pointer;
  color:var(--muted);transition:background .15s,color .15s}
.seg button:hover{color:var(--fg);background:#1b2029}
.seg button.on{background:var(--accent);color:#fff}

.btn{background:#0e1116;border:1px solid var(--line);border-radius:8px;
  padding:6px 11px;cursor:pointer;color:var(--muted);
  transition:background .15s,color .15s,border-color .15s}
.btn:hover{color:var(--fg);border-color:#3a4354;background:#1b2029}
.btn.ghost{background:rgba(15,17,21,.72);backdrop-filter:blur(6px)}

/* ---------- stage ---------- */
#stage{flex:1;display:flex;min-height:0;position:relative}
#mapWrap,#panoWrap{position:relative;min-width:0;height:100%}
#map,#pano{position:absolute;inset:0}
#map{background:#0b0d11}

/* three layout modes, animated so switching does not feel like a page jump */
#mapWrap,#panoWrap{transition:flex-basis .28s cubic-bezier(.4,0,.2,1)}
.mode-split #mapWrap{flex:0 0 38%}
.mode-split #panoWrap{flex:1}
.mode-map   #mapWrap{flex:1}
.mode-map   #panoWrap{flex:0 0 0;overflow:hidden}
.mode-pano  #mapWrap{flex:0 0 0;overflow:hidden}
.mode-pano  #panoWrap{flex:1}

/* mini map floats over the panorama when the big map is hidden */
#mini{
  position:absolute;left:14px;bottom:14px;width:210px;height:150px;
  border-radius:12px;overflow:hidden;border:1px solid var(--line);
  box-shadow:0 10px 34px rgba(0,0,0,.55);display:none;z-index:6;
}
.mode-pano #mini{display:block}
#closePano{position:absolute;top:12px;right:12px;z-index:7;display:none}
.mode-pano #closePano{display:block}

/* ---------- readout ---------- */
#readout{
  position:absolute;left:14px;top:12px;z-index:6;display:none;gap:10px;
  padding:7px 12px;border-radius:9px;font-size:12px;color:var(--fg);
  background:rgba(15,17,21,.72);backdrop-filter:blur(8px);
  border:1px solid var(--line);
}
#readout.on{display:flex}
#readout b{color:var(--muted);font-weight:500}

.hint{
  position:absolute;left:50%;bottom:16px;transform:translateX(-50%);
  padding:7px 14px;border-radius:20px;font-size:12.5px;white-space:nowrap;
  background:rgba(15,17,21,.8);backdrop-filter:blur(8px);
  border:1px solid var(--line);color:var(--muted);pointer-events:none;
  transition:opacity .3s;z-index:5;
}
.hint.gone{opacity:0}
.hint b{color:var(--accentGlow)}

/* landslide legend, bottom-left of the map */
.legend{
  position:absolute;left:12px;bottom:34px;z-index:5;padding:8px 11px;border-radius:9px;
  font-size:12px;color:var(--fg);background:rgba(15,17,21,.8);backdrop-filter:blur(8px);
  border:1px solid var(--line);display:flex;flex-direction:column;gap:3px;
}
.legend[hidden]{display:none}
.legend label{display:flex;gap:6px;align-items:center;font-weight:600;cursor:pointer;margin-bottom:2px}
.legend small{color:var(--muted);font-size:10.5px;margin-top:3px}
.zone{display:inline-block;width:11px;height:11px;border-radius:3px;margin-right:6px;
  vertical-align:-1px;border:1px solid rgba(255,255,255,.25)}
.zone.dot{background:#dc2626;border-radius:50%;border:2px solid #fff}
#readout .near{color:#fca5a5;font-weight:600}

/* embedded in another page (#...&embed): just the 360 view, no bar / mini map / readout */
.embed #bar,.embed #mini,.embed #readout,.embed #closePano{display:none!important}

.empty{
  position:absolute;inset:0;display:flex;align-items:center;justify-content:center;
  text-align:center;color:var(--muted);background:var(--bg);z-index:4;
}
.empty h2{margin:0 0 6px;font-size:16px;font-weight:600;color:var(--fg)}
.empty p{margin:0;font-size:13px}
.empty.gone{display:none}

/* ---------- boot ---------- */
#boot{
  position:absolute;inset:0;z-index:50;display:flex;flex-direction:column;
  align-items:center;justify-content:center;gap:14px;background:var(--bg);
  color:var(--muted);transition:opacity .35s;
}
#boot.gone{opacity:0;pointer-events:none}
.spin{width:26px;height:26px;border:2.5px solid var(--line);
  border-top-color:var(--accent);border-radius:50%;animation:sp .8s linear infinite}
@keyframes sp{to{transform:rotate(1turn)}}

/* ---------- map bits ---------- */
.maplibregl-ctrl-group{background:var(--panel)!important;border:1px solid var(--line)!important}
.maplibregl-ctrl-group button+button{border-top:1px solid var(--line)!important}
.maplibregl-ctrl-group button span{filter:invert(1) brightness(1.6)}
.maplibregl-ctrl-attrib{background:rgba(15,17,21,.8)!important;font-size:10px}
.maplibregl-ctrl-attrib a{color:var(--muted)!important}


/* ---------- small screens ---------- */
@media (max-width:860px){
  :root{--bar:48px}
  .brand .sub{display:none}
  #stage{flex-direction:column}
  .mode-split #mapWrap{flex:0 0 42%}
  .mode-split #panoWrap{flex:1}
  #mini{width:150px;height:108px}
  /* info bar: beside the compass, only what matters on a phone (zone + hazard warning) */
  #readout{left:auto;right:10px;top:10px;max-width:calc(100% - 110px);flex-wrap:wrap;gap:2px 8px;font-size:11.5px}
  #readout .c{display:none}
  /* legend folded to a "Map key" button until tapped */
  .legend{left:8px;bottom:28px;padding:6px 9px;font-size:11.5px}
  .legend .legendBtn{display:block}
  .legend:not(.open) > :not(.legendBtn){display:none}
}
.legendBtn{display:none;background:none;border:0;padding:0;color:var(--fg);font-weight:600;cursor:pointer;text-align:left}
@media (max-width:420px){
  #bar{gap:6px;padding:0 8px}
  .seg button{padding:6px 9px}
  .btn{padding:6px 8px}
}
