/* ==========================================================
   Walk the route: the series becomes a sideways journey
   ========================================================== */
.route {
  position: relative;
  border-top: 1px solid #d9d9d5;
}

.route-pin {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  background: var(--paper);
}

.route .series {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  max-width: none;
  margin: 0;
  padding: 0 22vw 0 8vw;
  display: flex;
  align-items: center;
  gap: 11vw;
  will-change: transform;
}

.route .entry,
.route .entry.reverse {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 26px;
  margin: 0;
  min-height: 0;
  height: 100%;
  justify-content: center;
  padding: 9vh 0 15vh;
}

.route .entry.reverse {
  flex-direction: column-reverse;
}

.route .entry .photo,
.route .entry.reverse .photo {
  max-width: none !important;
  grid-column: auto;
  grid-row: auto;
}

.route .photo img {
  height: 54vh;
  width: auto;
  max-width: none;
  max-height: none;
  object-fit: contain;
  box-shadow: 0 18px 40px rgba(0,0,0,.12);
}

.route .entry:nth-child(even) .photo img {
  height: 46vh;
}

.route .photo figcaption {
  display: none;
}

.route .writing {
  max-width: 34ch;
}

.route .writing h2 {
  font-size: clamp(30px,3.3vw,54px);
  margin: 10px 0 12px;
}

.route .writing p {
  font-size: clamp(14px,1.15vw,17px);
}

/* the road */
.route-line {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 9vh;
  height: 0;
  border-top: 2px dashed rgba(23,23,23,.28);
  pointer-events: none;
}

.route-hud {
  position: absolute;
  left: clamp(20px,5vw,80px);
  right: clamp(20px,5vw,80px);
  top: 26px;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  pointer-events: none;
}

.route-progress {
  position: absolute;
  left: 92px;
  right: 40px;
  bottom: calc(9vh - 1px);
  height: 0;
  pointer-events: none;
}

.route-progress::before {
  content: "";
  position: absolute;
  left: 0;
  top: -1px;
  height: 3px;
  width: calc(var(--p, 0) * 100%);
  background: var(--red);
}

.route-walker {
  position: absolute;
  bottom: 0;
  left: calc(var(--p, 0) * 100%);
  width: 74px;
  translate: -50% 0;
  margin-bottom: 1px;
}

.route-walker img {
  display: block;
  width: 100%;
  height: auto;
}

.route-walker .stand {
  position: absolute;
  inset: auto 0 0 0;
  opacity: 0;
}

.route-walker.is-still .walk {
  opacity: 0;
}

.route-walker.is-still .stand {
  opacity: 1;
}

@media (max-width:760px) {
  .route .series {
    gap: 18vw;
    padding: 0 30vw 0 8vw;
  }
  .route .photo img,
  .route .entry:nth-child(even) .photo img {
    height: auto;
    width: 74vw;
    max-height: 48vh;
    object-fit: cover;
  }
  .route .writing {
    max-width: 74vw;
  }
  .route-walker {
    width: 54px;
  }
  .route-hud span:last-child {
    display: none;
  }
}

@media (prefers-reduced-motion:reduce) {
  .route-walker .walk { opacity: 0; }
  .route-walker .stand { opacity: 1; }
}

/* keep the walking elephant clear of the captions */
.route .entry,
.route .entry.reverse {
  padding-bottom: 19vh;
}

.route-line {
  bottom: 6vh;
}

.route-progress {
  bottom: calc(6vh - 1px);
}

.route-walker {
  width: 48px;
}

@media (max-width:760px) {
  .route-walker { width: 38px; }
}

.route-progress::before { width: calc(var(--p, 0) * 86%); }
.route-walker { left: calc(var(--p, 0) * 86%); }


/* at the last photo: the elephant keeps walking on its own, off the right edge */
.route-walker.walk-off {
  left: calc(100% + 120px) !important;
  transition: left 3.2s linear;
}
.route-walker.walk-off .walk { opacity: 1 !important; }
.route-walker.walk-off .stand { opacity: 0 !important; }

/* the red line follows the elephant all the way off the screen */
.route-progress::before {
  transition: width 3.2s linear;
}
.route-progress:not(.walk-off)::before {
  transition: none;
}
.route-progress.walk-off::before {
  width: calc(100% + 120px) !important;
}

/* the road and the red line run edge to edge */
.route-progress {
  left: 0 !important;
  right: 0 !important;
}
.route-progress:not(.walk-off)::before {
  width: calc(40px + var(--p, 0) * (100% - 160px)) !important;
}
.route-progress.walk-off::before {
  width: calc(100% + 120px) !important;
}
