/*
 * ECS service-area map (shared component, identical in every ECS theme).
 * Static SVG maps from assets/ecs-map/maps/<id>.svg, printed inline by ecs_map_render() (inc/ecs-map.php).
 * Colours are theme.json tokens: settings.custom.ecsMap -> --wp--custom--ecs-map--*.
 */
.ecs-map {
  --ecs-map-active: var(--wp--custom--ecs-map--active, #bd202e);
  --ecs-map-active-hover: var(--wp--custom--ecs-map--active-hover, #77141d);
  --ecs-map-base: var(--wp--custom--ecs-map--base, #d9dde3);
  --ecs-map-context: var(--wp--custom--ecs-map--context, #f2f2f2);
  --ecs-map-border: var(--wp--custom--ecs-map--border, #ffffff);
  --ecs-map-marker: var(--wp--custom--ecs-map--marker, #bd202e);
  --ecs-map-marker-hover: var(--wp--custom--ecs-map--marker-hover, #77141d);
  --ecs-map-marker-stroke: var(--wp--custom--ecs-map--marker-stroke, #ffffff);
  --ecs-map-label: var(--wp--custom--ecs-map--label, #222222);
  --ecs-map-max-height: 34rem;
  position: relative;
  margin: 0;
  width: 100%;
  max-width: 100%;
}

.ecs-map__canvas {
  position: relative;
}

.ecs-map__svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: var(--ecs-map-max-height);
  margin: 0 auto;
  overflow: hidden;
}

.ecs-map__base {
  fill: var(--ecs-map-base);
}

.ecs-map__context {
  fill: var(--ecs-map-context);
}

.ecs-map__lines {
  fill: none;
  stroke: var(--ecs-map-border);
  stroke-width: 1;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.ecs-map__lines--minor {
  stroke-opacity: 0.45;
}

.ecs-map__area {
  fill: var(--ecs-map-active);
  stroke: var(--ecs-map-border);
  stroke-width: 1;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  transition: fill 0.2s ease;
}

.ecs-map__marker {
  fill: var(--ecs-map-marker);
  stroke: var(--ecs-map-marker-stroke);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
  transition: fill 0.2s ease;
}

.ecs-map__link {
  cursor: pointer;
}

.ecs-map__area.is-active,
.ecs-map__link:hover .ecs-map__area {
  fill: var(--ecs-map-active-hover);
}

.ecs-map__marker.is-active,
.ecs-map__link:hover .ecs-map__marker {
  fill: var(--ecs-map-marker-hover);
}

.ecs-map__label {
  fill: var(--ecs-map-label);
  font-family: inherit;
  font-weight: 600;
  letter-spacing: 0.02em;
  paint-order: stroke;
  stroke: var(--ecs-map-border);
  stroke-width: 3px;
  stroke-linejoin: round;
  pointer-events: none;
}

/* tooltip (created by ecs-map.js) */
.ecs-map__tip {
  position: absolute;
  z-index: 2;
  max-width: 16rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: var(--ecs-map-label);
  color: #ffffff;
  font-size: 0.8125rem;
  line-height: 1.3;
  white-space: nowrap;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 12px));
}

.ecs-map__tip.is-below {
  transform: translate(-50%, 12px);
}

.ecs-map__tip[hidden] {
  display: none;
}

/* accessible text list of the areas (also the keyboard route to the links) */
.ecs-map__caption {
  margin: 1rem 0 0;
  padding: 0;
}

.ecs-map__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.ecs-map .ecs-map__list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ecs-map .ecs-map__list > .ecs-map__item {
  width: auto;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ecs-map .ecs-map__list > .ecs-map__item::before,
.ecs-map .ecs-map__list > .ecs-map__item::after {
  content: none;
  display: none;
}

.ecs-map .ecs-map__name {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.3em 0.8em;
  border: 1px solid color-mix(in srgb, var(--ecs-map-label) 18%, transparent);
  border-radius: 999px;
  background: #ffffff;
  color: var(--ecs-map-label);
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.35;
  letter-spacing: normal;
  text-decoration: none;
  text-transform: none;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.ecs-map .ecs-map__name::before {
  content: "";
  flex: none;
  width: 0.6em;
  height: 0.6em;
  border-radius: 50%;
  background: var(--ecs-map-active);
}

.ecs-map .ecs-map__item--marker .ecs-map__name::before {
  box-sizing: border-box;
  border: 2px solid var(--ecs-map-marker-stroke);
  background: var(--ecs-map-marker);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--ecs-map-label) 25%, transparent);
}

.ecs-map a.ecs-map__name:hover,
.ecs-map .ecs-map__item.is-active .ecs-map__name {
  border-color: var(--ecs-map-active);
  background: color-mix(in srgb, var(--ecs-map-active) 10%, #ffffff);
  color: var(--ecs-map-label);
}

.ecs-map a.ecs-map__name:hover {
  text-decoration: underline;
}

.ecs-map a.ecs-map__name:focus-visible {
  outline: 2px solid var(--ecs-map-active-hover);
  outline-offset: 2px;
}

@media (max-width: 599px) {
  .ecs-map .ecs-map__list {
    gap: 0.4rem;
  }

  .ecs-map .ecs-map__name {
    font-size: 0.8125rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ecs-map__area,
  .ecs-map__marker,
  .ecs-map .ecs-map__name {
    transition: none;
  }
}
