/* The contact page's 3D map (assets/map.js, markup from tools/map_markup.py). The figure keeps its box from the first
   paint (4:3, 4:5 below 1024 px), so nothing moves when the poster or the live map arrives. Every colour of the map is a
   --map-* token of the page; assets/map.js reads them and repaints the map when the colour scheme changes. Only the few
   MapLibre rules the map needs are below, instead of MapLibre's whole sheet. Radius 0, no shadows: the model's light
   is the only depth. */

/* The map's colours are the page's --map-* tokens (site.css :root). The marks' own, overridable the same way: */
:where(:root) {
  --map-pin: #2c4bfd;                 /* the pin's head stays cobalt in both schemes: the white R on it 5.9:1 */
  --map-tag: #ffffff;
  --map-tag-ink: #1d1d1f;
  --map-tag-line: rgb(29 29 31 / .16);
}
@media (prefers-color-scheme: dark) {
  :where(:root) {
    --map-tag: #131846;
    --map-tag-ink: #f5f5f7;
    --map-tag-line: rgb(245 245 247 / .2);
  }
}

.map {
  position: relative;
  aspect-ratio: 4 / 3;
  margin: 0;
  overflow: hidden;
  contain: layout paint;
  background: var(--map-ground);
  color: var(--map-tag-ink);
  font-family: "Geist", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  font-synthesis: none;
}
/* wide windows 16:10, so the map ends with the column beside it (4:3 left a hole there, critic 02.11.2026) */
@media (min-width: 1280px) {
  .map { aspect-ratio: 16 / 10; }
}
@media (max-width: 1023px) {
  .map { aspect-ratio: 4 / 5; }
}

.map-poster,
.map-poster img,
.map-gl {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.map-poster img { object-fit: cover; }
.map-gl {
  opacity: 0;
  transition: opacity 320ms cubic-bezier(.22, 1, .36, 1);
}
.map[data-state="live"] .map-gl { opacity: 1; }
.map[data-state="live"] .map-poster {
  visibility: hidden;
  transition: visibility 0s 320ms;
}
/* map.js resolves each --map-* colour through this probe's color; a transition (the site gives every element 1 ms
   under reduced motion) would hand it the old colour instead */
.map-probe {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
  transition: none !important;
}

/* ---- MapLibre, the rules the map needs ---- */
.map .maplibregl-map {
  font: inherit;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}
.map .maplibregl-canvas {
  position: absolute;
  left: 0;
  top: 0;
}
/* the site's quiet keyboard ring, drawn inside: the figure clips everything outside its edge */
.map .maplibregl-canvas:focus-visible {
  outline: 1px solid currentColor;
  outline-offset: -4px;
}
.map .maplibregl-canvas-container.maplibregl-interactive {
  cursor: grab;
  user-select: none;
}
.map .maplibregl-canvas-container.maplibregl-interactive:active { cursor: grabbing; }
.map .maplibregl-canvas-container.maplibregl-touch-zoom-rotate,
.map .maplibregl-canvas-container.maplibregl-touch-zoom-rotate .maplibregl-canvas { touch-action: pan-x pan-y; }
.map .maplibregl-canvas-container.maplibregl-touch-drag-pan,
.map .maplibregl-canvas-container.maplibregl-touch-drag-pan .maplibregl-canvas { touch-action: pinch-zoom; }
.map .maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan,
.map .maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan .maplibregl-canvas { touch-action: none; }
.map .maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures,
.map .maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures .maplibregl-canvas { touch-action: pan-x pan-y; }
.map .maplibregl-marker {
  position: absolute;
  top: 0;
  left: 0;
  will-change: transform;
  pointer-events: none;
}
.map .maplibregl-cooperative-gesture-screen {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  color: #fff;
  background: rgb(2 5 39 / .5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 400ms ease 800ms;
}
.map .maplibregl-cooperative-gesture-screen.maplibregl-show {
  opacity: 1;
  transition: opacity 60ms;
}
.map .maplibregl-cooperative-gesture-screen .maplibregl-mobile-message { display: none; }
@media (hover: none), (pointer: coarse) {
  .map .maplibregl-cooperative-gesture-screen .maplibregl-desktop-message { display: none; }
  .map .maplibregl-cooperative-gesture-screen .maplibregl-mobile-message { display: block; }
}

/* ---- the marks: the house's pin and the station exits ---- */
.map-pin,
.map-stop {
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
}
.map-pin {
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 2;
}
.map-pin-head {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  box-sizing: border-box;
  border: 2px solid var(--map-tag);
  background: var(--map-pin);
  color: #fff;
}
.map-pin-head svg {
  width: 11px;
  height: 14px;
  fill: currentColor;
}
/* the needle in the head's cobalt, edged like the head, so it stands out from the accent roof in both schemes */
.map-pin-stem {
  width: 2px;
  height: 16px;
  background: var(--map-pin);
  box-shadow: 1px 0 0 var(--map-tag), -1px 0 0 var(--map-tag);
}
.map-stop {
  display: flex;
  align-items: center;
  gap: 6px;
  /* the square sits on the exit, the name hangs to its right */
  translate: calc(50% - 5px) 0;
}
.map-stop[data-flip] {
  flex-direction: row-reverse;
  translate: calc(-50% + 5px) 0;
}
.map-stop[data-above] {
  flex-direction: column-reverse;
  translate: 0 calc(-50% + 5px);
}
.map-stop[data-below] {
  flex-direction: column;
  translate: 0 calc(50% - 5px);
}
.map-stop-dot {
  flex: none;
  width: 10px;
  height: 10px;
  box-sizing: border-box;
  border: 2.5px solid var(--map-tag-ink);
  background: var(--map-tag);
}
.map-stop-name {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 7px;
  background: var(--map-tag);
  color: var(--map-tag-ink);
  box-shadow: inset 0 0 0 1px var(--map-tag-line);
  font-weight: 500;
}
/* a line as in the list beside the map: a square in its BVG colour, then its name (a surface: 4.3:1 on the tag) */
.map-line {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
}
.map-line::before {
  content: "";
  flex: none;
  width: 9px;
  height: 9px;
  background: var(--line, #555);
}
.map-line + .map-line { margin-inline-start: -2px; }
.map-stop-time {
  color: var(--map-label);
  font-variant-numeric: tabular-nums;
}
.map-stop,
.map-pin { opacity: 1; transition: opacity 240ms cubic-bezier(.22, 1, .36, 1); }
.map-stop[data-wait] { opacity: 0; }

/* ---- the reset key and the credit ---- */
.map-reset {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  background: var(--map-tag);
  color: var(--map-tag-ink);
  box-shadow: inset 0 0 0 1px var(--map-tag-line);
  cursor: pointer;
  transition: transform 120ms cubic-bezier(.22, 1, .36, 1);
}
.map-reset[hidden] { display: none; }
.map-reset::before {
  content: "";
  position: absolute;
  inset: -2px;
}
.map-reset:active { transform: scale(.97); }
.map-reset:focus-visible { outline: 1px solid currentColor; outline-offset: 3px; }
.map-reset-i { width: 20px; height: 20px; }

.map-credit {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 4;
  max-width: calc(100% - 16px);
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--map-label);
}
.map-credit details {
  padding: 2px 8px 2px 4px;
  background: color-mix(in srgb, var(--map-ground) 82%, transparent);
}
.map-credit details[open] {
  max-width: 340px;
  padding-block: 6px;
  background: var(--map-tag);
  color: var(--map-tag-ink);
  box-shadow: inset 0 0 0 1px var(--map-tag-line);
}
.map-credit summary {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  list-style: none;
  cursor: pointer;
}
.map-credit summary::-webkit-details-marker { display: none; }
.map-credit summary::before {
  content: "";
  position: absolute;
  inset: -14px -10px;
}
.map-credit summary:focus-visible { outline: 1px solid currentColor; outline-offset: 3px; }
.map-credit-i { flex: none; width: 14px; height: 14px; }
.map-credit p { margin: 6px 0 0 18px; }
.map-credit a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .18em;
}

@media (prefers-reduced-motion: reduce) {
  .map-gl,
  .map-stop,
  .map-pin { transition-duration: 1ms; }
  .map[data-state="live"] .map-poster { transition-delay: 1ms; }
}
@media print {
  .map-gl,
  .map-reset,
  .map-credit details > p { display: none; }
}
