.route-film {
  --film-ice: #9cf8ff;
  --film-ink: #080e1d;
  --film-top: var(--header, 75px);
  --film-height: calc(100svh - var(--film-top));
  --film-gutter: clamp(22px, 6vw, 108px);
  --film-frame: clamp(11px, 1.6vw, 24px);
  color: #f4f8ff;
  background: var(--film-ink);
}

.route-roll {
  position: relative;
}

.route-stage {
  display: none;
}

.route-panel {
  position: relative;
  isolation: isolate;
  display: flex;
  min-height: min(680px, var(--film-height));
  align-items: center;
  padding: clamp(55px, 10vh, 114px) var(--film-gutter);
}

.route-panel-photo {
  position: absolute;
  z-index: -1;
  inset: 0;
  background-color: #13253a;
  background-position: center;
  background-size: cover;
}

.route-panel-photo::after {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(90deg, #050c1af5, #050c1ace 30%, #050c1a60 63%, #050c1a1a),
    linear-gradient(0deg, #050c1ad8, transparent 36%);
}

.route-panel-photo--opening { background-image: url("assets/last-mile.webp"); background-position: 64% center; }
.route-panel-photo--pickup { background-image: url("assets/hero.webp"); background-position: 69% center; }
.route-panel-photo--sort { background-image: url("assets/warehouse.webp"); background-position: 60% 41%; }
.route-panel-photo--door { background-image: url("assets/business.webp"); background-position: 58% 42%; }

.route-caption {
  position: relative;
  width: min(100%, 39rem);
}

.route-caption h1,
.route-caption h2 {
  margin: 17px 0 20px;
  font-size: clamp(4rem, 9.3vw, 10.6rem);
  font-weight: 760;
  line-height: .78;
  letter-spacing: -.082em;
}

.route-caption h2 {
  font-size: clamp(3.4rem, 7.5vw, 8.4rem);
  line-height: .88;
}

.route-caption em {
  color: var(--film-ice);
  font-family: "Instrument Serif", Georgia, serif;
  font-weight: 400;
  letter-spacing: -.077em;
}

.route-caption > p:not(.route-kicker) {
  max-width: 32rem;
  color: #e5eefb;
  font-size: clamp(.98rem, 1.35vw, 1.23rem);
  line-height: 1.56;
  text-wrap: pretty;
}

.route-kicker {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--film-ice);
  font: 700 .75rem/1.35 "IBM Plex Mono", Consolas, monospace;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.route-kicker > span {
  width: 20px;
  height: 1px;
  flex: none;
  background: currentColor;
  box-shadow: 0 0 12px #9cf8ff90;
}

.route-caption > p.route-tip {
  display: grid;
  gap: 4px;
  max-width: 29rem;
  margin-top: clamp(17px, 4vh, 39px);
  padding-left: 14px;
  border-left: 1px solid #a9faff85;
  color: #ccdaea;
  font-size: .92rem;
}

.route-tip strong {
  color: var(--film-ice);
  font-size: .75rem;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.route-start,
.route-replay {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  gap: 10px;
  color: #eefcff;
  font-size: .91rem;
  font-weight: 700;
}

.route-start {
  margin-top: clamp(15px, 4vh, 36px);
}

.route-start span,
.route-replay span {
  display: grid;
  width: 39px;
  height: 39px;
  place-items: center;
  border: 1px solid #a9faff67;
  border-radius: 50%;
  color: var(--film-ice);
  background: #84eaff12;
  transition: background .2s, color .2s, transform .24s var(--ease);
}

.route-start:hover span,
.route-replay:hover span {
  transform: translateY(3px);
  color: var(--film-ink);
  background: var(--film-ice);
}

.route-replay:hover span {
  transform: translateY(-3px);
}

.route-static-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 9px 20px;
  margin-top: 13px;
  color: var(--film-ice);
  font-size: .85rem;
  font-weight: 700;
}

.route-static-nav a {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.is-cinematic .route-static-nav {
  display: none;
}

.route-parcel {
  padding: clamp(24px, 5vw, 70px) var(--film-gutter);
}

.route-parcel-inner {
  display: grid;
  grid-template-columns: minmax(0, .7fr) minmax(0, 1.3fr);
  align-items: center;
  gap: clamp(12px, 4vw, 42px);
  width: min(100%, 1260px);
  margin-inline: auto;
  padding: clamp(17px, 4vw, 46px);
  border: 1px solid #a1e8ff38;
  border-radius: 16px;
  background: radial-gradient(ellipse at 72% 38%, #173e6573, transparent 58%), #0b1728;
}

.route-parcel h2 {
  font-size: clamp(1.625rem, 4.1vw, 4.1rem);
  line-height: 1.05;
  letter-spacing: -.048em;
  text-wrap: balance;
}

.route-parcel h2 em {
  color: var(--film-ice);
  font-style: normal;
}

.route-parcel-inner .route-parcel-stage {
  width: 100%;
  height: clamp(248px, 33vw, 426px);
  min-height: 0;
  margin: 0;
}

.route-parcel-stage canvas,
.route-parcel-stage .scene-fallback {
  height: calc(100% - 62px);
}

.route-parcel-stage canvas { touch-action: pan-y pinch-zoom; }
.route-parcel-stage canvas:focus-visible { outline-offset: -3px; }
.route-parcel-stage:not(.is-ready) .scene-fallback { height: 100%; }

.route-parcel-stage .scene-controls {
  bottom: 0;
  flex-direction: column;
  gap: 5px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.route-parcel-stage .scene-hint {
  display: block;
  color: #bdd7e8;
  font-size: .78rem;
  font-weight: 500;
  text-align: center;
}

.route-parcel-stage .scene-buttons button {
  width: 44px;
  height: 44px;
  border-radius: 9px;
}

@media (max-width: 640px) {
  .route-parcel-inner { grid-template-columns: minmax(0, 1fr); }
  .route-parcel h2 { text-wrap: wrap; }
}

.route-outro {
  display: grid;
  min-height: min(650px, 92svh);
  place-items: center;
  padding: clamp(70px, 12vh, 154px) var(--film-gutter);
  border-top: 1px solid #a1e8ff38;
  background:
    radial-gradient(ellipse at 85% 15%, #184d653e, transparent 52%),
    radial-gradient(ellipse at 16% 90%, #17365853, transparent 48%),
    #080e1d;
}

.route-outro-inner {
  width: min(100%, 1260px);
}

.route-outro h2 {
  font-size: clamp(3.4rem, 7.6vw, 8rem);
  line-height: .92;
  letter-spacing: -.072em;
}

.route-outro p {
  max-width: 29rem;
  margin-top: 21px;
  color: #cbd9eb;
  text-wrap: pretty;
}

.route-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 25px;
}

.route-primary {
  border-color: var(--film-ice);
  color: #07131f;
  background: var(--film-ice);
}

.route-primary:hover {
  background: #d2fdff;
}

.route-replay {
  margin-top: 21px;
}

.route-film a:focus-visible {
  outline-color: var(--film-ice);
}

.is-cinematic .route-stage {
  position: sticky;
  z-index: 0;
  top: var(--film-top);
  display: block;
  height: var(--film-height);
  overflow: hidden;
  isolation: isolate;
  background: #07101f;
}

.is-cinematic .route-script {
  position: relative;
  z-index: 1;
  margin-top: calc(-1 * var(--film-height));
  pointer-events: none;
}

.is-cinematic .route-panel {
  min-height: var(--film-height);
  padding-bottom: max(95px, 17vh);
}

.is-cinematic .route-caption a,
.is-cinematic .route-caption p,
.is-cinematic .route-caption h1,
.is-cinematic .route-caption h2 {
  width: fit-content;
  pointer-events: auto;
}

.is-cinematic .route-panel-photo {
  display: none;
}

.route-world,
.route-shot,
.route-light,
.route-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.route-world {
  overflow: hidden;
  perspective: 1050px;
}

.route-shot {
  opacity: var(--shot-alpha, 0);
  perspective: 1050px;
  transform: translateZ(0);
}

.route-shot:first-child { --shot-alpha: 1; }

.route-shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(.92) contrast(1.06);
  transform:
    translate3d(var(--camera-x, 0px), var(--camera-y, 0px), 0)
    rotateX(var(--camera-pitch, 0deg))
    rotateY(var(--camera-yaw, 0deg))
    scale(var(--camera-zoom, 1.12));
}

.route-shot--opening img { object-position: 65% 53%; }
.route-shot--pickup img { object-position: 70% 44%; }
.route-shot--sort img { object-position: 64% 43%; }
.route-shot--door img { object-position: 64% 42%; }

.route-light {
  z-index: 1;
  opacity: var(--film-flare, 0);
  background: linear-gradient(106deg, transparent 36%, #65cbf564 46%, #c8fbffaf 49%, transparent 53%);
  transform: translateX(var(--flare-x, -55%));
  mix-blend-mode: screen;
}

.route-vignette {
  z-index: 2;
  background:
    linear-gradient(90deg, #061021f2, #061021e3 19%, #0610219d 40%, #06102119 73%, #050b16a0),
    linear-gradient(0deg, #060d1df9, #060d1d18 43%, #060d1d34 70%, #060d1d98),
    radial-gradient(ellipse at 58% 32%, transparent 35%, #050a15a0 97%);
}

.route-frame {
  position: absolute;
  z-index: 3;
  inset: var(--film-frame);
  border: 1px solid #b6ebff23;
  pointer-events: none;
}

.route-frame i {
  position: absolute;
  width: 15px;
  height: 15px;
  border: solid #a1edffb5;
}

.route-frame i:nth-child(1) { top: -1px; left: -1px; border-width: 1px 0 0 1px; }
.route-frame i:nth-child(2) { top: -1px; right: -1px; border-width: 1px 1px 0 0; }
.route-frame i:nth-child(3) { right: -1px; bottom: -1px; border-width: 0 1px 1px 0; }
.route-frame i:nth-child(4) { bottom: -1px; left: -1px; border-width: 0 0 1px 1px; }

.route-flight {
  position: absolute;
  right: max(4vw, 26px);
  bottom: clamp(95px, 14vh, 145px);
  width: min(48vw, 660px);
  height: clamp(132px, 24vh, 250px);
  pointer-events: none;
}

.route-flight canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.route-console {
  position: absolute;
  z-index: 5;
  right: var(--film-gutter);
  bottom: calc(var(--film-frame) + 14px);
  left: var(--film-gutter);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: clamp(12px, 3vw, 44px);
  align-items: center;
}

.route-console-count {
  display: inline-flex;
  min-width: 72px;
  align-items: center;
  gap: 7px;
  color: #aab9cc;
  font: 600 .72rem/1.2 "IBM Plex Mono", Consolas, monospace;
  letter-spacing: .055em;
}

.route-console-count span:first-child {
  color: var(--film-ice);
  font-size: 1.15rem;
}

.route-console-track {
  position: relative;
  align-self: stretch;
}

.route-console-meter {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 1px;
  background: #b5ebff48;
}

.route-console-meter::after {
  display: block;
  width: 100%;
  height: 100%;
  transform: scaleX(var(--film-progress, .025));
  transform-origin: left;
  background: var(--film-ice);
  box-shadow: 0 0 12px #99f8ffab;
  content: "";
}

.route-chapter-links {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}

.route-chapter-links a {
  display: flex;
  width: fit-content;
  min-height: 44px;
  align-items: center;
  gap: 7px;
  padding: 4px 7px 1px 0;
  color: #c2d2e5;
  font-size: .79rem;
  font-weight: 700;
  transition: color .2s;
}

.route-chapter-links a:hover,
.route-chapter-links a[aria-current] {
  color: var(--film-ice);
}

.route-nav-dot {
  width: 5px;
  height: 5px;
  flex: none;
  border-radius: 50%;
  background: currentColor;
}

.route-chapter-links a[aria-current] .route-nav-dot {
  box-shadow: 0 0 10px 2px #9cf8ff91;
}

@media (min-width: 761px) and (max-height: 610px) {
  .is-cinematic .route-caption h1 { font-size: clamp(3.5rem, 10vh, 6.3rem); }
  .is-cinematic .route-caption h2 { font-size: clamp(3rem, 9vh, 5.5rem); }
  .is-cinematic .route-panel { padding-top: 34px; }
}

@media (orientation: landscape) and (max-height: 499px) {
  .route-panel {
    min-height: max(315px, var(--film-height));
    align-items: center;
    padding-block: 32px;
  }

  .route-caption { max-width: min(59vw, 33rem); }
  .route-caption h1 { font-size: clamp(2.8rem, 11svh, 4.4rem); }
  .route-caption h2 { font-size: clamp(2.4rem, 9svh, 3.8rem); }
  .route-panel-photo::after {
    background: linear-gradient(90deg, #050c1af5, #050c1acb 37%, #050c1a54 66%, transparent);
  }
}

@media (max-width: 760px), (orientation: landscape) and (max-width: 1024px) and (max-height: 519px) {
  .route-film { --film-gutter: var(--mobile-gutter, clamp(16px, 5vw, 38px)); }
  .route-panel { min-height: 0; }
  .route-caption { width: 100%; max-width: 39rem; }

  .route-opening {
    align-items: end;
    padding-block: clamp(151px, 43vw, 263px) clamp(30px, 7vw, 48px);
    overflow: hidden;
    border-bottom: 1px solid #b4d8fb24;
  }

  .route-panel-photo--opening {
    inset-block: -15px;
    background-position: 73% 37%;
    transform: translateY(calc(var(--motion-shift, 0px) * .34));
  }

  .route-panel-photo--opening::after {
    background: linear-gradient(0deg, var(--film-ink) 4%, #080e1df5 24%, #080e1dc2 46%, #080e1d10 79%);
  }

  .route-opening .route-kicker,
  .route-static-nav,
  .route-replay { display: none; }

  .route-caption h1 {
    margin: 0 0 12px;
    font-size: clamp(3.3rem, 11vw, 5.1rem);
    line-height: .88;
  }

  .route-caption h2 {
    margin: 5px 0 10px;
    font-size: clamp(2.24rem, 8.3vw, 3.85rem);
    line-height: 1.01;
  }

  .route-caption h2 br,
  .route-outro h2 br { display: none; }

  .route-caption > p:not(.route-kicker) {
    margin: 0;
    font-size: .96rem;
    line-height: 1.55;
  }

  .route-start {
    min-height: 44px;
    margin-top: 16px;
    padding-inline: 13px;
    border-radius: 8px;
    color: var(--film-ink);
    background: var(--film-ice);
  }

  .route-start span {
    width: auto;
    height: auto;
    border: 0;
    color: inherit;
    background: none;
  }

  .route-start:hover span { background: none; }

  .route-chapter {
    display: grid;
    padding: 0;
    border-bottom: 1px solid #b4d8fb24;
    overflow: hidden;
  }

  .route-chapter .route-panel-photo {
    position: relative;
    inset: auto;
    height: clamp(156px, 46vw, 250px);
    background-position-y: calc(43% + var(--motion-shift, 0px) * .42);
  }

  .route-chapter .route-panel-photo::after {
    background: linear-gradient(0deg, #080e1d5c, transparent 45%);
  }

  .route-chapter .route-caption { padding: 23px var(--film-gutter) 29px; }
  .route-kicker { font-size: .7rem; }
  .route-kicker > span { display: none; }

  .route-caption > p.route-tip {
    display: block;
    margin-top: 9px;
    padding: 0;
    border: 0;
    color: #b9cade;
    font-size: .82rem;
  }

  .route-tip strong {
    margin-inline-end: .32em;
    color: #d8ecf9;
    font-size: inherit;
    letter-spacing: normal;
    text-transform: none;
  }

  .route-outro {
    min-height: 0;
    padding-block: clamp(38px, 9vw, 64px);
    border-top: 0;
  }

  .route-outro h2 {
    font-size: clamp(2.52rem, 8vw, 4.3rem);
    line-height: 1;
  }

  .route-outro p { margin-top: 12px; }

  .route-actions {
    display: grid;
    justify-items: start;
    gap: 4px;
    margin-top: 16px;
  }

  .route-actions .button { min-height: 44px; }
  .route-actions .button--glass {
    padding-inline: 0;
    border-color: transparent;
    color: var(--film-ice);
    background: transparent;
  }
}

@media (orientation: landscape) and (min-width: 560px) and (max-width: 1024px) and (max-height: 519px) {
  .route-opening {
    min-height: min(340px, var(--film-height));
    padding-block: 28px;
    align-items: center;
  }

  .route-opening .route-caption { max-width: min(61%, 29rem); }
  .route-opening .route-caption h1 { font-size: clamp(3.05rem, 11svh, 4.4rem); }
  .route-panel-photo--opening::after {
    background: linear-gradient(90deg, #080e1df8, #080e1dc7 40%, #080e1d26 76%);
  }

  .route-chapter {
    grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
    align-items: stretch;
  }

  .route-chapter .route-panel-photo { height: 100%; }
  .route-chapter .route-caption { align-self: center; }
  .route-caption h2 { font-size: clamp(2.1rem, 5.6vw, 3.45rem); }
}

@media (prefers-reduced-motion: reduce) {
  .route-start span,
  .route-replay span,
  .route-chapter-links a {
    transition: none;
  }

  .route-roll:not(.is-cinematic) .route-panel-photo { transform: none; }
}
