/* The transverse road sits above the vertical driving route. */
#journey #tunnel.flyover-stop {
  --approach: 16px;
  --arch-height: clamp(101px, 8.8vw, 143px);
  --arch-width: clamp(300px, 28vw, 440px);
  --deck-height: clamp(195.84px, 16.83vw, 269.28px);
  --joint: calc(var(--arch-height) * .12);
  position: relative;
  height: auto;
  min-height: 0;
  padding: 0;
}
.flyover-span {
  position: relative;
  z-index: 32;
  padding-block: calc(var(--approach) + var(--arch-height) - var(--joint));
}
#journey #tunnel.flyover-stop .tunnel-portal {
  width: var(--arch-width);
  height: var(--arch-height);
  left: 50%;
}
#journey #tunnel.flyover-stop .entry { top: var(--approach); }
#journey #tunnel.flyover-stop .exit { bottom: var(--approach); }
/* Seat the roof behind the arch posts. */
.flyover-cover {
  position: absolute;
  z-index: 29;
  inset-block: calc(var(--approach) + var(--arch-height) * .27);
  left: 50%;
  width: calc(var(--arch-width) * .86);
  transform: translateX(-50%);
  pointer-events: none;
  background: linear-gradient(90deg, #353b39, #171c1b 10%, #111615 50%, #171c1b 90%, #353b39);
}
.flyover-deck {
  /* The F1 artwork has transparent margins. This gives the hatch about 96% of its visible length. */
  --hatch-length: calc(1.63 * var(--car-width, 142px));
  position: relative;
  z-index: 32;
  overflow: hidden;
  container-type: inline-size;
  height: var(--deck-height);
  box-sizing: border-box;
  background:
    linear-gradient(0deg, transparent 12%, #8b7b53 12% 13.5%, transparent 13.5% 86.5%, #8b7b53 86.5% 88%, transparent 88%),
    repeating-linear-gradient(95deg, transparent 0 240px, #c7c9bb08 241px, transparent 244px),
    linear-gradient(0deg, #222925, #2a322e 37%, #2b332f 65%, #232a27);
  border-block: 4px solid #515c56;
  box-shadow: 0 3px 0 #202723, 0 8px 0 #39433e, 0 14px 17px #0008;
  scroll-margin-top: calc(50vh - var(--deck-height) / 2);
}
.flyover-deck::before, .flyover-deck::after {
  content: ""; position: absolute; left: 0; right: 0; height: 5px;
  background: repeating-linear-gradient(90deg,#727d75 0 3px,#242c28 3px 43px);
  border-block: 1px solid #59645d;
}
.flyover-deck::before { top: 0; }
.flyover-deck::after { bottom: 0; }
.flyover-hatch {
  position: absolute;
  width: var(--hatch-length);
  max-width: none;
  height: auto;
  top: 50%;
  left: 0;
  filter: drop-shadow(2px 3px 1px #0009) drop-shadow(12px 16px 4px #0006);
  transform: translate(var(--cross-x, -105%), -50%) scaleX(var(--cross-facing, 1));
}
@media (prefers-reduced-motion: reduce) {
  .flyover-hatch { left: 50%; transform: translate(-50%, -50%); }
}
@media (max-width: 1023px) {
  main > .flyover-mobile {
    --approach: clamp(84px, 24vw, 120px);
    --arch-width: clamp(200px, 59vw, 320px);
    --arch-height: calc(var(--arch-width) / 3.16);
    --deck-height: clamp(140.76px, 42.84vw, 206.55px);
    --joint: calc(var(--arch-height) * .12);
    position: relative;
    isolation: isolate;
    overflow: hidden;
    width: auto;
    margin-inline: calc(50% - 50vw);
    margin-bottom: 26px;
    padding-block: 0;
  }
  .flyover-mobile::before {
    content: "";
    position: absolute;
    inset-block: 0;
    left: 50%;
    transform: translateX(-50%);
    width: calc(var(--arch-width) * .58);
    border-inline: 2px solid #454d48;
    background:
      repeating-linear-gradient(to bottom, #806342 0 14px, transparent 14px 40px) center / 1px 100% no-repeat,
      #151b19;
    mask-image: linear-gradient(transparent, black 9%, black 91%, transparent);
  }
  .flyover-mobile .flyover-deck {
    --hatch-length: clamp(154px, 41vw, 218px);
  }
  .flyover-under-car {
    position: absolute;
    z-index: 1;
    left: 50%;
    top: 0;
    width: clamp(64px, 19vw, 94px);
    height: auto;
    transform: translate(-50%, calc(var(--under-y, -200px) - 50%)) rotate(var(--under-heading, 0deg));
    filter: drop-shadow(4px 5px 3px #0007);
  }
  .flyover-mobile .tunnel-portal {
    position: absolute;
    z-index: 30;
    left: 50%;
    width: var(--arch-width);
    height: var(--arch-height);
    object-fit: fill;
    pointer-events: none;
  }
  .flyover-mobile .entry { top: var(--approach); transform: translateX(-50%) rotate(180deg); }
  .flyover-mobile .exit { bottom: var(--approach); transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .flyover-under-car { display: none; }
}
