/* The virtual card with the number that reveals itself as you pass: the card of a banking app, graphite with a soft
   violet aura, on a near black page. The digits live in fixed cells, so their width axis can swell and settle without
   moving the others; the bars that hide them sit in the same cells. The pill under the card changes its words. */
:root {
  --page: #0b0b0d;          /* the page */
  --card-a: #1c1c21;        /* the card, top left */
  --card-b: #0f0f12;        /* the card, bottom right */
  --ink: #f1f0f4;           /* the words on the card */
  --muted: #8b8a96;         /* the small words */
  --accent: #a493ff;        /* the aura and the light */
  --bar: rgba(241, 240, 244, 0.34); /* the bars that hide the digits */
  --pill: #f3f2f6;          /* the pill */
  --pill-ink: #0b0b0d;      /* the words on the pill */
}

* {
  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 {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow: hidden;
  background: radial-gradient(60% 45% at 50% 46%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 70%);
}

.wallet {
  width: min(86vw, 360px, calc((100vh - 130px) * 1.586));
  display: grid;
  gap: clamp(12px, 3vh, 18px);
  opacity: 0;
}

/* the element GSAP tilts; the body inside keeps its own transform free */
.card {
  container-type: inline-size;
  perspective: 900px;
}

.card__body {
  position: relative;
  aspect-ratio: 1.586;
  border-radius: 4.6cqw;
  overflow: hidden;
  padding: 6cqw 6.4cqw 5.4cqw;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  background: linear-gradient(135deg, var(--card-a), var(--card-b) 70%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 1px 1px rgba(0, 0, 0, 0.5),
    0 12px 24px -10px rgba(0, 0, 0, 0.7),
    0 40px 70px -30px rgba(0, 0, 0, 0.9);
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
}

.card__grain {
  position: absolute;
  inset: 0;
  opacity: 0.09;
  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='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
}

.card__aura {
  position: absolute;
  width: 80cqw;
  height: 80cqw;
  right: -34cqw;
  top: -44cqw;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 36%, transparent), transparent);
  filter: blur(6px);
  pointer-events: none;
}

/* the band of light that crosses the card; GSAP moves it on x */
.card__sheen {
  position: absolute;
  top: -20%;
  bottom: -20%;
  left: 0;
  width: 34cqw;
  margin-left: -17cqw;
  background: linear-gradient(90deg,
    transparent,
    color-mix(in srgb, var(--accent) 10%, transparent) 30%,
    rgba(255, 255, 255, 0.16) 50%,
    color-mix(in srgb, var(--accent) 10%, transparent) 70%,
    transparent);
  mix-blend-mode: screen;
  opacity: 0;
  pointer-events: none;
}

.card__head,
.card__marks,
.card__number,
.card__foot {
  position: relative;
}

.card__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card__brand {
  font-size: 5.4cqw;
  font-weight: 700;
  font-variation-settings: 'wdth' 118;
  letter-spacing: -0.02em;
}

.card__kind {
  font-size: 2.9cqw;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 1cqw 2.4cqw;
  border-radius: 99px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.card__marks {
  display: flex;
  align-items: center;
  gap: 3cqw;
  align-self: center;
}

.card__chip {
  width: 10.4cqw;
  height: auto;
  display: block;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.5));
}

.card__wave {
  width: 4.6cqw;
  height: auto;
  color: var(--muted);
}

.card__number {
  margin: 0 0 4.6cqw;
  display: flex;
  gap: 3.6cqw;
  font-size: 6.6cqw;
  line-height: 1;
}

.card__group {
  display: flex;
}

/* one digit: a fixed cell, the glyph and the bar on top of each other */
.d {
  position: relative;
  width: 0.6em;
  height: 1.1em;
  display: grid;
  place-items: center;
}

.d__ch {
  --w: 100;
  --g: 500;
  display: block;
  font-variation-settings: 'wdth' var(--w), 'wght' var(--g);
  font-variant-numeric: tabular-nums;
  will-change: transform, opacity, filter;
}

.d__bar {
  position: absolute;
  left: 18%;
  right: 18%;
  top: 50%;
  height: 0.09em;
  min-height: 1.5px;
  margin-top: -0.045em;
  border-radius: 2px;
  background: var(--bar);
}

.card__foot {
  display: flex;
  gap: 6cqw;
  align-items: flex-end;
}

.card__field {
  display: grid;
  gap: 1cqw;
}

.card__field:first-child {
  margin-right: auto;
}

.card__label {
  font-size: 2.5cqw;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.card__value {
  font-size: 3.6cqw;
  font-weight: 560;
  font-variation-settings: 'wdth' 104;
  white-space: nowrap;
}

.card__digits {
  display: flex;
  font-size: 3.9cqw;
  line-height: 1;
}

/* the row under the card */
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px;
}

.row__name {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.row__title {
  font-size: 14px;
  font-weight: 600;
  font-variation-settings: 'wdth' 106;
}

.row__note {
  --w: 100;
  font-size: 12px;
  color: var(--muted);
  font-variation-settings: 'wdth' var(--w);
  white-space: nowrap;
}

.pill {
  appearance: none;
  border: 0;
  padding: 0;
  background: none;
  font: inherit;
  cursor: pointer;
  flex: none;
  -webkit-tap-highlight-color: transparent;
}

.pill__face {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 16px 0 13px;
  border-radius: 99px;
  background: var(--pill);
  color: var(--pill-ink);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.12), 0 6px 16px -8px rgba(0, 0, 0, 0.8);
  overflow: hidden;
  white-space: nowrap;
}

.pill:focus-visible .pill__face {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.pill__icon {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
}

.pill__copy,
.pill__check {
  opacity: 0;
}

.pill__words {
  --w: 100;
  display: inline-block;
  font-size: 13.5px;
  font-weight: 600;
  font-variation-settings: 'wdth' var(--w);
}

@media (hover: hover) {
  .pill:hover .pill__face {
    background: #ffffff;
  }
}
