/* ============================================================
   DESCENSO POR SCROLL (frente F, demo portal-sello)
   Activo con body.descent-scrub (lo pone descent-scrub.mjs durante
   la fase VUELO). La exploración crece para dar recorrido al descenso
   y el mapa queda pegado al viewport. Al llegar, descent-arrived
   conserva ese espacio hasta el siguiente viaje para evitar que el
   documento colapse debajo del usuario.
   R70.1b: ese mismo encuadre se establece ya en CARGANDO, dentro del
   gesto del visitante que pulsa «Explorar», y los controles usan una
   sola geometría en carga, puente de entrada, vuelo y llegada. Al
   empezar el vuelo y al llegar la maqueta no cambia: no hay salto.
   Se carga la última para ganar la cascada a journey.css,
   journey-theme.css y archipelago.css.
   ============================================================ */

/* Recorrido: 100svh de mapa + 175svh de descenso. */
body.descent-scrub #exploration,
body.descent-arrived #exploration { height: 275svh; min-height: 0; }
body.descent-scrub #map,
body.descent-arrived #map {
  position: sticky;
  top: 0;
  height: 100svh;
}

/* The scroll track stays in place, so its UI must stay reachable too.
   Controls and status use the same geometry as while loading; the
   entrance bridge rules (archipelago.css) must not move them. */
body:is(.descent-scrub, .descent-arrived) header {
  position: sticky;
  top: 0;
  z-index: 35;
  background: #0b0c0ef0;
}
body.enhanced:is(.descent-scrub, .descent-arrived) .map-controls {
  position: fixed;
  top: 82px;
  left: 0;
  right: 0;
  padding: 16px 5vw;
  z-index: 30;
}
body:is(.descent-scrub, .descent-arrived) #status:not(:empty) {
  position: fixed;
  top: 148px;
  left: 0;
  margin: 0 5vw;
  max-width: 65ch;
  font-size: inherit;
  z-index: 30;
}
body:is(.descent-scrub, .descent-arrived) #content {
  position: fixed;
  top: 142px;
  right: 24px;
  bottom: 24px;
  width: 350px;
  z-index: 30;
}

@media (max-width: 650px) {
  body.enhanced:is(.descent-scrub, .descent-arrived) .map-controls { top: 72px; padding: 8px 12px; }
  body:is(.descent-scrub, .descent-arrived) #status:not(:empty) { top: 132px; }
  body:is(.descent-scrub, .descent-arrived) #content {
    position: fixed;
    inset: auto 12px 12px;
    width: auto;
    max-height: 36svh;
    margin: 0;
    overflow: auto;
  }

  /* FICHA is taller than the compact exploration panel. Keep its close
     control and the whole card reachable inside the mobile viewport. */
  body.enhanced.descent-arrived[data-phase="FICHA"] #content {
    max-height: calc(100svh - 150px);
    overflow: auto;
  }
}

/* R70.1b: CARGANDO adopts the descent layout on the visitor's own tap,
   so starting the flight does not move the footer, controls or status. */
@media (prefers-reduced-motion: no-preference) {
  body.enhanced:not(.list-only)[data-phase="CARGANDO"] #exploration { height: 275svh; min-height: 0; }
  body.enhanced:not(.list-only)[data-phase="CARGANDO"] #map {
    position: sticky;
    top: 0;
    height: 100svh;
  }
  body.enhanced:not(.list-only)[data-phase="CARGANDO"] header {
    position: sticky;
    top: 0;
    z-index: 35;
    background: #0b0c0ef0;
  }
  body.enhanced:not(.list-only)[data-phase="CARGANDO"] .map-controls {
    position: fixed;
    top: 82px;
    left: 0;
    right: 0;
    padding: 16px 5vw;
    z-index: 30;
  }
  body.enhanced:not(.list-only)[data-phase="CARGANDO"] #status:not(:empty) {
    position: fixed;
    top: 148px;
    left: 0;
    margin: 0 5vw;
    max-width: 65ch;
    font-size: inherit;
    z-index: 30;
  }
  body.enhanced:not(.list-only)[data-phase="CARGANDO"] #content {
    position: fixed;
    top: 142px;
    right: 24px;
    bottom: 24px;
    width: 350px;
    z-index: 30;
  }
  /* As in the approved descent, the island panel stays out of view while
     the map loads and flies; it appears on arrival without moving anything. */
  body.enhanced[data-phase="CARGANDO"] #content,
  body.descent-scrub #content { visibility: hidden; }
}
@media (prefers-reduced-motion: no-preference) and (max-width: 650px) {
  body.enhanced:not(.list-only)[data-phase="CARGANDO"] .map-controls { top: 72px; padding: 8px 12px; }
  body.enhanced:not(.list-only)[data-phase="CARGANDO"] #status:not(:empty) { top: 132px; }
  body.enhanced:not(.list-only)[data-phase="CARGANDO"] #content {
    position: fixed;
    inset: auto 12px 12px;
    width: auto;
    max-height: 36svh;
    margin: 0;
    overflow: auto;
  }
}

/* Cue editorial: se desvanece conforme el descenso avanza. */
body.descent-scrub::after {
  content: attr(data-descent-cue);
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .24em;
  color: var(--plata, #b7c3c5);
  opacity: calc(1 - var(--descent-progress, 0) * 2.5);
  pointer-events: none;
  z-index: 60;
}

/* Reduced motion nunca activa el scrub (el módulo devuelve false y
   gobierna el flyTo clásico); doble seguro por si la clase quedara. */
@media (prefers-reduced-motion: reduce) {
  body.descent-scrub #exploration,
  body.descent-arrived #exploration { height: auto; }
  body.descent-scrub::after { content: none; }
}