.road-scene {
  --art-ratio: 1.776833;
  --far-y: 0px;
  --middle-y: 0px;
  --near-y: 0px;
  --near-x: 0px;
  --night: 0;
  --lamps: 0;
  --mist: 0;
  --fireflies: 0;
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  isolation: isolate;
  pointer-events: none;
  background: #253829;
}

/* One overscanned canvas keeps the light and the painted windows registered. */
.road-scene .road-art {
  position: absolute;
  right: -21px;
  top: 50%;
  width: max(calc(100% + 44px), calc((100lvh + 44px) * var(--art-ratio)));
  aspect-ratio: var(--art-ratio);
}

.road-scene .road-far {
  transform: translateY(calc(-50% + var(--far-y)));
}

.road-scene .road-middle {
  transform: translateY(calc(-50% + var(--middle-y)));
  mask-image:
    linear-gradient(90deg, transparent 44%, #000 55%),
    linear-gradient(180deg, transparent 14%, #000 23% 78%, transparent 97%);
  mask-composite: intersect;
}

.road-scene .road-art picture,
.road-scene .road-art picture::after,
.road-scene .road-art img,
.road-scene .road-lamps,
.road-scene .road-night,
.road-scene .road-mist,
.road-scene .road-near,
.road-scene .road-fireflies,
.road-scene .road-shade {
  position: absolute;
  inset: 0;
}

.road-scene .road-art picture {
  overflow: hidden;
  isolation: isolate;
}

.road-scene .road-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(calc(1 - .34 * var(--night))) saturate(calc(1 - .34 * var(--night)));
}

.road-scene .road-art picture::after {
  content: "";
  background: linear-gradient(175deg, #797cdd 0%, #849aca 48%, #476c90 100%);
  mix-blend-mode: multiply;
  opacity: var(--night);
}

.road-scene .road-night {
  background: radial-gradient(ellipse at 71% 15%, #807bba74, #49598b22 50%, transparent 74%);
  mix-blend-mode: screen;
  opacity: calc(.5 * var(--night));
}

.road-scene .road-lamps {
  opacity: var(--lamps);
}

.road-scene .road-lamps i {
  position: absolute;
  border-radius: 3%;
  background:
    linear-gradient(90deg, transparent 46%, #78451f 49% 52%, transparent 54%),
    linear-gradient(180deg, transparent 45%, #6a3c21 47% 50%, transparent 52%),
    radial-gradient(ellipse at 45% 76%, #ffed9b, #df9343 64%, #c4783b);
  box-shadow: 0 0 9px #ffbd6499, 0 0 23px #ffb74a44;
  mix-blend-mode: screen;
}

.road-scene .road-lamps i:nth-child(3) {
  left: 81.22%;
  top: 64.83%;
  width: 2.69%;
  height: 5.31%;
}

.road-scene .road-lamps i:nth-child(4) {
  left: 89.17%;
  top: 67.69%;
  width: 2.39%;
  height: 3.51%;
  opacity: .8;
}

/* Percentages correspond to inner glass, without the surrounding frames. */
.road-scene .road-lamps i:first-child {
  left: 72.43%;
  top: 63.87%;
  width: 3.17%;
  height: 5.95%;
}

.road-scene .road-lamps i:nth-child(2) {
  left: 77.09%;
  top: 64.51%;
  width: 2.69%;
  height: 5.52%;
}

.road-scene .road-mist {
  background:
    radial-gradient(ellipse 46% 9% at 72% 76%, #aba7cf74, transparent 100%),
    radial-gradient(ellipse 45% 11% at 58% 85%, #a4a0c453, transparent 99%),
    radial-gradient(ellipse 51% 8% at 98% 69%, #a3a0c971, transparent 99%);
  opacity: var(--mist);
  transform: translateY(calc(16px * (1 - var(--mist))));
}

.road-scene .road-near {
  transform: translate3d(var(--near-x), var(--near-y), 0);
}

.road-scene .road-near img {
  position: absolute;
  display: block;
  height: auto;
  filter: brightness(calc(1 - .30 * var(--night))) saturate(calc(1 - .24 * var(--night)));
}

.road-scene .road-bough {
  left: -4vw;
  bottom: -15lvh;
  width: clamp(315px, 42vw, 760px);
}

.road-scene .road-sign {
  left: clamp(10px, 4vw, 80px);
  bottom: -5lvh;
  width: clamp(145px, 19vw, 310px);
}

.road-scene .road-fireflies {
  opacity: var(--fireflies);
}

.road-scene .road-fireflies i {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #fff3a0;
  box-shadow: 0 0 5px 2px #ffcf5370, 0 0 14px 4px #ffb54b36;
  animation: road-glimmer 5s ease-in-out infinite alternate;
}

.road-scene .road-fireflies i:nth-child(1) { left: 59%; top: 86%; }
.road-scene .road-fireflies i:nth-child(2) { left: 78%; top: 79%; animation-delay: -3s; }
.road-scene .road-fireflies i:nth-child(3) { left: 89%; top: 89%; animation-delay: -1.1s; }
.road-scene .road-fireflies i:nth-child(4) { left: 95%; top: 77%; animation-delay: -4s; }
.road-scene .road-fireflies i:nth-child(5) { left: 70%; top: 92%; animation-delay: -2.3s; }

.road-scene .road-shade {
  background:
    linear-gradient(90deg, #111c18b8 0%, #131e1977 29%, #171f182d 53%, transparent 75%),
    linear-gradient(180deg, #151f1c63 0%, transparent 25%, transparent 79%, #191b2a70 100%);
}

@keyframes road-glimmer {
  0%, 24% { opacity: .22; }
  73%, 100% { opacity: .88; }
}

@media (max-width: 700px) {
  .road-scene {
    --art-ratio: .625473;
  }

  .road-scene .road-art {
    right: -9px;
    width: max(calc(100% + 24px), calc((100lvh + 24px) * var(--art-ratio)));
  }

  .road-scene .road-middle {
    mask-image:
      linear-gradient(90deg, transparent 16%, #000 29%),
      linear-gradient(180deg, transparent 37%, #000 43% 77%, transparent 93%);
  }

  .road-scene .road-lamps i:first-child {
    left: 56.35%;
    top: 64.82%;
    width: 4.54%;
    height: 3.34%;
  }

  .road-scene .road-lamps i:nth-child(2) {
    left: 63.6%;
    top: 65.07%;
    width: 4.23%;
    height: 3.28%;
  }

  .road-scene .road-lamps i:nth-child(3) {
    left: 70.36%;
    top: 65.45%;
    width: 3.83%;
    height: 3.02%;
  }

  .road-scene .road-lamps i:nth-child(4) {
    left: 82.66%;
    top: 66.65%;
    width: 3.73%;
    height: 2.27%;
  }

  .road-scene .road-bough {
    width: clamp(200px, 58vw, 390px);
    bottom: -9lvh;
    left: -10vw;
  }

  .road-scene .road-sign {
    width: clamp(100px, 22vw, 168px);
    left: 3vw;
    bottom: 1lvh;
  }

  .road-scene .road-shade {
    background: linear-gradient(180deg, #141d18a6, #101a1777 27%, #181f1b2e 51%, transparent 70%, #121a2554);
  }

  .road-scene .road-fireflies i {
    animation: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .road-scene .road-art,
  .road-scene .road-near,
  .road-scene .road-mist {
    --far-y: 0px;
    --middle-y: 0px;
    --near-y: 0px;
    --near-x: 0px;
    --night: 0;
    --lamps: 0;
    --mist: 0;
  }

  .road-scene .road-night,
  .road-scene .road-fireflies {
    display: none;
  }
}
