/* Desktop wallpaper (shell, every page): two stacked layers behind everything, day (light theme) and night (dark
   theme). Night is the base image, day is derived from it (same composition, colors only), so both line up exactly.
   Keyed on html[data-theme] only (never prefers-color-scheme).
   FILES: /Assets/web/wallpaper/wallpaper-{day,night}-v2-{1280,1859}.webp (about 2.2:1; 1859 = the originals' full width,
   never upscaled): 1280 below a 1400px viewport, 1859 at or above it. Phones (under 700px): no wallpaper at all.
   GEOMETRY: both layers use the SAME box, size and position, so any viewport crops them identically:
   --wallpaper-pos-x / --wallpaper-pos-y (chosen with scripts/wallpaper-check.py --crop: on screens up to 2.2:1 the image
   fills the height exactly and only the sides are cropped; the vertical position matters only on ultrawides).
   SWAP: without JavaScript or under reduced motion the theme swaps the layers instantly (opacity + z-index below).
   With JavaScript, components/wallpaper.js crossfades without a dip: the incoming layer fades in ON TOP (450ms) while
   the outgoing one stays fully opaque underneath (.is-held), then drops away.
   LOADING: on a normal-window page (the home page) the CURRENT theme's layer gets its image from this stylesheet, so it
   loads at once without JavaScript; everything else is requested by wallpaper.js (.is-requested) after the load event +
   idle. .is-pending = requested by the script, not loaded yet: transparent (the solid fallback color shows), then it
   fades in. Fallback color: --os-wallpaper-fallback (styles/os9.css), also on <html>. */
:root {
  --wallpaper-pos-x: 50%;
  --wallpaper-pos-y: 60%;
}
.wallpaper {
  position: fixed;
  inset: 0;
  z-index: -1; /* under the menu bar, the window, the dock and the CRT overlay */
  background: var(--os-wallpaper-fallback);
  pointer-events: none;
}
.wallpaper__layer {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-position: var(--wallpaper-pos-x) var(--wallpaper-pos-y);
  background-repeat: no-repeat;
  background-size: cover;
  opacity: 0;
}
html[data-theme="light"] .wallpaper__layer--day,
html[data-theme="dark"] .wallpaper__layer--night { z-index: 1; opacity: 1; }
.wallpaper__layer.is-held { opacity: 1; }    /* the outgoing layer, under the incoming one while it fades in */
.wallpaper .wallpaper__layer.is-pending { opacity: 0; } /* not loaded yet: the fallback color shows (beats the theme rule) */

@media (max-width: 699.98px) {
  .wallpaper__layer { display: none; } /* phones: the window fills the screen; no wallpaper requested */
}
@media (min-width: 700px) {
  :root {
    --wallpaper-day: url("/Assets/web/wallpaper/wallpaper-day-v2-1280.webp");
    --wallpaper-night: url("/Assets/web/wallpaper/wallpaper-night-v2-1280.webp");
  }
  html[data-window="normal"][data-theme="light"] .wallpaper__layer--day,
  .wallpaper__layer--day.is-requested { background-image: var(--wallpaper-day); }
  html[data-window="normal"][data-theme="dark"] .wallpaper__layer--night,
  .wallpaper__layer--night.is-requested { background-image: var(--wallpaper-night); }
}
@media (min-width: 1400px) {
  :root {
    --wallpaper-day: url("/Assets/web/wallpaper/wallpaper-day-v2-1859.webp");
    --wallpaper-night: url("/Assets/web/wallpaper/wallpaper-night-v2-1859.webp");
  }
}
