/* The wall display's idle slideshow. Only ever created on the kiosk — see
   js/screensaver.js and js/kiosk.js. */

.screensaver {
  position: fixed;
  inset: 0;
  /* Above everything the app draws, including the on-screen keyboard's
     z-index: 100 and any open <dialog>'s backdrop. */
  z-index: 9999;
  background-color: #000;
  overflow: hidden;
}

/* Two layers cross-fading, so a photo change never flashes the background
   between images. */
.screensaver__layer {
  position: absolute;
  inset: 0;
  background-position: center;
  background-repeat: no-repeat;
  /* `contain`, not `cover`: this is a family photo, not wallpaper — cropping
     heads out of a portrait shot to fill a landscape screen is worse than
     letterboxing it. */
  background-size: contain;
  opacity: 0;
  transition: opacity 1.2s ease-in-out;
}

.screensaver__layer--visible {
  opacity: 1;
}

/* Time and temperature together in the top-left. Grouped in one positioned
   box so the pair stays aligned and can be moved as a unit. */
.screensaver__overlay {
  position: absolute;
  top: calc(var(--spacing-unit) * 3);
  left: calc(var(--spacing-unit) * 4);
  display: flex;
  flex-direction: column;
  gap: calc(var(--spacing-unit) * 0.5);
  /* The photo behind is any colour at all, so both lines carry their own
     shadow rather than relying on the image being dark. */
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.85);
  color: #fff;
  font-variant-numeric: tabular-nums;
  /* Decorative, and large enough that a stray drag could otherwise select
     it and leave a highlight sitting on the wall. */
  -webkit-user-select: none;
  user-select: none;
}

.screensaver__clock {
  font-size: 7.2rem;
  font-weight: 600;
  line-height: 1;
}

/* Half the clock's size, in em rather than rem so it stays exactly half if
   the clock is ever resized again. */
.screensaver__meridiem {
  font-size: 0.5em;
  font-weight: 500;
  margin-left: 0.18em;
}

/* Temperature and condition on one line, baseline-aligned so the small
   label sits with the big number rather than floating beside it. */
.screensaver__weather {
  display: flex;
  align-items: baseline;
  gap: calc(var(--spacing-unit) * 1.5);
}

.screensaver__temperature {
  font-size: 4.2rem;
  font-weight: 700;
  line-height: 1;
}

/* Half the temperature's size, in em so it tracks any future resize — same
   treatment as the clock's AM/PM. No margin: "12" and "°C" belong together. */
.screensaver__unit {
  font-size: 0.5em;
  font-weight: 500;
}

.screensaver__condition {
  font-size: 2.2rem;
  font-weight: 400;
  /* Held back so the reading order across the room is time, then
     temperature, then this. */
  opacity: 0.85;
}

/* Nothing behind the slideshow should be scrollable while it's up: a stray
   touch that lands as a scroll would move the dashboard underneath. */
body.screensaver-open {
  overflow: hidden;
}
