.terrain-section {
  position: relative;
  z-index: 3;
  background: var(--story-background);
  padding: 64px 4vw 48px;
  border-top: 1px solid var(--story-line);
  scroll-margin-top: 80px;
}
.terrain-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 32px;
  margin-bottom: 32px;
}
.terrain-heading,
.terrain-figure {
  max-width: calc(68svh * 16 / 9);
  margin-inline: auto;
}
.terrain-heading h2 {
  font-size: clamp(2.25rem, 4vw, 4rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
  margin: 0;
}
.terrain-heading p {
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--story-copy);
  max-width: 38ch;
  margin: 0;
}
.terrain-figure {
  margin-block: 0;
}
.terrain-visual {
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: #d9e1e4;
  isolation: isolate;
}
.terrain-visual > img,
.terrain-overlay {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.terrain-visual > img {
  object-fit: fill;
}
.terrain-visual > .terrain-grid-source {
  display: none;
}
.terrain-overlay {
  overflow: hidden;
  pointer-events: none;
}
.terrain-enhanced[data-motion='running'] .terrain-ping {
  animation-play-state: running;
}
.terrain-node {
  position: absolute;
  left: var(--point-x);
  top: var(--point-y);
  width: 16px;
  height: 16px;
  transform: translate(-50%, -50%);
  border: 1px solid #4d6874;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 9px #17334155;
}
.terrain-node::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 100%;
  height: 38px;
  width: 1px;
  background: #fff;
  box-shadow: 1px 0 #3e5d7270;
}
.terrain-node-label {
  position: absolute;
  bottom: calc(100% + 37px);
  left: 50%;
  transform: translateX(-50%);
  background: #253e4a;
  color: #fff;
  padding: 7px 11px;
  white-space: nowrap;
  font-size: 0.68rem;
  line-height: 1.2;
  letter-spacing: 0.04em;
  border: 1px solid #ffffff60;
  border-radius: 2px;
}
.terrain-node-base {
  width: 20px;
  height: 20px;
}
.terrain-ping {
  position: absolute;
  inset: -10px;
  border: 1px solid #fff;
  border-radius: 50%;
  opacity: 0.8;
}
.terrain-enhanced .terrain-ping {
  animation: terrain-contact 8.75s linear infinite;
  animation-play-state: paused;
}
.terrain-node-peak-one .terrain-ping {
  animation-delay: 4.5s;
}
.terrain-node-peak-two .terrain-ping {
  animation-delay: 4s;
}
.terrain-caption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding-top: 12px;
  color: var(--story-muted);
  font-size: 0.72rem;
  line-height: 1.6;
}
.scan-toggle {
  border: 0;
  background: none;
  color: var(--story-ink);
  font: inherit;
  padding: 12px 0 12px 16px;
  min-height: 44px;
  white-space: nowrap;
  cursor: pointer;
}
.scan-toggle[hidden] {
  display: none;
}
.scan-toggle:disabled {
  cursor: default;
  color: var(--story-muted);
}
.terrain-image-error {
  display: none;
}
.terrain-section[data-image='unavailable'] .terrain-visual {
  display: none;
}
.terrain-section[data-image='unavailable'] .terrain-image-error {
  display: block;
  color: var(--story-muted);
  padding: 40px 0;
}
.terrain-enhanced[data-motion='still'] .terrain-ping {
  animation: none;
  opacity: 0.8;
}
@keyframes terrain-contact {
  0% {
    transform: scale(0.9);
    opacity: 0.85;
  }
  17% {
    transform: scale(2.6);
    opacity: 0;
  }
  100% {
    transform: scale(2.6);
    opacity: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .terrain-enhanced .terrain-ping {
    animation: none;
  }
}
@media (max-width: 760px) {
  .terrain-section {
    padding: 40px 22px 30px;
    scroll-margin-top: 66px;
  }
  .terrain-heading,
  .terrain-figure {
    max-width: none;
  }
  .terrain-heading {
    display: block;
    margin-bottom: 24px;
  }
  .terrain-heading h2 {
    font-size: 2.2rem;
  }
  .terrain-heading p {
    font-size: 0.85rem;
    margin-top: 16px;
    max-width: 40ch;
  }
  .terrain-visual {
    aspect-ratio: 4/3;
  }
  .terrain-visual > img,
  .terrain-overlay {
    width: 133.333%;
    max-width: none;
    left: -16.667%;
    height: 100%;
  }
  .terrain-node {
    left: calc((var(--point-x) - 50%) * 1.33333 + 50%);
    width: 12px;
    height: 12px;
  }
  .terrain-node-base {
    width: 16px;
    height: 16px;
  }
  .terrain-node::before {
    height: 6px;
  }
  .terrain-node-label {
    bottom: calc(100% + 5px);
    padding: 3px 7px;
    font-size: 0.75rem;
  }
  .terrain-caption {
    align-items: start;
    gap: 16px;
    font-size: 0.75rem;
  }
  .scan-toggle {
    padding-top: 0;
    min-height: 44px;
  }
}

.terrain-overlay .wave-fronts {
  opacity: 0;
}
.terrain-overlay .wave-fronts ellipse {
  fill: none;
  stroke: #fff;
  stroke-width: 3;
}
.terrain-overlay .wave-fronts ellipse + ellipse {
  stroke-width: 2;
  opacity: 0.7;
}
