/* The Face ID pay button with the corners that become a check. One graphite glass pill on a black page: the glass is
   a gradient with a line of light along the top, a 1px edge and a fine grain (no big blur). GSAP moves .pay (press,
   shake), .pay__words (width), the layers, the chip icons and the glyph's strokes; the CSS styles the rest. */
:root {
  --page: #000000;                        /* the page */
  --glass-top: #202126;                   /* the glass, at the top */
  --glass-bottom: #111216;                /* the glass, at the bottom */
  --edge: rgba(255, 255, 255, 0.1);       /* the 1px edge */
  --well: #0a0b0d;                        /* the round well of the glyph */
  --ink: #f2f3f5;                         /* the words */
  --muted: #8d919a;                       /* the small words */
  --glyph: #c9ccd3;                       /* the face glyph at rest */
  --mint: #5ef2b8;                        /* the accent: the scan and Paid */
  --coral: #ff6d5e;                       /* not recognised */
}

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

.stage {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow: hidden;
}

/* ------------------------------------------------------------------ the pill */
.pay {
  --mx: 30%;
  --my: 0%;
  --tone: var(--glyph);          /* the colour of the glyph, moved by GSAP */
  --lit: 0;                      /* 0 rest, 1 paid: the mint in the glass */
  --hot: 0;                      /* 1 while the pointer is over it */
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  height: 64px;
  max-width: calc(100vw - 24px);
  padding: 0 12px 0 10px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  isolation: isolate;
  -webkit-tap-highlight-color: transparent;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04),
    0 2px 4px rgba(0, 0, 0, 0.6),
    0 14px 30px -10px rgba(0, 0, 0, 0.9),
    0 40px 70px -30px rgba(94, 242, 184, calc(var(--lit) * 0.35));
}

.pay:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 4px;
}

/* the glass: gradient, line of light on top, grain */
.pay__glass,
.pay__tint,
.pay__glow,
.pay__sweep {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
}

.pay__glass {
  z-index: -3;
  background:
    linear-gradient(180deg, var(--glass-top), var(--glass-bottom));
  box-shadow:
    inset 0 0 0 1px var(--edge),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -10px 18px -12px rgba(0, 0, 0, 0.8);
}

.pay__glass::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0.11;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%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.9 0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* the mint that spreads from the glyph when it is paid, and the edge that takes it */
.pay__tint {
  z-index: -2;
  opacity: var(--lit);
  background:
    radial-gradient(120% 160% at 0% 50%, rgba(94, 242, 184, 0.22), rgba(94, 242, 184, 0.05) 55%, transparent 80%);
  box-shadow: inset 0 0 0 1px rgba(94, 242, 184, 0.34), inset 0 1px 0 rgba(190, 255, 228, 0.25);
}

/* the light under the pointer */
.pay__glow {
  z-index: -1;
  opacity: calc(var(--hot) * 0.9);
  background: radial-gradient(140px 90px at var(--mx) var(--my), rgba(255, 255, 255, 0.09), transparent 70%);
  transition: opacity 0.35s ease;
}

/* the band of light that crosses the pill while it scans */
.pay__sweep {
  overflow: hidden;
  z-index: 0;
}

.pay__sweep i {
  position: absolute;
  top: -20%;
  bottom: -20%;
  left: 0;
  width: 46%;
  opacity: 0;
  background: linear-gradient(100deg, transparent 10%, rgba(94, 242, 184, 0.13) 45%, rgba(220, 255, 240, 0.2) 50%, rgba(94, 242, 184, 0.13) 55%, transparent 90%);
  transform: translateX(-120%);
}

/* ------------------------------------------------------------------ the glyph in its well */
.fid {
  position: relative;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(circle at 50% 30%, #17181c, var(--well) 70%);
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.9),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05),
    0 1px 0 rgba(255, 255, 255, 0.07);
}

.fid__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px var(--tone);
  opacity: 0;
}

.fid__svg {
  position: absolute;
  left: 7px;
  top: 7px;
  width: 30px;
  height: 30px;
  overflow: visible;
  fill: none;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fid__base {
  stroke: var(--tone);
}

.fid__lit {
  stroke: #ffffff;
}

.fid__band {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 18px;
  opacity: 0;
  background: linear-gradient(180deg, transparent, rgba(94, 242, 184, 0.28) 50%, transparent);
  transform: translateY(-20px);
  mix-blend-mode: screen;
}

/* ------------------------------------------------------------------ the words */
.pay__words {
  position: relative;
  display: block;
  height: 40px;
  min-width: 0;
  overflow: hidden;
}

.pay__layer {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  height: 40px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
}

.pay__layer[data-layer='rest'] {
  opacity: 1;
  visibility: visible;
}

.pay__t {
  font-size: 15.5px;
  font-weight: 600;
  font-stretch: 100%;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.pay__s {
  font-size: 12.5px;
  font-weight: 450;
  color: var(--muted);
  line-height: 1.15;
}

.pay__layer--error .pay__t {
  color: var(--coral);
}

.pay__layer--paid .pay__t {
  font-stretch: 112%;
  font-weight: 650;
}

.pay__layer--paid .pay__s {
  color: rgba(190, 240, 220, 0.62);
}

/* ------------------------------------------------------------------ the chip on the right */
.chip {
  position: relative;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.chip svg {
  position: absolute;
  left: 8px;
  top: 8px;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chip__spin {
  opacity: 0;
  stroke: var(--mint) !important;
}

.chip__spin circle {
  stroke-dasharray: 0.28 0.72;
}

.chip__receipt {
  opacity: 0;
  stroke: var(--mint) !important;
}

@media (hover: hover) {
  .pay:hover {
    --hot: 1;
  }
}

/* a narrow phone: the same pill, a little tighter */
@media (max-width: 360px) {
  .pay {
    gap: 11px;
    padding: 0 10px 0 9px;
  }
  .pay__t {
    font-size: 14.5px;
  }
  .pay__s {
    font-size: 12px;
  }
}
