/* Horizontal Scroll Section, in full: the end of the Bayeux Tapestry. The run is exactly as tall as
   the strip is wider than the screen; its frame is sticky, and the track travels sideways on the
   run's view timeline. The strip is four sheets placed by build/register.py (shift, turn, scale,
   cut) in units of --u, display pixels per strip unit, the way Kinetic Drag places the Tabula. */

.bayeux{position:relative;width:100vw;margin-inline:calc(50% - 50vw);border:0;border-radius:0;overflow:clip;color:#EDE4D3;
  background:radial-gradient(140% 90% at 50% 45%,#2B2219,#120E0A 72%)}
.run{--h:clamp(220px,58svh,640px);--u:calc(var(--h) / var(--mh));--gutter:clamp(20px,6vw,96px);
  --travel:calc(var(--mw) * var(--u) + 2 * var(--gutter) - 100vw);
  height:calc(100svh - var(--bar) + var(--travel));view-timeline:--run block;view-timeline-inset:var(--bar) 0px}
.frame{position:sticky;top:var(--bar);height:calc(100svh - var(--bar));overflow:clip;container-type:inline-size;
  display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:auto 1fr auto;row-gap:clamp(14px,2.4vh,24px);
  padding-block:clamp(16px,4vh,40px) clamp(12px,3vh,28px);box-sizing:border-box}
.where{margin:0 var(--gutter);font-family:var(--mono);font-size:10px;letter-spacing:.18em;text-transform:uppercase;color:#958A7A}

/* the cloth, travelling: down becomes across. The pan ends with the last stitch a gutter from the
   frame's right edge, exactly (100cqw is the frame; 100% the track) */
.track{align-self:center;justify-self:start;width:max-content;padding-inline:var(--gutter);
  animation:pan linear both;animation-timeline:--run;animation-range:contain 0% contain 100%}
@keyframes pan{to{translate:calc(100cqw - 100%) 0}}
.strip{position:relative;width:calc(var(--mw) * var(--u));height:var(--h);overflow:clip;
  box-shadow:0 30px 80px -30px rgb(0 0 0 / .8)}
.sheet{position:absolute;left:0;top:0;width:calc(var(--iw) * var(--u));height:calc(var(--ih) * var(--u));max-width:none;
  transform-origin:0 0;
  transform:translate(calc(var(--x) * var(--u)),calc(var(--y) * var(--u))) rotate(var(--r)) scale(var(--s));
  clip-path:inset(calc(var(--ct) * var(--u)) calc(var(--cr) * var(--u)) calc(var(--cb) * var(--u)) calc(var(--cl) * var(--u)))}

/* the tituli, each under the words stitched above it */
.tituli{position:relative;height:clamp(64px,12vh,110px);margin:clamp(14px,2.6vh,26px) 0 0;padding:0;list-style:none}
.tituli li{position:absolute;left:calc(var(--tx) * var(--u));top:0;width:max-content;max-width:min(34em,80vw);
  padding-left:14px;border-left:1px solid rgb(237 228 211 / .28)}
.tituli b{display:block;font-family:var(--display);font-weight:400;font-size:clamp(14px,1.25vw,18px);letter-spacing:.1em;line-height:1.3}
.tituli span{display:block;margin-top:6px;font-size:clamp(13px,1vw,15px);line-height:1.45;color:#B3A796;font-style:italic;max-width:30em}
.tituli .end{translate:-100% 0;padding:0 14px 0 0;border:0;border-right:1px solid rgb(237 228 211 / .28);text-align:right}

/* how far along the cloth */
.along{height:1px;margin:0 var(--gutter);background:rgb(237 228 211 / .14)}
.along::after{content:'';display:block;height:100%;background:#EDE4D3;transform-origin:0 50%;
  animation:along linear both;animation-timeline:--run;animation-range:contain 0% contain 100%}
@keyframes along{from{scale:0 1}}

@media (max-width:760px){
  .run{--h:clamp(180px,50svh,460px)}
  .tituli{height:clamp(96px,18vh,140px)}
}
/* without motion: the cloth is an ordinary sideways scroller */
@media (prefers-reduced-motion:reduce){
  .run{height:auto}
  .frame{position:static;height:auto}
  .track{animation:none;justify-self:stretch;width:auto;overflow-x:auto;padding-bottom:12px}
  .strip,.tituli{width:calc(var(--mw) * var(--u))}
  .along{display:none}
}
