/* The Lock fare button with the digits that stop. One pill of dark graphite (.fl__body, moved only by GSAP) with its
   layers inside: the shell with the 1px edge and the grain, the light under the pointer, the reflection that crosses
   it when the fare is locked, and the row with the lock, the words and the price capsule. The price is an odometer:
   every digit is a column of 0-9 written three times, slid by GSAP. */
:root {
  --page: #060607;            /* the page */
  --gold: #f3b862;            /* the light of the lock, the ring and the glow */
  --ink: #f4f1ea;             /* the words */
  --muted: rgba(244, 241, 234, 0.56); /* the small line under the words */
  --up: #ff9f74;              /* the fare going up */
  --down: #8fe3c0;            /* the fare going down */
  --shell-top: #1d1c20;       /* the pill, at the top */
  --shell-bottom: #0d0d0f;    /* the pill, at the bottom */
}

* {
  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;
}

/* the page: near black, a warm light from above and a fine grain */
.stage {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow: hidden;
  background:
    radial-gradient(ellipse min(70vw, 520px) min(46vh, 300px) at 50% 38%, color-mix(in srgb, var(--gold) 9%, transparent), transparent 70%),
    radial-gradient(ellipse 90% 60% at 50% 110%, rgba(255, 255, 255, 0.035), transparent 70%),
    var(--page);
}

.stage::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.5;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' 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.09 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

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

/* the warm light the button throws on the floor */
.fl__spill {
  position: absolute;
  left: 50%;
  top: 100%;
  width: 110%;
  height: 44px;
  margin: -16px 0 0 -55%;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--gold) 55%, transparent), color-mix(in srgb, var(--gold) 14%, transparent) 60%, transparent);
  filter: blur(16px);
  opacity: 0.18;
  pointer-events: none;
}

.fl__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;
}

.fl__btn:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--gold) 80%, white);
  outline-offset: 5px;
}

.fl__body {
  --mx: 50%;
  --my: 50%;
  position: relative;
  display: block;
  width: min(86vw, 318px);
  height: 60px;
  border-radius: 999px;
  isolation: isolate;
  box-shadow:
    0 1px 1px rgba(0, 0, 0, 0.8),
    0 6px 14px -6px rgba(0, 0, 0, 0.9),
    0 18px 40px -18px color-mix(in srgb, var(--gold) 34%, transparent),
    0 36px 70px -30px rgba(0, 0, 0, 1);
}

.fl__shell,
.fl__shine,
.fl__sweep {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
}

/* graphite with a 1px edge that catches the light at the top, a darker one below and a very fine grain */
.fl__shell {
  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.95' 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.16 0'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(180deg, var(--shell-top), var(--shell-bottom));
  background-size: 120px 120px, 100% 100%;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -1px 0 rgba(0, 0, 0, 0.6),
    inset 0 -12px 20px -14px rgba(0, 0, 0, 0.8);
}

/* a soft highlight on the upper half */
.fl__shell::after {
  content: '';
  position: absolute;
  left: 7%;
  right: 7%;
  top: 1px;
  height: 44%;
  border-radius: 999px 999px 40% 40%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0));
}

/* the light under the pointer */
.fl__shine {
  background: radial-gradient(110px 70px at var(--mx) var(--my), color-mix(in srgb, var(--gold) 16%, transparent), rgba(255, 255, 255, 0.025) 52%, transparent 74%);
  opacity: 0;
}

/* the reflection that crosses the pill when the fare is locked */
.fl__sweep-band {
  position: absolute;
  top: -30%;
  left: 0;
  width: 34%;
  height: 160%;
  background: linear-gradient(100deg, transparent 0%, rgba(255, 236, 200, 0.04) 30%, rgba(255, 240, 214, 0.24) 50%, rgba(255, 236, 200, 0.04) 70%, transparent 100%);
  transform: translateX(-140%) skewX(-16deg);
}

.fl__row {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 9px 0 9px;
  gap: 11px;
}

/* the lock, in a small round well */
.fl__icon {
  position: relative;
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.015));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 2px rgba(0, 0, 0, 0.5);
}

.fl__icon-glow {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 60%, color-mix(in srgb, var(--gold) 46%, transparent), transparent 70%);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--gold) 45%, transparent);
  opacity: 0;
}

.fl__icon svg {
  position: relative;
  width: 22px;
  height: 22px;
  overflow: visible;
}

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

.fl__lockbody {
  fill: var(--ink);
}

.fl__keyhole {
  fill: none;
  stroke: var(--shell-bottom);
  stroke-width: 1.8;
  stroke-linecap: round;
}

.fl__text {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
  text-align: left;
}

.fl__labels,
.fl__subs {
  display: grid;
}

.fl__label {
  grid-area: 1 / 1;
  font-size: 15.5px;
  line-height: 1.15;
  font-weight: 590;
  font-variation-settings: 'wdth' 102;
  letter-spacing: 0.002em;
  white-space: nowrap;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);
}

/* Locking fare: a warm band of light slides through the letters (GSAP moves background-position) */
.fl__label--busy {
  background: linear-gradient(90deg, var(--ink) 0%, var(--ink) 38%, #ffffff 46%, var(--gold) 50%, #ffffff 54%, var(--ink) 62%, var(--ink) 100%);
  background-size: 260% 100%;
  background-position: 100% 0;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
}

.fl__sub {
  grid-area: 1 / 1;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  line-height: 1.2;
  font-weight: 500;
  font-variation-settings: 'wdth' 96;
  letter-spacing: 0.02em;
  color: var(--muted);
  white-space: nowrap;
}

.fl__arrow {
  width: 12px;
  height: 8px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fl__sep {
  opacity: 0.6;
  margin: 0 1px;
}

.fl__live {
  color: color-mix(in srgb, var(--gold) 80%, var(--ink));
}

.fl__clock {
  font-variant-numeric: tabular-nums;
  color: color-mix(in srgb, var(--gold) 70%, var(--ink));
}

/* the price capsule */
.fl__price {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  gap: 5px;
  height: 42px;
  padding: 0 13px 0 11px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0.2));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), inset 0 1px 2px rgba(0, 0, 0, 0.6), 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* a thin light that runs over the top of the capsule at every update of the fare */
.fl__scan {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
}

.fl__scan-band {
  position: absolute;
  top: 0;
  left: 0;
  width: 46%;
  height: 1px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--gold) 80%, white), transparent);
  opacity: 0;
}

.fl__ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.fl__ring path {
  fill: none;
  stroke: url(#fl-grad);
  stroke-linecap: round;
  opacity: 0;
}

.fl__ring-line {
  stroke-width: 1.4;
}

.fl__ring-glow {
  stroke-width: 5;
  filter: blur(3px);
}

.fl__trend {
  flex: none;
  width: 9px;
  height: 9px;
  display: grid;
}

.fl__trend svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.fl__trend-up {
  fill: var(--up);
  opacity: 0;
}

.fl__trend-down {
  fill: var(--down);
}

.fl__amount {
  display: flex;
  align-items: baseline;
  font-size: 18px;
  font-weight: 640;
  font-variation-settings: 'wdth' 94;
  letter-spacing: -0.005em;
  line-height: 1;
}

.fl__cur {
  font-size: 13px;
  font-weight: 560;
  color: var(--muted);
  margin-right: 1px;
  transform: translateY(-3px);
}

.fl__digits {
  display: flex;
  height: 1.16em;
  overflow: hidden;
  /* the digits fade at the top and bottom of their window, like a real counter */
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 24%, #000 76%, transparent);
  mask-image: linear-gradient(180deg, transparent, #000 24%, #000 76%, transparent);
}

.fl__digit {
  display: block;
  width: 0.6em;
  height: 1.16em;
  overflow: visible;
}

.fl__col {
  display: block;
  text-align: center;
}

.fl__col span {
  display: block;
  height: 1.16em;
  line-height: 1.16em;
}

/* before the script runs, only the rest state shows */
.fl__label + .fl__label,
.fl__sub + .fl__sub {
  opacity: 0;
}
