/* The crowd map page (/map). The shell it sits in (server.js shellPage, "bare") brings the fonts and the base colours of
   privacy.html; this file adds the rest of the app's colour tokens and the page's own full-height layout. Every colour
   below is a token from the app (index.html), so light and dark follow the phone. The map's own colours (the dots and the
   pin) are in map.js. */
:root{--l1:#C98A12;--l2:#D4572B;--l3:#B3283D;--t0:#1E6E52;--t1:#8A5A00;--t2:#B04318;--t3:#B3283D}
@media (prefers-color-scheme:dark){:root{--t0:#4CC59A;--l1:#E5AE3D;--l2:#F07B52;--l3:#EF6A80;--t1:#E5AE3D;--t2:#F07B52;--t3:#EF6A80}}
.l0{--c:var(--l0);--ct:var(--t0)}.l1{--c:var(--l1);--ct:var(--t1)}.l2{--c:var(--l2);--ct:var(--t2)}.l3{--c:var(--l3);--ct:var(--t3)}
.cl{--c:var(--line);--ct:var(--mute)}

/* One column, as tall as the screen: the top bar, the map (which takes what is left) and the legend. dvh is the visible
   height on a phone with a moving address bar; vh is for browsers that do not know it. */
main.bare{max-width:680px;margin:0 auto;padding:0;height:100vh;height:100dvh;position:relative}
.mp{height:100%;display:flex;flex-direction:column}
@media (min-width:700px){main.bare{border-left:1px solid var(--line);border-right:1px solid var(--line)}}
:focus-visible{outline:2px solid var(--acc);outline-offset:2px}

.mtop{flex:none;display:flex;align-items:center;gap:10px;padding:calc(4px + env(safe-area-inset-top,0px)) max(12px,env(safe-area-inset-right,0px)) 4px max(4px,env(safe-area-inset-left,0px));border-bottom:1px solid var(--line);background:var(--bg)}
.mback{display:inline-flex;align-items:center;min-height:44px;padding:0 10px;font-weight:600;text-decoration:none;white-space:nowrap}
.mtop h1{flex:1;min-width:0;margin:0;font-size:calc(1.3rem - 0.5pt);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mtime{flex:none;padding:4px 11px;border-radius:999px;border:1px solid var(--line);background:var(--card);color:var(--ink);font-size:calc(0.88rem - 0.5pt);font-weight:600;line-height:1.4;white-space:nowrap}

.mwrap{flex:1;min-height:260px;position:relative;overflow:hidden;background:var(--bg)}
#mcanvas{position:absolute;inset:0}
.mplot{position:absolute;inset:0;width:100%;height:100%;background:var(--bg)}
.mplot[hidden],#mcanvas[hidden]{display:none}
.mplot .pd{fill:var(--c);stroke:var(--card);stroke-width:1.5}
.mplot .pg{fill:var(--c);opacity:.28}
.mplot .ph{fill:none;pointer-events:all;cursor:pointer}
.mplot .pp{pointer-events:none;cursor:pointer}

/* Filter chips over the map: one row that scrolls sideways. The row lets taps through to the map between chips. */
.mchips{position:absolute;z-index:3;top:8px;left:0;right:0;display:flex;gap:8px;padding:0 12px;overflow-x:auto;scrollbar-width:none;-webkit-overflow-scrolling:touch;touch-action:pan-x} /* the row takes touches itself (a swipe along it scrolls the chips; with pointer-events none the map underneath swallowed the swipe and the row could not scroll); it is 44px of the map's top edge, so nothing is lost */
.mchips::-webkit-scrollbar{display:none}
.mchips::after{content:"";flex:0 0 4px}
.chip{pointer-events:auto;flex:none;min-height:44px;padding:0 15px;border-radius:999px;border:1px solid var(--line);background:var(--card);color:var(--ink);font:600 calc(0.94rem - 0.5pt)/1 Figtree,var(--fbf),system-ui,sans-serif;cursor:pointer}
.chip[aria-pressed=true]{background:var(--acc);border-color:var(--acc);color:var(--accink)}

/* Small notes under the chips: loading, tiles that did not load, no favorites yet */
.mstack{position:absolute;z-index:3;top:60px;left:12px;right:12px;display:flex;flex-direction:column;align-items:flex-start;gap:6px;pointer-events:none}
.mcloud{margin:0;padding:6px 12px;border-radius:12px;border:1px solid var(--line);background:var(--card);color:var(--ink);font-size:calc(0.88rem - 0.5pt);line-height:1.4}
.mcloud[hidden]{display:none}
.mcloud:empty{display:none}

/* The selected place's card, over the bottom of the map (room is left under it for the map's credit). The level colour
   is the 4px left edge, as on the "Best time" callout, and the level word is in the text version of that colour. */
.mcardw{position:absolute;z-index:3;left:12px;right:12px;bottom:34px;pointer-events:none}
.mcardw:empty{display:none}
.mcard{pointer-events:auto;padding:2px 6px 4px 12px;border-radius:14px;border:1px solid var(--line);border-left:4px solid var(--c);background:var(--card);box-shadow:0 2px 10px color-mix(in srgb,var(--ink) 18%,transparent)}
.mc-h{display:flex;align-items:center;gap:8px}
.mc-h h2{flex:1;min-width:0;margin:0;font-size:calc(1rem - 0.5pt);line-height:1.25;overflow-wrap:anywhere}
.mc-lv{flex:none;font-weight:700;font-size:calc(0.94rem - 0.5pt);color:var(--ct)}
.mc-star{flex:none;min-width:44px;min-height:44px;margin-top:-4px;margin-bottom:-6px;margin-right:-4px;background:none;border:0;padding:0;font-size:calc(1.5rem - 0.5pt);line-height:1;color:var(--mute);cursor:pointer}
.mc-star[aria-pressed=true]{color:var(--l1)}
.mc-starro{display:inline-flex;align-items:center;justify-content:center;color:var(--l1);cursor:default}
.mc-r{display:flex;align-items:center;gap:10px}.mc-meta{flex:1;min-width:0;margin:0;color:var(--mute);font-size:calc(0.88rem - 0.5pt);line-height:1.3;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.mc-open{flex:none;display:inline-flex;align-items:center;min-height:36px;padding:0 4px;font-weight:600;font-size:calc(0.94rem - 0.5pt);text-decoration:none;white-space:nowrap}

/* The map's own credit, from the library's stylesheet, sits bottom right; the legend and the fine print are under the map */
.mfoot{flex:none;padding:6px max(16px,env(safe-area-inset-right,0px)) calc(8px + env(safe-area-inset-bottom,0px)) max(16px,env(safe-area-inset-left,0px));border-top:1px solid var(--line);background:var(--bg)}
.mleg{display:flex;flex-wrap:wrap;gap:2px 16px;margin:0;padding:0;list-style:none;font-size:calc(0.88rem - 0.5pt);font-weight:600}
.mleg li{display:flex;align-items:center;gap:6px}
.mleg i{width:10px;height:10px;border-radius:50%;background:var(--c);flex:none}

/* The pins (MapLibre markers; the plain version's .pp are the same shape): one on every saved place and on the selected one.
   Only the pin's shape takes taps, so the dots around and under it stay tappable, and the markers sit over the map's dots.
   MapLibre positions a marker with its own transform, so the selected look (a larger pin and a ring) goes on the svg inside. The
   scale is about the bottom tip, which stays on the place. The pin itself stays ink with a white stroke in both themes (the brand
   mark); the ring is the accent, which is the one part that follows the theme. */
.mpin{width:34px;height:44px;z-index:1;pointer-events:none;cursor:pointer}
.mpin.sel{z-index:2}
.mpin svg,.mplot .pp svg{display:block;pointer-events:none}
.mpin svg>path,.mplot .pp svg>path{pointer-events:auto}
.mpin.sel svg{transform:scale(1.15);transform-origin:50% 100%}
.mpin.sel svg,.mplot .pp.sel{filter:drop-shadow(2px 0 0 var(--acc)) drop-shadow(-2px 0 0 var(--acc)) drop-shadow(0 2px 0 var(--acc)) drop-shadow(0 -2px 0 var(--acc))}
.mpin:focus-visible,.mplot .pp:focus-visible{outline:2px solid var(--acc);outline-offset:2px}

/* For screen readers only: the places on the map, as text */
.sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0;list-style:none}

@media (prefers-reduced-motion:reduce){*{scroll-behavior:auto!important}}
