/* Ken Burns, in full: slower than attention. Six pictures run as a film, nine
   seconds each and two more to dissolve into the next. A move is a focus that
   travels and a scale that pushes in or pulls out about it; the focus is two
   registered percentages, so it interpolates. No script. */

@property --fx{syntax:'<percentage>';inherits:false;initial-value:50%}
@property --fy{syntax:'<percentage>';inherits:false;initial-value:50%}

.film{position:relative;width:100vw;margin-inline:calc(50% - 50vw);height:max(520px,calc(100svh - var(--bar)));
  border:0;border-radius:0;overflow:clip;background:#0B0A09;color:#F2EDE5;scroll-snap-align:start}
html{scroll-snap-type:y proximity;scroll-padding-top:var(--bar)}

.shot{position:absolute;inset:0;margin:0}
/* the cycle: 6 × 9 s = 54 s. In over 2 s on top of the last, hold, keep moving under the next while it dissolves in */
.shot img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;
  object-position:var(--fx) var(--fy);transform-origin:var(--fx) var(--fy);
  opacity:0;animation:kb 54s linear infinite backwards;animation-delay:calc(var(--i) * 9s)}
@keyframes kb{
  0%{opacity:0;z-index:2;--fx:var(--fx0);--fy:var(--fy0);scale:var(--s0)}
  3.704%{opacity:1;z-index:2}
  3.8%{z-index:1}
  20.37%{opacity:1;z-index:1;--fx:var(--fx1);--fy:var(--fy1);scale:var(--s1)}
  20.4%,100%{opacity:0;z-index:1;--fx:var(--fx1);--fy:var(--fy1);scale:var(--s1)}
}
/* a lower third, the way a documentary names a picture: in after the picture settles, out before it goes */
.shot::after{content:'';position:absolute;inset:auto 0 0;height:54%;z-index:3;pointer-events:none;
  background:linear-gradient(to top,rgb(11 10 9 / .9),rgb(11 10 9 / .6) 46%,rgb(11 10 9 / 0));opacity:0;
  animation:cap 54s linear infinite backwards;animation-delay:calc(var(--i) * 9s)}
.shot figcaption{position:absolute;z-index:4;left:clamp(20px,5vw,72px);right:clamp(20px,5vw,72px);bottom:clamp(54px,9vh,92px);
  display:grid;gap:8px;max-width:62ch;opacity:0;animation:cap 54s linear infinite backwards;animation-delay:calc(var(--i) * 9s);
  text-shadow:0 1px 14px rgb(11 10 9 / .55)}
@keyframes cap{0%,2.8%{opacity:0;translate:0 6px}5.6%,14.8%{opacity:1;translate:0 0}16.6%,100%{opacity:0;translate:0 0}}
.shot .who{font-family:var(--mono);font-size:10px;letter-spacing:.18em;text-transform:uppercase;color:var(--accent)}
.shot .what{font-family:var(--display);font-weight:400;font-size:clamp(22px,2.4vw,36px);line-height:1.12;letter-spacing:-.015em;text-wrap:balance}
.shot .where{font-family:var(--mono);font-size:10px;letter-spacing:.14em;text-transform:uppercase;color:#B4ABA0}

/* now playing: six hairlines, the current one filling over its nine seconds */
.reel{position:absolute;z-index:5;left:clamp(20px,5vw,72px);right:clamp(20px,5vw,72px);bottom:clamp(20px,3.4vh,34px);
  display:grid;grid-template-columns:repeat(6,1fr);gap:8px}
.reel i{height:2px;background:rgb(242 237 229 / .2);overflow:clip;position:relative}
.reel i::after{content:'';position:absolute;inset:0;background:#F2EDE5;transform-origin:0 50%;scale:0 1;
  animation:fill 54s linear infinite backwards;animation-delay:calc(var(--i) * 9s)}
@keyframes fill{0%{scale:0 1}16.667%{scale:1 1}16.68%,100%{scale:0 1}}

/* resting the pointer on the film holds the picture, its move, its caption and the reel together */
.film:hover .shot img,.film:hover .shot::after,.film:hover figcaption,.film:hover .reel i::after{animation-play-state:paused}

@media (max-width:760px){
  .shot figcaption{bottom:58px}
  .shot::after{height:62%}
}
/* without motion the pictures still change, but nothing drifts */
@media (prefers-reduced-motion:reduce){
  .shot{--s0:1;--s1:1;--fx1:var(--fx0);--fy1:var(--fy0)}
}
