/*
 * DEV-20 VXL first demo (#demo-camera): example motion, input area and local-result area.
 * Designer-owned. Every class starts with vxl-cam-. Nothing here restyles existing vxl.css classes.
 *
 * Motion contract
 *   <div class="vxl-cam-motion" data-cam-motion data-scene="1|2|3" aria-hidden="true">
 *   - data-scene picks the scene (same as demo step 1/2/3). Set by the frontend.
 *   - Entering the viewport starts timed playback. The reader can choose a step or replay once.
 *     The active scene may animate; under prefers-reduced-motion each scene shows a still frame.
 *   - Stage choreography follows #camera-stage[data-step] (see "stage choreography" below):
 *     step 1 one large centered phone and no grid, step 2 the phone shrinks upward and the whole grid
 *     fades in with loading rings, step 3 the four real results rise in order (.vxl-cam-reveal--run).
 *     CSS only: animations and transitions start from the attribute change, no timers of their own.
 *   - Optional smoother switch: set data-prev-scene to the outgoing scene number for ~300ms;
 *     it stays underneath while the new scene fades in. Without it the new scene fades in from the dark screen.
 *   - Text slots carry data-cam-text="key"; the frontend fills them per language.
 *   - Type: every text size comes from jp-assets/type.css tokens (rem, at least --type-body), so
 *     scripts/check_jp_typography.py passes at 16px and at doubled text. Class names, data-* attributes
 *     and data-cam-text keys are unchanged; the four motion labels stay where they were, at --type-body,
 *     and wrap or truncate inside the phone. Result order is drawn as 1-4 pips, not typed numbers.
 * Icons are self-drawn SVGs in images/vxl/camera-demo/, used as CSS masks so they take currentColor.
 */

.vxl-cam-motion,
.vxl-cam-reveal,
.vxl-cam-input,
.vxl-cam-user {
    --vxl-cam-accent: var(--vxl-accent, #4f44ff);
    --vxl-cam-accent-dark: var(--vxl-accent-dark, #3a30e0);
    --vxl-cam-ink: var(--vxl-ink, #0f172a);
    --vxl-cam-muted: var(--vxl-muted, #475569);
    --vxl-cam-line: var(--vxl-line, #d7d9e6);
    --vxl-cam-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --vxl-cam-focus: #07004e;
}

/* ---------- icons (mask, colour = currentColor) ---------- */

.vxl-cam-icon {
    display: inline-block;
    flex: none;
    width: 1.25em;
    height: 1.25em;
    background-color: currentColor;
    -webkit-mask: var(--vxl-cam-i) center / contain no-repeat;
    mask: var(--vxl-cam-i) center / contain no-repeat;
}

.vxl-cam-icon--camera  { --vxl-cam-i: url('../images/vxl/camera-demo/camera.svg'); }
.vxl-cam-icon--album   { --vxl-cam-i: url('../images/vxl/camera-demo/album.svg'); }
.vxl-cam-icon--heart   { --vxl-cam-i: url('../images/vxl/camera-demo/heart.svg'); }
.vxl-cam-icon--comment { --vxl-cam-i: url('../images/vxl/camera-demo/comment.svg'); }
.vxl-cam-icon--share   { --vxl-cam-i: url('../images/vxl/camera-demo/share.svg'); }
.vxl-cam-icon--check   { --vxl-cam-i: url('../images/vxl/camera-demo/check.svg'); }
.vxl-cam-icon--device  { --vxl-cam-i: url('../images/vxl/camera-demo/device.svg'); }
.vxl-cam-icon--photo   { --vxl-cam-i: url('../images/vxl/camera-demo/photo.svg'); }
.vxl-cam-icon--capture { --vxl-cam-i: url('../images/vxl/camera-demo/capture.svg'); }
.vxl-cam-icon--alert   { --vxl-cam-i: url('../images/vxl/camera-demo/alert.svg'); }
.vxl-cam-icon--shutter { --vxl-cam-i: url('../images/vxl/camera-demo/shutter.svg'); }

/* ================================================================
   1. Example motion
   ================================================================ */

.vxl-cam-motion {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 0 16px;
}


/* Generic phone. Outer radius 28, bezel 6 -> screen radius 22. */
/* Width in rem so the phone grows with enlarged text (capped by the stage width). */
/* The same phone lifts and shrinks when the capture tray opens. */
.vxl-cam-phone {
    width: 12.5rem;
    max-width: 100%;
    padding: 6px;
    border-radius: 28px;
    background: #15132b;
    margin-block-start: 0;
    transition: width 600ms var(--vxl-cam-ease), margin-block-start 600ms var(--vxl-cam-ease);
}

@media (min-width: 375px) {
    .vxl-cam-phone { width: 13.75rem; }
}

@media (min-width: 600px) {
    .vxl-cam-phone { width: 15rem; }
}

.vxl-cam-screen {
    position: relative;
    aspect-ratio: 9 / 16;
    overflow: hidden;
    border-radius: 22px;
    background: #15132b;
    isolation: isolate;
}

.vxl-cam-scene {
    position: absolute;
    inset: 0;
    display: none;
}

.vxl-cam-motion[data-scene="1"] .vxl-cam-scene--1,
.vxl-cam-motion[data-scene="2"] .vxl-cam-scene--2,
.vxl-cam-motion[data-scene="3"] .vxl-cam-scene--3 { display: block; z-index: 1; }

.vxl-cam-motion[data-scene="1"] .vxl-cam-scene--1,
.vxl-cam-motion[data-scene="2"] .vxl-cam-scene--2 { z-index: 1; }

/* outgoing scene kept underneath during the switch (optional data-prev-scene) */
.vxl-cam-motion[data-prev-scene="1"]:not([data-scene="1"]) .vxl-cam-scene--1,
.vxl-cam-motion[data-prev-scene="2"]:not([data-scene="2"]) .vxl-cam-scene--2,
.vxl-cam-motion[data-prev-scene="3"]:not([data-scene="3"]) .vxl-cam-scene--3 { display: block; z-index: 0; }

/* "SNS post example" chip (motion-sns) */
.vxl-cam-chip {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 3;
    max-width: calc(100% - 24px);
    padding: 2px 8px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--vxl-cam-ink);
    font-size: var(--type-body);
    font-weight: 700;
    line-height: 1.5;
}

.vxl-cam-scene img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}


/* ---------- scene 1: vertical short-form post ---------- */

.vxl-cam-scene--1 { background: #000; }

.vxl-cam-scene--1 .vxl-cam-post__img {
    object-position: 50% 30%;
    transform-origin: 50% 40%;
}

/* flat scrim behind the caption so white text stays legible */
.vxl-cam-scene--1::after {
    content: '';
    position: absolute;
    inset: auto 0 0;
    height: 26%;
    background: rgba(0, 0, 0, 0.32);
}

.vxl-cam-rail {
    position: absolute;
    right: 8px;
    bottom: 56px;
    z-index: 2;
    display: grid;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
    color: #fff;
}

.vxl-cam-rail li {
    display: grid;
    justify-items: center;
    gap: 4px;
}

.vxl-cam-rail .vxl-cam-icon {
    width: 24px;
    height: 24px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

/* counts are drawn as short bars: no numbers to invent */
.vxl-cam-rail li::after {
    content: '';
    width: 16px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.8);
}

.vxl-cam-rail .is-liked { color: #ff5a6e; }

.vxl-cam-post__meta {
    position: absolute;
    left: 12px;
    right: 48px;
    bottom: 20px;
    z-index: 2;
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    align-items: center;
    column-gap: 8px;
    row-gap: 6px;
    color: #fff;
}

.vxl-cam-avatar {
    width: 24px;
    height: 24px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #b9bdd3;
}

.vxl-cam-post__name {
    min-width: 0;
    overflow: hidden;
    font-size: var(--type-body);
    font-weight: 700;
    line-height: 1.5;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vxl-cam-line {
    grid-column: 1 / -1;
    width: 88%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.78);
}

.vxl-cam-line--short { width: 56%; }

/* video progress: still frame shows it part way through */
.vxl-cam-progress {
    position: absolute;
    inset: auto 0 0;
    z-index: 2;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
}

.vxl-cam-progress > span {
    display: block;
    height: 100%;
    background: #fff;
    transform: scaleX(0.62);
    transform-origin: 0 50%;
}

/* ---------- scene 2: capture the dress, pick it from the album ---------- */

.vxl-cam-scene--2 { background: #000; }

.vxl-cam-shot {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.vxl-cam-shot img {
    object-position: 50% 32%;
    opacity: 0.72;
}

/* capture brackets drawn around the dress */
.vxl-cam-crop {
    position: absolute;
    inset: 7% 22% 58%;
    z-index: 2;
    --c: #fff;
    background:
        linear-gradient(var(--c), var(--c)) 0 0 / 16px 3px,
        linear-gradient(var(--c), var(--c)) 0 0 / 3px 16px,
        linear-gradient(var(--c), var(--c)) 100% 0 / 16px 3px,
        linear-gradient(var(--c), var(--c)) 100% 0 / 3px 16px,
        linear-gradient(var(--c), var(--c)) 0 100% / 16px 3px,
        linear-gradient(var(--c), var(--c)) 0 100% / 3px 16px,
        linear-gradient(var(--c), var(--c)) 100% 100% / 16px 3px,
        linear-gradient(var(--c), var(--c)) 100% 100% / 3px 16px;
    background-repeat: no-repeat;
    box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.35);
}

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

.vxl-cam-album {
    position: absolute;
    inset: auto 0 0;
    z-index: 3;
    height: 56%;
    padding: 12px 8px 8px;
    border-radius: 16px 16px 0 0;
    background: #fff;
}

.vxl-cam-album__title {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 4px 8px;
    color: var(--vxl-cam-ink);
    font-size: var(--type-body);
    font-weight: 700;
    line-height: 1.5;
}

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

.vxl-cam-tile {
    position: relative;
    display: grid;
    place-items: center;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 4px;
    background: #e9eaf2;
    color: #b9bdd3;
}

.vxl-cam-tile:nth-child(3n) { background: #dfe1ec; }
.vxl-cam-tile .vxl-cam-icon { width: 20px; height: 20px; }
.vxl-cam-rail .vxl-cam-icon,
.vxl-cam-tick .vxl-cam-icon { flex: none; }

/* the captured dress: same photo, cropped like the brackets above */
.vxl-cam-tile--pick {
    outline: 3px solid var(--vxl-cam-accent);
    outline-offset: -3px;
}

.vxl-cam-tile--pick img {
    object-position: 50% 45%;
    transform: scale(1.6);
}

.vxl-cam-tick {
    position: absolute;
    right: 4px;
    bottom: 4px;
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--vxl-cam-accent);
    color: #fff;
}

.vxl-cam-tick .vxl-cam-icon { width: 12px; height: 12px; }

/* ---------- scene 3: the picked image goes in, similar styles come out ---------- */

.vxl-cam-scene--3 {
    padding: 16px 12px 12px;
    background: #f4f4fa;
}

.vxl-cam-query {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 8px;
    row-gap: 4px;
    margin-bottom: 8px;
}

.vxl-cam-query__img {
    width: 32%;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    border: 2px solid var(--vxl-cam-accent);
    border-radius: 6px;
    background: #f7f7f7;
}

.vxl-cam-query__img img {
    object-position: 50% 45%;
    transform: scale(1.6);
}

.vxl-cam-query__arrow {
    width: 32px;
    height: 2px;
    background: var(--vxl-cam-accent);
    position: relative;
}

.vxl-cam-query__arrow::after {
    content: '';
    position: absolute;
    right: -1px;
    top: -4px;
    width: 8px;
    height: 8px;
    border-top: 2px solid var(--vxl-cam-accent);
    border-right: 2px solid var(--vxl-cam-accent);
    transform: rotate(45deg);
}

.vxl-cam-results__title {
    flex-basis: 100%;
    margin: 0;
    color: var(--vxl-cam-ink);
    font-size: var(--type-body);
    font-weight: 700;
    line-height: 1.5;
}

.vxl-cam-results {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.vxl-cam-results li {
    position: relative;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    border-radius: 6px;
    background: #f7f7f7;
}

.vxl-cam-results img { object-fit: contain; }

/* original order 1-4 drawn as pips (no text): 1 to 4 small dots on each tile */
.vxl-cam-results li::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    z-index: 1;
    height: 10px;
    padding: 0 2px;
    border-radius: 5px;
    background:
        radial-gradient(circle, var(--vxl-cam-ink) 2.5px, transparent 3px) 0 0 / 8px 10px repeat-x content-box,
        rgba(255, 255, 255, 0.92);
}

.vxl-cam-results li:nth-child(1)::before { width: 8px; }
.vxl-cam-results li:nth-child(2)::before { width: 16px; }
.vxl-cam-results li:nth-child(3)::before { width: 24px; }
.vxl-cam-results li:nth-child(4)::before { width: 32px; }

/* ---------- automatic run (only with .is-animating) ---------- */

@keyframes vxl-cam-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes vxl-cam-settle {
    from { transform: scale(1.08); }
    to   { transform: scale(1); }
}

@keyframes vxl-cam-progress {
    from { transform: scaleX(0); }
    to   { transform: scaleX(0.62); }
}

@keyframes vxl-cam-pop {
    0%   { opacity: 0; transform: scale(0.4); }
    70%  { opacity: 1; transform: scale(1.15); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes vxl-cam-like {
    0%, 55% { color: #fff; transform: scale(1); }
    70%     { color: #ff5a6e; transform: scale(1.3); }
    100%    { color: #ff5a6e; transform: scale(1); }
}

@keyframes vxl-cam-crop {
    from { opacity: 0; transform: scale(1.18); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes vxl-cam-flash {
    0%, 100% { opacity: 0; }
    35%      { opacity: 0.85; }
}

@keyframes vxl-cam-sheet {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

@keyframes vxl-cam-rise {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.vxl-cam-motion.is-animating .vxl-cam-scene { animation: vxl-cam-in 300ms var(--vxl-cam-ease) both; }

/* scene 1 (1.3s): settle, icons arrive, like, progress runs */
.vxl-cam-motion.is-animating[data-scene="1"] .vxl-cam-post__img { animation: vxl-cam-settle 1200ms var(--vxl-cam-ease) both; }
.vxl-cam-motion.is-animating[data-scene="1"] .vxl-cam-progress > span { animation: vxl-cam-progress 1200ms cubic-bezier(0.33, 0, 0.67, 1) both; }
.vxl-cam-motion.is-animating[data-scene="1"] .vxl-cam-chip { animation: vxl-cam-in 200ms var(--vxl-cam-ease) 80ms both; }
.vxl-cam-motion.is-animating[data-scene="1"] .vxl-cam-rail li { animation: vxl-cam-rise 200ms var(--vxl-cam-ease) both; }
.vxl-cam-motion.is-animating[data-scene="1"] .vxl-cam-rail li:nth-child(1) { animation-delay: 200ms; }
.vxl-cam-motion.is-animating[data-scene="1"] .vxl-cam-rail li:nth-child(2) { animation-delay: 250ms; }
.vxl-cam-motion.is-animating[data-scene="1"] .vxl-cam-rail li:nth-child(3) { animation-delay: 300ms; }
.vxl-cam-motion.is-animating[data-scene="1"] .vxl-cam-rail .is-liked .vxl-cam-icon { animation: vxl-cam-like 560ms var(--vxl-cam-ease) 640ms both; }
.vxl-cam-motion.is-animating[data-scene="1"] .vxl-cam-post__meta { animation: vxl-cam-rise 240ms var(--vxl-cam-ease) 360ms both; }

/* scene 2 (1.3s): brackets close in, flash, album slides up, the capture is ticked */
.vxl-cam-motion.is-animating[data-scene="2"] .vxl-cam-crop { animation: vxl-cam-crop 280ms var(--vxl-cam-ease) 80ms both; }
.vxl-cam-motion.is-animating[data-scene="2"] .vxl-cam-flash { animation: vxl-cam-flash 200ms ease-out 400ms both; }
.vxl-cam-motion.is-animating[data-scene="2"] .vxl-cam-album { animation: vxl-cam-sheet 280ms var(--vxl-cam-ease) 600ms both; }
.vxl-cam-motion.is-animating[data-scene="2"] .vxl-cam-tile--pick { animation: vxl-cam-in 120ms var(--vxl-cam-ease) 880ms both; }
.vxl-cam-motion.is-animating[data-scene="2"] .vxl-cam-tick { animation: vxl-cam-pop 200ms var(--vxl-cam-ease) 990ms both; }

/* scene 3 (3.2s): query card, then results 1 -> 4 in original order */
.vxl-cam-motion.is-animating[data-scene="3"] .vxl-cam-query { animation: vxl-cam-rise 200ms var(--vxl-cam-ease) 40ms both; }
.vxl-cam-motion.is-animating[data-scene="3"] .vxl-cam-results li { animation: vxl-cam-rise 200ms var(--vxl-cam-ease) both; }
.vxl-cam-motion.is-animating[data-scene="3"] .vxl-cam-results li:nth-child(1) { animation-delay: 360ms; }
.vxl-cam-motion.is-animating[data-scene="3"] .vxl-cam-results li:nth-child(2) { animation-delay: 500ms; }
.vxl-cam-motion.is-animating[data-scene="3"] .vxl-cam-results li:nth-child(3) { animation-delay: 640ms; }
.vxl-cam-motion.is-animating[data-scene="3"] .vxl-cam-results li:nth-child(4) { animation-delay: 780ms; }

/* Optional: reveal of the real result cards in the stage grid, in original order.
   Put .vxl-cam-reveal on the existing .vxl-grid and add .vxl-cam-reveal--run while scene 3 plays. */
.vxl-cam-reveal.vxl-cam-reveal--run > :not(.vxl-card--input) { animation: vxl-cam-rise 200ms var(--vxl-cam-ease) both; }
.vxl-cam-reveal.vxl-cam-reveal--run > :nth-child(2) { animation-delay: 360ms; }
.vxl-cam-reveal.vxl-cam-reveal--run > :nth-child(3) { animation-delay: 500ms; }
.vxl-cam-reveal.vxl-cam-reveal--run > :nth-child(4) { animation-delay: 640ms; }
.vxl-cam-reveal.vxl-cam-reveal--run > :nth-child(5) { animation-delay: 780ms; }

/* ---------- stage choreography (#camera-stage[data-step], set by the frontend) ----------
   Step 1: one large phone, centred by .vxl-cam-motion; the result grid takes no space (no empty gap).
           The frontend also sets aria-hidden/inert on the grid; display:none here is only the visual side.
   Step 2: the phone transitions upward to its compact width;
           the whole grid (reference card + four dashed frames with loading rings) fades in below it.
   Step 3: the four real result cards rise in 1 -> 4 through .vxl-cam-reveal--run (above).
   Within the 1300ms step, the phone moves for 600ms and the grid fades in after 200ms.
   Step 1 width: large but never taller than ~75% of the viewport, never smaller than the step 2 phone,
   and still capped by max-width: 100% at 320px and at enlarged text.
   No JavaScript: no data-step, so none of this applies (normal phone, grid always visible). */
#camera-stage[data-step="1"] .vxl-cam-phone {
    margin-block-start: clamp(16px, 3vh, 32px);
    width: clamp(12.5rem, 42vh, 17.5rem);
    width: clamp(12.5rem, 42svh, 17.5rem);
}

@media (min-width: 375px) {
    #camera-stage[data-step="1"] .vxl-cam-phone {
        width: clamp(13.75rem, 42vh, 17.5rem);
        width: clamp(13.75rem, 42svh, 17.5rem);
    }
}

@media (min-width: 600px) {
    #camera-stage[data-step="1"] .vxl-cam-phone {
        width: clamp(15rem, 42vh, 20rem);
        width: clamp(15rem, 42svh, 20rem);
    }
}

#camera-stage[data-step="1"] .vxl-cam-reveal { display: none; }

#camera-stage[data-step="2"] .vxl-cam-reveal { animation: vxl-cam-in 500ms var(--vxl-cam-ease) 200ms both; }

/* ================================================================
   2. Input area: two clearly different buttons
   ================================================================ */

.vxl-cam-input { margin-top: 16px; }

.vxl-cam-input__buttons {
    display: grid;
    gap: 8px;
}

/* Two columns only while the intro text runs full width (600-1023px).
   From 1024px the intro sits in the narrow left column, so the options stack again. */
@media (min-width: 600px) and (max-width: 1023px) {
    .vxl-cam-input__buttons { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.vxl-cam-option { min-width: 0; }

/* the route each button takes, shown under it: shutter -> results / screenshot -> album -> results */
.vxl-cam-path {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 6px 0 0;
    flex-wrap: wrap;
    color: var(--vxl-cam-muted);
    font-size: var(--type-body);
    line-height: 1.5;
    text-align: center;
}

.vxl-cam-path .vxl-cam-icon { color: var(--vxl-cam-accent-dark); }

.vxl-cam-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 12px 16px;
    border: 2px solid var(--vxl-cam-accent);
    border-radius: 999px;
    background: #fff;
    color: var(--vxl-cam-accent-dark);
    font: inherit;
    font-size: var(--type-body);
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
    cursor: pointer;
    transition: background-color 200ms var(--vxl-cam-ease), color 200ms var(--vxl-cam-ease);
}

.vxl-cam-btn--primary {
    background: var(--vxl-cam-accent);
    color: #fff;
}

.vxl-cam-btn:hover { background: #eceaff; }
.vxl-cam-btn--primary:hover { background: var(--vxl-cam-accent-dark); }
.vxl-cam-btn:active { transform: translateY(1px); }

/* site.css spans the last two labels of any grid (label:nth-last-of-type(-n+2)); keep these side by side */
.vxl-cam-input__buttons .vxl-cam-btn { grid-column: auto; }

/* the real <input type="file"> covers the button, stays focusable */
.vxl-cam-file {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    opacity: 0;
    cursor: pointer;
    font-size: var(--type-body);
}

.vxl-cam-btn:focus-within,
.vxl-cam-btn:focus-visible {
    outline: 3px solid var(--vxl-cam-focus);
    outline-offset: 3px;
}

.vxl-cam-privacy {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 12px 0 0;
    color: var(--vxl-cam-muted);
    font-size: var(--type-body);
    line-height: 1.6;
}

.vxl-cam-privacy .vxl-cam-icon { margin-top: 3px; }

/* ================================================================
   3. User result area (item-agnostic: works for a dress, a shirt or anything else)
   ================================================================ */

.vxl-cam-user {
    margin-top: 16px;
    padding: 16px;
    border: 2px solid var(--vxl-cam-accent);
    border-radius: 12px;
    background: #fff;
}

@media (min-width: 600px) {
    .vxl-cam-user { padding: 20px; border-radius: 16px; }
}

@media (min-width: 1024px) {
    .vxl-cam-user { padding: 24px; }
}

.vxl-cam-user[hidden] { display: none; }

/* after a photo is chosen the page scrolls here; keep it clear of the sticky header */
.vxl-cam-user { scroll-margin-top: 88px; }
.vxl-cam-user:focus { outline: none; }
.vxl-cam-user:focus-visible { outline: 3px solid var(--vxl-cam-focus); outline-offset: 3px; }

.vxl-cam-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 4px 12px;
    border-radius: 999px;
    background: #eceaff;
    color: var(--vxl-cam-accent-dark);
    font-size: var(--type-body);
    font-weight: 700;
    line-height: 1.5;
}

.vxl-cam-user__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

/* "your photo" tag inside an existing .vxl-card__label */
.vxl-cam-tag {
    padding: 1px 8px;
    border: 1px solid var(--vxl-cam-accent);
    border-radius: 4px;
    background: #fff;
    color: var(--vxl-cam-accent-dark);
}

/* rank chip for locally calculated candidates: "1".."4" */
.vxl-cam-rank {
    display: inline-grid;
    place-items: center;
    min-width: 1.5em;
    height: 1.5em;
    padding: 0 0.375em;
    border-radius: 999px;
    background: var(--vxl-cam-accent);
    color: #fff;
    font-size: var(--type-body);
    font-weight: 700;
    line-height: 1;
}

/* user photo frame: dashed accent border, never the solid one used for the fixed example */
.vxl-cam-preview {
    position: relative;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    border: 2px dashed var(--vxl-cam-accent);
    border-radius: 8px;
    background: #f7f7f7;
}

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

/* status line + indeterminate meter while calculating */
.vxl-cam-status {
    margin: 12px 0 0;
    color: var(--vxl-cam-ink);
    font-size: var(--type-body);
    font-weight: 600;
    line-height: 1.6;
}

.vxl-cam-meter {
    position: relative;
    height: 4px;
    margin-top: 8px;
    overflow: hidden;
    border-radius: 2px;
    background: #e3e5ec;
}

.vxl-cam-meter::after {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 32%;
    border-radius: 2px;
    background: var(--vxl-cam-accent);
    animation: vxl-cam-meter 1200ms var(--vxl-cam-ease) infinite;
}

@keyframes vxl-cam-meter {
    from { transform: translateX(-100%); }
    to   { transform: translateX(320%); }
}

.vxl-cam-user:not([data-state="computing"]) .vxl-cam-meter { display: none; }

.vxl-cam-source {
    margin: 12px 0 0;
    color: var(--vxl-cam-muted);
    font-size: var(--type-body);
    line-height: 1.6;
}

.vxl-cam-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.vxl-cam-actions > * { min-height: 44px; }

/* error: inline, specific, never alert() */
.vxl-cam-error {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 12px 0 0;
    padding: 12px;
    border: 1px solid #f1b8b2;
    border-radius: 8px;
    background: #fff4f2;
    color: #9f1d1d;
    font-size: var(--type-body);
    line-height: 1.6;
}

.vxl-cam-error[hidden] { display: none; }
.vxl-cam-error .vxl-cam-icon { margin-top: 3px; }

/* ================================================================
   Reduced motion: still frames only. Manual steps and file input keep working.
   The phone jumps straight to its step size and the grid appears without a fade.
   ================================================================ */

@media (prefers-reduced-motion: reduce) {
    .vxl-cam-motion *,
    .vxl-cam-motion .vxl-cam-scene,
    .vxl-cam-reveal,
    .vxl-cam-reveal > *,
    .vxl-cam-meter::after {
        animation: none !important;
        transition: none !important;
    }

    .vxl-cam-meter::after { width: 100%; opacity: 0.35; }
    .vxl-cam-btn:active { transform: none; }
}

/* ================================================================
   DEV-20 VXL-CENTER-REVEAL (frontend): loading spinner in the real result frames
   Only in #demo-camera step 2, only on the four result cards that vxl.js still marks .is-pending
   (dashed frame). Never on the reference photo (.vxl-card--input, no data-reveal) nor in steps 1 and 3.
   Decorative: a pseudo-element, so no text and no focus. The frame's ::after belongs to the input card,
   so the result frames use ::before. Centered with inset:0 + margin:auto, so the frame size does not change
   and transform stays free for the rotation. Without JavaScript there is no .is-pending, so no spinner.
   ================================================================ */
#demo-camera .vxl-stage[data-step="2"] .vxl-grid > .vxl-card[data-reveal].is-pending > .vxl-card__frame::before {
    content: '';
    position: absolute;
    inset: 0;
    width: 2.5rem;
    height: 2.5rem;
    margin: auto;
    box-sizing: border-box;
    border: 3px solid rgba(79, 68, 255, 0.18);
    border-top-color: var(--vxl-cam-accent, #4f44ff);
    border-radius: 50%;
    pointer-events: none;
    animation: vxl-cam-spin 900ms linear infinite;
}

@keyframes vxl-cam-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    /* still ring with one coloured arc: visible, not spinning */
    #demo-camera .vxl-stage[data-step="2"] .vxl-grid > .vxl-card[data-reveal].is-pending > .vxl-card__frame::before {
        animation: none;
    }
}
