/* Dispatch / ship button (inspired by aduok dispatch-button). */

.ship-btn {
  --b-dark: #1c212e;
  --b-blue: #275efe;
  --b-bll: #7699ff;
  --b-grey: #6c7486;
  --b-gd: #3f4656;
  --b-gl: #cdd9ed;
  --b-green: #16bf78;
  --b-sand: #dcb773;
  --b-sandl: #edd9a9;

  appearance: none;
  border: 0;
  background: var(--b-dark);
  position: relative;
  height: 56px;
  width: min(100%, 240px);
  padding: 0;
  outline: none;
  cursor: pointer;
  border-radius: 32px;
  -webkit-mask-image: -webkit-radial-gradient(white, black);
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
  transition: transform 0.3s ease;
  flex: none;
}

.ship-btn:active {
  transform: scale(0.96);
}

.ship-btn:disabled {
  cursor: default;
  opacity: 0.7;
}

.ship-btn .lbl {
  --o: 1;
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
  top: 16px;
  line-height: 24px;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  opacity: var(--o);
  transition: opacity 0.3s ease;
}

.ship-btn .lbl.idle {
  transition-delay: 0.3s;
}

.ship-btn .lbl.done {
  --o: 0;
}

.ship-btn .lbl.done svg {
  width: 12px;
  height: 10px;
  display: inline-block;
  vertical-align: top;
  fill: none;
  margin: 7px 0 0 4px;
  stroke: var(--b-green);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 16px;
  stroke-dashoffset: 16px;
  transition: stroke-dashoffset 0.3s ease;
}

.ship-btn .rail {
  opacity: 0;
  position: absolute;
  height: 3px;
  background: #fff;
  border-radius: 2px;
  width: 6px;
  top: 27px;
  left: 100%;
  box-shadow:
    15px 0 0 #fff, 30px 0 0 #fff, 45px 0 0 #fff, 60px 0 0 #fff,
    75px 0 0 #fff, 90px 0 0 #fff, 105px 0 0 #fff, 120px 0 0 #fff,
    135px 0 0 #fff, 150px 0 0 #fff, 165px 0 0 #fff, 180px 0 0 #fff,
    195px 0 0 #fff, 210px 0 0 #fff, 225px 0 0 #fff, 240px 0 0 #fff,
    255px 0 0 #fff, 270px 0 0 #fff, 285px 0 0 #fff, 300px 0 0 #fff,
    315px 0 0 #fff, 330px 0 0 #fff;
}

.ship-btn .cargo {
  background: linear-gradient(var(--b-sandl), var(--b-sand));
  width: 21px;
  height: 21px;
  right: 100%;
  top: 18px;
  border-radius: 2px;
  position: absolute;
}

.ship-btn .cargo::before,
.ship-btn .cargo::after {
  content: "";
  top: 10px;
  position: absolute;
  left: 0;
  right: 0;
}

.ship-btn .cargo::before {
  height: 3px;
  margin-top: -1px;
  background: rgba(0, 0, 0, 0.1);
}

.ship-btn .cargo::after {
  height: 1px;
  background: rgba(0, 0, 0, 0.15);
}

.ship-btn .vehicle {
  width: 60px;
  height: 41px;
  left: 100%;
  z-index: 1;
  top: 8px;
  position: absolute;
  transform: translateX(24px);
}

.ship-btn .vehicle::before,
.ship-btn .vehicle::after {
  --r: -90deg;
  content: "";
  height: 2px;
  width: 20px;
  right: 58px;
  position: absolute;
  display: block;
  background: #fff;
  border-radius: 1px;
  transform-origin: 100% 50%;
  transform: rotate(var(--r));
}

.ship-btn .vehicle::before {
  top: 4px;
}

.ship-btn .vehicle::after {
  --r: 90deg;
  bottom: 4px;
}

.ship-btn .cab-back {
  background: linear-gradient(#fff, var(--b-gl));
  left: 0;
  top: 0;
  width: 60px;
  height: 41px;
  z-index: 1;
  border-radius: 2px;
  position: absolute;
}

.ship-btn .cab-front {
  overflow: hidden;
  position: absolute;
  border-radius: 2px 9px 9px 2px;
  width: 26px;
  height: 41px;
  left: 60px;
}

.ship-btn .cab-front::before,
.ship-btn .cab-front::after {
  content: "";
  position: absolute;
  display: block;
}

.ship-btn .cab-front::before {
  height: 13px;
  width: 2px;
  left: 0;
  top: 14px;
  background: linear-gradient(var(--b-grey), var(--b-gd));
}

.ship-btn .cab-front::after {
  border-radius: 2px 9px 9px 2px;
  background: var(--b-blue);
  width: 24px;
  height: 41px;
  right: 0;
}

.ship-btn .windshield {
  overflow: hidden;
  border-radius: 2px 8px 8px 2px;
  background: var(--b-bll);
  transform: perspective(4px) rotateY(3deg);
  width: 22px;
  height: 41px;
  position: absolute;
  left: 2px;
  top: 0;
  z-index: 1;
  transform-origin: 0 50%;
}

.ship-btn .windshield::before,
.ship-btn .windshield::after {
  content: "";
  position: absolute;
  right: 0;
}

.ship-btn .windshield::before {
  top: 0;
  bottom: 0;
  width: 14px;
  background: var(--b-dark);
}

.ship-btn .windshield::after {
  width: 14px;
  top: 7px;
  height: 4px;
  background: rgba(255, 255, 255, 0.14);
  transform: skewY(14deg);
  box-shadow: 0 7px 0 rgba(255, 255, 255, 0.14);
}

.ship-btn .headlight {
  width: 3px;
  height: 8px;
  left: 83px;
  transform-origin: 100% 50%;
  position: absolute;
  border-radius: 2px;
  transform: scaleX(0.8);
  background: rgba(240, 220, 95, 1);
}

.ship-btn .headlight::before {
  content: "";
  height: 4px;
  width: 7px;
  opacity: 0;
  transform: perspective(2px) rotateY(-15deg) scaleX(0.94);
  position: absolute;
  transform-origin: 0 50%;
  left: 3px;
  top: 50%;
  margin-top: -2px;
  background: linear-gradient(90deg, rgba(240, 220, 95, 1), rgba(240, 220, 95, 0.7), rgba(240, 220, 95, 0));
}

.ship-btn .headlight.top {
  top: 4px;
}

.ship-btn .headlight.bottom {
  bottom: 4px;
}

.ship-btn.go .lbl.idle {
  --o: 0;
  transition-delay: 0s;
}

.ship-btn.go .lbl.done {
  --o: 1;
  transition-delay: 3.2s;
}

.ship-btn.go .lbl.done svg {
  stroke-dashoffset: 0;
  transition-delay: 3.5s;
}

.ship-btn.go .vehicle {
  animation: ship-veh 4.8s ease forwards;
}

.ship-btn.go .vehicle::before {
  animation: ship-hatch1 1.4s ease forwards 0.2s;
}

.ship-btn.go .vehicle::after {
  animation: ship-hatch2 1.4s ease forwards 0.35s;
}

.ship-btn.go .headlight::before {
  animation: ship-glow 4.8s ease forwards;
}

.ship-btn.go .cargo {
  animation: ship-pkg 4.8s ease forwards;
}

.ship-btn.go .rail {
  animation: ship-rails 4.8s ease forwards;
}

@keyframes ship-veh {
  10%,
  30% {
    transform: translateX(-164px);
  }
  40% {
    transform: translateX(-104px);
  }
  60% {
    transform: translateX(-224px);
  }
  75%,
  100% {
    transform: translateX(24px);
  }
}

@keyframes ship-rails {
  0%,
  30% {
    opacity: 0;
    transform: scaleY(0.7) translateX(0);
  }
  35%,
  65% {
    opacity: 1;
  }
  70% {
    opacity: 0;
  }
  100% {
    transform: scaleY(0.7) translateX(-400px);
  }
}

@keyframes ship-glow {
  0%,
  30% {
    opacity: 0;
    transform: perspective(2px) rotateY(-15deg) scaleX(0.88);
  }
  40%,
  100% {
    opacity: 1;
    transform: perspective(2px) rotateY(-15deg) scaleX(0.94);
  }
}

@keyframes ship-hatch1 {
  30%,
  50% {
    transform: rotate(32deg);
  }
}

@keyframes ship-hatch2 {
  30%,
  50% {
    transform: rotate(-32deg);
  }
}

@keyframes ship-pkg {
  8%,
  10% {
    transform: translateX(40px);
    opacity: 1;
  }
  25% {
    transform: translateX(112px);
    opacity: 1;
  }
  26% {
    transform: translateX(112px);
    opacity: 0;
  }
  27%,
  100% {
    transform: translateX(0);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ship-btn.go .vehicle,
  .ship-btn.go .vehicle::before,
  .ship-btn.go .vehicle::after,
  .ship-btn.go .headlight::before,
  .ship-btn.go .cargo,
  .ship-btn.go .rail {
    animation: none;
  }

  .ship-btn.go .lbl.done {
    transition-delay: 0.2s;
  }

  .ship-btn.go .lbl.done svg {
    transition-delay: 0.3s;
  }
}

/* Layout for .ship-btn-wrap lives in features-rwd.css (phone / tablet / desktop). */

.ship-btn:focus-visible {
  outline: 2px solid #275efe;
  outline-offset: 3px;
}
