/* VSSGEO design round 2: MAP lane (docs/design/round2/map.css).
   The map canvas and everything floating on it: corner tools (#gmapc: pin / transparency / clear), MapLibre zoom and
   attribution ("i"), the dock (layer toggles, legends, the pin / drive-time tool box), MapLibre popups, the hex hover
   card (#tip), the dropped pin, the Vista Elements / Data library footer, and the map's Working state.
   Load AFTER vssgeo-theme.css, door.css and door-panels.css (several rules win on order at equal specificity).
   Pairs with map.js (block-by-block layer arrival + the Working counter; it adds body.vgmap-working).
   Scoped to body.door. Colours are --vg-* tokens (plus the --vgmap-* locals below, defined for both themes).
   8-pt: 4 / 8 / 16 / 24 / 32 / 48. Floating controls are 40 (32 inside a box), 48 / 40 on touch.
   Motion roles: Arrive (popups, pin, legends, data layers), Working (top edge line + hex shimmer while Geo computes),
   Rest (nothing loops: the "on" rings no longer spin at rest). The area outline (door.js areaRing) is not touched.
   !important is used only against door.css's own !important light-mode dock rule or inline styles; each use is marked [!]. */

/* ══ tokens (local to this lane) ══════════════════════════════════════════════════════════════════════ */
:root{
  --vgmap-ctl:40px;          /* a floating control (corner buttons, the zoom box) */
  --vgmap-btn:32px;          /* a button inside a box / minimum target */
  --vgmap-inset:16px;        /* distance from the map edge */
  --vgmap-float:0 1px 2px rgba(0,0,0,.30),0 8px 24px rgba(0,0,0,.34);   /* floating controls: quieter than --vg-shadow */
  --vgmap-card:0 16px 32px rgba(0,0,0,.42);                              /* popups and the hover card */
  --vgmap-flow:linear-gradient(90deg,#ebaa1f,#b22c2e,#b5d9ee,#ebaa1f);   /* the brand ring's colours, as a line */
}
:root[data-theme="light"]{
  --vgmap-float:0 1px 2px rgba(20,25,28,.08),0 8px 24px rgba(20,25,28,.12);
  --vgmap-card:0 16px 32px rgba(20,25,28,.14);
}

@keyframes vgmap-fade{from{opacity:0}to{opacity:1}}
@keyframes vgmap-flow{to{background-position:-200% 0}}
@keyframes vgmap-drop{from{translate:0 -24px;opacity:0}to{translate:0 0;opacity:1}}
@keyframes vgmap-ramp{from{clip-path:inset(-8px 100% -8px -8px)}to{clip-path:inset(-8px -8px -8px -8px)}}
@keyframes vgmap-block{from{transform:scaleY(0);opacity:0}to{transform:none;opacity:1}}
@keyframes vgmap-shine{from{transform:translateX(-120%)}to{transform:translateX(120%)}}


/* ══ 1. one floating-control style ════════════════════════════════════════════════════════════════════
   Glass, a 1px rule, 12 corners, the quiet float shadow; hover lifts 1px and shows the brand ring (door.css);
   press springs to .94; keyboard focus shows the ring too, plus the accent outline. */
body.door #gmapc{top:var(--vgmap-inset);gap:8px}
body.door #gmapc>button{width:var(--vgmap-ctl);height:var(--vgmap-ctl);--vg-shadow:var(--vgmap-float);   /* door.css reads box-shadow:var(--vg-shadow) */
  -webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px)}
body.door #gmapc>button:hover{transform:translateY(-1px)}
body.door #gmapc>button:active{transform:scale(.94)}
body.door #gmapc>button:focus-visible::after{opacity:1;animation:vg-spin 4.5s linear infinite}
/* the bin says what it does before you click it */
body.door #gmapc>[data-c="clr"]:hover{color:color-mix(in srgb,var(--vg-red) 72%,var(--vg-ink))}
/* popovers from the corner: 16 padding on the 8-pt grid */
body.door .gmcpop{padding:16px}
body.door .gmch{margin-bottom:8px}
body.door .gmcs{margin-top:4px}

/* zoom +/−: a 40-wide box (3 + 1px rule = the 4px optical inset) holding 32px buttons, 4 apart */
body.door .maplibregl-ctrl-group{--vg-shadow:var(--vgmap-float);padding:3px;gap:4px}   /* door.css: box-shadow:var(--vg-shadow)!important */
body.door .maplibregl-ctrl-group button{width:var(--vgmap-btn);height:var(--vgmap-btn)}
body.door .maplibregl-ctrl-group:focus-within::after{opacity:1;animation:vg-spin 4.5s linear infinite}
body.door .maplibregl-ctrl-group button:disabled .maplibregl-ctrl-icon{opacity:.35}
body.door .maplibregl-ctrl-bottom-right .maplibregl-ctrl{margin:0 var(--vgmap-inset) 8px 0}
body.door .maplibregl-ctrl-bottom-right .maplibregl-ctrl:last-child{margin-bottom:var(--vgmap-inset)}

/* attribution "i": ultra-quiet 22px round dot when folded; slim 9px glass pill when clicked open */
body.door .maplibregl-ctrl-attrib{box-shadow:var(--vgmap-float);opacity:.55;transition:opacity .2s ease}
body.door .maplibregl-ctrl-attrib:hover,body.door .maplibregl-ctrl-attrib.maplibregl-compact-show,body.door .maplibregl-ctrl-attrib[open]{opacity:1}
body.door .maplibregl-ctrl-attrib.maplibregl-compact{box-sizing:border-box;min-height:22px;min-width:22px;padding:0;border-radius:999px;font-size:9px;line-height:18px}
body.door .maplibregl-ctrl-attrib.maplibregl-compact.maplibregl-compact-show,body.door .maplibregl-ctrl-attrib.maplibregl-compact[open]{padding:2px 26px 2px 10px}
body.door .maplibregl-ctrl-attrib.maplibregl-compact:not(.maplibregl-compact-show):not([open]) .maplibregl-ctrl-attrib-inner{display:none}
body.door .maplibregl-ctrl-attrib-inner{line-height:18px;font-size:9px}
body.door .maplibregl-ctrl-attrib .maplibregl-ctrl-attrib-button{width:22px;height:22px;top:-1px;right:-1px;background-position:center;background-size:14px 14px}
body.door .maplibregl-ctrl-attrib .maplibregl-ctrl-attrib-button:focus-visible{outline:2px solid var(--vg-accent);outline-offset:2px}


/* ══ 2. the dock: layer toggles, legends as quiet cards, the pin / drive-time tool box ══════════════════════ */
body.door #dock{box-shadow:var(--vgmap-float);padding:4px}
body.door #dock .drow{gap:4px}
body.door #dock .layers button{min-height:var(--vgmap-btn);padding:0 16px}
/* door.css's light rule paints every dock button glass + ink with !important, which hides the accent "on" colour */
:root[data-theme="light"] body.door #dock .layers button.on{color:var(--vg-accent)!important}   /* [!] vs door.css light #dock button */

/* legends: a quiet inner card (a fill, no line: the dock is the container), mono ticks, and they ARRIVE */
body.door #dock .gheat{min-height:var(--vgmap-btn);padding:0 16px;gap:8px;border-radius:var(--vg-pill);background:color-mix(in srgb,var(--vg-ink) 5%,transparent)}
body.door #dock .gheat i{animation:vgmap-ramp .48s steps(6,end) both}      /* the ramp builds in 6 blocks */
body.door #dock #ladder{min-height:var(--vgmap-btn);margin:4px 0 0;padding:0 16px;gap:8px;border-radius:var(--vg-pill);
  background:color-mix(in srgb,var(--vg-ink) 5%,transparent);font:500 10.5px/1 var(--vg-font-mono);color:var(--vg-muted);font-variant-numeric:tabular-nums}
body.door #dock #lbar i{transform-origin:50% 100%;animation:vgmap-block .3s var(--vg-spring) both}   /* the ten tiers stack in, left to right */
body.door #dock #lbar i:nth-child(2){animation-delay:.03s}body.door #dock #lbar i:nth-child(3){animation-delay:.06s}
body.door #dock #lbar i:nth-child(4){animation-delay:.09s}body.door #dock #lbar i:nth-child(5){animation-delay:.12s}
body.door #dock #lbar i:nth-child(6){animation-delay:.15s}body.door #dock #lbar i:nth-child(7){animation-delay:.18s}
body.door #dock #lbar i:nth-child(8){animation-delay:.21s}body.door #dock #lbar i:nth-child(9){animation-delay:.24s}
body.door #dock #lbar i:nth-child(n+10){animation-delay:.27s}

/* the tool box ("Click the map to drop a pin. Drive time: 5 · 10 · 15 · 20 · 30 min … Done") */
body.door #dock #toolbox{padding:8px 8px 8px 16px;font:500 13px/1.5 var(--vg-font-body);color:var(--vg-muted)}   /* display is set inline by setTool */
body.door #dock #toolbox::after{content:"";display:block;clear:both}   /* contain Evan's floated Done */
body.door #dock #toolbox .tbtitle{display:block;margin-bottom:4px;font:600 12px var(--vg-font-display);color:var(--vg-ink)}
body.door #dock #toolbox .opts{gap:8px;margin-top:8px}
body.door #dock #toolbox .chip{min-height:var(--vgmap-btn);padding:0 16px;display:inline-flex;align-items:center}
/* the values are numbers: mono (Undo / Finish are words and keep the display face) */
body.door #dock #toolbox .opts .chip[onclick*="OPT."]{font:500 12.5px var(--vg-font-mono);font-variant-numeric:tabular-nums}
body.door #dock #toolbox .chip.on{border-color:var(--vg-accent);color:var(--vg-ink)}
:root[data-theme="light"] body.door #dock #toolbox .chip.on{background:var(--vg-accent-soft)!important}   /* [!] vs door.css light #dock button */
body.door #dock #toolbox .go{min-height:var(--vgmap-btn);padding:0 16px}
:root[data-theme="light"] body.door #dock #toolbox .go{background:var(--vg-red)!important;color:var(--vg-geo-ink)!important}   /* [!] Finish stayed white in light */
body.door #dock #toolbox .gdone{min-height:var(--vgmap-btn);margin-top:8px;padding:0 16px;border-radius:var(--vg-pill)}
body.door #dock #toolbox .gnum{height:var(--vgmap-btn);padding:0 8px}


/* ══ 3. map popups: quiet cards (address card .vpop, boundary pick .gpop) ═══════════════════════════════ */
body.door .maplibregl-popup-content{--vg-shadow:var(--vgmap-card);   /* door.css: box-shadow:var(--vg-shadow)!important */
  background:var(--vg-panel);padding:16px;font-variant-numeric:tabular-nums;animation:vg-pop .24s var(--vg-spring) both}
body.door .maplibregl-popup-content::before{content:none}          /* round 1's two-tone glow: popups are quiet now */
body.door .maplibregl-popup-close-button{top:8px;right:8px;width:var(--vgmap-btn);height:var(--vgmap-btn);isolation:isolate}
body.door .maplibregl-popup-close-button::after{content:"";position:absolute;inset:0;border-radius:50%;padding:1.4px;pointer-events:none;
  background:conic-gradient(from var(--vg-ang),var(--vg-gold) 0deg,var(--vg-red) 110deg,var(--vg-blue) 210deg,var(--vg-gold) 330deg,var(--vg-gold) 360deg);
  -webkit-mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0);mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0);
  -webkit-mask-composite:xor;mask-composite:exclude;opacity:0;transition:opacity .22s ease}
body.door .maplibregl-popup-close-button:is(:hover,:focus-visible)::after{opacity:1;animation:vg-spin 3s linear infinite}
body.door .vpop b{padding-right:40px}
body.door .vpop small{margin:4px 0 16px}
body.door .vpop .vpa{gap:8px}
body.door .vpop .vpa :is(.go,.chip){min-height:var(--vgmap-btn);padding:0 16px;display:inline-flex;align-items:center}
/* boundary pick: segmented pill, then value + unit + Run on one 40px row */
body.door .gpick{gap:16px}
body.door .gseg{margin-right:40px;padding:4px;gap:4px}
body.door .gseg button{min-height:var(--vgmap-btn);padding:0}
body.door .gpv{gap:8px}
body.door .gpv input{height:var(--vgmap-ctl);padding:0 8px}
body.door .gpv .go{height:var(--vgmap-ctl);padding:0 16px}
body.door .gpick>.go{min-height:var(--vgmap-ctl)}
body.door .gpick .gerr{margin-top:-8px;font:500 12px var(--vg-font-body);color:color-mix(in srgb,var(--vg-red) 60%,var(--vg-ink))}

/* the dropped pin ARRIVES: falls 24px on the spring (translate composes with the pin's own rotate) */
body.door .vpin .vp{animation:vgmap-drop .4s var(--vg-spring) both}


/* ══ 4. hex hover card (#tip): a quiet card; the number is a mono tag in its data colour ═══════════════════ */
body.door #tip{border-radius:var(--vg-r);padding:8px 16px 8px 8px;background:var(--vg-glass);color:var(--vg-ink);border:1px solid var(--vg-rule);
  box-shadow:var(--vgmap-card);font:500 12.5px/1.6 var(--vg-font-body);max-width:320px;animation:vgmap-fade .14s ease both}
body.door #tip b{display:inline-block;margin-right:4px;padding:0 8px;border-radius:var(--vg-pill);line-height:20px;
  font:600 12.5px/20px var(--vg-font-mono);font-variant-numeric:tabular-nums;background:color-mix(in srgb,currentColor 14%,transparent)}
/* light: the inline gold / tier colours are darkened in place so they read on the light card (same hue as the hexes) */
:root[data-theme="light"] body.door #tip{background:var(--vg-glass);color:var(--vg-ink);border-color:var(--vg-rule)}
:root[data-theme="light"] body.door #tip b{filter:brightness(.55) saturate(1.3)}
:root[data-theme="light"] body.door #tip span[style]{color:var(--vg-muted)!important}   /* [!] round 1 set --vg-faint !important for the old inverted card */


/* ══ 5. Vista Elements / Data library (under the message box) ══════════════════════════════════════════ */
body.door .gfoot .gel,body.door .gfoot .glib{min-height:var(--vgmap-btn);padding:0 16px}
body.door .gfoot :is(.gel,.glib):focus-visible::after{opacity:1;animation:vg-spin 4.5s linear infinite}
/* Rest: "on" shows the ring still; it turns only on hover (round 1 had it spinning for as long as the layer was on) */
body.door .gfoot .gel[aria-pressed="true"]::after,body.door .gfoot .glib[aria-expanded="true"]::after{opacity:.85;animation:none}
body.door .gfoot .gel[aria-pressed="true"]:hover::after,body.door .gfoot .glib[aria-expanded="true"]:hover::after{opacity:1;animation:vg-spin 4.5s linear infinite}
/* Evan's swatch sheen looped forever at rest; now it sweeps once when you point at the switch */
body.door .gel .gsw::after{animation:none;transform:translateX(-120%)}
body.door .gel:hover .gsw::after{animation:vgmap-shine .7s ease 1 both}


/* ══ 6. Working: while Geo computes (map.js counts in-flight /api/(find|chat|agent|story|brief) calls) ══════ */
/* a thin brand line runs along the map's top edge; map.js also lets the hex edges shimmer. Gone when the calls end. */
body.door #map::after{content:"";position:absolute;left:0;right:0;top:0;height:2px;z-index:3;pointer-events:none;
  background:var(--vgmap-flow) 0 0/200% 100%;opacity:0;transition:opacity .3s ease}
body.door.vgmap-working #map::after{opacity:.9;animation:vgmap-flow 1.4s linear infinite}


/* ══ 7. touch: obvious targets (40 minimum) ═════════════════════════════════════════════════════════════ */
@media (pointer:coarse){
  body.door .maplibregl-ctrl-group button,body.door .maplibregl-popup-close-button,body.door .maplibregl-ctrl-attrib .maplibregl-ctrl-attrib-button{width:var(--vgmap-ctl);height:var(--vgmap-ctl)}
  body.door .maplibregl-ctrl-attrib.maplibregl-compact{min-height:var(--vgmap-ctl);padding-right:var(--vgmap-ctl)}
  body.door #dock .layers button,body.door #dock #toolbox :is(.chip,.go,.gdone),body.door .gfoot :is(.gel,.glib),
  body.door .vpop .vpa :is(.go,.chip),body.door .gseg button{min-height:var(--vgmap-ctl)}
  body.door .vpop b{padding-right:48px}
  body.door .gseg{margin-right:48px}
}


/* ══ 8. reduced motion ══════════════════════════════════════════════════════════════════════════════════
   door.css already switches off every animation/transition under body.door. These make sure everything ends at rest:
   legends fully drawn, the pin in place, the Working line shown still (it is a state, not decoration). */
@media (prefers-reduced-motion:reduce){
  body.door #dock .gheat i,body.door #dock #lbar i,body.door .vpin .vp,body.door #tip,body.door .maplibregl-popup-content{animation:none;clip-path:none;translate:none;opacity:1}
  body.door.vgmap-working #map::after{animation:none;opacity:.6}
  body.door .gel .gsw::after{display:none}
}
