/* ============================================
   MAPA VISUAL - Camino con 7 destinos y popovers
   ============================================ */

.mapa-visual-section {
  padding: 48px 0 64px;
  background: linear-gradient(180deg, rgba(252, 250, 247, 0.5) 0%, rgba(245, 243, 240, 0.6) 100%);
}

.mapa-visual-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px;
}

.mapa-visual-title {
  font-size: clamp(26px, 4vw, 34px);
  font-weight: 700;
  color: var(--text);
  text-align: center;
  margin: 0 0 8px 0;
  font-family: Georgia, "Times New Roman", serif;
}

.mapa-visual-subtitle {
  font-size: clamp(15px, 2vw, 17px);
  color: var(--muted);
  text-align: center;
  margin: 0 0 40px 0;
  font-family: Georgia, "Times New Roman", serif;
}

/* Road wrapper: relative for absolute positioning of destinations */
.mapa-road-wrap {
  position: relative;
  min-height: 820px;
}

.mapa-road-svg {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 150px;
  height: 100%;
  min-height: 820px;
  pointer-events: none;
}

.road-border {
  opacity: 0.85;
}

.road-fill {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.08));
}

.road-center {
  stroke-dasharray: 8 6;
  animation: roadDash 20s linear infinite;
}

.road-dot {
  fill: var(--accent);
  stroke: rgba(255, 255, 255, 0.9);
  stroke-width: 1.5;
}

@keyframes roadDash {
  to {
    stroke-dashoffset: -56;
  }
}

/* Destinations container */
.mapa-destinos {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

.mapa-destinos .mapa-destino {
  pointer-events: auto;
}

/* Each destination: positioned along the road */
.mapa-destino {
  position: absolute;
  width: 42%;
  max-width: 280px;
  z-index: 2;
  opacity: 0;
  animation: mapaDestinoFadeIn 0.4s ease forwards;
}

.mapa-destino-1 {
  animation-delay: 0.05s;
}

.mapa-destino-2 {
  animation-delay: 0.15s;
}

.mapa-destino-3 {
  animation-delay: 0.25s;
}

.mapa-destino-4 {
  animation-delay: 0.35s;
}

.mapa-destino-5 {
  animation-delay: 0.45s;
}

.mapa-destino-6 {
  animation-delay: 0.55s;
}

.mapa-destino-7 {
  animation-delay: 0.65s;
}

@keyframes mapaDestinoFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.mapa-destino-trigger {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  min-height: 44px;
  background: var(--panel);
  border: 1px solid rgba(107, 91, 79, 0.2);
  border-radius: 24px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
  text-decoration: none;
  color: inherit;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s ease, border-color 0.4s ease;
}

.mapa-destino-trigger:hover {
  border-color: rgba(5, 150, 105, 0.6);
  box-shadow:
    0 10px 30px -5px rgba(0, 0, 0, 0.1),
    0 0 20px rgba(5, 150, 105, 0.15);
  transform: translateY(-4px) scale(1.02);
}

.mapa-destino-trigger:focus {
  outline: none;
}

.mapa-destino-trigger:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Hover/open: traer tarjeta (y su popover) por encima de las colindantes */
.mapa-destino:hover,
.mapa-destino.is-open {
  z-index: 20;
}

.mapa-destino.is-open .mapa-destino-trigger {
  border-color: var(--accent);
  box-shadow: var(--shadow-md), 0 0 0 3px rgba(5, 150, 105, 0.2);
}

.mapa-destino-icon {
  flex-shrink: 0;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mapa-destino-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.mapa-destino-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: var(--accent);
  color: white;
  font-size: 13px;
  font-weight: 700;
  border-radius: 50%;
  margin-bottom: 2px;
}

.mapa-destino-titulo {
  display: block;
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  line-height: 1.25;
}

.mapa-destino-frase {
  display: block;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

/* Positions: odd right, even left; vertical spread */
.mapa-destino-1 {
  left: 0;
  top: 5%;
  /* Bajamos el primer destino del 2% al 5% para ganar aire arriba */
}

.mapa-destino-2 {
  right: 0;
  top: 14%;
  left: auto;
}

.mapa-destino-3 {
  left: 0;
  top: 26%;
}

.mapa-destino-4 {
  right: 0;
  top: 38%;
  left: auto;
}

.mapa-destino-5 {
  left: 0;
  top: 50%;
}

.mapa-destino-6 {
  right: 0;
  top: 62%;
  left: auto;
}

.mapa-destino-7 {
  left: 0;
  top: 80%;
  max-width: 280px;
}

/* Popover */
.mapa-popover {
  position: absolute;
  z-index: 10;
  width: 320px;
  max-width: 90vw;
  padding: 18px;
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  margin-top: 8px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.mapa-destino.is-open .mapa-popover {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  display: block !important;
  /* anula [hidden] del navegador */
}

.mapa-popover h3 {
  margin: 0 0 10px 0;
  font-size: 17px;
  color: var(--accent);
}

.mapa-popover p {
  margin: 0 0 14px 0;
  font-size: 14px;
  color: var(--text);
  line-height: 1.55;
}

.mapa-popover-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.mapa-popover-link:hover {
  text-decoration: underline;
}

.mapa-popover-link:focus {
  outline: none;
}

.mapa-popover-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Popover position: left-aligned destinations get popover to the right; right-aligned to the left */
.mapa-destino-1 .mapa-popover,
.mapa-destino-3 .mapa-popover,
.mapa-destino-5 .mapa-popover {
  left: 100%;
  margin-left: 12px;
  top: 0;
}

.mapa-destino-2 .mapa-popover,
.mapa-destino-4 .mapa-popover,
.mapa-destino-6 .mapa-popover {
  right: 100%;
  left: auto;
  margin-right: 12px;
  margin-left: 0;
  top: 0;
}

.mapa-destino-7 .mapa-popover {
  left: 100%;
  margin-left: 12px;
  top: 0;
}

/* Quote at bottom - versículo diferenciado de los destinos (sin recuadro tipo card) */
.mapa-visual-quote {
  margin: 56px 0 0 0;
  padding: 0 16px;
  text-align: center;
  border: none;
  position: relative;
  max-width: 540px;
  margin-left: auto;
  margin-right: auto;
}

.mapa-visual-quote::before {
  content: '';
  display: block;
  width: 48px;
  height: 2px;
  margin: 0 auto 28px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.6;
}

.mapa-visual-quote-mark {
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(calc(-50% - 140px));
  font-family: Georgia, "Times New Roman", serif;
  font-size: 56px;
  line-height: 1;
  color: var(--accent);
  opacity: 0.2;
}

.mapa-visual-quote cite {
  display: block;
  font-style: italic;
  font-size: 19px;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 20px;
  font-family: Georgia, "Times New Roman", serif;
}

.mapa-visual-quote footer {
  margin: 0;
  padding: 0;
  background: none;
  border: none;
}

.mapa-visual-quote-ref {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(5, 150, 105, 0.12);
  padding: 8px 16px;
  border-radius: 999px;
  font-family: "Inter", system-ui, sans-serif;
  font-style: normal;
}

@media (max-width: 600px) {
  .mapa-visual-quote-mark {
    display: none;
  }
}

/* Responsive: stack vertically, road as vertical indicator, bottom sheet popover */
@media (max-width: 768px) {
  .mapa-road-wrap {
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .mapa-road-svg {
    position: relative;
    left: auto;
    transform: none;
    height: 32px;
    min-height: 0;
    margin: 16px 0;
  }

  .mapa-road-svg .road-dot {
    display: none;
  }

  .mapa-destinos {
    position: static;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
  }

  .mapa-destino {
    position: static !important;
    width: 100%;
    max-width: 360px;
    transform: none !important;
  }

  .mapa-destino-7 {
    max-width: 360px;
  }

  .mapa-destino-trigger {
    min-height: 48px;
    padding: 16px 18px;
  }

  /* Bottom sheet style popover on mobile */
  .mapa-popover {
    position: fixed;
    left: 0 !important;
    right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-top: 0 !important;
    transform: translateY(100%) !important;
    top: auto !important;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    max-height: 70vh;
    overflow-y: auto;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.15);
    pointer-events: auto;
    padding-bottom: env(safe-area-inset-bottom, 24px);
  }

  .mapa-popover::before {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 12px auto 16px;
  }

  .mapa-destino.is-open .mapa-popover {
    transform: translateY(0) !important;
  }

  .mapa-destino-7 .mapa-popover {
    transform: translateY(100%) !important;
  }

  .mapa-destino-7.is-open .mapa-popover {
    transform: translateY(0) !important;
  }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  .road-center {
    animation: none;
  }

  .mapa-destino {
    animation: none;
    opacity: 1;
  }

  .mapa-destino-trigger {
    transition: none;
  }

  .mapa-popover {
    transition: none;
  }
}

/* ============================================
   SCROLLYTELLING LAYOUT
   ============================================ */

@media (min-width: 992px) {
  .scrolly-layout {
    display: flex;
    flex-direction: row-reverse;
    align-items: flex-start;
    gap: 40px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px;
  }

  .scrolly-map {
    flex: 0 0 45%;
    position: sticky;
    top: 240px;
    /* Offset generoso para evitar sensación de agobio con el menú */
    height: calc(100vh - 280px);
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent !important;
    padding: 0 !important;
  }

  .scrolly-map .mapa-visual-container {
    width: 100%;
    margin: 0;
    padding: 0;
    margin-top: 120px;
    /* Gran espacio inicial para que el mapa respire respecto al título y menú */
  }

  .scrolly-content {
    flex: 1;
    padding-top: 60px;
    /* Reduce un poco el inicio para que el texto y tarjeta se alineen */
    padding-bottom: 400px;
    margin-right: -40px;
  }

  .scrolly-content section {
    margin-bottom: 120px;
    opacity: 0.2;
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    transform: scale(0.92) translateX(-20px);
    pointer-events: none;
    scroll-margin-top: 160px;
    /* Evita que el título quede oculto bajo el TOC sticky */
  }

  .scrolly-content section.is-observed {
    opacity: 1;
    transform: scale(1) translateX(0);
    pointer-events: auto;
  }

  /* Adjust map road scale for sticky view */
  .scrolly-map .mapa-road-wrap {
    transform: scale(0.85);
    transform-origin: center;
  }
}

/* Active State for Map Destiny */
.mapa-destino.is-active {
  z-index: 50;
}

.mapa-destino.is-active .mapa-destino-trigger {
  border-color: var(--accent);
  background: white;
  transform: scale(1.15) translateY(-5px);
  box-shadow:
    0 20px 40px -10px rgba(5, 150, 105, 0.25),
    0 0 20px rgba(5, 150, 105, 0.2);
}

.mapa-destino.is-active .mapa-destino-num {
  transform: scale(1.1);
  box-shadow: 0 0 10px rgba(5, 150, 105, 0.4);
}

/* Final quote section after scrollytelling */

/* Reverted & Balanced Final Quote Section */
.mapa-quote-section {
  padding: 80px 0;
  margin-top: 120px;
  margin-bottom: 20px;
  background: var(--bg);
  position: relative;
  z-index: 200; /* Supera al mapa sticky si se solapa */
  border-top: 1px solid var(--border);
}

.mapa-quote-section .mapa-visual-quote {
  margin: 0 auto;
  max-width: 540px;
  text-align: center;
}

.mapa-quote-section .mapa-visual-quote cite {
  display: block;
  font-style: italic;
  font-size: 20px;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 22px;
  font-family: Georgia, serif;
}

.mapa-quote-section .mapa-visual-quote-mark {
  font-size: 64px;
  opacity: 0.1;
  color: var(--accent);
  top: -10px;
  left: 50%;
  transform: translateX(calc(-50% - 150px));
}

.mapa-quote-section .mapa-visual-quote-ref {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(5, 150, 105, 0.1);
  padding: 8px 18px;
  border-radius: 999px;
  font-family: inherit;
  font-style: normal;
  border: 1px solid rgba(5, 150, 105, 0.08);
}
