/* Motion in the card below the film is kept to things being placed by hand: pictures are set
   down, the seal is stamped, countdown cards flip, album prints are dealt. Text simply sits
   on the page; the film above is where the animation lives. All of it moves in steps. */

/* Mounted pictures are laid down when they scroll into view. */
.paper-photo { opacity: 0; }
.paper-photo.is-placed { opacity: 1; animation: photoLaidDown 0.34s steps(4, end); }
@keyframes photoLaidDown {
  from { opacity: 0; transform: translateY(-20px) rotate(calc(var(--tilt, 0deg) * 4)); }
  to   { opacity: 1; transform: rotate(var(--tilt, 0deg)); }
}

/* The double-happiness seal is stamped down. */
.songhy-emblem.is-placed { animation: sealStamp 0.42s steps(5, end) both; }
@keyframes sealStamp {
  0%   { transform: scale(1.9) rotate(-14deg); opacity: 0; }
  40%  { transform: scale(0.9) rotate(3deg); opacity: 1; }
  70%  { transform: scale(1.06) rotate(-1deg); }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* Countdown numbers flip like a paper card when they change. */
.cd-num.is-ticking { animation: cardFlip 0.34s steps(4, end); }
@keyframes cardFlip {
  0%   { transform: perspective(300px) rotateX(-78deg); }
  60%  { transform: perspective(300px) rotateX(12deg); }
  100% { transform: none; }
}

/* Album prints are dealt out one by one whenever the tab changes. */
.album-tile { animation: tileDeal 0.3s steps(4, end) backwards; animation-delay: calc(var(--i, 0) * 80ms); }
@keyframes tileDeal {
  from { opacity: 0; translate: 0 -18px; }
  to   { opacity: 1; translate: 0 0; }
}

/* Lightbox picture is placed, not faded. */
.lightbox-img.is-placed { animation: photoPlaced 0.25s steps(3, end); }
@keyframes photoPlaced {
  from { opacity: 0.2; transform: scale(1.06) rotate(-1.5deg); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .paper-photo { opacity: 1; }
  .paper-photo.is-placed, .songhy-emblem.is-placed, .cd-num.is-ticking, .album-tile, .lightbox-img.is-placed { animation: none; }
  html { scroll-behavior: auto; }
}
