/* Flux Fusion Corner · video hero.
   The camera move lives in the MP4. CSS only frames it and adds the car selector,
   which is aligned to the video's final frame (cars measured in % of the frame). */

@property --h0{syntax:"<percentage>";inherits:true;initial-value:35.3%}
@property --h1{syntax:"<percentage>";inherits:true;initial-value:64.7%}

.stage{
  /* car extents in the final frame (desktop: full 16:9 film) */
  --l0:.7%;  --l1:31.2%;
  --c0:35.3%;--c1:64.7%;
  --r0:68.7%;--r1:99.4%;
  /* column borders between cars */
  --b1:33.25%;--b2:66.7%;
}
.headline{pointer-events:none}

/* ---------- film ---------- */
.film-frame{position:absolute;inset:0;overflow:hidden;pointer-events:none}
/* same rectangle as object-fit:contain, so the selector can share its coordinates */
.film-box{position:absolute;left:50%;top:50%;width:min(100vw,177.778vh);width:min(100vw,177.778svh);aspect-ratio:16/9;transform:translate(-50%,-50%)}
.film-media{position:absolute;inset:0;
  /* soft floor edge when the screen is taller than 16:9 */
  -webkit-mask-image:linear-gradient(to bottom,#000 80%,transparent 99%);mask-image:linear-gradient(to bottom,#000 80%,transparent 99%)}
.film-poster,.hero-film{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.hero-film{opacity:0}
.film-playing .hero-film{opacity:1}
.film-playing .film-poster{opacity:0}
/* poster takes over if playback was cut short or the layout switched */
.film-static .hero-film{opacity:0}
.film-static .film-poster{opacity:1}

/* dims the two cars that are not selected; the clear "window" glides between cars */
.shade{position:absolute;inset:0;background:#020202;opacity:0;
  -webkit-mask-image:linear-gradient(to right,#000 calc(var(--h0) - 3%),transparent calc(var(--h0) + 1%),transparent calc(var(--h1) - 1%),#000 calc(var(--h1) + 3%));
          mask-image:linear-gradient(to right,#000 calc(var(--h0) - 3%),transparent calc(var(--h0) + 1%),transparent calc(var(--h1) - 1%),#000 calc(var(--h1) + 3%));
  transition:opacity .6s cubic-bezier(.2,.7,.2,1),--h0 .65s cubic-bezier(.65,0,.35,1),--h1 .65s cubic-bezier(.65,0,.35,1)}
.stage[data-focus] .shade{opacity:.62}
.stage[data-focus="l"]{--h0:var(--l0);--h1:var(--l1)}
.stage[data-focus="c"]{--h0:var(--c0);--h1:var(--c1)}
.stage[data-focus="r"]{--h0:var(--r0);--h1:var(--r1)}

/* ---------- car selector ---------- */
.lineup{position:absolute;inset:0;margin:0;padding:0;list-style:none;opacity:0;visibility:hidden;transition:opacity .9s ease,visibility 0s linear .9s}
.stage[data-phase="complete"] .lineup,.stage[data-phase="static"] .lineup{opacity:1;visibility:visible;pointer-events:auto;transition:opacity .9s ease}
.spot{position:absolute;top:22%;height:62%;display:block;cursor:pointer;-webkit-tap-highlight-color:transparent}
.spot:focus-visible{outline:none}
.spot[data-car="l"]{left:0;width:var(--b1)}
.spot[data-car="c"]{left:var(--b1);width:calc(var(--b2) - var(--b1))}
.spot[data-car="r"]{left:var(--b2);right:0}

.spot-mark{position:absolute;left:50%;top:91%;width:28px;height:28px;border-radius:50%;transform:translate(-50%,-50%);
  color:var(--text);border:1px solid rgba(242,242,238,.42);background:rgba(5,5,5,.4);
  -webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px);
  transition:background .35s,color .35s,border-color .35s,transform .45s cubic-bezier(.2,.7,.2,1)}
.spot-mark::before,.spot-mark::after{content:"";position:absolute;left:50%;top:50%;width:10px;height:1.2px;background:currentColor;transform:translate(-50%,-50%)}
.spot-mark::after{transform:translate(-50%,-50%) rotate(90deg)}
/* one gentle pulse per marker when the camera settles */
.spot-mark i{position:absolute;inset:-1px;border-radius:50%;border:1px solid rgba(242,242,238,.5);opacity:0}
.stage[data-phase="complete"] .spot-mark i{animation:spot-ring 1.6s cubic-bezier(.2,.7,.2,1) 2 both}
.stage[data-phase="complete"] li:nth-child(2) .spot-mark i{animation-delay:.18s}
.stage[data-phase="complete"] li:nth-child(3) .spot-mark i{animation-delay:.36s}
@keyframes spot-ring{0%{transform:scale(1);opacity:.7}100%{transform:scale(2.3);opacity:0}}

.stage[data-focus="l"] .spot[data-car="l"] .spot-mark,
.stage[data-focus="c"] .spot[data-car="c"] .spot-mark,
.stage[data-focus="r"] .spot[data-car="r"] .spot-mark,
.spot:focus-visible .spot-mark{background:var(--text);color:var(--bg);border-color:var(--text);transform:translate(-50%,-50%) scale(1.12)}
.spot:focus-visible .spot-mark{outline:1px solid var(--teal);outline-offset:4px}

/* ---------- description swaps to the selected model ---------- */
.desc{display:grid}
.desc>p{grid-area:1/1;margin:0;transition:opacity .45s ease,transform .45s cubic-bezier(.2,.7,.2,1)}
.desc-model{opacity:0;transform:translateY(8px)}
.stage[data-focus] .desc-text{opacity:0;transform:translateY(-8px)}
.stage[data-focus] .desc-model{opacity:1;transform:none}
.desc-model b{font-weight:600;color:var(--text);letter-spacing:.06em;text-transform:uppercase;font-size:12.5px}
.desc-model .dm-sep{margin:0 .7em;opacity:.45}
.desc-model .dm-price{color:var(--text)}
.desc-model br{display:none}
.desc-model .dm-hint{display:block;margin-top:4px;color:rgba(242,242,238,.5);font-size:12.5px}

/* ---------- bottom corners (large screens) ---------- */
.hero-corner{position:absolute;z-index:5;bottom:calc(max(4.5vh,28px) + 8px);height:28px;display:flex;align-items:center;gap:12px;
  font:500 10.5px/1 var(--sans);letter-spacing:.2em;text-transform:uppercase;color:var(--muted)}
.hero-corner-l{left:var(--gut-l)}
.hero-corner-r{right:var(--gut-r);transition:color .25s}
.hero-corner-r:hover{color:var(--text)}
.hero-corner svg{width:13px;height:13px;flex:none}
.scroll-line{position:relative;width:1px;height:28px;background:rgba(242,242,238,.16);overflow:hidden}
.scroll-line::after{content:"";position:absolute;left:0;top:0;width:1px;height:45%;background:var(--text);animation:scroll-cue 2.4s cubic-bezier(.65,0,.35,1) infinite}
@keyframes scroll-cue{0%{transform:translateY(-100%)}100%{transform:translateY(230%)}}
.motion-ready .hero-corner{opacity:0}
@media (max-width:1099px){.hero-corner{display:none}}

/* ---------- top bar turns to glass once the page scrolls ---------- */
.bar{transition:background-color .4s ease,padding .4s ease,border-color .4s ease;border-bottom:1px solid transparent}
.bar.is-scrolled{background-color:rgba(5,5,5,.72);-webkit-backdrop-filter:blur(16px) saturate(1.2);backdrop-filter:blur(16px) saturate(1.2);
  padding-top:calc(14px + env(safe-area-inset-top,0px));padding-bottom:14px;border-bottom-color:var(--line)}

/* ---------- phones ---------- */
@media (max-width:760px){
  /* the phone video is pre-cropped to this 8:5 window: full Xiaomi, black cars cut at the edges */
  .stage{--l0:-6%;--l1:16.1%;--c0:23.5%;--c1:76.5%;--r0:83.7%;--r1:106%;--b1:19.8%;--b2:80.1%}
  .hero{height:auto}
  .stage{height:auto;display:flex;flex-direction:column;align-items:center;gap:20px;padding:calc(100px + env(safe-area-inset-top,0px)) 0 28px}
  .headline{position:relative;order:0;left:auto;top:auto;transform:none;width:calc(100% - 32px);max-width:none;font-size:clamp(34px,10vw,60px)}
  .film-frame{position:relative;order:1;inset:auto;width:100%;aspect-ratio:8/5;flex:none;
    -webkit-mask-image:linear-gradient(to bottom,transparent,#000 8%,#000 94%,transparent);mask-image:linear-gradient(to bottom,transparent,#000 8%,#000 94%,transparent)}
  .film-box{inset:0;left:0;top:0;width:auto;aspect-ratio:auto;transform:none}
  .film-media{-webkit-mask-image:none;mask-image:none}
  .spot{top:8%;height:84%}
  .spot-mark{top:94%;width:24px;height:24px}
  .hero-foot{position:relative;order:2;left:auto;bottom:auto;transform:none;width:calc(100% - 40px);gap:16px}
  .desc-model .dm-hint{font-size:12px}
  .brands{padding-top:64px}
}

@media (prefers-reduced-motion:reduce){
  .shade,.spot-mark,.desc>p,.bar{transition:none}
  .spot-mark i,.scroll-line::after{animation:none}
}
