/*
 * DEV-20 VXL showcase: shooting scenarios (.vxl-story) and motion for the three existing demos.
 * Designer-owned. Load after vxl.css and jp-assets/vxl-camera-motion.css.
 *
 * State contract (nothing else is read):
 *   .vxl-story[data-ready]                 JS is ready. Without it: final layout (photo left, all matches right), no step buttons.
 *   .vxl-story__stage[data-step="1|2|3"]   1 framing and focus / 2 shutter and still / 3 similar items beside the photo.
 *   .vxl-story__steps button[aria-pressed] current step.
 * Existing demos: only states vxl.js already sets are used
 *   (.vxl-enhanced, .vxl-stage[data-step], .is-pending, .vxl-chip[aria-pressed], .is-emph, [hidden],
 *    .vxl-cam-reveal--run, and [data-attr-main].is-crossfading with the previous photo as the inline
 *    background-image of its frame while the automatic loop changes the angle). An animation starts when
 *   its selector starts to match, so every state change that vxl.js makes replays the matching motion.
 *   Only transform, translate and opacity move.
 * Type: all text uses jp-assets/type.css tokens (no px font sizes).
 */

.vxl-story,
#demo-camera,
#demo-coord,
#demo-attr {
    --vxl-sc-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --vxl-sc-accent: var(--vxl-accent, #4f44ff);
    --vxl-sc-ink: var(--vxl-ink, #0f172a);
    --vxl-sc-muted: var(--vxl-muted, #475569);
    --vxl-sc-line: var(--vxl-line, #d7d9e6);
    --vxl-sc-focus-ring: #07004e;
    --vxl-sc-lock: #ffd84d;
}

/* ================================================================
   1. Shooting scenarios
   ================================================================ */

.vxl-story {
    padding: 48px 0;
    border-top: 1px solid var(--vxl-sc-line);
}

@media (min-width: 1024px) {
    .vxl-story { padding: 72px 0; }
}

.vxl-story__layout {
    display: grid;
    gap: 24px;
}

@media (min-width: 1024px) {
    .vxl-story__layout {
        grid-template-columns: minmax(0, 38fr) minmax(0, 62fr);
        column-gap: 40px;
        align-items: start;
    }
}

.vxl-story__copy { min-width: 0; }

/* Stage: one fixed layout at every width, [photo | results] over [steps].
   Nothing in the grid changes between steps: the photo only moves with translate/scale and the
   results column keeps its height while hidden, so the section never jumps.
   The stage is a size container so the photo can be centred with cqw.
   The shared panel in vxl.css provides padding and the inset shadow. */
.vxl-story__stage {
    --vxl-sc-cam: min(44%, 360px);
    --vxl-sc-cam-cq: min(44cqw, 360px);
    --vxl-sc-lift: 1.2;
    position: relative;
    display: grid;
    grid-template-columns: var(--vxl-sc-cam) minmax(0, 1fr);
    grid-template-areas:
        "camera matches"
        "steps steps";
    gap: 12px;
    container-type: inline-size;
    min-width: 0;
}

@media (min-width: 600px) {
    .vxl-story__stage { gap: 16px; }
}

/* ---------- camera ---------- */

.vxl-story__camera {
    position: relative;
    grid-area: camera;
    /* the photos are 2:3 (900x1350, 700x1050): same ratio, so nothing is cropped */
    z-index: 1;
    width: 100%;
    align-self: start;
    margin: 0;
    aspect-ratio: 2 / 3;
    overflow: hidden;
    border-radius: 12px;
    background: #15132b;
    isolation: isolate;
    /* position is moved with the independent translate/scale properties, never with transform,
       so the shutter and card-press animations (transform) cannot overwrite it */
    translate: 0 0;
    scale: 1;
    transform-origin: 50% 0;
}

/* step 3: the photo glides from the centre to its column. The transition lives only on the
   step-3 state, so going back to steps 1-2 (manual or loop) puts the photo in the centre at once
   and the first frame of JS (data-ready on step 1) does not slide either. */
.vxl-story[data-ready] .vxl-story__stage[data-step="3"] .vxl-story__camera {
    transition: translate 700ms var(--vxl-sc-ease), scale 700ms var(--vxl-sc-ease);
}

/* steps 1-2: the same photo sits in the horizontal centre of the stage, a little larger */
.vxl-story[data-ready] .vxl-story__stage:not([data-step="3"]) .vxl-story__camera {
    /* fallback without container units (Safari < 16): 44% column -> (1 / 0.44 - 1) / 2 = 63.6% of the photo */
    translate: 63.6% 0;
    translate: calc((100cqw - var(--vxl-sc-cam-cq)) / 2) 0;
    scale: var(--vxl-sc-lift);
}

.vxl-story__subject {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* viewfinder guides, drawn (no text): store = rule of thirds, bed = centre cross + level line */
.vxl-story__camera::before,
.vxl-story__camera::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    opacity: 0;
}

.vxl-story__camera::before {
    background:
        linear-gradient(rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.55)) 33.333% 0 / 1px 100% no-repeat,
        linear-gradient(rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.55)) 66.666% 0 / 1px 100% no-repeat,
        linear-gradient(rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.55)) 0 33.333% / 100% 1px no-repeat,
        linear-gradient(rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.55)) 0 66.666% / 100% 1px no-repeat;
}

.vxl-story[data-story="bed"] .vxl-story__camera::before {
    background:
        linear-gradient(rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.7)) 50% 50% / 24px 1px no-repeat,
        linear-gradient(rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.7)) 50% 50% / 1px 24px no-repeat,
        linear-gradient(rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.55)) 50% 50% / 40% 1px no-repeat;
}

/* corner brackets of the viewfinder */
.vxl-story__camera::after {
    inset: 12px;
    --c: rgba(255, 255, 255, 0.9);
    background:
        linear-gradient(var(--c), var(--c)) 0 0 / 20px 2px,
        linear-gradient(var(--c), var(--c)) 0 0 / 2px 20px,
        linear-gradient(var(--c), var(--c)) 100% 0 / 20px 2px,
        linear-gradient(var(--c), var(--c)) 100% 0 / 2px 20px,
        linear-gradient(var(--c), var(--c)) 0 100% / 20px 2px,
        linear-gradient(var(--c), var(--c)) 0 100% / 2px 20px,
        linear-gradient(var(--c), var(--c)) 100% 100% / 20px 2px,
        linear-gradient(var(--c), var(--c)) 100% 100% / 2px 20px;
    background-repeat: no-repeat;
}

/* focus square: lands on the dress (store: bodice of the standing model, bed: bodice of the laid-out dress) */
.vxl-story__focus {
    position: absolute;
    top: 34%;
    left: 50%;
    z-index: 2;
    width: 30%;
    aspect-ratio: 1;
    translate: -50% -50%;
    border: 2px solid var(--vxl-sc-lock);
    border-radius: 4px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
    pointer-events: none;
    opacity: 0;
}

.vxl-story[data-story="bed"] .vxl-story__focus { top: 28%; left: 51%; }

.vxl-story__flash {
    position: absolute;
    inset: 0;
    z-index: 3;
    background: #fff;
    pointer-events: none;
    opacity: 0;
}

/* ---------- matches ---------- */

.vxl-story__matches {
    grid-area: matches;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    align-content: start;
    min-width: 0;
    /* room for the lifted photo of steps 1-2, so nothing below moves */
    min-height: calc(var(--vxl-sc-cam-cq) * 1.5 * var(--vxl-sc-lift));
}

.vxl-story__matches figure {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-width: 0;
    margin: 0;
}

.vxl-story__matches figure img {
    flex: 0 0 40%;
    width: 40%;
}

.vxl-story__matches img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: contain;
    border-radius: 8px;
    background: #f7f7f7;
}

.vxl-story__matches figcaption {
    flex: 1 1 5em;
    min-width: 0;
    padding-top: 0;
    color: var(--vxl-sc-ink);
    font-size: var(--type-body);
    line-height: 1.5;
    overflow-wrap: anywhere;
}

@media (min-width: 600px) {
    .vxl-story__matches,
    .vxl-story__matches figure { gap: 12px; }
}

/* ---------- step buttons ---------- */

.vxl-story__stage > :is(.vxl-story__steps, .vxl-motion-controls) {
    grid-area: steps;
}

.vxl-story__steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.vxl-story__steps button {
    min-width: 0;
    min-height: 48px;
    padding: 8px;
    border: 1px solid #b9bdd3;
    border-radius: 12px;
    background: #fff;
    color: #07004e;
    font: inherit;
    font-size: var(--type-body);
    font-weight: 700;
    line-height: 1.3;
    overflow-wrap: anywhere;
    cursor: pointer;
    transition: background-color 200ms var(--vxl-sc-ease), color 200ms var(--vxl-sc-ease), border-color 200ms var(--vxl-sc-ease);
}

.vxl-story__steps button:hover { border-color: var(--vxl-sc-accent); }

.vxl-story__steps button[aria-pressed="true"] {
    border-color: var(--vxl-sc-accent);
    background: var(--vxl-sc-accent);
    color: #fff;
}

.vxl-story__steps button:active { transform: translateY(1px); }

.vxl-story__steps button:focus-visible {
    outline: 3px solid var(--vxl-sc-focus-ring);
    outline-offset: 3px;
}

/* ---------- no JS (or before JS): still photo, all matches, no step buttons ---------- */

.vxl-story:not([data-ready]) .vxl-story__steps { display: none; }

/* ---------- step 1: framing and focus (live viewfinder) ---------- */

.vxl-story[data-ready] .vxl-story__stage[data-step="1"] .vxl-story__camera::before,
.vxl-story[data-ready] .vxl-story__stage[data-step="1"] .vxl-story__camera::after,
.vxl-story[data-ready] .vxl-story__stage[data-step="1"] .vxl-story__focus { opacity: 1; }

.vxl-story[data-ready] .vxl-story__stage[data-step="1"] .vxl-story__subject {
    animation: vxl-sc-frame 1.2s var(--vxl-sc-ease) both;
}

.vxl-story[data-ready] .vxl-story__stage[data-step="1"] .vxl-story__focus {
    animation: vxl-sc-focus 700ms var(--vxl-sc-ease) 180ms both;
}

/* steps 1-2: the results column keeps its place but shows nothing (no slot, no outline, no label) */
.vxl-story[data-ready] .vxl-story__stage:not([data-step="3"]) .vxl-story__matches { visibility: hidden; }

/* ---------- step 2: shutter and still ---------- */

.vxl-story[data-ready] .vxl-story__stage[data-step="2"] .vxl-story__flash {
    animation: vxl-sc-flash 600ms ease-out both;
}

.vxl-story[data-ready] .vxl-story__stage[data-step="2"] .vxl-story__camera,
.vxl-story[data-ready] .vxl-story__stage[data-step="3"] .vxl-story__camera {
    box-shadow: 0 0 0 3px #fff, 0 8px 24px rgba(15, 23, 42, 0.18);
}

.vxl-story[data-ready] .vxl-story__stage[data-step="2"] .vxl-story__camera {
    animation: vxl-sc-shutter 500ms var(--vxl-sc-ease) both;
}

/* ---------- step 3: the same still photo, three similar items arrive beside it ---------- */

.vxl-story[data-ready] .vxl-story__stage[data-step="3"] .vxl-story__matches figure {
    animation: vxl-sc-rise 350ms var(--vxl-sc-ease) both;
}

.vxl-story[data-ready] .vxl-story__stage[data-step="3"] .vxl-story__matches figure:nth-child(1) { animation-delay: 800ms; }
.vxl-story[data-ready] .vxl-story__stage[data-step="3"] .vxl-story__matches figure:nth-child(2) { animation-delay: 950ms; }
.vxl-story[data-ready] .vxl-story__stage[data-step="3"] .vxl-story__matches figure:nth-child(3) { animation-delay: 1000ms; }

/* ================================================================
   1b. Product -> similar products (data-story="similar")
   Starts from a chosen product card, not a photo: no viewfinder, no focus, no shutter.
   ================================================================ */

/* the base item is a product card: white, thin border, contained 2:3 photo */
.vxl-story[data-story="similar"] .vxl-story__camera {
    border: 1px solid var(--vxl-sc-line);
    background: #f7f7f7;
}

.vxl-story[data-story="similar"] .vxl-story__camera::before { content: none; }

/* check badge of the chosen card (drawn, no text) */
.vxl-story[data-story="similar"] .vxl-story__camera::after {
    inset: 8px 8px auto auto;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 12.5 4 4 8-9' fill='none' stroke='white' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 18px no-repeat, var(--vxl-sc-accent);
}

/* silhouette of the base dress (drawn over off-white-pleated-dress.webp, 700x1050).
   Decorative, thin, with a light tint so the product stays recognisable. */
.vxl-similar__outline {
    position: absolute;
    inset: 0;
    z-index: 2;
    background: var(--vxl-sc-accent);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 600' preserveAspectRatio='none'%3E%3Cpath d='M165 120 L205 142 L245 122 L250 180 L248 245 L262 400 L276 532 L118 536 L135 400 L158 245 L155 180 Z' fill='black' fill-opacity='.14' stroke='black' stroke-width='3' stroke-linejoin='round'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 600' preserveAspectRatio='none'%3E%3Cpath d='M165 120 L205 142 L245 122 L250 180 L248 245 L262 400 L276 532 L118 536 L135 400 L158 245 L155 180 Z' fill='black' fill-opacity='.14' stroke='black' stroke-width='3' stroke-linejoin='round'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat;
    pointer-events: none;
    opacity: 0;
}

/* four results in a 2 x 2 grid at every width */
/* phones: the same [thumb | caption] rows as the shooting scenarios; from 600px: 2 x 2 cards */
@media (min-width: 600px) {
    .vxl-story[data-story="similar"] .vxl-story__matches { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .vxl-story[data-story="similar"] .vxl-story__matches figure { display: block; }
    .vxl-story[data-story="similar"] .vxl-story__matches figure img { width: 100%; }
    .vxl-story[data-story="similar"] .vxl-story__matches figcaption { padding-top: 4px; }
}

/* none of the shooting motion applies here: no live drift, no shutter, no white still border */
.vxl-story[data-story="similar"][data-ready] .vxl-story__stage .vxl-story__subject { animation: none; }

.vxl-story[data-story="similar"][data-ready] .vxl-story__stage[data-step="2"] .vxl-story__camera,
.vxl-story[data-story="similar"][data-ready] .vxl-story__stage[data-step="3"] .vxl-story__camera {
    animation: none;
    box-shadow: none;
}

/* step 1: the card is chosen */
.vxl-story[data-story="similar"][data-ready] .vxl-story__stage[data-step="1"] .vxl-story__camera {
    border-color: var(--vxl-sc-accent);
    box-shadow: 0 0 0 2px var(--vxl-sc-accent);
    animation: vxl-sc-press 520ms var(--vxl-sc-ease) 200ms both;
}

.vxl-story[data-story="similar"][data-ready] .vxl-story__stage .vxl-story__camera::after { opacity: 1; }

.vxl-story[data-story="similar"][data-ready] .vxl-story__stage[data-step="1"] .vxl-story__camera::after {
    animation: vxl-sc-chip 360ms var(--vxl-sc-ease) 500ms both;
}

/* step 2: the outline traces the silhouette from top to hem */
.vxl-story[data-story="similar"][data-ready] .vxl-story__stage[data-step="2"] .vxl-similar__outline {
    opacity: 1;
    animation: vxl-sc-trace 900ms var(--vxl-sc-ease) 150ms both;
}

/* step 3: the base card stays, the outline stays faint, four items unfold in original order */
.vxl-story[data-story="similar"][data-ready] .vxl-story__stage[data-step="3"] .vxl-similar__outline { opacity: 0.45; }

.vxl-story[data-story="similar"][data-ready] .vxl-story__stage[data-step="3"] .vxl-story__matches figure {
    animation: vxl-sc-unfold 350ms var(--vxl-sc-ease) both;
}

.vxl-story[data-story="similar"][data-ready] .vxl-story__stage[data-step="3"] .vxl-story__matches figure:nth-child(1) { animation-delay: 800ms; }
.vxl-story[data-story="similar"][data-ready] .vxl-story__stage[data-step="3"] .vxl-story__matches figure:nth-child(2) { animation-delay: 950ms; }
.vxl-story[data-story="similar"][data-ready] .vxl-story__stage[data-step="3"] .vxl-story__matches figure:nth-child(3) { animation-delay: 1000ms; }
.vxl-story[data-story="similar"][data-ready] .vxl-story__stage[data-step="3"] .vxl-story__matches figure:nth-child(4) { animation-delay: 1120ms; }

/* ================================================================
   2. Existing demos: motion on the states vxl.js already sets
   ================================================================ */

/* ---------- #demo-camera: result cards ----------
   During the automatic loop vxl.js adds .vxl-cam-reveal--run and the SNS motion's reveal wins
   (this rule does not match then). On manual steps this staggered pop plays instead. */
.vxl-enhanced #demo-camera .vxl-stage[data-step] .vxl-grid:not(.vxl-cam-reveal--run) > .vxl-card[data-reveal]:not(.is-pending) {
    animation: vxl-sc-pop 520ms var(--vxl-sc-ease) both;
}

.vxl-enhanced #demo-camera .vxl-stage[data-step] .vxl-grid:not(.vxl-cam-reveal--run) > .vxl-card[data-reveal]:nth-child(3) { animation-delay: 120ms; }
.vxl-enhanced #demo-camera .vxl-stage[data-step] .vxl-grid:not(.vxl-cam-reveal--run) > .vxl-card[data-reveal]:nth-child(4) { animation-delay: 240ms; }
.vxl-enhanced #demo-camera .vxl-stage[data-step] .vxl-grid:not(.vxl-cam-reveal--run) > .vxl-card[data-reveal]:nth-child(5) { animation-delay: 360ms; }

/* ---------- #demo-coord: the shirt stays the anchor, the outfit gathers beside it ----------
   Step 1: the shirt sits alone in the centre of its row; the empty result slots are not drawn.
   Steps 2-3: the shirt glides to its own (first) column, the chosen items arrive from the right,
   then one outline closes around the outfit. The grid columns never change, so nothing below moves. */
.vxl-enhanced #demo-coord .vxl-stage[data-step] .vxl-card--input {
    position: relative;
    z-index: 1;
    translate: 0 0;
}

/* centre of the row: (columns - 1) / 2 x (card + gap); % of translate is the card's own width */
.vxl-enhanced #demo-coord .vxl-stage[data-step="1"] .vxl-card--input {
    translate: calc(50% + var(--vxl-gap, 16px) / 2) 0;
    animation: vxl-sc-fade 500ms var(--vxl-sc-ease) both;
}

@media (min-width: 600px) {
    .vxl-enhanced #demo-coord .vxl-stage[data-step="1"] .vxl-card--input {
        translate: calc(150% + var(--vxl-gap, 16px) * 1.5) 0;
    }
}

/* the glide lives on the settled state only: the first frame of JS does not slide, and a return
   to step 1 (tab or loop) re-centres the shirt at once behind the fade above */
.vxl-enhanced #demo-coord .vxl-stage:not([data-step="1"]) .vxl-card--input {
    transition: translate 700ms var(--vxl-sc-ease);
}

.vxl-enhanced #demo-coord .vxl-stage[data-step="1"] .vxl-card[data-chip-card] { visibility: hidden; }

/* steps 2-3: a slot still waiting for its category fades in once the shirt has settled */
.vxl-enhanced #demo-coord .vxl-stage:not([data-step="1"]) .vxl-card[data-chip-card].is-pending {
    animation: vxl-sc-fade 400ms var(--vxl-sc-ease) 450ms both;
}

/* each chosen item arrives from the right, toward the shirt, as the shirt clears its column */
.vxl-enhanced #demo-coord .vxl-stage:not([data-step="1"]) .vxl-card[data-chip-card]:not(.is-pending) {
    animation: vxl-sc-gather 560ms var(--vxl-sc-ease) 300ms both;
}

/* step 3: shoes and bag follow as a pair; trousers already in place keep still */
.vxl-enhanced #demo-coord .vxl-stage[data-step="3"] .vxl-card[data-chip-card]:nth-child(3) { animation-delay: 240ms; }
.vxl-enhanced #demo-coord .vxl-stage[data-step="3"] .vxl-card[data-chip-card]:nth-child(4) { animation-delay: 360ms; }

/* step 3: one outline closes around the whole outfit after the last item has landed */
.vxl-enhanced #demo-coord .vxl-stage[data-step] .vxl-grid { position: relative; }

.vxl-enhanced #demo-coord .vxl-stage[data-step] .vxl-grid::after {
    content: '';
    position: absolute;
    inset: -6px;
    border: 2px solid var(--vxl-sc-accent);
    border-radius: 12px;
    pointer-events: none;
    opacity: 0;
}

.vxl-enhanced #demo-coord .vxl-stage[data-step="3"] .vxl-grid::after {
    opacity: 1;
    animation: vxl-sc-ring 600ms var(--vxl-sc-ease) 900ms both;
}

/* ---------- #demo-attr: angles -> scan -> attributes -> stripe-filtered collection ---------- */

/* Reserve the final grid while showing only the photograph and results already derived. */
.vxl-enhanced #demo-attr .is-pending { visibility: hidden; }
.vxl-enhanced #demo-attr .vxl-stage[data-step="1"] .vxl-card--input {
    translate: calc(50% + var(--vxl-gap) / 2) 0;
}
@media (min-width: 600px) {
    .vxl-enhanced #demo-attr .vxl-stage[data-step="1"] .vxl-card--input {
        translate: calc(100% + var(--vxl-gap)) 0;
    }
}
@media (max-width: 16em) {
    :lang(en) .vxl-enhanced #demo-attr .vxl-stage[data-step="1"] .vxl-card--input { translate: none; }
}
.vxl-enhanced #demo-attr .vxl-stage:not([data-step="1"]) .vxl-card--input {
    transition: translate 550ms var(--vxl-sc-ease);
}

/* automatic step 1 reads the shirt from its real angles: for those swaps only, vxl.js leaves the
   previous photo as the frame background and fades the new one in over it (.is-crossfading).
   A photo chosen by the user is swapped at once. */
.vxl-enhanced #demo-attr .vxl-card--input .vxl-card__frame {
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
}

.vxl-enhanced #demo-attr [data-attr-main].is-crossfading {
    animation: vxl-sc-fade 200ms ease both;
}

/* step 2: a scan band passes once over the input image */
.vxl-enhanced #demo-attr .vxl-stage[data-step] .vxl-card--input .vxl-card__frame::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(transparent 0, transparent 44%, rgba(79, 68, 255, 0.28) 49%, rgba(79, 68, 255, 0.55) 50%, transparent 56%, transparent 100%);
    pointer-events: none;
    opacity: 0;
}

.vxl-enhanced #demo-attr .vxl-stage[data-step="2"] .vxl-card--input .vxl-card__frame::before {
    animation: vxl-sc-scan 1100ms var(--vxl-sc-ease) both;
}

/* attributes arrive one by one, then the tags settle */
.vxl-enhanced #demo-attr .vxl-stage[data-step] .vxl-card[data-reveal="2"]:not(.is-pending) .vxl-attrs li {
    animation: vxl-sc-slide 340ms var(--vxl-sc-ease) both;
}

.vxl-enhanced #demo-attr .vxl-stage[data-step] .vxl-card[data-reveal="2"]:not(.is-pending) .vxl-attrs li:nth-child(1) { animation-delay: 500ms; }
.vxl-enhanced #demo-attr .vxl-stage[data-step] .vxl-card[data-reveal="2"]:not(.is-pending) .vxl-attrs li:nth-child(2) { animation-delay: 620ms; }
.vxl-enhanced #demo-attr .vxl-stage[data-step] .vxl-card[data-reveal="2"]:not(.is-pending) .vxl-attrs li:nth-child(3) { animation-delay: 740ms; }
.vxl-enhanced #demo-attr .vxl-stage[data-step] .vxl-card[data-reveal="2"]:not(.is-pending) .vxl-attrs li:nth-child(4) { animation-delay: 860ms; }

.vxl-enhanced #demo-attr .vxl-stage[data-step] .vxl-card[data-reveal="2"]:not(.is-pending) .vxl-tags li {
    animation: vxl-sc-settle 300ms var(--vxl-sc-ease) both;
}

.vxl-enhanced #demo-attr .vxl-stage[data-step] .vxl-card[data-reveal="2"]:not(.is-pending) .vxl-tags li:nth-child(1) { animation-delay: 820ms; }
.vxl-enhanced #demo-attr .vxl-stage[data-step] .vxl-card[data-reveal="2"]:not(.is-pending) .vxl-tags li:nth-child(2) { animation-delay: 880ms; }
.vxl-enhanced #demo-attr .vxl-stage[data-step] .vxl-card[data-reveal="2"]:not(.is-pending) .vxl-tags li:nth-child(3) { animation-delay: 940ms; }

/* step 3 (wide screens keep the attribute card): the pattern attribute takes the emphasis it hands
   to the filter chip. Colour only (eased by vxl.css), no pulse and no change of size. */
.vxl-enhanced #demo-attr .vxl-stage[data-step="3"] .vxl-card[data-reveal="2"]:not(.is-pending) .vxl-attrs li:nth-child(2) {
    border-color: var(--vxl-sc-accent);
    background: #ecebff;
    color: var(--vxl-sc-accent);
}

/* step 3: the collection rises, the filter chip settles, then the filtered items arrive */
.vxl-enhanced #demo-attr .vxl-stage[data-step] .vxl-feature:not(.is-pending) {
    animation: vxl-sc-rise 480ms var(--vxl-sc-ease) 150ms both;
}

.vxl-enhanced #demo-attr .vxl-stage[data-step] .vxl-feature:not(.is-pending) [data-filter] {
    animation: vxl-sc-settle 360ms var(--vxl-sc-ease) 400ms both;
}

.vxl-enhanced #demo-attr .vxl-stage[data-step] .vxl-feature:not(.is-pending) .vxl-mini:not([hidden]) {
    animation: vxl-sc-rise 480ms var(--vxl-sc-ease) both;
}

.vxl-enhanced #demo-attr .vxl-stage[data-step] .vxl-feature:not(.is-pending) .vxl-mini:nth-child(1) { animation-delay: 650ms; }
.vxl-enhanced #demo-attr .vxl-stage[data-step] .vxl-feature:not(.is-pending) .vxl-mini:nth-child(2) { animation-delay: 770ms; }
/* the plain white shirt returns quickly when the filter is switched off */
.vxl-enhanced #demo-attr .vxl-stage[data-step] .vxl-feature:not(.is-pending) .vxl-mini:nth-child(3) { animation-delay: 120ms; }

/* ================================================================
   Keyframes (transform, translate and opacity only)
   ================================================================ */

@keyframes vxl-sc-frame {
    0%   { transform: scale(1.12) translate(2%, 1.5%); }
    100% { transform: scale(1.02) translate(0, 0); }
}

@keyframes vxl-sc-focus {
    0%   { opacity: 0; scale: 1.7; }
    45%  { opacity: 1; scale: 0.94; }
    60%  { scale: 1; }
    72%  { opacity: 0.35; }
    84%  { opacity: 1; }
    100% { opacity: 1; scale: 1; }
}

@keyframes vxl-sc-flash {
    0%   { opacity: 0; }
    20%  { opacity: 0.92; }
    100% { opacity: 0; }
}

@keyframes vxl-sc-shutter {
    0%   { transform: scale(1); }
    35%  { transform: scale(0.97); }
    100% { transform: scale(1); }
}

@keyframes vxl-sc-rise {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: none; }
}

@keyframes vxl-sc-pop {
    from { opacity: 0; transform: translateY(16px) scale(0.96); }
    to   { opacity: 1; transform: none; }
}

@keyframes vxl-sc-slide {
    from { opacity: 0; transform: translateX(-24px); }
    to   { opacity: 1; transform: none; }
}

@keyframes vxl-sc-gather {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: none; }
}

@keyframes vxl-sc-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes vxl-sc-settle {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
}

@keyframes vxl-sc-chip {
    0%   { transform: scale(0.85); opacity: 0.4; }
    60%  { transform: scale(1.08); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes vxl-sc-ring {
    from { opacity: 0; transform: scale(0.98); }
    to   { opacity: 1; transform: none; }
}

@keyframes vxl-sc-scan {
    0%   { opacity: 1; transform: translateY(-60%); }
    85%  { opacity: 1; }
    100% { opacity: 0; transform: translateY(60%); }
}

@keyframes vxl-sc-press {
    0%   { transform: scale(1); }
    40%  { transform: scale(0.96); }
    100% { transform: scale(1); }
}

@keyframes vxl-sc-trace {
    from { clip-path: inset(0 0 100% 0); }
    to   { clip-path: inset(0 0 0 0); }
}

@keyframes vxl-sc-unfold {
    from { opacity: 0; transform: translateX(-24px) scale(0.92); }
    to   { opacity: 1; transform: none; }
}

/* ================================================================
   Reduced motion: no animation or transition; every step shows its finished frame.
   ================================================================ */

@media (prefers-reduced-motion: reduce) {
    .vxl-story *,
    .vxl-story *::before,
    .vxl-story *::after,
    #demo-camera .vxl-grid > *,
    #demo-coord .vxl-stage *,
    #demo-coord .vxl-stage *::before,
    #demo-coord .vxl-stage *::after,
    #demo-attr .vxl-stage *,
    #demo-attr .vxl-stage *::before,
    #demo-attr .vxl-stage *::after {
        animation: none !important;
        transition: none !important;
    }

    .vxl-story__steps button:active { transform: none; }
}

/* Let the two product stories enter with the photographs as the reader scrolls. */
@supports (animation-timeline: view()) {
    @media (prefers-reduced-motion: no-preference) {
        #demo-coord .vxl-demo__text,
        #demo-attr .vxl-demo__text {
            animation: vxl-copy-enter linear both;
            animation-timeline: view();
            animation-range: entry 0% entry 60%;
        }

        @keyframes vxl-copy-enter {
            from { opacity: .87; transform: translateY(8px); }
            to { opacity: 1; transform: translateY(0); }
        }
    }
}
