.ambientia-map {
  --map-ink: #153b44;
  --map-origin: #075e72;
  height: 100%;
  min-height: 15rem;
  isolation: isolate;
  color: var(--map-ink);
}

.ambientia-map__scene {
  position: relative;
  height: 100%;
  overflow: hidden;
  background: linear-gradient(145deg, #bad9de 0%, #a0c6cf 60%, #8db8c6 100%);
  cursor: grab;
  touch-action: pan-y pinch-zoom;
  user-select: none;
}

.ambientia-map__scene--dragging { cursor: grabbing; }
.ambientia-map__geo, .ambientia-map__markers {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.ambientia-map__grid {
  fill: none;
  stroke: #215563;
  stroke-opacity: .13;
  stroke-width: .55;
  vector-effect: non-scaling-stroke;
}
.ambientia-map__countries {
  fill: #ccdbbc;
  stroke: #fffdf3;
  stroke-width: 1;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* Gentle color variation provides contrast without implying an elevation scale. */
.ambientia-map__countries path:nth-child(4n + 1) { fill: #d7ddc2; }
.ambientia-map__countries path:nth-child(4n + 2) { fill: #c3d5b1; }
.ambientia-map__countries path:nth-child(4n + 3) { fill: #d7dfc5; }
.ambientia-map__connection {
  fill: none;
  stroke: #085c6b;
  stroke-width: 2;
  stroke-dasharray: 4 4;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.ambientia-map__marker {
  position: absolute;
  display: grid;
  place-items: center;
  width: 2.15rem;
  height: 2.15rem;
  transform: translate(-50%, -50%);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--map-ink);
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
}
.ambientia-map__marker[hidden],
.ambientia-map__legend[hidden],
.ambientia-map__message[hidden] { display: none; }
.ambientia-map__marker:focus-visible {
  z-index: 3;
  outline: 2px solid var(--map-origin);
  outline-offset: -1px;
}
.ambientia-map__marker:hover { z-index: 3; }
.ambientia-map__dot {
  width: .78rem;
  height: .78rem;
  border: 2px solid #fffdf2;
  border-radius: 50%;
  background: var(--map-origin);
  box-shadow: 0 0 0 1.5px var(--map-origin), 0 1px 4px #17394370;
  pointer-events: none;
}
.ambientia-map__marker[data-kind="candidate"] .ambientia-map__dot { background: #ffffff; }
.ambientia-map__marker[data-kind="current"] .ambientia-map__dot {
  width: 1.02rem;
  height: 1.02rem;
  box-shadow: 0 0 0 2px var(--map-origin), 0 0 0 5px #f6fcf866;
}
.ambientia-map__marker[data-kind="target"] .ambientia-map__dot {
  width: .92rem;
  height: .92rem;
  border-radius: .18rem;
  background: #fffdf2;
  transform: rotate(45deg);
}
.ambientia-map__label {
  position: absolute;
  top: 50%;
  left: calc(50% + .9rem);
  display: none;
  transform: translateY(-50%);
  max-width: min(10em, 30vw);
  padding: .24rem .48rem;
  border: 1px solid #9db8bd;
  border-radius: 6px;
  color: var(--map-ink);
  background: #fffdf6;
  box-shadow: 0 1px 6px #1d3c4424;
  font-size: .76rem;
  font-weight: 650;
  line-height: 1.15;
  text-align: start;
  pointer-events: none;
  width: max-content;
  overflow-wrap: anywhere;
}
.ambientia-map__marker[data-side="left"] .ambientia-map__label {
  left: auto;
  right: calc(50% + .9rem);
}
.ambientia-map__marker:is(:hover, :focus-visible, [data-kind="current"], [data-kind="target"]) .ambientia-map__label {
  display: block;
}

.ambientia-map__controls {
  position: absolute;
  right: .65rem;
  bottom: 1.85rem;
  display: flex;
  flex-direction: column;
  border: 1px solid #a0bcc1;
  border-radius: .58rem;
  background: #fffdf7;
  box-shadow: 0 2px 8px #23515d26;
}
.ambientia-map__control {
  display: grid;
  place-items: center;
  width: 2.35rem;
  height: 2.25rem;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: #173d48;
  background: transparent;
  font: 650 1.25rem/1 system-ui, sans-serif;
  cursor: pointer;
}
.ambientia-map__control + .ambientia-map__control { border-top: 1px solid #c6d9dc; }
.ambientia-map__control:first-child { border-radius: .55rem .55rem 0 0; }
.ambientia-map__control:last-child { border-radius: 0 0 .55rem .55rem; }
.ambientia-map__control:hover { background: #e5f2f2; }
.ambientia-map__control:focus-visible { outline: 2px solid var(--map-origin); outline-offset: -3px; }
.ambientia-map__credit {
  position: absolute;
  right: .65rem;
  bottom: .45rem;
  padding: .15rem .35rem;
  border-radius: 4px;
  color: #264a54;
  background: #f4faf6d9;
  font-size: .66rem;
  line-height: 1.2;
  pointer-events: none;
}
.ambientia-map__legend {
  position: absolute;
  left: .65rem;
  bottom: .65rem;
  display: grid;
  gap: .36rem;
  padding: .42rem .57rem;
  border: 1px solid #aac2c5;
  border-radius: .46rem;
  background: #fefef8f5;
  color: var(--map-ink);
  font-size: .72rem;
}
.ambientia-map__key { display: flex; align-items: center; gap: .44rem; }
.ambientia-map__symbol {
  display: inline-block;
  width: .58rem;
  height: .58rem;
  border: 1.5px solid var(--map-origin);
}
.ambientia-map__symbol--origin { border-radius: 50%; background: var(--map-origin); }
.ambientia-map__symbol--target { background: white; transform: rotate(45deg); }
.ambientia-map__message {
  position: absolute;
  left: .65rem;
  top: .65rem;
  right: .65rem;
  margin: 0;
  padding: .55rem .72rem;
  border-radius: .45rem;
  color: var(--map-ink);
  background: #ffffffeb;
  font-size: .88rem;
}
