/*
 * GP Digital Polska · moving roof clouds
 * Reuse the existing cloud texture and precise building silhouette mask.
 * The rain canvas, photo, camera, facade and navigation are not modified.
 */
@keyframes gpdp-roof-cloud-pan {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(calc(0px - var(--gpdp-cloud-tile)), 0, 0); }
}

@media (prefers-reduced-motion: no-preference) {
  .roof-weather__sky {
    /* Keep the same clip-path around the Palace, chimneys and antennae. */
    mask-image: linear-gradient(#000 0 24%, #000e 32%, #0008 40%, transparent 48%);
  }

  .roof-weather__sky::before {
    --gpdp-cloud-tile: 1240px;
    --gpdp-cloud-top: 6px;
    --gpdp-cloud-height: 288px;
    --gpdp-cloud-opacity: .84;
    --gpdp-cloud-light: 1.18;
    --gpdp-cloud-period: 88s;
    --gpdp-cloud-phase: -24s;
  }

  .roof-weather__sky::after {
    --gpdp-cloud-tile: 1032px;
    --gpdp-cloud-top: 73px;
    --gpdp-cloud-height: 274px;
    --gpdp-cloud-opacity: .77;
    --gpdp-cloud-light: 1.11;
    --gpdp-cloud-period: 48s;
    --gpdp-cloud-phase: -6s;
  }

  /* Overscan by one whole tile so the wrap is seamless and no edge is exposed.
     Use transforms, leaving the underlying sky and rain in their own layers. */
  .roof-weather__sky::before,
  .roof-weather__sky::after,
  .roof-weather[data-running] .roof-weather__sky::before,
  .roof-weather[data-running] .roof-weather__sky::after {
    inset: var(--gpdp-cloud-top) auto auto 0;
    width: calc(100% + var(--gpdp-cloud-tile));
    height: var(--gpdp-cloud-height);
    background: url("/assets/gpdp/v15/cloud-veils.webp") repeat-x 0 0 / var(--gpdp-cloud-tile) 100%;
    opacity: var(--gpdp-cloud-opacity);
    filter: brightness(var(--gpdp-cloud-light));
    animation: gpdp-roof-cloud-pan var(--gpdp-cloud-period) linear var(--gpdp-cloud-phase) infinite paused;
  }

  /* Start with the camera, not with the asynchronous initialization of the rain. */
  html:is([data-camera="panorama"], [data-section-active="panorama"]) .roof-weather .roof-weather__sky::before,
  html:is([data-camera="panorama"], [data-section-active="panorama"]) .roof-weather .roof-weather__sky::after {
    animation-play-state: running;
    will-change: transform;
  }
}

@media (prefers-reduced-motion: no-preference) and (max-width: 720px) {
  .roof-weather__sky::before { --gpdp-cloud-opacity: .83; }
  .roof-weather__sky::after { --gpdp-cloud-opacity: .75; }
}
