/* The Get directions button with the route that draws itself and the drive time that rolls. A white page and in the
   middle one graphite pill with a hairline edge that catches the light. Inside, layered in one rounded box (.gd__body,
   moved only by GSAP): the graphite fill, a cool blue light that grows from the turn sign as the route is found, the
   light under the pointer, the glint that crosses at the end and the edges on top. Then the row: the disc (turn sign
   and navigation arrow), the middle (the words, and under them the little street plan with the route and the pin)
   and the chip with the odometer of the drive time and the miles. */
:root {
  --page: #ffffff;            /* the page */
  --graphite: #16181d;        /* the pill */
  --graphite-hi: #2a2e37;     /* the top of the pill, where the light falls */
  --accent: #6e9bff;          /* the route, the arrow and the pin */
  --accent-deep: #3e6df0;     /* the deep side of the accent */
  --ink: #f4f6fb;             /* the words */
  --muted: rgba(228, 233, 245, 0.56); /* the small line under the words */
  --street: rgba(214, 224, 255, 0.11); /* the streets of the little plan */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.stage {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow: hidden;
  background: var(--page);
}

.gd {
  position: relative;
  display: grid;
  place-items: center;
}

/* the soft shadow on the white page and the blue light the found route throws under the pill */
.gd__spill {
  position: absolute;
  left: 50%;
  top: 100%;
  width: 92%;
  height: 34px;
  margin: -20px 0 0 -46%;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 60%, transparent), color-mix(in srgb, var(--accent-deep) 18%, transparent) 60%, transparent);
  filter: blur(14px);
  opacity: 0;
  pointer-events: none;
}

.gd__btn {
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  border-radius: 999px;
  -webkit-tap-highlight-color: transparent;
}

.gd__btn:focus-visible {
  outline: 2px solid var(--accent-deep);
  outline-offset: 5px;
}

.gd__body {
  --mx: 50%;
  --my: 50%;
  position: relative;
  display: block;
  width: min(88vw, 328px);
  height: 60px;
  border-radius: 999px;
  isolation: isolate;
  box-shadow:
    0 0 0 1px rgba(14, 16, 22, 0.9),
    0 1px 1px rgba(14, 18, 30, 0.22),
    0 4px 8px -2px rgba(14, 18, 30, 0.18),
    0 14px 26px -10px rgba(14, 22, 48, 0.34),
    0 30px 46px -24px rgba(20, 34, 80, 0.36);
}

.gd__fill,
.gd__glow,
.gd__shine,
.gd__sweep,
.gd__edge {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
}

/* graphite: lighter at the top, with a fine grain */
.gd__fill {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(180deg, var(--graphite-hi), var(--graphite) 55%, #101216);
  background-size: 120px 120px, auto;
}

/* the cool light that spreads from the turn sign while the route is found (GSAP scales it) */
.gd__glow-light {
  position: absolute;
  left: -26px;
  top: -50%;
  width: 150px;
  height: 200%;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 34%, transparent), color-mix(in srgb, var(--accent) 10%, transparent) 55%, transparent);
  transform-origin: 30px 50%;
  opacity: 0;
}

/* the light under the pointer */
.gd__shine {
  background: radial-gradient(110px 66px at var(--mx) var(--my), rgba(220, 230, 255, 0.14), rgba(220, 230, 255, 0.04) 50%, transparent 72%);
  opacity: 0;
}

/* the glint that crosses the pill when the route is found */
.gd__sweep-band {
  position: absolute;
  top: -30%;
  left: 0;
  width: 30%;
  height: 160%;
  background: linear-gradient(100deg, transparent 0%, rgba(220, 232, 255, 0.04) 30%, rgba(220, 232, 255, 0.22) 50%, rgba(220, 232, 255, 0.04) 70%, transparent 100%);
  transform: translateX(-140%) skewX(-16deg);
}

/* the edges: a hairline that catches the light at the top and goes dark at the bottom */
.gd__edge {
  z-index: 3;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    inset 0 -1px 0 rgba(0, 0, 0, 0.5),
    inset 0 -12px 18px -12px rgba(0, 0, 0, 0.6);
}

.gd__edge::after {
  content: '';
  position: absolute;
  left: 10%;
  right: 10%;
  top: 1px;
  height: 42%;
  border-radius: 999px 999px 40% 40%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0));
}

.gd__row {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 8px;
  gap: 10px;
}

/* the disc on the left: a dark well with the turn sign, then the navigation arrow */
.gd__disc {
  position: relative;
  flex: none;
  width: 44px;
  height: 44px;
}

.gd__plate {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 28%, rgba(255, 255, 255, 0.08), transparent 62%),
    #0e1014;
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.7),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05),
    0 1px 0 rgba(255, 255, 255, 0.07);
}

.gd__plate::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--accent) 46%, transparent), color-mix(in srgb, var(--accent-deep) 20%, transparent) 60%, transparent 75%);
  opacity: var(--lit, 0);
}

.gd__sign,
.gd__nav {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 24px;
  height: 24px;
  margin: -12px 0 0 -12px;
  overflow: visible;
}

.gd__sign-shape {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.5;
  stroke-linejoin: round;
}

.gd__sign-arrow {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.gd__nav {
  opacity: 0;
}

.gd__nav path {
  fill: var(--accent);
  stroke: color-mix(in srgb, var(--accent) 60%, white);
  stroke-width: 0.8;
  stroke-linejoin: round;
}

/* the middle: the words on top of the little street plan */
.gd__mid {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
}

.gd__text {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  gap: 2px;
  text-align: left;
}

.gd__title {
  font-size: 15px;
  font-weight: 620;
  font-stretch: 104%;
  letter-spacing: -0.005em;
  line-height: 1.15;
  white-space: nowrap;
}

.gd__sub {
  font-size: 11.5px;
  font-weight: 460;
  color: var(--muted);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gd__map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
}

.gd__streets path {
  fill: none;
  stroke: var(--street);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.gd__streets .gd__block {
  fill: rgba(214, 224, 255, 0.035);
  stroke: none;
}

.gd__streets .gd__park {
  fill: rgba(140, 200, 170, 0.07);
  stroke: none;
}

.gd__route-under {
  fill: none;
  stroke: rgba(0, 0, 0, 0.55);
  stroke-width: 4.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.gd__route-glow {
  fill: none;
  stroke: var(--accent);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.32;
  filter: blur(3px);
}

.gd__route {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.gd__route-shine {
  fill: none;
  stroke: #fff;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  mix-blend-mode: screen;
}

.gd__start {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linecap: round;
}

.gd__car path {
  fill: #fff;
  stroke: var(--accent-deep);
  stroke-width: 0.8;
  stroke-linejoin: round;
}

.gd__pin-shadow {
  fill: rgba(0, 0, 0, 0.6);
}

.gd__pin-body {
  fill: var(--accent);
  stroke: color-mix(in srgb, var(--accent) 55%, white);
  stroke-width: 0.7;
}

.gd__pin-mark {
  fill: #0f1a3a;
}

/* the chip on the right: the odometer of the drive time, and the miles */
.gd__chip {
  position: relative;
  flex: none;
  display: grid;
  justify-items: end;
  gap: 1px;
  min-width: 56px;
  padding: 0 12px 0 4px;
}

.gd__eta {
  display: flex;
  align-items: baseline;
  font-size: 16px;
  font-weight: 660;
  font-stretch: 100%;
  line-height: 1;
}

.gd__col {
  position: relative;
  display: inline-block;
  width: 0.6em;
  height: 1.1em;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 22%, #000 78%, transparent);
  mask-image: linear-gradient(180deg, transparent, #000 22%, #000 78%, transparent);
}

.gd__strip {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  display: grid;
}

.gd__strip span {
  display: block;
  height: 1.1em;
  line-height: 1.1em;
  text-align: center;
}

.gd__unit {
  margin-left: 3px;
  font-size: 11px;
  font-weight: 520;
  color: var(--muted);
}

.gd__chip-sub {
  position: relative;
  display: block;
  width: 100%;
  height: 13px;
  font-size: 10.5px;
  font-weight: 480;
  color: var(--muted);
}

.gd__chip-face {
  position: absolute;
  right: 0;
  top: 0;
  white-space: nowrap;
}

@media (max-width: 360px) {
  .gd__title {
    font-size: 14px;
    font-stretch: 96%;
  }
  .gd__sub {
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gd__route-glow {
    filter: none;
    opacity: 0.18;
  }
}
