/* Photo to 3D Room, on the WIP home only (home-page/home-v2-room3d.html). The row takes the Agent rows' card; its two frames
   (owner, 11-10), the photo and the room assembling itself from the photo's own view, share the width, each picture filling
   its frame. Owner, 11-10 ("太厚了，变矮"): the frames are 4:3, near the other rows' height; the square pictures lose a little
   top and bottom alike, a little more of the ceiling than of the floor, so the pendant and the chairs stay whole. */
.hv2-agent .hv2-flow--room3d .hv2-flow-frames { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.hv2-agent .hv2-flow--room3d .hv2-flow-picture { aspect-ratio: 4 / 3; }
.hv2-agent .hv2-flow--room3d .hv2-flow-picture img,
.hv2-agent .hv2-flow--room3d .hv2-flow-picture video { object-position: 50% 55%; }

/* The clip is drawn on the light stage of the 3D views, in both themes; until it plays, one moment of it (the room half
   furnished) stands in its place. */
.hv2-agent .hv2-flow--room3d .hv2-room3d-clip { background: radial-gradient(110% 90% at 50% 42%, #fff 0%, #f2f5fa 62%, #e8edf5 100%); }
.hv2-agent .hv2-room3d-clip img { object-fit: cover; }
/* Owner, 11-10 ("右侧有个黑线要去掉"): a playing video is drawn on its own layer, which can fall a pixel short of the frame
   and let the still behind it (dark shelves at its right edge) show as a line. The clip reaches a pixel past every edge (the
   frame's rounded clip trims it), and once it shows, the still goes. */
.hv2-room3d-clip video {
    position: absolute;
    inset: -1px;
    width: calc(100% + 2px);
    height: calc(100% + 2px);
    object-fit: cover;
    opacity: 0;
    transition: opacity .3s ease;
}
.hv2-room3d-clip.is-playing video { opacity: 1; }
.hv2-agent .hv2-room3d-clip.is-playing img { opacity: 0; transition: opacity 0s linear .3s; }

/* Owner, 11-10 ("带有 bbox 自动识别的动效"): the photo shows the objects the tool finds, boxed and named. The boxes are laid
   on a square the size of the photo as the frame draws it (cover, 55% down), so they stay on their objects however the frame
   is shaped; without container units, a 4:3 frame is assumed. Without the script (and for reduced motion or saving data) they
   simply show; with it, a line scans down the photo, each box appears as the line reaches it, and all fade as the clip
   beside them ends, to start again with it. */
.hv2-room3d-detect { position: absolute; inset: 0; pointer-events: none; container-type: size; }
.hv2-room3d-boxes { position: absolute; left: 0; top: -18.333%; width: 100%; height: 133.333%; }
@supports (width: 1cqw) {
    .hv2-room3d-boxes {
        left: calc((100cqw - max(100cqw, 100cqh)) * .5);
        top: calc((100cqh - max(100cqw, 100cqh)) * .55);
        width: max(100cqw, 100cqh);
        height: max(100cqw, 100cqh);
    }
}
.hv2-room3d-box {
    position: absolute;
    left: var(--x);
    top: var(--y);
    width: var(--w);
    height: var(--h);
    box-sizing: border-box;
    border: 1.5px solid var(--hv2-blue);
    border-radius: 4px;
    background: rgba(38, 100, 255, .08);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .6);
}
/* A name sits in its box's top corner, over every box; it shrinks with the frame (10.5px on a desktop frame, 8.5px at least). */
.hv2-room3d-tag {
    position: absolute;
    left: var(--x);
    top: var(--y);
    padding: .2em .55em;
    border-radius: 4px 0 4px 0;
    background: var(--hv2-blue);
    color: #fff;
    font-size: 10.5px;
    font-weight: 600;
    line-height: 1.25;
    white-space: nowrap;
}
@supports (width: 1cqw) {
    .hv2-room3d-tag { font-size: clamp(8.5px, 2.35cqw, 10.5px); }
}
.hv2-room3d-tag--end { left: auto; right: calc(100% - var(--x) - var(--w)); border-radius: 0 4px 0 4px; }
.hv2-room3d-scan {
    position: absolute;
    inset: 0;
    display: none;
    background: linear-gradient(to bottom, rgba(38, 100, 255, 0) 72%, rgba(38, 100, 255, .2) calc(100% - 2px), var(--hv2-blue) calc(100% - 2px));
    transform: translateY(-100%);
}
.hv2-room3d-detect.is-armed .hv2-room3d-box,
.hv2-room3d-detect.is-armed .hv2-room3d-tag { opacity: 0; }
.hv2-room3d-detect.is-armed .hv2-room3d-scan { display: block; }
.hv2-room3d-detect.is-detecting { animation: hv2-room3d-fade 10s linear both; }
.hv2-room3d-detect.is-detecting .hv2-room3d-box { animation: hv2-room3d-box .5s cubic-bezier(.2, .8, .2, 1) var(--d) both; }
.hv2-room3d-detect.is-detecting .hv2-room3d-tag { animation: hv2-room3d-tag .35s ease-out calc(var(--d) + .15s) both; }
.hv2-room3d-detect.is-detecting .hv2-room3d-scan { animation: hv2-room3d-scan 1.6s cubic-bezier(.45, 0, .25, 1) both; }
.hv2-room3d-detect.is-paused,
.hv2-room3d-detect.is-paused * { animation-play-state: paused; }
@keyframes hv2-room3d-box { from { opacity: 0; transform: scale(1.12); } to { opacity: 1; transform: none; } }
@keyframes hv2-room3d-tag { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
@keyframes hv2-room3d-scan { 0% { opacity: 1; transform: translateY(-100%); } 88% { opacity: 1; } 100% { opacity: 0; transform: translateY(0); } }
@keyframes hv2-room3d-fade { 0%, 86% { opacity: 1; } 92%, 100% { opacity: 0; } }

/* The cases row's Photo to 3D card: its room fills the card down to the words, so on narrow cards (where every card's shade
   rises to 60%) its shade stays lower, over the empty floor in front rather than the furniture. */
@media (max-width: 1100px) {
    .hv2-case--light[href*="photos-to-room"]::after { height: 46%; }
}

/* One column on phones: the two pictures one above the other. */
@media (max-width: 520px) {
    .hv2-agent .hv2-flow--room3d .hv2-flow-frames { grid-template-columns: minmax(0, 1fr); }
}
