/* High-speed sorter map module */
.sorter-map {
  --sorter-map-accent: #fbb040;
  --sorter-map-pin: #ffffff;
  margin-top: clamp(8rem, 14vw, 14.4rem);
  margin-bottom: clamp(8rem, 14vw, 14.4rem);
  padding-top: clamp(2rem, 4vw, 3.5rem);
  padding-bottom: clamp(2rem, 4vw, 3.5rem);
}

.sorter-map .sorter-map__title {
  margin-bottom: clamp(4.5rem, 8vw, 7rem);
  font-size: calc(var(--font-size-h1) * 0.8);
}

/* The frame is a window onto an oversized map; sorter-map.js sizes and shifts
   the artwork so that only the configured bounds stay visible. */
.sorter-map__frame {
  position: relative;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  overflow: hidden;
  /* Softens the crop so the map fades out instead of ending on a hard edge.
     Browsers without mask compositing simply keep the straight edge. */
  -webkit-mask-image:
    linear-gradient(to right, transparent 0, #000 5%, #000 95%, transparent 100%),
    linear-gradient(to bottom, transparent 0, #000 7%, #000 93%, transparent 100%);
  mask-image:
    linear-gradient(to right, transparent 0, #000 5%, #000 95%, transparent 100%),
    linear-gradient(to bottom, transparent 0, #000 7%, #000 93%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
}

.sorter-map__base {
  position: absolute;
  display: block;
  max-width: none;
  opacity: 0.85;
}

.sorter-map__markers {
  position: absolute;
  inset: 0;
}

.sorter-map__pin {
  position: absolute;
  width: 1rem;
  height: 1rem;
  transform: translate(-50%, -50%);
}

/* Swap the content of this rule to change the icon on every marker at once. */
.sorter-map__pin::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0.375rem;
  height: 0.375rem;
  margin: -0.1875rem 0 0 -0.1875rem;
  border-radius: 50%;
  background-color: var(--sorter-map-pin);
  box-shadow: 0 0 0.3rem rgba(255, 255, 255, 0.85);
  animation: sorterMapBlink 2.4s ease-in-out infinite;
  animation-delay: var(--sorter-map-delay, 0s);
}

.sorter-map__pin::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1.125rem;
  height: 1.125rem;
  margin: -0.5625rem 0 0 -0.5625rem;
  border: 1px solid var(--sorter-map-pin);
  border-radius: 50%;
  animation: sorterMapRipple 2.4s ease-out infinite;
  animation-delay: var(--sorter-map-delay, 0s);
}

.sorter-map__pin-label {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 0.1rem;
  padding: 0.1rem 0.35rem;
  border-radius: 0.2rem;
  background-color: rgba(0, 0, 0, 0.78);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  line-height: 1.3;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.sorter-map__pin:hover,
.sorter-map__pin.is-active {
  z-index: 2;
}

.sorter-map__pin:hover .sorter-map__pin-label,
.sorter-map__pin.is-active .sorter-map__pin-label {
  opacity: 1;
}

/* Hovering a pin steadies its dot so the label is easy to read. */
.sorter-map__pin:hover::before,
.sorter-map__pin.is-active::before {
  animation: none;
  opacity: 1;
  transform: scale(1.25);
}

@keyframes sorterMapBlink {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.25;
    transform: scale(0.7);
  }
}

@keyframes sorterMapRipple {
  0% {
    opacity: 0.7;
    transform: scale(0.25);
  }

  100% {
    opacity: 0;
    transform: scale(1);
  }
}

.sorter-map__legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem 1.6rem;
  max-width: 1100px;
  margin: clamp(3rem, 5vw, 4.5rem) auto 0;
  padding: 0;
  list-style: none;
}

.sorter-map__legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: #dddddd;
  font-size: 0.85rem;
  font-weight: 300;
  letter-spacing: 0.03em;
}

.sorter-map__legend-item::before {
  content: "";
  width: 0.35rem;
  height: 0.35rem;
  border-radius: 50%;
  background-color: var(--sorter-map-accent);
}

@media (max-width: 575.98px) {
  .sorter-map__pin::after {
    width: 0.75rem;
    height: 0.75rem;
    margin: -0.375rem 0 0 -0.375rem;
  }

  .sorter-map__pin-label {
    font-size: 0.65rem;
  }

  .sorter-map__legend {
    gap: 0.35rem 1rem;
  }

  .sorter-map__legend-item {
    font-size: 0.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {

  .sorter-map__pin::before,
  .sorter-map__pin::after {
    animation: none;
  }

  .sorter-map__pin::after {
    opacity: 0.4;
  }
}
