/* SafeDrive cover (safedrive-cover.js): my drive clip (drive-demo.mp4) slowed and dimmed behind; in front,
   the box's redrawn OLED small at the lower left and the app's live driving screen on the right, joined by a
   wire a confirmed brake travels along. The UI sits on a 1600×900 artboard (900×1125 on phones), scaled to
   the stage width by the script. The OLED follows the layout in 04_full_system.ino. */
.sd-cover.shell{margin-inline:auto}
.cv-stage{position:relative;aspect-ratio:16/9;border-radius:24px;overflow:hidden;background:#0d1426;box-shadow:0 30px 60px -34px rgb(20 30 60/.45)}
.cv-video{display:block;position:absolute;inset:0;width:100%;height:100%;object-fit:cover;filter:blur(1.2px) saturate(.85);transform:scale(1.03)}
.cv-stage::after{content:"";position:absolute;inset:0;z-index:0;background:linear-gradient(180deg,rgb(6 10 20/.42),rgb(6 10 20/.62));pointer-events:none}

.cv-art{position:absolute;left:0;top:0;z-index:1;width:1600px;height:900px;transform:scale(var(--k,.5));transform-origin:0 0;pointer-events:none}
.cv-art .sa-phone{position:absolute;box-shadow:0 40px 90px -30px rgb(0 0 0/.7),0 2px 6px rgb(0 0 0/.3)}

/* the box's screen */
.cv-box{position:absolute;left:96px;top:620px;width:330px}
.cv-oled{position:relative;width:100%;aspect-ratio:2/1;padding:.8em 1.1em;border:10px solid #d9d6ce;border-radius:12px;background:#0b0c0f;font:500 17.5px/1.3 ui-monospace,SFMono-Regular,Menlo,monospace;color:#57b8f0;box-sizing:border-box;box-shadow:0 30px 60px -24px rgb(0 0 0/.7)}
.cv-oled p{margin:0;color:#57b8f0;font:inherit}
.cv-oled .cv-o-score{font-size:1.85em;line-height:1.1;color:#f2d33b;margin-bottom:.25em}
.cv-o-bar{position:absolute;left:1.1em;right:1.1em;bottom:.8em;height:.55em;border:1px solid #57b8f0;padding:1px}
.cv-o-bar span{display:block;height:100%;width:100%;background:#57b8f0;transition:width .4s}
.cv-oled.is-hit .cv-o-score{animation:cv-blink .5s steps(2) 2}
@keyframes cv-blink{50%{opacity:.25}}
.cv-dots-row{display:flex;align-items:center;gap:10px;margin:14px 0 0;color:#fff;font:500 18px/1 -apple-system,BlinkMacSystemFont,"SF Pro Text",system-ui,sans-serif}
.cv-dots{display:flex;gap:6px}
.cv-dots i{width:11px;height:11px;border-radius:50%;background:rgb(255 255 255/.25);transition:background .25s,scale .25s}
.cv-dots i.on{background:#FFD58A;scale:1.15}

/* the wire, and the light a confirmed brake sends along it */
.cv-wire{position:absolute;left:440px;top:420px;width:560px;height:300px;overflow:visible}
.cv-wire path{fill:none;stroke:rgb(255 255 255/.32);stroke-width:2.5;stroke-dasharray:7 9}
.cv-pulse{position:absolute;left:440px;top:420px;width:16px;height:16px;margin:-8px 0 0 -8px;border-radius:50%;background:#FFD58A;box-shadow:0 0 18px 6px rgb(255 213 138/.6);opacity:0;offset-path:path('M0 270 C250 270 300 30 560 30');offset-rotate:0deg}
.cv-art.is-hit .cv-pulse{animation:cv-travel .75s cubic-bezier(.65,0,.35,1)}
@keyframes cv-travel{0%{opacity:1;offset-distance:0%}90%{opacity:1}100%{opacity:0;offset-distance:100%}}

/* the app */
.cv-live{position:absolute;left:1010px;top:45px;scale:1.22;transform-origin:top left}

/* G2: the screen sits in the box's silver enclosure (3D-printed, vents on the left, the OLED behind a window),
   with a Bluetooth mark on its corner; the wire leaves from the box itself */
.cv-unit{position:relative}
.cv-vents,.cv-ble,.cv-wire2{display:none}
.sd-cover[data-cover=g2] .cv-box{left:96px;top:590px;width:470px;scale:.76;transform-origin:0 0}
.sd-cover[data-cover=g2] .cv-unit{height:250px;border-radius:26px;background:linear-gradient(165deg,#f7f8f9 0%,#dfe2e5 38%,#c3c7cc 78%,#aeb3b9 100%);box-shadow:inset 0 2px 0 rgb(255 255 255/.9),inset 0 -10px 0 rgb(0 0 0/.08),0 34px 60px -26px rgb(0 0 0/.75)}
.sd-cover[data-cover=g2] .cv-vents{display:block;position:absolute;left:30px;top:44px;width:150px;height:150px;background:radial-gradient(circle,#8f959c 0 4.4px,transparent 5px) 0 0/30px 30px;opacity:.75}
.sd-cover[data-cover=g2] .cv-window{position:absolute;right:26px;top:50%;translate:0 -50%;width:244px;padding:9px;border-radius:12px;background:#1a1c20;box-shadow:inset 0 2px 6px rgb(0 0 0/.6)}
.sd-cover[data-cover=g2] .cv-oled{border:0;border-radius:4px;font-size:12.6px;box-shadow:none}
.sd-cover[data-cover=g2] .cv-ble{display:grid;place-items:center;position:absolute;right:-16px;top:-16px;width:44px;height:44px;border-radius:50%;background:#1B4FD8;box-shadow:0 6px 16px rgb(27 79 216/.5)}
.cv-ble svg{width:22px;height:22px;fill:none;stroke:#fff;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.sd-cover[data-cover=g2] .cv-ble::after{content:"";position:absolute;inset:0;border-radius:50%;border:2px solid #6f93ff;opacity:0}
@media(prefers-reduced-motion:no-preference){.sd-cover[data-cover=g2] .cv-ble::after{animation:cv-ping 2.2s ease-out infinite}}
@keyframes cv-ping{0%{opacity:.8;scale:1}100%{opacity:0;scale:2.1}}
.sd-cover[data-cover=g2] .cv-wire{display:none}
.sd-cover[data-cover=g2] .cv-wire2{display:block;position:absolute;inset:0;width:1600px;height:900px;overflow:visible}
.cv-wire2 path{fill:none;stroke:rgb(255 255 255/.32);stroke-width:2.5;stroke-dasharray:7 9}
.sd-cover[data-cover=g2] .cv-pulse{left:0;top:0;offset-path:path('M453 685 C720 685 760 330 1004 330')}
.sd-cover[data-cover=g2] .cv-dots-row{margin-top:18px}

/* sound, off until turned on (the button is shared with the highlights; styles in safedrive-app.css) */
.sd .cv-sound{position:absolute;right:16px;bottom:16px;z-index:4;background:rgb(255 255 255/.16);box-shadow:inset 0 0 0 1px rgb(255 255 255/.28)}
.sd .cv-sound:hover{background:rgb(255 255 255/.26)}

@media(max-width:700px){
  .cv-stage{aspect-ratio:4/5}
  .cv-art{width:900px;height:1125px}
  .cv-box{left:44px;top:830px;width:300px}
  .cv-oled{font-size:16px;border-width:9px}
  .cv-wire,.cv-pulse{display:none}
  .cv-live{left:356px;top:36px;scale:1.4}
  .cv-sound{right:10px;bottom:10px}
  .sd-cover[data-cover=g2] .cv-box{left:44px;top:860px;width:330px}
  .sd-cover[data-cover=g2] .cv-unit{height:176px;border-radius:20px}
  .sd-cover[data-cover=g2] .cv-vents{left:22px;top:32px;width:96px;height:108px;background-size:24px 24px}
  .sd-cover[data-cover=g2] .cv-window{right:18px;width:172px;padding:7px}
  .sd-cover[data-cover=g2] .cv-oled{font-size:8.9px}
  .sd-cover[data-cover=g2] .cv-wire2{display:none}
}

/* scene previews (?cover=s1–s5): a generated in-car photo on its own artboard (its pixel size), scaled to
   cover the stage; the live app's screen is mapped onto the photo's phone screen with a homography */
.cv-scene{display:none;position:absolute;left:0;top:0;transform-origin:0 0;z-index:1}
.sd-cover:is([data-cover^=s],[data-cover^=v]) .cv-scene.is-on{display:block}
.sd-cover:is([data-cover^=s],[data-cover^=v]) .cv-art,.sd-cover:is([data-cover^=s],[data-cover^=v]) .cv-video{display:none}
.sd-cover:is([data-cover^=s],[data-cover^=v]) .cv-stage::after{background:linear-gradient(180deg,rgb(6 10 20/0) 60%,rgb(6 10 20/.22));z-index:2}
.cv-car{position:absolute;inset:0;will-change:transform}
/* the box's screen in a video scene: drawn at 200×100 (the OLED's 2:1) and scaled onto the tracked window */
.cv-box-oled{display:none;position:absolute;left:0;top:0;width:200px;height:100px;box-sizing:border-box;padding:9px 12px;background:#06070a;font:600 13px/1.25 ui-monospace,SFMono-Regular,Menlo,monospace;color:#57b8f0;transform-origin:0 0;filter:blur(.35px) brightness(1.15)}
.cv-scene[data-scene^=v] .cv-box-oled{display:block}
.cv-box-oled p{margin:0;font:inherit;color:inherit}
.cv-box-oled .cv-o-score{font-size:22px;line-height:1.1;color:#f2d33b;margin-bottom:4px}
.cv-box-oled .cv-o-bar{position:absolute;left:12px;right:12px;bottom:9px;height:7px;border:1px solid #57b8f0;padding:1px}
.cv-box-oled .cv-o-bar span{display:block;height:100%;width:100%;background:#57b8f0;transition:width .4s}
.cv-box-oled.is-hit .cv-o-score{animation:cv-blink .5s steps(2) 2}
.cv-scene-photo{position:absolute;left:0;top:0;display:block;max-width:none}
.cv-scene-screen{position:absolute;left:0;top:0;width:302px;height:655px;transform-origin:0 0}
.sd .cv-scene-screen.sa-phone{position:absolute;width:302px;height:655px;padding:0;border-radius:0;background:none;box-shadow:none}
.cv-scene-screen .sa-drive{width:302px;height:655px;border-radius:var(--r,26px)}
.cv-scene-screen .sa-island,.cv-scene-screen .sa-status{display:none}
.cv-scene-screen .sa-pad{padding-top:34px}

/* preview only (?cover=…): the cover switcher, bottom left */
.cv-switch{position:fixed;left:16px;bottom:16px;z-index:60;display:flex;gap:4px;padding:4px;border-radius:999px;background:#1c1d21;box-shadow:0 6px 18px rgb(0 0 0/.2)}
.cv-switch a{padding:6px 12px;border-radius:999px;color:#cfd2d8;font:500 12px/1.2 system-ui,sans-serif;text-decoration:none;white-space:nowrap}
.cv-switch a[aria-current]{background:#fff;color:#000}
@media(max-width:700px){.cv-switch{left:8px;right:8px;bottom:8px;justify-content:center;flex-wrap:wrap}}

/* the reel (?cover=reel): the two videos are stacked; the next fades in over the last frame of the one before */
.sd-cover[data-cover=reel] .cv-scene{display:block;opacity:0;transition:opacity .9s ease}
.sd-cover[data-cover=reel] .cv-scene.is-on{opacity:1;z-index:2}
.sd-cover[data-cover=reel] :is(.cv-video,.cv-art){display:none}
.sd-cover[data-cover=reel] .cv-stage::after{opacity:.35}
