/*
 * hyd-photo-trail.css - a short trail of photo thumbnails on the empty desktop.
 *
 * hyd-photo-trail.js builds .hyd-photo-trail and appends one .hyd-photo-trail-thumb per photo, setting
 * --trail-angle (degrees) and --trail-drift (px) on it. The thumb stays hidden (display none) until its image has loaded and
 * decoded; the script then sets data-ready, which starts the animation, and removes the thumb after LIFETIME
 * (1150 ms), which must stay equal to the animation length below.
 *
 * The trail is decoration only: it never takes pointer input, and it is hidden for reduced motion, for
 * body.motion-off and on coarse pointers.
 */

/* Full-bleed layer over the desktop. !important on pointer-events here and on the thumbs: the trail
   must stay click-through whatever other rules say. contain keeps its layout and paint local. */
.hyd-photo-trail {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none !important;
  z-index: 1;
  contain: layout paint;
}

/* One photo print: a white border, thicker at the bottom like an instant photo, and a soft shadow. */
.hyd-photo-trail-thumb {
  position: absolute;
  left: 0;
  top: 0;
  /* Placed by --trail-x and --trail-y (set by the script), so moving it never touches layout. */
  translate: var(--trail-x, 0px) var(--trail-y, 0px);
  width: 52px;
  height: 40px;
  box-sizing: border-box;
  object-fit: cover;
  border: 2px solid #fff;
  border-bottom-width: 5px;
  border-radius: 2px;
  box-shadow: 0 2px 7px #152d4550;
  pointer-events: none !important;
  animation: none;
  will-change: transform, opacity;
}

/* Starts only after the image has loaded and decoded. */
.hyd-photo-trail-thumb[data-ready] {
  animation: hyd-photo-drift 1150ms ease-out both;
}

.hyd-photo-trail-thumb:not([data-ready]) {
  display: none;
}

/* Drift: fade in and settle (0 to 8 percent, about 90 ms, so a print is solid almost at once), fade out while sliding sideways by --trail-drift and
   turning a further 5 degrees. The whole run is 1150 ms, matching LIFETIME in hyd-photo-trail.js. */
@keyframes hyd-photo-drift {
  0% {
    opacity: 0.4;
    transform: translate3d(0,0,0) rotate(var(--trail-angle)) scale(.88);
  }
  8% {
    opacity: 0.86;
    transform: translate3d(3px,-5px,0) rotate(var(--trail-angle)) scale(1);
  }
  65% {
    opacity: 0.65;
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--trail-drift),12px,0) rotate(calc(var(--trail-angle) + 5deg)) scale(.9);
  }
}

/* No trail when the visitor turns animations off, when the OS asks for reduced motion, or on a
   touch screen (coarse pointer). */
body.motion-off .hyd-photo-trail {
  display: none;
}
@media (prefers-reduced-motion: reduce), (pointer: coarse) {
  .hyd-photo-trail {
    display: none;
  }
}
