/* Lean-follow frames. Rewritten from Imperiale Bolgheri's c-frames (Frames.js = module 1201 + o-reveal-mask CSS),
   teardown 10-04. A row of 2:3 frames on a stepped rhythm; each one leans after the pointer while hovered (part.js),
   and on first view rises 48px while a page-coloured slab with a slanted top edge drops off its picture. */
.lff {
  --lff-cols: 6;                 /* frames per row */
  --lff-gap: clamp(4px, .5vw, 8px);
  --lff-ratio: 2 / 3;
  --lff-offset: 35%;             /* drop per step, % of the frame's width */
  --lff-rise: 48px;              /* entrance rise */
  --lff-rise-dur: 1s;
  --lff-rise-ease: cubic-bezier(.165,.84,.44,1);
  --lff-slab: #000;              /* slab colour = the page colour (the source also uses its sand) */
  --lff-slant: 10%;              /* slab edge: left at h, right at h * .4; slab overhangs the top by 1.5h */
  --lff-wipe: .8s;
  --lff-wipe-ease: cubic-bezier(.77,0,.175,1);
  --lff-stagger: .05s;           /* per frame */
  display: grid; grid-template-columns: repeat(var(--lff-cols), minmax(0, 1fr)); gap: var(--lff-gap);
  align-items: start;
}
.lff__item { --step: 0; --n: 0; position: relative; will-change: transform; }
/* the source's rhythm: steps 1, 2, 1, 0, 2, 1 (part.js takes data-lff-steps for your own) */
.lff__item:nth-child(6n+1), .lff__item:nth-child(6n+3), .lff__item:nth-child(6n+6) { --step: 1; }
.lff__item:nth-child(6n+2), .lff__item:nth-child(6n+5) { --step: 2; }
.lff__media {
  position: relative; overflow: hidden; aspect-ratio: var(--lff-ratio);
  margin-top: calc(var(--lff-offset) * var(--step));
  transform: translateY(var(--lff-rise));
  transition: transform var(--lff-rise-dur) var(--lff-rise-ease) calc(var(--lff-stagger) * var(--n));
}
.lff__media > img, .lff__media > video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.lff__media::before {
  content: ""; position: absolute; z-index: 2; inset: calc(var(--lff-slant) * -1.5) 0 0 0;
  background: var(--lff-slab);
  clip-path: polygon(0 var(--lff-slant), 100% calc(var(--lff-slant) * .4), 100% 100%, 0 100%);
  transition: transform var(--lff-wipe) var(--lff-wipe-ease) calc(var(--lff-stagger) * var(--n));
  will-change: transform;
}
.lff.is-inview .lff__media { transform: none; }
.lff.is-holding .lff__media, .lff.is-holding .lff__media::before { transition: none; }
.lff.is-inview .lff__media::before { transform: translateY(100%); }
/* phones: four to a row, the rest hidden (the source does the same) */
@media (max-width: 767.98px) {
  .lff { --lff-cols: 4; }
  .lff__item:nth-child(n+5) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .lff__media { transform: none; transition: none; }
  .lff__media::before { display: none; }
}
