/* Not sticky: a sticky heading lets go where its containing block ends, and the hero lead's block ends before its
   window does. */

/* How it works' heading type, which heading-pin.js measures and removes again */
.pin-ruler{position:absolute;top:0;left:0;margin:0;padding:0;visibility:hidden;white-space:nowrap;font-size:var(--hm-fs-head);line-height:var(--hm-tl-head);letter-spacing:var(--h-tr);font-weight:var(--h-w)}

:root{--pin-wide:1}
@media (max-width:767px),(max-width:1023px) and (max-aspect-ratio:9999/10000),(max-width:1023px) and (max-height:499px){
  :root{--pin-wide:0}
}

@keyframes pin-hold{from{translate:0 0}to{translate:0 calc((var(--pin-to) - var(--pin-from)) * var(--pin-unit))}}
@keyframes pin-band{from{scale:1 0}to{scale:1 1}}

/* the timeline and range follow the animation shorthand, which resets them */
@supports (animation-timeline:scroll()){
  @media (min-height:500px){
    [data-pin]{
      position:relative;
      z-index:var(--z-sticky);
      align-self:start;
      /* its place follows the scroll, so WebKit's scroll anchoring would chase it and move a jump that lands in a hold */
      overflow-anchor:none;
      animation:pin-hold linear both;
      animation-timeline:scroll(root block);
      animation-range:calc(var(--pin-from) * var(--pin-unit)) calc(var(--pin-to) * var(--pin-unit));
    }
    /* the band reaches one pixel into the paper below: the two are separate layers, and edges that only meet leave a seam */
    [data-pin]::before,[data-pin]::after{content:"";position:absolute;inset-inline:0;z-index:var(--z-behind);background:var(--paper)}
    [data-pin]::before{inset-block:0}
    [data-pin]::after{
      bottom:calc(100% - var(--pin-unit));
      height:calc((var(--pin-band) + 1) * var(--pin-unit));
      transform-origin:50% 100%;
      animation:pin-band linear both;
      animation-timeline:scroll(root block);
      animation-range:calc(var(--pin-from) * var(--pin-unit)) calc((var(--pin-from) + var(--pin-band) + 1) * var(--pin-unit));
    }
    /* the page clips sideways overflow, so the paper can run past both screen edges */
    [data-pin=bleed]::before,[data-pin=bleed]::after{inset-inline:-100vw}
  }
  @media (min-height:500px) and (max-width:767px),(min-height:500px) and (max-width:1023px) and (max-aspect-ratio:9999/10000){
    [data-pin=compact-bleed]::before,[data-pin=compact-bleed]::after{inset-inline:-100vw}
  }
}
