html body.modern-site.modern-v3 {
  isolation: isolate;
  --backdrop-art: url("../images/site-backdrop.webp");
  --backdrop-base: #29292e;
  --backdrop-wash: rgb(238 221 195 / 8%);
  --backdrop-gutter: clamp(64px, calc(19vw - 145px), 180px);
}
html[data-theme="dark"] body.modern-site.modern-v3 {
  --backdrop-base: #14191f;
  --backdrop-wash: rgb(11 17 25 / 15%);
}

.site-backdrop {
  position: fixed;
  z-index: -1;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  background: var(--backdrop-base);
  --visible-rail: max(var(--backdrop-gutter), calc((100vw - var(--ui-measure, 1480px)) / 2));
}
.site-backdrop__scene,
.site-backdrop__side,
.site-backdrop > canvas[data-site-backdrop] {
  position: absolute;
  pointer-events: none;
}
.site-backdrop__scene {
  inset: 0;
  /* Only the source's central streetscape fills the canvas behind the pairs. */
  background-image: linear-gradient(var(--backdrop-wash), var(--backdrop-wash)), var(--backdrop-art);
  background-position: center, 49% 52%;
  background-size: cover, max(285vw, 190vh) auto;
  background-repeat: no-repeat;
}
.site-backdrop__side {
  width: min(var(--visible-rail), 42vh);
  top: clamp(104px, 25vh, 320px);
  aspect-ratio: 0.56;
  background-image: var(--backdrop-art);
  background-repeat: no-repeat;
  background-size: 312% auto;
  mask-image: linear-gradient(to bottom, transparent, black 11%, black 89%, transparent);
}
.site-backdrop__side--left {
  left: 0;
  background-position: left center;
}
.site-backdrop__side--right {
  right: 0;
  background-position: right center;
}
.site-backdrop > canvas[data-site-backdrop] {
  z-index: 1;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

@media (min-width: 1100px) {
  html .modern-site.modern-v3 #main-content {
    padding-inline: var(--backdrop-gutter) !important;
  }
  html .modern-site.modern-v3 > .cs-site-stats {
    width: calc(100% - 2 * var(--backdrop-gutter));
  }
}

@media (max-width: 1099px) {
  /* The full cast fits above the first panel without taking width from the catalogue. */
  html .modern-site.modern-v3 #main-content {
    --backdrop-opening: clamp(108px, 31vw, 176px);
    padding-top: var(--backdrop-opening) !important;
  }
  .site-backdrop__scene {
    background-image: var(--backdrop-art), linear-gradient(var(--backdrop-wash), var(--backdrop-wash)), var(--backdrop-art);
    background-size: 100% auto, cover, auto max(115vh, 72vw);
    background-position: center var(--backdrop-header-height, 66px), center, center;
  }
  .site-backdrop__side { display: none; }

  /* With scripting off the expanded navigation can be several rows high. Keep
     the panorama in document flow until the header measurement is available. */
  html .modern-site.modern-v3:has(> .site-backdrop:not([style*="--backdrop-header-height"])) #main-content {
    padding-top: 0 !important;
  }
  .modern-site:has(> .site-backdrop:not([style*="--backdrop-header-height"])) #main-content::before {
    content: "";
    display: block;
    height: var(--backdrop-opening);
    margin-inline: calc(0px - var(--ui-gutter));
    background: var(--backdrop-art) center top / 100% auto no-repeat;
    pointer-events: none;
  }
}

@media print {
  .site-backdrop { display: none; }
  html .modern-site.modern-v3 #main-content { padding: 0 !important; }
}
