#window-scene {
  --window-open: 0.36;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  touch-action: pan-y pinch-zoom;
  user-select: none;
  cursor: grab;
  background: #202f40 url("./rain-rooftops.webp") 55% 54% / cover no-repeat;
}

.window-scene .scene-glass,
.window-scene .scene-ambient,
.window-scene .scene-interior,
.window-scene .scene-frame,
.window-scene .scene-sill {
  position: absolute;
  pointer-events: none;
}

.window-scene .scene-ambient {
  inset: 0;
  background:
    radial-gradient(ellipse at 55% 53%, transparent 40%, rgb(9 15 24 / 19%) 100%),
    linear-gradient(to top, rgb(12 17 24 / 12%), transparent 38%);
}

.window-scene .scene-glass {
  inset-block: 0;
  background:
    url("./rain-glass.webp") 0 0 / 400px 365px repeat,
    linear-gradient(108deg, rgb(125 150 170 / 5%), rgb(103 129 155 / 2%) 40%, rgb(147 166 181 / 6%) 61%, transparent 64%);
}

.window-scene .scene-fixed {
  inset-inline: 0 53%;
  box-shadow:
    inset -2px 0 0 #78818b54,
    inset -6px 0 0 #1d2630,
    inset -8px 0 0 #39424b,
    1px 0 2px #0d131c88;
}

.window-scene .scene-sliding {
  left: 46.85%;
  width: 55%;
  transform: translateX(calc(var(--window-open) * 87%));
  transition: transform 120ms ease-out;
  background-position: 82px 21px, 0 0;
  border-left: clamp(5px, 0.58vw, 8px) solid #1c242e;
  box-shadow: -2px 0 1px #0e141dcc, inset 1px 0 #75818b7d, inset 4px 0 #2d3742, 2px 0 4px #141e27;
}

.window-scene .scene-sliding::after {
  content: "";
  position: absolute;
  top: 64%;
  left: 1px;
  width: 4px;
  height: clamp(12px, 3%, 19px);
  border-radius: 3px;
  background: linear-gradient(90deg, #2d3239, #72716c 49%, #45484c);
  box-shadow: 1px 1px 1px #10131ad9;
}

#window-scene.scene-dragging { cursor: grabbing; }
.window-scene.scene-dragging .scene-sliding { transition: none; }

.window-scene .scene-runner {
  position: absolute;
  width: 1px;
  height: var(--length);
  left: var(--left);
  top: var(--top);
  opacity: 0;
  transform: rotate(4deg);
  background: linear-gradient(to bottom, transparent, #b2cad85e 91%, #c6d6df9c);
  animation: scene-drizzle var(--period) linear var(--delay) infinite;
}

@keyframes scene-drizzle {
  0%, 83% { opacity: 0; transform: translate(0, 0) rotate(4deg) scaleY(.45); }
  86% { opacity: .36; }
  96% { opacity: .2; }
  100% { opacity: 0; transform: translate(-1px, 17px) rotate(4deg) scaleY(1); }
}

.window-scene .scene-frame {
  inset: 0;
  box-shadow:
    inset 0 2px 2px #151b26a1,
    inset 4px 0 3px #10162070,
    inset -2px 0 2px #10162091;
}

.window-scene .scene-interior {
  inset: 0;
  background: url("./room-light.webp") right bottom / auto 100% no-repeat;
}

.window-scene .scene-sill {
  inset: auto 0 0;
  height: clamp(3px, 1.25%, 8px);
  background:
    radial-gradient(ellipse at 89% 0, #a08b6d5c 0%, transparent 33%),
    linear-gradient(#42474c, #2e353b 20%, #222832 56%, #1c222b 72%, #141b23);
  box-shadow: 0 -1px 2px #141c245c;
}

.window-scene.scene-still .scene-runner,
body:has(#night[open]) .scene-runner {
  animation-play-state: paused;
}

@media (prefers-reduced-motion: reduce) {
  .window-scene .scene-runner { display: none; }
  .window-scene .scene-sliding { transition: none; }
}
