/* map.css: the foundation's location map on the contact page (assets/js/visitmap.js, markup in design/map-snippet.html).
   A flat, muted MapLibre map with the site's one radius (--r). Loaded only on the page that has the map.
   The map's colours are the custom properties below; visitmap.js reads them and repaints the basemap with them,
   so no colour lives in the script. Values that are not a site token are mixes of the tokens over --ground. */

.vmap {
  --vmap-land: var(--ground);              /* empty land, landuse, background */
  --vmap-park: #E3E8E5;                    /* parks, wood: --ground with a little --teal and --ink */
  --vmap-water: #C9DEE0;                   /* water: --teal at 16% over --ground */
  --vmap-building: #E5E6E3;                /* buildings: --ink at 5% over --ground */
  --vmap-building-line: #D8DBD9;
  --vmap-road: var(--paper);               /* major roads, inner line */
  --vmap-road-line: #D3D9D9;               /* road casings */
  --vmap-minor: #DCE0DF;                   /* minor roads and paths */
  --vmap-boundary: #B6BFC0;
  --vmap-label: var(--ink-2);              /* place names */
  --vmap-road-label: #556163;              /* street names: --ink-2 lifted, 5.6:1 on --ground */
  --vmap-water-label: var(--teal-ink);
  --vmap-halo: var(--ground);
  display: flex;
  flex-direction: column;
  height: 100%;                            /* fills its cell (.kr-contact__map) beside the facts */
}

/* The frame is MapLibre's container. Its size is set before anything loads, so nothing around it moves. */
.vmap__frame {
  position: relative;
  flex: 1 1 auto;
  min-height: 300px;
  overflow: hidden;
  border-radius: var(--r);
  background: var(--vmap-land);
}

/* Fallback: no WebGL2, the library or the style did not load (data-state="fallback", set by visitmap.js),
   or JavaScript is off. The frame goes and the directions link takes its place; the cell drops its map height,
   so no empty box is left. */
.vmap__fallback { display: none; margin: 0; }
.vmap[data-state="fallback"] .vmap__frame { display: none; }
.vmap[data-state="fallback"] .vmap__fallback { display: block; }
.kr-contact__map:has(> .vmap[data-state="fallback"]) { min-height: 0; }
@media (scripting: none) {
  .vmap__frame { display: none; }
  .vmap__fallback { display: block; }
  .kr-contact__map:has(> .vmap) { min-height: 0; }
}

/* MapLibre's own stylesheet loads after this one; two classes keep these rules ahead of its one-class rules. */
.vmap .vmap__frame { font: 400 .75rem/1.4 var(--font); }
.vmap .maplibregl-canvas-container.maplibregl-interactive,
.vmap .maplibregl-canvas { cursor: default; }

/* Keyboard focus: the canvas fills the clipped frame, so its own outline would be cut off. The frame draws it
   (only where :has() works; elsewhere the canvas keeps the site's own focus outline). */
@supports selector(:has(*)) {
  .vmap .maplibregl-canvas:focus,
  .vmap .maplibregl-canvas:focus-visible { outline: none; }
  .vmap .vmap__frame:has(.maplibregl-canvas:focus-visible) { outline: 2px solid var(--teal); outline-offset: 3px; }
}

/* Zoom buttons: flat paper, a hairline edge, 44px targets. */
.vmap .maplibregl-ctrl-top-right .maplibregl-ctrl { margin: 12px 12px 0 0; }
.vmap .maplibregl-ctrl-group:not(:empty) { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); box-shadow: none; }
.vmap .maplibregl-ctrl-group button { width: 44px; height: 44px; }
.vmap .maplibregl-ctrl-group button + button { border-top: 1px solid var(--line); }
.vmap .maplibregl-ctrl-group:not(:empty) button:first-child { border-radius: var(--r) var(--r) 0 0; }
.vmap .maplibregl-ctrl-group:not(:empty) button:last-child { border-radius: 0 0 var(--r) var(--r); }
.vmap .maplibregl-ctrl-group button:focus:focus-visible { box-shadow: none; outline: 2px solid var(--teal); outline-offset: 2px; }
.vmap .maplibregl-ctrl button:not(:disabled):hover { background-color: var(--ground); }

/* The credit (OpenFreeMap, OpenMapTiles, OpenStreetMap): always open, readable, in the corner. */
.vmap .maplibregl-ctrl-bottom-right .maplibregl-ctrl-attrib {
  margin: 0;
  padding: 0 8px;
  max-width: 100%;
  border-radius: var(--r) 0 0 0;
  background: rgba(251, 251, 250, .92);    /* --paper, for browsers without color-mix() */
  color: var(--ink-2);
  font: 400 .75rem/1.3 var(--font);
}
.vmap .maplibregl-ctrl-attrib a { display: inline-block; padding-block: 15px; margin-block: -11px; color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: .2em; }
.vmap .maplibregl-ctrl-attrib a:hover { color: var(--teal-ink); text-decoration-color: currentColor; }
.vmap .maplibregl-ctrl-attrib a:focus-visible { outline: 2px solid var(--teal); outline-offset: -2px; }

/* The pin: --teal teardrop, --deep edge, --gold centre. Built in JS; the colours are here. */
.vmap__pin { color: var(--teal); line-height: 0; cursor: default; }
.vmap__pin svg { display: block; }
.vmap__pin-body { fill: currentColor; stroke: var(--deep); stroke-width: 1; }
.vmap__pin-dot { fill: var(--gold); stroke: var(--deep); stroke-width: .75; }
