.map-section {
  --map-ink: var(--ink, #192b23);
  --map-forest: var(--forest, #122820);
  --map-paper: var(--paper, #f6f3ea);
  --map-gold: var(--gold, #d3bd96);
  color: var(--map-ink);
  background: var(--map-paper);
  padding-block: clamp(4.25rem, 8vw, 7rem);
}

.map-shell {
  width: min(calc(100% - var(--gutter) * 2), var(--page-width, 1240px));
  margin-inline: auto;
}

.map-heading {
  margin-bottom: clamp(1.75rem, 4vw, 2.75rem);
}

.map-heading h2 {
  text-wrap: balance;
}

.map-heading p {
  margin: 0.85rem 0 0;
  color: #4b5b51;
  font-size: 1rem;
  line-height: 1.55;
}

.map-layout {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(17.5rem, 1fr);
  grid-template-areas: "figure detail" "legend detail";
  align-items: start;
  gap: 1.1rem clamp(1.25rem, 3vw, 2.6rem);
}

.map-figure {
  grid-area: figure;
  margin: 0;
}

.map-stage {
  position: relative;
  isolation: isolate;
  background: var(--map-forest);
  border-radius: 0.9rem;
  overflow: hidden;
}

.map-plan {
  display: block;
  width: 100%;
  height: auto;
}

.map-leader {
  position: absolute;
  left: var(--map-x);
  top: var(--map-y);
  transform: rotate(var(--map-angle));
  transform-origin: left center;
  width: var(--map-length);
  height: 1px;
  background: #fff9e2;
  box-shadow: 0 0 2px 1px #14281dbc;
  pointer-events: none;
}

.map-leader::before {
  content: "";
  position: absolute;
  top: -2px;
  left: -2px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: inherit;
}

.map-leader-active {
  height: 2px;
  background: #ffdc99;
  z-index: 1;
}

.map-pin {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  left: var(--map-x);
  top: var(--map-y);
  transform: translate(-50%, -50%);
  border: 0;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  color: #fffdf2;
  cursor: pointer;
  touch-action: manipulation;
}

.map-pin span {
  display: grid;
  place-items: center;
  width: 33px;
  height: 33px;
  border: 1px solid #fff5d9;
  border-radius: 50%;
  background: var(--map-forest);
  box-shadow: 0 2px 8px #14281d80;
  font: 700 0.875rem/1 var(--font-body, Arial, sans-serif);
  transition: background-color 150ms ease, color 150ms ease;
}

.map-pin:hover span,
.map-pin[aria-pressed="true"] span {
  color: var(--map-forest);
  background: #f0d3a2;
}

.map-pin[aria-pressed="true"] {
  z-index: 3;
}

.map-pin:focus-visible,
.map-choice:focus-visible {
  outline: 2px solid #181f16;
  outline-offset: 2px;
}

.map-pin:focus-visible {
  outline-color: #fffdf2;
  box-shadow: 0 0 0 3px #14281d;
}

.map-caption {
  color: #4b5b51;
  margin-top: 0.52rem;
  font-size: 0.8125rem;
  line-height: 1.45;
}

.map-legend {
  grid-area: legend;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
}

.map-choice {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  min-height: 44px;
  padding: 0.38rem 0.42rem;
  border: 1px solid #c5c7b8;
  border-radius: 0.45rem;
  background: transparent;
  color: var(--map-forest);
  font: 650 0.875rem/1.2 var(--font-body, Arial, sans-serif);
  overflow-wrap: anywhere;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

.map-choice:hover {
  background: #ede8d8;
  border-color: #8b9486;
}

.map-choice[aria-pressed="true"] {
  color: var(--map-paper);
  background: var(--map-forest);
  border-color: var(--map-forest);
}

.map-index {
  display: grid;
  flex: 0 0 1.5rem;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: #e8dfca;
  color: var(--map-forest);
  font-size: 0.75rem;
  font-weight: 700;
}

.map-choice[aria-pressed="true"] .map-index {
  background: #f0d3a2;
}

.map-detail {
  grid-area: detail;
  display: flex;
  flex-direction: column-reverse;
  overflow: hidden;
  border-radius: 0.9rem;
  background: var(--map-forest);
  color: var(--map-paper);
}

.map-detail-copy {
  display: grid;
  align-content: start;
  gap: 0.6rem;
  min-height: 10rem;
  padding: clamp(1.1rem, 2.5vw, 1.75rem);
}

.map-detail h3 {
  margin: 0;
  font-size: clamp(1.45rem, 2.4vw, 2.2rem);
}

.map-detail p {
  margin: 0;
  color: #e9e7dd;
  font-size: 1rem;
  line-height: 1.5;
}

.map-detail-photo {
  position: relative;
  margin: 0;
}

.map-detail-photo img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}

.map-detail-photo figcaption {
  position: absolute;
  bottom: 0.6rem;
  right: 0.6rem;
  max-width: calc(100% - 1.2rem);
  padding: 0.24rem 0.5rem;
  border-radius: 0.25rem;
  background: #122820ed;
  color: #fffdf2;
  font-size: 0.75rem;
}

.map-view-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0.7rem 0.85rem 0;
}

.map-view-options[hidden] { display: none; }

.map-view {
  min-height: 44px;
  padding: 0.35rem 0.75rem;
  border: 1px solid #fffdf265;
  border-radius: 0.4rem;
  background: transparent;
  color: var(--map-paper);
  font-size: 0.875rem;
  font-weight: 650;
  cursor: pointer;
}

.map-view:hover { border-color: var(--map-gold); }
.map-view[aria-pressed="true"] {
  border-color: var(--map-gold);
  background: var(--map-gold);
  color: var(--map-forest);
}

.map-announcement {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 52rem) {
  .map-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "figure" "legend" "detail";
  }

  .map-legend {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .map-detail {
    display: flex;
    flex-direction: column;
  }

  .map-detail-copy {
    min-height: auto;
  }

  .map-view-options { padding-bottom: 0.85rem; }
}

@media (max-width: 37rem) {
  .map-legend {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .map-pin span {
    width: 26px;
    height: 26px;
    font-size: 0.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .map-pin span,
  .map-choice {
    transition: none;
  }
}
