:root {
  background: #070d15;
}

body {
  display: grid;
  min-height: 100dvh;
  margin: 0;
  place-items: center;
}

.scene {
  position: relative;
  width: min(100vw, 177.7778dvh);
  aspect-ratio: 16 / 9;
}

.scene-backdrop, .scene-art-layer, .house-windows, .scene-facade {
  position: absolute;
  inset: 0;
}

.scene-backdrop, .scene-art-layer {
  display: block;
  width: 100%;
  height: 100%;
}

.scene-art-layer { pointer-events: none; }
.scene-wet-paving { opacity: var(--pavement-wetness, 0); }
.scene-reflections { opacity: var(--lamp-reflections, 0); }
.scene[data-surface="wet"] { --pavement-wetness: 1; --lamp-reflections: 1; }
.scene[data-surface="dry"] :is(.scene-wet-paving, .scene-reflections, #scene-rain) { display: none; }

.house-windows { pointer-events: none; }

/* The glass cutouts keep the painted sash in front of every interior.
   Apply them to the moving image only so the sill caption stays outside. */
.scene-room-glass, .neighbor-glass, .calibration-glass {
  mask-image: var(--window-glazing);
}

#scene-rain {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.scene-window {
  position: absolute;
  left: var(--window-left);
  top: var(--window-top);
  width: var(--window-width);
  height: var(--window-height);
}

body:has(.weather-controls:not([hidden])) {
  --preview-width: min(100vw, calc((100dvh - 3.75rem) * 16 / 9));
  align-content: center;
}

body:has(.weather-controls:not([hidden])) .scene { width: var(--preview-width); }

.weather-controls:not([hidden]) {
  box-sizing: border-box;
  width: max(var(--preview-width), min(100vw, 22rem));
  min-height: 3.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .5rem clamp(.5rem, 2vw, 1.5rem);
  border-top: 1px solid #29343d;
  background: #10171e;
  color: #dec8a6;
  font: .875rem/1.35 Inter, "Segoe UI", system-ui, sans-serif;
}

.weather-readout, .weather-actions { display: flex; align-items: center; gap: .5rem; }
.weather-readout { flex-wrap: wrap; column-gap: 1rem; row-gap: 0; }
#weather-phase { font-weight: 600; }
#weather-time { color: #b4c0ce; font-variant-numeric: tabular-nums; white-space: nowrap; }
.weather-actions button {
  border: 1px solid #43505c;
  border-radius: .4rem;
  padding: .45rem .7rem;
  background: transparent;
  color: #e6ebef;
  font: inherit;
  white-space: nowrap;
  cursor: pointer;
}
.weather-actions button:hover { background: #232e39; }
.weather-actions button:focus-visible { outline: 2px solid #efc38a; outline-offset: 2px; }

.weather-source { display: none; }
.scene[data-surface="live"] .weather-source {
  position: absolute;
  right: .6rem;
  bottom: .45rem;
  display: grid;
  gap: .16rem;
  box-sizing: border-box;
  max-width: calc(100% - 1.2rem);
  padding: .3rem .6rem;
  border-radius: .25rem;
  background: rgb(10 17 24 / 88%);
  color: #e7e8e7;
  font: .75rem/1.35 Inter, "Segoe UI", system-ui, sans-serif;
}
.weather-observation, .weather-credit {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: .6rem;
}
.weather-credit a { color: #f0d7b4; }
.weather-credit a:focus-visible { outline: 2px solid #efc38a; outline-offset: 2px; }
#live-condition { color: #f0d7b4; }
#live-age { color: #c9d2db; font-variant-numeric: tabular-nums; }
.scene[data-weather-pace="normal"] :is(#live-condition, #live-age) { display: none; }
.scene[data-weather-pace="normal"] .weather-source[data-quality="live"] .weather-observation { display: none; }

.scene[data-surface="live"][data-weather-pace="status"] {
  --status-height: 4.5rem;
  width: min(100vw, calc((100dvh - var(--status-height)) * 16 / 9));
  margin-bottom: var(--status-height);
}
.scene[data-weather-pace="status"] .weather-source {
  top: 100%;
  inset-inline: 0;
  bottom: auto;
  max-width: none;
  min-height: var(--status-height);
  align-content: center;
  gap: .35rem;
  padding: .55rem clamp(.65rem, 2vw, 1.5rem);
  border-top: 1px solid #29343d;
  border-radius: 0;
  background: #10171e;
}
.scene[data-weather-pace="status"] .weather-observation { font-size: .9rem; }
@media (max-width: 700px) {
  .scene[data-surface="live"][data-weather-pace="status"] { --status-height: 7.5rem; }
}
