/* FROM — Services, section 2: riding with FROM. Words on the left; on the right the rider app on a light street
   map, with a switch people can flip: online, a trip offer slides up, Accept draws the way to the pickup.
   js/ride.js runs it. */

.ride {
  padding: clamp(88px, 11vw, 160px) 0;
  background: var(--paper-warm);
}

.ride__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr);
  align-items: center;
  gap: 56px clamp(48px, 7vw, 120px);
}

.ride__title {
  max-width: 13ch;
  margin: 0;
  font-size: clamp(36px, 4.6vw, 72px);
  line-height: 1.02;
  font-weight: 760;
  letter-spacing: -0.05em;
  text-wrap: balance;
}

.ride__title em {
  font-style: normal;
  color: var(--orange);
}

.ride__lede {
  max-width: 44ch;
  margin-top: 28px;
  font-size: clamp(17px, 1.4vw, 21px);
  line-height: 1.55;
  color: var(--ink-2);
}

.ride__points {
  display: grid;
  gap: 14px;
  max-width: 44ch;
  margin: 32px 0 0;
  padding: 28px 0 0;
  border-top: 1.5px solid var(--line);
  list-style: none;
}

.ride__points li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 17px;
  line-height: 1.45;
  font-weight: 600;
}

.ride__points .icon {
  width: 24px;
  height: 24px;
  padding: 5px;
  border-radius: 50%;
  background: var(--orange);
  color: #fff;
  stroke-width: 3;
}

/* ---------- The rider app ---------- */

.rider-app {
  position: relative;
  aspect-ratio: 4 / 5;
  min-height: 520px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #f7f1ea;
  box-shadow: inset 0 0 0 1px rgba(7, 13, 23, 0.06);
  isolation: isolate;
}

.rider-app__map,
.rider-app__route {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.rider-app__map {
  object-fit: cover;
  filter: grayscale(1);
  opacity: 0.55;
  transition: filter 0.8s, opacity 0.8s;
}

.rider-app.is-online .rider-app__map {
  filter: none;
  opacity: 1;
}

/* The trip on the map: the way to the pickup (after Accept), then the trip itself. */
.rider-app__route path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 1.2s var(--ease-out);
}

.rider-app__trip {
  stroke: var(--orange);
  stroke-width: 9;
}

.rider-app__way {
  stroke: var(--ink);
  stroke-width: 6;
}

.rider-app.has-offer .rider-app__trip,
.rider-app.is-accepted .rider-app__way {
  stroke-dashoffset: 0;
}

.rider-app__stop {
  opacity: 0;
  transition: opacity 0.4s;
}

.rider-app.has-offer .rider-app__stop {
  opacity: 1;
}

/* You, on the map: grey when offline, orange and pulsing when online. */
.rider-app__me circle {
  fill: #9aa1ab;
  transition: fill 0.4s;
}

.rider-app__me .rider-app__pulse {
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
}

.rider-app.is-online .rider-app__me circle {
  fill: var(--orange);
}

.rider-app.is-online .rider-app__pulse {
  animation: rider-pulse 2s var(--ease-out) infinite;
}

@keyframes rider-pulse {
  from {
    opacity: 0.45;
    transform: scale(0.6);
  }
  to {
    opacity: 0;
    transform: scale(2.6);
  }
}

/* The bar at the top: status and the switch. */
.rider-app__bar {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 10px 10px 20px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(7, 13, 23, 0.1);
}

.rider-app__status {
  display: grid;
  font-size: 16px;
  font-weight: 700;
}

.rider-app__status small {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-3);
}

.switch {
  position: relative;
  flex: none;
  width: 64px;
  height: 38px;
  border-radius: 999px;
  background: #d9dde3;
  transition: background-color 0.3s;
}

.switch__knob {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(7, 13, 23, 0.2);
  transition: transform 0.35s var(--ease-out);
}

.switch[aria-checked="true"] {
  background: var(--orange);
}

.switch[aria-checked="true"] .switch__knob {
  transform: translateX(26px);
}

.switch:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

/* A nudge to try the switch, until someone has. */
.rider-app__try {
  position: absolute;
  top: 78px;
  right: 22px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  transition: opacity 0.3s;
}

.rider-app__try::before {
  content: "";
  position: absolute;
  top: -5px;
  right: 26px;
  width: 10px;
  height: 10px;
  background: inherit;
  transform: rotate(45deg);
}

.rider-app.is-touched .rider-app__try,
.rider-app.is-online .rider-app__try {
  opacity: 0;
}

/* ---------- The trip offer ---------- */

.offer {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  padding: 18px;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 -10px 40px rgba(7, 13, 23, 0.14);
  transform: translateY(calc(100% + 24px));
  transition: transform 0.6s var(--ease-out);
}

.rider-app.has-offer .offer {
  transform: none;
}

.offer__title {
  font-size: 14px;
  font-weight: 650;
  color: var(--orange-ink);
}

.offer__stops {
  position: relative;
  display: grid;
  gap: 12px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.offer__stops::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 14px;
  bottom: 14px;
  border-left: 2px dotted var(--ink-3);
}

.offer__stops li {
  position: relative;
  display: grid;
  padding-left: 28px;
  font-size: 16px;
  font-weight: 650;
}

.offer__stops li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 4px var(--ink);
}

.offer__stops li:last-child::before {
  border-radius: 4px;
  box-shadow: inset 0 0 0 4px var(--orange);
}

.offer__stops span {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-3);
}

.offer__facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.offer__facts dt {
  font-size: 12px;
  color: var(--ink-3);
}

.offer__facts dd {
  margin: 2px 0 0;
  font-size: 16px;
  font-weight: 700;
}

.offer__facts div:last-child dd {
  color: var(--orange-ink);
}

.offer__actions {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 10px;
  margin-top: 14px;
}

.offer__actions button {
  height: 46px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  transition: background-color 0.2s, transform 0.2s;
}

.offer__actions button:active {
  transform: scale(0.97);
}

.offer__no {
  background: var(--paper-warm);
}

.offer__yes {
  background: var(--orange);
  color: #fff;
}

.offer__done {
  display: none;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  height: 46px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--orange-wash);
  font-size: 15px;
  font-weight: 650;
}

.offer__done .icon {
  width: 22px;
  height: 22px;
  padding: 4px;
  border-radius: 50%;
  background: var(--orange);
  color: #fff;
  stroke-width: 3;
}

.rider-app.is-accepted .offer__actions {
  display: none;
}

.rider-app.is-accepted .offer__done {
  display: flex;
}

/* ---------- Tablet and phone ---------- */

@media (max-width: 1000px) {
  .ride__grid {
    grid-template-columns: 1fr;
  }

  .rider-app {
    max-width: 560px;
  }
}

@media (max-width: 480px) {
  .rider-app {
    aspect-ratio: auto;
    height: 600px;
    min-height: 0;
  }

  .rider-app__bar {
    top: 12px;
    left: 12px;
    right: 12px;
  }

  .offer {
    left: 12px;
    right: 12px;
    bottom: 12px;
    padding: 16px;
  }
}
