/* About section: vehicles drive in, then idle */
.cars-sec{overflow-x:clip}
.car-wrap{position:relative}
.car{position:relative;z-index:1;transition:transform .35s ease}

/* hidden start positions (only once JS is running) */
.cars-js .car-from-right{opacity:0;transform:translateX(220px)}
.cars-js .car-from-left{opacity:0;transform:translateX(-220px)}
.cars-js .car-badge{opacity:0;transform:scale(.6)}

/* drive in: overshoot, brake, settle */
.cars-go .car-from-right{animation:drive-r 1.5s cubic-bezier(.22,.9,.3,1) forwards,idle 1.8s 1.6s ease-in-out infinite}
.cars-go .car-from-left{animation:drive-l 1.5s cubic-bezier(.22,.9,.3,1) forwards,idle 1.8s 1.6s ease-in-out infinite}
.cars-go .car-wrap:nth-of-type(3) .car{animation-delay:.35s,1.95s}
.cars-go .car-wrap:nth-of-type(4) .car{animation-delay:.7s,2.3s}
.cars-go .car-badge{animation:badge-pop .6s 1.3s cubic-bezier(.3,1.6,.5,1) forwards}

@keyframes drive-r{
  0%{opacity:0;transform:translateX(220px)}
  15%{opacity:1}
  70%{transform:translateX(-12px) rotate(-1.2deg)}
  85%{transform:translateX(3px) rotate(.4deg)}
  100%{opacity:1;transform:none}
}
@keyframes drive-l{
  0%{opacity:0;transform:translateX(-220px)}
  15%{opacity:1}
  70%{transform:translateX(12px) rotate(1.2deg)}
  85%{transform:translateX(-3px) rotate(-.4deg)}
  100%{opacity:1;transform:none}
}
@keyframes idle{0%,100%{transform:translateY(0)}50%{transform:translateY(-3px)}}
@keyframes badge-pop{to{opacity:1;transform:none}}

/* speed lines behind each vehicle while it drives in */
.car-wrap::before{content:"";position:absolute;top:38%;height:34%;width:45%;z-index:0;opacity:0;pointer-events:none;
  background:repeating-linear-gradient(to bottom,transparent 0 10px,rgba(9,37,89,.35) 10px 12px)}
.car-wrap.from-right::before{right:0}
.car-wrap.from-left::before{left:20%;top:70px;height:90px}
.cars-go .car-wrap.from-right::before{animation:streak-r 1.1s ease-out forwards}
.cars-go .car-wrap.from-left::before{animation:streak-l 1.1s ease-out forwards}
.cars-go .car-wrap:nth-of-type(3)::before{animation-delay:.35s}
.cars-go .car-wrap:nth-of-type(4)::before{animation-delay:.7s}
@keyframes streak-r{0%{opacity:0;transform:translateX(160px) scaleX(.4)}30%{opacity:1}100%{opacity:0;transform:translateX(40px) scaleX(1)}}
@keyframes streak-l{0%{opacity:0;transform:translateX(-160px) scaleX(.4)}30%{opacity:1}100%{opacity:0;transform:translateX(-40px) scaleX(1)}}

/* hover: nudge forward the way the vehicle faces */
.car-wrap{transition:transform .35s ease}
.car-wrap.from-right:hover{transform:translateX(-10px)}
.car-wrap.from-left:hover{transform:translateX(10px)}

@media (prefers-reduced-motion:reduce){
  .cars-js .car-from-right,.cars-js .car-from-left,.cars-js .car-badge{opacity:1;transform:none;animation:none!important}
  .car-wrap::before{display:none}
}

/* floated vehicle wrappers have no height: place their speed lines explicitly */
.car-wrap.from-right:has(> .float-end)::before{top:70px;height:90px;right:0}
