/* ═══════════════════════════════════════════
   birthday-scrapbook — beat 7: photo-strips (9.0 s, tap, hold `next-strips` at 8.4 s)
   The photos are the point: photo-booth strips of the two of them and a
   small airmail card that types "Happy Birthday Love ♥ / Manifesting a /
   lifetime of memories".

   Phone (portrait, primary; uses the whole screen, unlike the reference):
   the card in the top ~30svh (tilted -4deg, ~78vw); a fan of S strips
   (S = min(4, ceil(n / 3))) in the bottom ~66svh, fanned from a pivot
   below the bottom edge (4 strips: -21, -7, +7, +21 deg; 3: -14, 0, +14; 2: -11, +11; 1: -3), overlapping
   and cropped by the edges; next >> on a cream pill on the fan's lower third.
   Desktop / landscape: the reference's composition, two tilted strips down
   each side bleeding off the top and bottom, the card centred (~34vw),
   next >> under it.

   Budget: transform and opacity only. The ground, grain, stars, papers and
   shadows are static. Continuously animating at most: the four strips'
   sway + the two shining stars = 6 layers, and only while the beat is
   live (`.photo-strips-is-live`, set by the entrance cue, removed at the
   exit cue and by prepare()).

   State classes (the JS toggles them on elements boot never recreates):
     container: photo-strips-is-live · photo-strips-is-leaving · photo-strips-is-gone · photo-strips-instant
     fan:       photo-strips-in-1..4 · photo-strips-sway-on · photo-strips-shine-1..4
     card:      photo-strips-card-on       wish chars: photo-strips-ch-on
     next:      photo-strips-next-on · photo-strips-next-pressed
   ═══════════════════════════════════════════ */

.photo-strips-container {
    --photo-strips-vh: 1vh;
    --photo-strips-top: calc(env(safe-area-inset-top, 0px) + 54px);       /* mute pill + progress tape */
    --photo-strips-pivot: calc(72 * var(--photo-strips-vh));              /* phone: the fan's pivot, from a strip's top */

    position: absolute;
    inset: 0;
    width: 100%;
    min-height: 100%;
    overflow: hidden;
    overflow: clip;           /* the strips bleed past the edges: never let a scroll-into-view shift the beat */
    color: var(--ink);
    font-family: var(--font-body);
}
@supports (height: 1svh) {
    .photo-strips-container { --photo-strips-vh: 1svh; }
}

/* Entry states are applied instantly (prepare), never animated in. */
.photo-strips-container.photo-strips-instant,
.photo-strips-container.photo-strips-instant * {
    transition: none !important;
    animation: none !important;
}

/* ─────────── The ground: love-note's blue gingham, full bleed, on the far plane ─────────── */
.photo-strips-ground {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: var(--ground-gingham-blue);
    transform: translateZ(-100px) scale(1.12);
    pointer-events: none;
}
.photo-strips-grain {
    position: absolute;
    inset: 0;
    opacity: 0.22;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .16 0 0 0 0 .2 0 0 0 0 .32 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23g)'/%3E%3C/svg%3E");
    background-size: 180px 180px;
}
.photo-strips-defs {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ─────────── Glitter stars (already on screen from love-note: no pop-in here) ─────────── */
.photo-strips-stars {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}
.photo-strips-star {
    position: absolute;
    left: var(--px, 50%);
    top: var(--py, 50%);
    width: calc(var(--s, 1) * (24px + 4.2vmin));
    aspect-ratio: 1;
    color: var(--c, var(--glitter-pink));
    transform: translate(-50%, -50%) rotate(var(--r, 0deg));
}
.photo-strips-star svg {
    display: block;
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 2px 2px rgba(31, 63, 122, 0.28));
}
/* phone: the first 14 */
.photo-strips-star:nth-child(n + 15) { display: none; }

/* The shimmer: a highlight crossing the star, clipped to its shape (as love-note). */
.photo-strips-glint {
    position: absolute;
    inset: 0;
    overflow: hidden;
    -webkit-clip-path: polygon(50% 8.93%, 61.02% 36.62%, 90.76% 38.54%, 67.83% 57.58%, 75.19% 86.46%, 50% 70.54%, 24.81% 86.46%, 32.17% 57.58%, 9.24% 38.54%, 38.98% 36.62%);
    clip-path: polygon(50% 8.93%, 61.02% 36.62%, 90.76% 38.54%, 67.83% 57.58%, 75.19% 86.46%, 50% 70.54%, 24.81% 86.46%, 32.17% 57.58%, 9.24% 38.54%, 38.98% 36.62%);
}
.photo-strips-glint i {
    position: absolute;
    top: -10%;
    bottom: -10%;
    left: 0;
    width: 100%;
    background: linear-gradient(105deg, rgba(255, 250, 245, 0) 30%, rgba(255, 250, 245, 0.85) 50%, rgba(255, 250, 245, 0) 70%);
    transform: translateX(-110%);
}
.photo-strips-container.photo-strips-is-live .photo-strips-glint i {
    animation: photo-strips-twinkle var(--gd, 5s) linear var(--gdl, 0s) infinite;
}
@keyframes photo-strips-twinkle {
    0% { transform: translateX(-110%); }
    20% { transform: translateX(110%); }      /* ~1.1 s of a 4.6-5.6 s cycle */
    100% { transform: translateX(110%); }
}

/* ─────────── The strips (built by setPhotoStrips) ─────────── */
.photo-strips-fan {
    --photo-strips-w: max(24vw, calc(13 * var(--photo-strips-vh)));
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
}
.photo-strips-fan[data-count="3"] { --photo-strips-w: max(27vw, calc(14 * var(--photo-strips-vh))); }
.photo-strips-fan[data-count="2"] { --photo-strips-w: max(33vw, calc(16 * var(--photo-strips-vh))); }
.photo-strips-fan[data-count="1"] { --photo-strips-w: max(42vw, calc(19 * var(--photo-strips-vh))); }

/* A strip at rest: placed, tilted, on its depth plane. Phone: rotated about the pivot below the screen. */
.photo-strips-strip {
    position: absolute;
    top: 34%;
    left: calc(50% - var(--photo-strips-w) / 2);
    width: var(--photo-strips-w);
    z-index: var(--photo-strips-zi, 1);
    transform-origin: 50% var(--photo-strips-pivot);
    transform: translateY(var(--photo-strips-ty, 0px)) rotate(var(--photo-strips-rot, 0deg)) translateZ(var(--photo-strips-z, 0px));
}
/* Phone fan positions (data-fan, set by the JS from S). */
.photo-strips-strip[data-fan="n21"] { --photo-strips-rot: -21deg; --photo-strips-zi: 1; --photo-strips-z: -10px; --photo-strips-from-x: -14vw; --photo-strips-from-y: 0px; --photo-strips-from-rot: -4deg; }
.photo-strips-strip[data-fan="n7"]  { --photo-strips-rot: -7deg;  --photo-strips-zi: 3; --photo-strips-z: 20px;  --photo-strips-from-x: -14vw; --photo-strips-from-y: 0px; --photo-strips-from-rot: -4deg; }
.photo-strips-strip[data-fan="p7"]  { --photo-strips-rot: 7deg;   --photo-strips-zi: 4; --photo-strips-z: 50px;  --photo-strips-from-x: 14vw;  --photo-strips-from-y: 0px; --photo-strips-from-rot: 4deg; }
.photo-strips-strip[data-fan="p21"] { --photo-strips-rot: 21deg;  --photo-strips-zi: 2; --photo-strips-z: -10px; --photo-strips-from-x: 14vw;  --photo-strips-from-y: 0px; --photo-strips-from-rot: 4deg; }
.photo-strips-strip[data-fan="n14"] { --photo-strips-rot: -14deg; --photo-strips-zi: 1; --photo-strips-z: -10px; --photo-strips-from-x: -14vw; --photo-strips-from-y: 0px; --photo-strips-from-rot: -4deg; }
.photo-strips-strip[data-fan="c0"]  { --photo-strips-rot: 0deg;   --photo-strips-zi: 3; --photo-strips-z: 50px;  --photo-strips-from-x: 0px;   --photo-strips-from-y: 14vh; --photo-strips-from-rot: -4deg; }
.photo-strips-strip[data-fan="p14"] { --photo-strips-rot: 14deg;  --photo-strips-zi: 2; --photo-strips-z: 20px;  --photo-strips-from-x: 14vw;  --photo-strips-from-y: 0px; --photo-strips-from-rot: 4deg; }
.photo-strips-strip[data-fan="n11"] { --photo-strips-rot: -11deg;  --photo-strips-zi: 1; --photo-strips-z: 20px;  --photo-strips-from-x: -14vw; --photo-strips-from-y: 0px; --photo-strips-from-rot: -4deg; }
.photo-strips-strip[data-fan="p11"] { --photo-strips-rot: 11deg;  --photo-strips-zi: 2; --photo-strips-z: 50px;  --photo-strips-from-x: 14vw;  --photo-strips-from-y: 0px; --photo-strips-from-rot: 4deg; }
.photo-strips-strip[data-fan="c"]   { --photo-strips-rot: -3deg;  --photo-strips-zi: 1; --photo-strips-z: 20px;  --photo-strips-from-x: 0px;   --photo-strips-from-y: 14vh; --photo-strips-from-rot: -4deg; }

/* The entrance layer: in from its own edge (14% travel, a 4deg rotation onto its rest tilt). */
.photo-strips-slide {
    transform-origin: 50% var(--photo-strips-pivot);
    transform: translate(var(--photo-strips-from-x, 0px), var(--photo-strips-from-y, 0px)) rotate(var(--photo-strips-from-rot, 0deg));
    opacity: 0;
    transition: transform 0.5s var(--ease-expo-out), opacity 0.35s var(--ease-silk);
}
/* The dwell layer: a slow sway once the card has said its line. */
.photo-strips-sway {
    transform-origin: 50% var(--photo-strips-pivot);
}

.photo-strips-paper {
    position: relative;
    overflow: hidden;
    padding: calc(var(--photo-strips-w) * 0.08) calc(var(--photo-strips-w) * 0.08) calc(var(--photo-strips-w) * 0.02);
    background: var(--paper-white);
    border-radius: 2px;
    box-shadow: var(--paper-shadow);
}
.photo-strips-frame {
    display: block;
    height: calc(var(--photo-strips-w) * 1.05);         /* 4:5 inside the 0.84W frame */
    margin-bottom: calc(var(--photo-strips-w) * 0.06);
    overflow: hidden;
    background: rgba(47, 111, 208, 0.14);
    opacity: 0;
    transition: opacity 0.3s var(--ease-silk);
}
/* Within a strip its frames arrive 0.12 s apart. */
.photo-strips-frame:nth-child(2) { transition-delay: 0.12s; }
.photo-strips-frame:nth-child(3) { transition-delay: 0.24s; }
.photo-strips-frame:nth-child(4) { transition-delay: 0.36s; }
.photo-strips-frame:nth-child(5) { transition-delay: 0.48s; }
.photo-strips-photo {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    -webkit-user-drag: none;
    user-select: none;
}
/* The glint that crosses each strip in turn during the dwell (pre-painted, transform only). */
.photo-strips-shine {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 70%;
    background: linear-gradient(100deg, rgba(255, 250, 245, 0) 25%, rgba(255, 250, 245, 0.62) 50%, rgba(255, 250, 245, 0) 75%);
    transform: translateX(-110%);
    pointer-events: none;
}

/* Strip k has entered. */
.photo-strips-fan.photo-strips-in-1 > .photo-strips-strip:nth-child(1) .photo-strips-slide,
.photo-strips-fan.photo-strips-in-2 > .photo-strips-strip:nth-child(2) .photo-strips-slide,
.photo-strips-fan.photo-strips-in-3 > .photo-strips-strip:nth-child(3) .photo-strips-slide,
.photo-strips-fan.photo-strips-in-4 > .photo-strips-strip:nth-child(4) .photo-strips-slide {
    transform: none;
    opacity: 1;
}
.photo-strips-fan.photo-strips-in-1 > .photo-strips-strip:nth-child(1) .photo-strips-frame,
.photo-strips-fan.photo-strips-in-2 > .photo-strips-strip:nth-child(2) .photo-strips-frame,
.photo-strips-fan.photo-strips-in-3 > .photo-strips-strip:nth-child(3) .photo-strips-frame,
.photo-strips-fan.photo-strips-in-4 > .photo-strips-strip:nth-child(4) .photo-strips-frame {
    opacity: 1;
}

/* The dwell: the strips sway ±0.8deg, staggered (breath, 5 s). Parked unless the beat is live. */
.photo-strips-container.photo-strips-is-live .photo-strips-fan.photo-strips-sway-on .photo-strips-sway {
    animation: photo-strips-sway 5s var(--ease-breath) var(--photo-strips-sd, 0s) infinite;
}
.photo-strips-strip:nth-child(2) { --photo-strips-sd: 0.6s; }
.photo-strips-strip:nth-child(3) { --photo-strips-sd: 1.2s; }
.photo-strips-strip:nth-child(4) { --photo-strips-sd: 1.8s; }
@keyframes photo-strips-sway {
    0% { transform: rotate(0deg); }
    25% { transform: rotate(0.8deg); }
    75% { transform: rotate(-0.8deg); }
    100% { transform: rotate(0deg); }
}

/* A glint crosses strip k (0.9 s), once, in turn. */
.photo-strips-fan.photo-strips-shine-1 > .photo-strips-strip:nth-child(1) .photo-strips-shine,
.photo-strips-fan.photo-strips-shine-2 > .photo-strips-strip:nth-child(2) .photo-strips-shine,
.photo-strips-fan.photo-strips-shine-3 > .photo-strips-strip:nth-child(3) .photo-strips-shine,
.photo-strips-fan.photo-strips-shine-4 > .photo-strips-strip:nth-child(4) .photo-strips-shine {
    animation: photo-strips-glint 0.9s var(--ease-silk) both;
}
@keyframes photo-strips-glint {
    from { transform: translateX(-110%); }
    to { transform: translateX(160%); }
}

/* ─────────── The airmail card ─────────── */
.photo-strips-card {
    position: absolute;
    left: 50%;
    top: calc(var(--photo-strips-top) + 16px);
    z-index: 3;
    min-width: 74vw;
    max-width: 92vw;
    padding: 9px;                                    /* the airmail border */
    background: var(--airmail-stripe);
    border-radius: 3px;
    box-shadow: var(--paper-shadow-lifted);
    transform: translateX(-50%) rotate(-4deg) translateZ(70px);
    /* the wipe: left to right (0.4 s, expo-out); the -40px keeps the shadow unclipped */
    -webkit-clip-path: inset(-40px calc(100% + 40px) -40px -40px);
    clip-path: inset(-40px calc(100% + 40px) -40px -40px);
    transition: clip-path 0.4s var(--ease-expo-out), -webkit-clip-path 0.4s var(--ease-expo-out);
}
.photo-strips-card.photo-strips-card-on {
    -webkit-clip-path: inset(-40px -40px -40px -40px);
    clip-path: inset(-40px -40px -40px -40px);
}
.photo-strips-card-paper {
    background: var(--paper-cream);
    padding: 0.5em 0.8em 0.55em;
    text-align: center;
    font-size: min(5.3vw, calc(3.3 * var(--photo-strips-vh)));
}
.photo-strips-wish {
    margin: 0;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 1em;
    line-height: 1.3;
    letter-spacing: var(--body-tracking);
    color: var(--ink);
}
.photo-strips-line {
    display: block;
    white-space: nowrap;
}
.photo-strips-heart {
    display: inline-block;
    width: 0.95em;
    height: 0.9em;
    margin-left: 0.04em;
    vertical-align: -0.12em;
    overflow: visible;
}
/* The typewriter: each character (and the heart) appears in turn. */
.photo-strips-ch { opacity: 0; }
.photo-strips-ch.photo-strips-ch-on { opacity: 1; }
.photo-strips-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ─────────── next >> ─────────── */
.photo-strips-next {
    --photo-strips-ny: 10px;
    --photo-strips-ns: 1;
    position: absolute;
    left: 50%;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 11%);
    z-index: 4;
    min-width: 136px;
    min-height: 48px;
    padding: 0.32em 1.2em 0.38em;
    border: 0;
    border-radius: 999px;
    background: var(--paper-cream);
    color: var(--btn-ink);
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 1.35rem;
    line-height: 1;
    letter-spacing: var(--label-tracking);
    box-shadow: var(--sticker-shadow);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transform: translateX(-50%) translateY(var(--photo-strips-ny)) scale(var(--photo-strips-ns));
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s var(--ease-expo-out), transform 0.25s var(--ease-expo-out), visibility 0s linear 0.25s;
}
.photo-strips-next.photo-strips-next-on {
    --photo-strips-ny: 0px;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.25s var(--ease-expo-out), transform 0.25s var(--ease-expo-out), visibility 0s;
}
.photo-strips-next.photo-strips-next-pressed {
    --photo-strips-ny: 0px;
    --photo-strips-ns: 0.94;
    opacity: 0;
    visibility: hidden;
    transition: transform 80ms var(--ease-snap), opacity 0.22s var(--ease-silk) 80ms, visibility 0s linear 0.3s;
}
.photo-strips-next:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 3px;
}

/* ─────────── The payoff: the strips slide back off their edges (0.3 s), the card goes ─────────── */
.photo-strips-container.photo-strips-is-leaving .photo-strips-fan > .photo-strips-strip > .photo-strips-slide,
.photo-strips-container.photo-strips-is-gone .photo-strips-fan > .photo-strips-strip > .photo-strips-slide {
    transform: translate(calc(var(--photo-strips-from-x, 0px) * 2.2), calc(var(--photo-strips-from-y, 0px) * 2.2)) rotate(var(--photo-strips-from-rot, 0deg));
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.55, 0, 1, 0.45), opacity 0.3s var(--ease-silk);
}
.photo-strips-container.photo-strips-is-leaving .photo-strips-card,
.photo-strips-container.photo-strips-is-gone .photo-strips-card {
    opacity: 0;
    transition: opacity 0.3s var(--ease-silk) 0.06s;
}

/* ─────────── Short phones: a touch smaller card ─────────── */
@media (orientation: portrait) and (max-height: 680px) {
    .photo-strips-card-paper { font-size: min(5vw, calc(3.2 * var(--photo-strips-vh))); }
    .photo-strips-next { bottom: calc(env(safe-area-inset-bottom, 0px) + 9%); }
}

/* ═══════════ Desktop / landscape: the reference's composition ═══════════ */
@media (orientation: landscape) {
    .photo-strips-container {
        --photo-strips-top: calc(env(safe-area-inset-top, 0px) + 58px);
        --photo-strips-pivot: 50%;
    }
    .photo-strips-star:nth-child(n + 15) { display: block; }
    .photo-strips-star {
        left: var(--x, 50%);
        top: var(--y, 50%);
        width: calc(var(--s, 1) * (18px + 4.4vmin));
    }

    .photo-strips-fan,
    .photo-strips-fan[data-count] {
        --photo-strips-w: max(14vw, calc(22 * var(--photo-strips-vh)));
    }
    /* Strips centred vertically and rotated about their middle: long enough to bleed off both edges. */
    .photo-strips-strip {
        --photo-strips-ty: -50%;
        top: 50%;
        left: calc(var(--photo-strips-x, 50%) - var(--photo-strips-w) / 2);
    }
    .photo-strips-strip[data-desk="lo"] { --photo-strips-x: 9%;  --photo-strips-rot: -24deg; --photo-strips-zi: 1; --photo-strips-z: -10px; --photo-strips-from-x: -14vw; --photo-strips-from-y: 0px; --photo-strips-from-rot: -4deg; }
    .photo-strips-strip[data-desk="li"] { --photo-strips-x: 27%; --photo-strips-rot: -21deg; --photo-strips-zi: 2; --photo-strips-z: 20px;  --photo-strips-from-x: -14vw; --photo-strips-from-y: 0px; --photo-strips-from-rot: -4deg; }
    .photo-strips-strip[data-desk="ri"] { --photo-strips-x: 73%; --photo-strips-rot: 21deg;  --photo-strips-zi: 2; --photo-strips-z: 50px;  --photo-strips-from-x: 14vw;  --photo-strips-from-y: 0px; --photo-strips-from-rot: 4deg; }
    .photo-strips-strip[data-desk="ro"] { --photo-strips-x: 91%; --photo-strips-rot: 24deg;  --photo-strips-zi: 1; --photo-strips-z: -10px; --photo-strips-from-x: 14vw;  --photo-strips-from-y: 0px; --photo-strips-from-rot: 4deg; }
    .photo-strips-strip[data-desk="lm"] { --photo-strips-x: 17%; --photo-strips-rot: -21deg; --photo-strips-zi: 2; --photo-strips-z: 20px;  --photo-strips-from-x: -14vw; --photo-strips-from-y: 0px; --photo-strips-from-rot: -4deg; }
    .photo-strips-strip[data-desk="rm"] { --photo-strips-x: 83%; --photo-strips-rot: 21deg;  --photo-strips-zi: 2; --photo-strips-z: 50px;  --photo-strips-from-x: 14vw;  --photo-strips-from-y: 0px; --photo-strips-from-rot: 4deg; }

    .photo-strips-card {
        top: max(11%, calc(var(--photo-strips-top) + 4px));
        min-width: 34vw;
        max-width: 46vw;
        transform: translateX(-50%) rotate(-6deg) translateZ(70px);
    }
    .photo-strips-card-paper {
        font-size: clamp(1rem, min(2.2vw, calc(4.6 * var(--photo-strips-vh))), 3rem);
        padding: 0.55em 0.9em 0.6em;
    }
    .photo-strips-wish { line-height: 1.38; }
    .photo-strips-next {
        bottom: auto;
        top: 64%;
    }
}

/* ═══════════ Reduced motion: every step still plays, calmly ═══════════
   The strips fade in together (no slide), the card fades in and its text
   appears whole, no sway, no glints; the payoff is a fade. */
@media (prefers-reduced-motion: reduce) {
    .photo-strips-fan .photo-strips-strip[data-fan] {
        --photo-strips-from-x: 0px;
        --photo-strips-from-y: 0px;
        --photo-strips-from-rot: 0deg;
    }
    .photo-strips-frame { transition-delay: 0s !important; }
    .photo-strips-container .photo-strips-sway,
    .photo-strips-container .photo-strips-shine,
    .photo-strips-container .photo-strips-glint i {
        animation: none !important;
    }
    .photo-strips-glint { display: none; }
    .photo-strips-card {
        -webkit-clip-path: none;
        clip-path: none;
        opacity: 0;
        transition: opacity 0.4s var(--ease-silk);
    }
    .photo-strips-card.photo-strips-card-on {
        -webkit-clip-path: none;
        clip-path: none;
        opacity: 1;
    }
    .photo-strips-next,
    .photo-strips-next.photo-strips-next-on,
    .photo-strips-next.photo-strips-next-pressed {
        --photo-strips-ny: 0px !important;
        --photo-strips-ns: 1 !important;
    }
}
