/*
  CSS encapsulado para módulos de storytelling dentro de una noticia.
  Si el CMS tiene una cabecera fija, por ejemplo de 64 px, se puede cambiar:
  --story-sticky-top: 64px;
*/

.story-map {
  --story-card-width: 430px;
  --story-sticky-top: 0px;
  --story-map-min-height: 560px;
  --story-intro-space: 32vh;

  position: relative;
  width: 100%;
  margin: 3rem 0;
  isolation: isolate;
}

.story-map .story-map__map-wrap {
  position: sticky;
  top: var(--story-sticky-top);
  height: calc(100vh - var(--story-sticky-top));
  min-height: var(--story-map-min-height);
  background: transparent;
  overflow: hidden;
  z-index: 0;
}

.story-map .story-map__map {
  width: 100%;
  height: 100%;
  background: transparent;
}

.story-map .story-map__map.leaflet-container {
  background: transparent;
}

.story-map .leaflet-interactive {
  cursor: pointer;
}

.story-map .story-map__legend {
  position: absolute;
  z-index: 500;
  left: 18px;
  bottom: 18px;
  width: min(290px, calc(100% - 36px));
  padding: 11px 12px 10px;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 4px;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.12);
  font: 12px/1.25 Arial, sans-serif;
  color: #111827;
}

.story-map .story-map__legend-title {
  margin-bottom: 7px;
  font-weight: 700;
}

.story-map .story-map__legend-gradient {
  height: 9px;
  border-radius: 2px;
}

.story-map .story-map__legend-labels {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 5px;
  font-variant-numeric: tabular-nums;
}

.story-map .story-map__legend-labels.is-diverging span:nth-child(2) {
  text-align: center;
}

.story-map .story-map__steps {
  position: relative;
  z-index: 10;
  margin-top: calc(-100vh + var(--story-sticky-top));
  padding-top: var(--story-intro-space);
  box-sizing: border-box;
  pointer-events: none;
}

.story-map .story-step {
  min-height: 95vh;
  display: flex;
  align-items: center;
  padding: 12vh clamp(18px, 5vw, 72px);
  box-sizing: border-box;
}

.story-map .story-step__card {
  width: min(var(--story-card-width), calc(100% - 36px));
  padding: 20px 22px;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.16);
  border-radius: 4px;
  color: #111827;
  font: 700 22px/1.35 Arial, sans-serif;
  opacity: 0.78;
  transform: translateY(4px);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: auto;
}

.story-map .story-step.is-active .story-step__card {
  opacity: 1;
  transform: translateY(0);
}

.story-map .story-map__error {
  margin: 0;
  padding: 2rem;
  font: 16px/1.4 Arial, sans-serif;
  color: #7f1d1d;
}


.story-map .story-map__leaflet-popup .leaflet-popup-content-wrapper {
  border-radius: 4px;
}

.story-map .story-map__leaflet-popup .leaflet-popup-content {
  margin: 12px 14px;
  min-width: 150px;
  font: 13px/1.3 Arial, sans-serif;
  color: #111827;
}

.story-map .story-map__popup-name {
  margin-bottom: 5px;
  font-size: 15px;
  font-weight: 700;
}

.story-map .story-map__popup-metric {
  color: #4b5563;
}

.story-map .story-map__popup-value {
  margin-top: 3px;
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 700px) {
  .story-map {
    --story-map-min-height: 500px;
  }

  .story-map .story-step {
    min-height: 90vh;
    align-items: flex-end;
    padding: 12vh 14px 16vh;
  }

  .story-map .story-step__card {
    width: 100%;
    padding: 16px 17px;
    font-size: 18px;
  }

  .story-map .story-map__legend {
    left: 12px;
    bottom: 12px;
    width: min(250px, calc(100% - 24px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .story-map .story-step__card {
    transition: none;
  }
}
