/* sidewrks.co scroll hero (drive). Load after site.css. */

/* scroll length of the pinned part: 210vh total = about 1.1 screens of scrolling while the car drives */
.drive{position:relative;height:210vh}
.drive-pin{position:sticky;top:0;height:100vh;height:100svh;min-height:560px;display:flex;flex-direction:column;overflow:hidden}
.drive-layer{position:relative;z-index:1;width:100%;box-sizing:border-box}

/* smaller than the site's .h1 so headline and car both fit the first screen */
.drive-text{display:flex;flex-direction:column;gap:20px;padding-top:2vh;will-change:transform,opacity}
.drive-h1{font-size:clamp(36px,min(4.8vw,7vh),72px)}
.drive-lead{font-size:17px;line-height:1.5;max-width:460px}

/* the car fills the screen under the menu; frames are 16:9, transparent, bottom-aligned */
.drive-car{position:absolute;left:0;right:0;top:132px;bottom:0;z-index:0;pointer-events:none;
  -webkit-mask-image:linear-gradient(90deg,transparent,#000 3%,#000 97%,transparent);
  mask-image:linear-gradient(90deg,transparent,#000 3%,#000 97%,transparent)}
.drive-car img{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;object-position:50% 100%}
.drive-car canvas{position:absolute;inset:0;width:100%;height:100%}
/* once the canvas has drawn its first frame, the still <img> underneath is hidden */
.drive-car.ready img{visibility:hidden}

/* the next section starts right after the pin; the old .showreel spacing is gone */
.drive + .section,.drive + main > .section:first-child{padding-top:96px}

@media (max-width:600px){
  .drive{height:180vh}
  .drive-car{top:116px}
  /* portrait: the 16:9 frame is width-bound, so sit it in the lower-middle instead of on the bottom edge */
  .drive-car img{object-position:50% 62%}
}
/* reduced motion: no pinning, one still frame */
@media (prefers-reduced-motion:reduce){
  .drive{height:auto}
  .drive-pin{position:relative;height:auto;min-height:0}
  .drive-car{position:relative;top:auto;aspect-ratio:16/9;margin-top:24px}
}

/* after the ride the menu stays at the top while the rest of the page scrolls */
.drive .nav.is-fixed{position:fixed;top:0;left:0;right:0;z-index:50;max-width:none;margin:0;
  padding-left:max(32px,calc(50vw - 588px));padding-right:max(32px,calc(50vw - 588px));
  background:rgba(245,244,241,.92);-webkit-backdrop-filter:saturate(1.2) blur(12px);backdrop-filter:saturate(1.2) blur(12px);
  border-bottom:1px solid var(--line)}
@media (max-width:600px){.drive .nav.is-fixed{padding-left:20px;padding-right:20px}}
/* in-page links land below the fixed menu */
main section[id]{scroll-margin-top:110px}
