/* Robots’ Last Exam — homepage parts after the intro.
   · .statement  a few words on a quiet page, between the parts
   · .act        one clip shown large on a pinned stage, which then draws back into a row of every clip
   · .strip      that row (home-strip.js); the intro uses the same row for scenes
   Driven by home-acts.js. Desktop-first. */

/* ---------- the row of footage ---------- */
.intro, .act-stage {
  --card-w: 34vw;
  --card-h: calc(var(--card-w) * 9 / 16);
  --card-gap: 16px;
  --row-y: 54vh;               /* middle of the row inside the pinned stage */
}
/* --reveal runs 0 → 1 as the large clip draws back; the row only takes the pointer once it is travelling. */
.strip { position: absolute; left: 0; right: 0; top: calc(var(--row-y) - var(--card-h) / 2); height: var(--card-h); z-index: 0; pointer-events: none; }
.strip.is-live { pointer-events: auto; }
.strip-card {
  position: absolute; left: 0; top: 0; width: var(--card-w); height: var(--card-h); padding: 0; border: 0;
  border-radius: 12px; overflow: hidden; background: #161617; color: var(--cream); cursor: pointer; text-align: left;
  opacity: var(--reveal, 0); scale: calc(.88 + .12 * var(--reveal, 0));
  box-shadow: 0 0 0 1px rgba(255,255,255,.06);
  transition: scale .45s cubic-bezier(.2, .8, .2, 1), box-shadow .45s ease;
  will-change: translate, scale;
}
.strip-card img, .strip-card video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.strip-card img:not([src]) { visibility: hidden; }
.strip-card video { opacity: 0; transition: opacity .6s ease; }
.strip-card video.is-playing { opacity: 1; }
.strip-cap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 44px 16px 14px;
  background: linear-gradient(to top, rgba(0,0,0,.82), rgba(0,0,0,0));
  font: 600 clamp(15px, 1.25vw, 20px)/1.15 var(--display); letter-spacing: -.014em;
}
.strip.is-live .strip-card:hover, .strip.is-live .strip-card:focus-visible { scale: 1.03; z-index: 1; box-shadow: 0 0 0 1px rgba(255,255,255,.55), 0 26px 60px rgba(0,0,0,.6); }

/* The line above the row: which part this is, and how much of it there is. */
.strip-head {
  position: absolute; z-index: 3; left: calc(var(--rail) + var(--pad)); right: calc(var(--right) + var(--pad));
  top: calc(var(--row-y) - var(--card-h) / 2 - 62px);
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity .4s ease, transform .5s ease;
}
.intro.is-row .strip-head, .act.is-row .strip-head { opacity: 1; transform: none; pointer-events: auto; transition: opacity .7s ease .15s, transform .9s cubic-bezier(.2, .7, .2, 1) .15s; }

/* Anchor the two-line gallery header to the upper edge of its moving row. */
.intro .strip-head {
  top: auto;
  bottom: calc(100% - var(--row-y) + var(--card-h) / 2 + clamp(16px, 3vh, 32px));
  left: var(--chapter-left); right: var(--chapter-right);
  align-items: flex-end;
}
.scene-gallery-heading .display {
  margin-top: var(--chapter-title-gap); font-size: var(--chapter-title-size);
}
@media (max-width: 600px) {
  .intro .strip-head { align-items: flex-start; flex-direction: column; gap: 14px; }
}
@media (max-height: 600px) and (min-aspect-ratio: 4/3) {
  .intro {
    --card-w: min(34vw, 65vh);
    --row-y: max(54vh, calc(var(--top) + 106px + var(--card-h) / 2));
  }
}

/* ---------- the next part's name, between the parts ---------- */
/* --p runs 0 → 1 as the section crosses the screen (home-acts.js). The words start apart, one high
   and to the left, the next low and to the right, and come to rest together on one centred line. */
.statement {
  position: relative; z-index: 1; display: grid; align-content: center; min-height: 118vh; padding: 16vh 0 14vh;
  background: var(--paper); color: var(--ink);
}
.statement-words {
  --j: clamp(0, (var(--p, 1) - .3) / .5, 1);   /* how far the words have come together */
  margin: 0; text-align: center; white-space: nowrap;
  font: 600 clamp(56px, 8.6vw, 172px)/1.05 var(--display); letter-spacing: -.03em;
  opacity: clamp(0, var(--p, 1) / .22, 1);
}
.statement-words span { display: inline-block; will-change: transform; }
.statement-words span:nth-child(1) { transform: translate3d(calc((1 - var(--j)) * -10vw), calc((1 - var(--j)) * -15vh), 0); }
.statement-words span:nth-child(2) { transform: translate3d(calc((1 - var(--j)) * 10vw), calc((1 - var(--j)) * 15vh), 0); }
.statement-words span:nth-child(3) { transform: translate3d(calc((1 - var(--j)) * 20vw), calc((1 - var(--j)) * 30vh), 0); }

.statement--review {
  min-height: 0; padding: 28px var(--pad) 8px calc(var(--rail) + var(--pad));
  background: var(--night); color: var(--cream);
}
.statement--review .statement-words {
  font-size: clamp(28px, 3.2vw, 48px); text-align: left; opacity: 1;
}
.statement--review .statement-words span { transform: none; }

/* ---------- one part: a clip shown large, then its row ---------- */
.act { position: relative; z-index: 1; height: 310vh; background: var(--night); color: var(--cream); }
.act-stage { position: sticky; top: 0; height: 100vh; min-height: 560px; overflow: hidden; }
/* home-acts.js writes the panel's transform and radius: a rounded card as it arrives, the whole screen
   while it holds, the size of one card in the row as it draws back. */
.act-panel { position: absolute; inset: 0; z-index: 1; overflow: hidden; background: #000000; transform-origin: 50% 50%; will-change: transform; transition: opacity .25s ease; }
.act.is-live .act-panel { opacity: 0; pointer-events: none; }
.act-media, .act-shade { position: absolute; inset: 0; }
.act-media img, .act-media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.act-media img:not([src]) { visibility: hidden; }
.act-media video { opacity: 0; transition: opacity .7s ease; }
.act-media video.is-playing { opacity: 1; }
.act-shade { pointer-events: none; transition: opacity .5s ease;
  background:
    linear-gradient(180deg, rgba(0,0,0,.5) 0, rgba(0,0,0,0) 160px),
    linear-gradient(90deg, rgba(0,0,0,.6) 0, rgba(0,0,0,.3) 36%, rgba(0,0,0,0) 68%),
    linear-gradient(0deg, rgba(0,0,0,.7) 0, rgba(0,0,0,.24) 34%, rgba(0,0,0,0) 58%); }
.act.is-strip .act-shade { opacity: 0; }

/* Same footing as the scene: title on the base line, the clip's own name and description beneath it. */
.act-head { position: absolute; left: calc(var(--rail) + var(--pad)); right: calc(var(--right) + var(--pad)); bottom: calc(100% - var(--base) + 30px); }
.act-head .eyebrow { margin-bottom: 20px; }
.act-foot { position: absolute; left: calc(var(--rail) + var(--pad) + 6px); right: calc(var(--right) + var(--pad)); top: calc(var(--base) + 36px); display: grid; grid-template-columns: 195px minmax(0, 1fr); align-items: start; }
.act-name { font: 600 clamp(19px, 1.5vw, 24px)/1.15 var(--display); letter-spacing: -.016em; }
.act-foot .body { margin-top: 8px; max-width: 34em; opacity: .84; }
.act-head > *, .act-foot { opacity: 0; transform: translateY(22px); transition: opacity .35s ease, transform .35s ease; }
.act.is-open .act-head > *, .act.is-open .act-foot { opacity: 1; transform: none; transition: opacity .9s cubic-bezier(.2, .7, .2, 1) calc(var(--i, 0) * .09s), transform 1.1s cubic-bezier(.2, .7, .2, 1) calc(var(--i, 0) * .09s); }
.act-head > :nth-child(2) { --i: 1; }
.act-foot { --i: 2; }

@media (prefers-reduced-motion: reduce) {
  .statement { min-height: 0; padding-block: 28px 8px; }
  .statement-words { font-size: clamp(28px, 3.2vw, 48px); }
  .statement-words { opacity: 1; }
  .statement-words span { transform: none !important; }
  .act { height: auto; }
  .act-stage { position: relative; height: auto; min-height: 0; padding-bottom: 60px; }
  .act-panel { position: relative; inset: auto; height: 80vh; transform: none !important; border-radius: 0 !important; }
  .act-head > *, .act-foot { opacity: 1; transform: none; transition: none; }
  .act .strip-head, .act .strip { display: none; }
}
