/* Each spread is keyed to the distance it has travelled into the viewport.
   At rest and without script, all content is printed in its final position. */
@media screen and (prefers-reduced-motion:no-preference) {
  /* A paper margin grows around the opening photograph as it gives way to
     the programme. The native video pixels and the controls keep their size. */
  .workbench.paper-entrance {
    --frame-corner:calc(min(2vw, 26px) * var(--paper-enter, 0));
    clip-path:inset(0 calc(min(2vw, 30px) * var(--paper-enter, 0)) calc(min(1.5vw, 18px) * var(--paper-enter, 0)) round 0 0 var(--frame-corner) var(--frame-corner));
  }
  .paper-entrance {
    --paper-progress: var(--paper-enter, 1);
    --paper-remaining: calc(1 - var(--paper-progress));
  }

  /* A tapered edge uncovers the print. Its detail stays at the original scale. */
  #cards:not(.program-stack) .paper-entrance .card-art picture,
  .paper-entrance.detail-figure picture,
  .paper-entrance .journal-film,
  .paper-entrance #stage-photo {
    clip-path: polygon(0 0, calc(100% - 23% * var(--paper-remaining)) 0,
      calc(100% - 38% * var(--paper-remaining)) 100%, 0 100%);
  }

  #cards:not(.program-stack) .paper-entrance:nth-of-type(3n + 2) {
    --paper-progress: clamp(0, calc((var(--paper-enter, 1) - .09) * 1.1), 1);
  }
  #cards:not(.program-stack) .paper-entrance:nth-of-type(3n) {
    --paper-progress: clamp(0, calc((var(--paper-enter, 1) - .15) * 1.177), 1);
  }

  .paper-entrance .next-label,
  .paper-entrance .section-title,
  .card-body.paper-entrance h3,
  .journal-copy h2.paper-entrance span,
  .journal-layout.paper-entrance .journal-heading > p,
  .booking-intro.paper-entrance h2,
  .cal-agenda h2.paper-entrance {
    translate: 0 calc(var(--paper-remaining) * 18px);
  }
  .journal-copy h2.paper-entrance i {
    translate: calc(var(--paper-remaining) * 26px) calc(var(--paper-remaining) * 9px);
  }
  .sectionbar.paper-entrance .section-title i,
  .studio-questions .section-title.paper-entrance i,
  .booking-intro.paper-entrance h2 i {
    display: inline-block;
    position: relative;
    translate: calc(var(--paper-remaining) * 14px) 0;
  }

  /* The slightly uneven lower edge follows the italic, like a dry brush. */
  .sectionbar.paper-entrance .section-title i::after,
  .studio-questions .section-title.paper-entrance i::after,
  .booking-intro.paper-entrance h2 i::after {
    content: "";
    position: absolute;
    pointer-events: none;
    left: .04em;
    right: -.045em;
    bottom: -.07em;
    height: .12em;
    background: currentColor;
    opacity: .73;
    clip-path: polygon(0 60%, 9% 42%, 29% 39%, 42% 22%, 69% 21%, 82% 9%, 97% 12%,
      100% 2%, 97% 38%, 78% 49%, 88% 50%, 64% 64%, 36% 67%, 12% 85%, 1% 91%);
    transform: scaleX(var(--paper-progress));
    transform-origin: left center;
  }

  .program-stack .card.paper-entrance,
  .studio-questions details.paper-entrance,
  .facts > div.paper-entrance,
  .cal-list > li.paper-entrance { position: relative; }
  .program-stack .card.paper-entrance::before,
  .studio-questions details.paper-entrance::before,
  .facts > div.paper-entrance::before,
  .cal-list > li.paper-entrance::before {
    content: "";
    position: absolute;
    inset: -1px 0 auto;
    height: 1px;
    background: linear-gradient(90deg, #9c6648, #cbae89 65%, #d6c6b3);
    pointer-events: none;
    transform: scaleX(var(--paper-progress));
    transform-origin: left center;
  }
  .facts > div.paper-entrance::before,
  .cal-list > li.paper-entrance::before { inset: auto 0 -1px; }

  .paper-entrance .cal-list-info,
  .facts > div.paper-entrance dd {
    translate: calc(var(--paper-remaining) * 11px) 0;
  }

  /* Keyboard focus and anchors bring every active control to its exact place. */
  .paper-entrance:focus-within,
  .paper-entrance:target {
    --paper-progress: 1 !important;
  }
}

@media screen and (max-width: 700px) and (prefers-reduced-motion:no-preference) {
  .paper-entrance .next-label {translate:none}
  .journal-copy h2.paper-entrance i { translate: calc(var(--paper-remaining) * 12px) calc(var(--paper-remaining) * 6px); }
  .card-body.paper-entrance h3 { translate: 0 calc(var(--paper-remaining) * 10px); }
}
