/* A single image-fragment surface, painted from the film's own frame. No
   independent easing, floating cloud or wall-clock animation moves its tiles. */
[data-film-pieces] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.film-pieces-ready > [data-film-screen] {
    z-index: 2;
}

/* The figures assemble where they will rest; their text can arrive separately
   without pulling the image a whole viewport away from the landing pixels. */
[data-film].film-pieces-ready #builds[style*="--film-p"] .builds-star {
    translate: 0 calc((var(--film-p) - 1) * 100lvh / var(--film-fit));
    scale: 1;
    opacity: 1;
}

.film-pieces-ready .live-star {
    translate: 0 calc((var(--film-p) - 2) * 100lvh / var(--film-fit));
}

[data-film].film-pieces-ready #live[style*="--film-p"] .live-art {
    scale: 1;
    filter: none;
    opacity: 1;
    animation: none;
}

.film-pieces-ready .nova-stage,
.film-pieces-ready .nova-tilt {
    transform: none;
}

[data-film].film-pieces-ready #builds[style*="--film-p"] .builds-star-fig > img {
    filter: brightness(1.49);
}

/* Outgoing bundle controls clear the incoming Live copy before it becomes
   readable, including on narrow screens where both occupy the same column. */
.film-pieces-ready #builds .builds-content {
    --leave: clamp(0, (var(--film-p) - 1.18) / 0.22, 1);
    opacity: calc(1 - var(--leave) * var(--leave) * (3 - 2 * var(--leave)));
}

/* The figure holds its place while the screen travels. Clear its guide before
   that travel carries the words into the bust; reveal it after assembly. */
[data-film].film-pieces-ready #builds[style*="--film-p"] .builds-guide {
    --guide-in: clamp(0, (var(--film-p) - 0.91) / 0.08, 1);
    --guide-out: clamp(0, (var(--film-p) - 1) / 0.06, 1);
    opacity: calc(var(--guide-in) * var(--guide-in) * (3 - 2 * var(--guide-in)) *
        (1 - var(--guide-out) * var(--guide-out) * (3 - 2 * var(--guide-out))));
}

/* Breathing and the old circular wipe would move or erase the source beneath
   its fragments. Keep the artwork registered while the scroll owns it. */
.film-pieces-ready .nova-breathe,
.film-pieces-ready .nova-nsettle,
.film-pieces-ready .nova-reveal,
.film-pieces-ready .builds-star-fig {
    animation: none;
}

.film-pieces-ready .nova-reveal {
    -webkit-mask-image: none;
    mask-image: none;
}

/* Let the scroll own the moving picture. The builds and live screens' ambient loops resume at a stop.
   The hero's several hundred twinkling and drifting dots (.nova-dot) are not named here: flipping animation-play-state on each of
   them restyled about 640 elements on the frame that clears data-film-moving (cost.browser.mjs AC-038), and film.css pauses them
   for good once the scroll has faded the art out (data-film-off). */
html[data-film-moving] .film-pieces-ready :is(.nova-px-twinkle, .nova-px-drift, .builds-neb, .live-neb) {
    animation-play-state: paused;
}

@media (prefers-reduced-motion: reduce) {
    [data-film-pieces] {
        display: none;
    }
}
