/* The invite-a-friend card of Tallow, a made-up savings app: one small card alone on white, a single violet accent. */
:root {
  --fondo: #ffffff;
  --carta: #ffffff;
  --bordo: #ebeae6;
  --linea: #f0efeb;
  --tinta: #f6f5f2;          /* the link well, the bar track */
  --testo: #16141a;
  --testo-2: #5e5a64;
  --testo-3: #9c98a3;
  --accento: #6b4cf6;        /* the single accent: the gift, Copy, the earned label, the bar */
  --accento-scuro: #4a30c9;
  --accento-velo: #efebff;   /* a pale wash of the accent */
  --ombra: 26, 22, 34;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
html { font-size: clamp(9px, min(4.2vw, 3.1vh), 19px); }
body {
  background: var(--fondo);
  color: var(--testo);
  font-family: "Mona Sans Variable", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
ul { list-style: none; }

.stage { height: 100vh; display: grid; place-items: center; padding: 2vh 4vw; }

/* the card */
.card {
  position: relative;
  width: min(19em, 92vw);
  padding: 1.2em 1.2em 1.05em;
  border-radius: 1.4em;
  background: var(--carta);
  box-shadow:
    0 1px 1px rgba(var(--ombra), .05),
    0 6px 14px -6px rgba(var(--ombra), .10),
    0 26px 50px -26px rgba(var(--ombra), .26);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: .95em;
  isolation: isolate;
}
.card__edge {
  position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 3;
  padding: 1px;
  background: linear-gradient(180deg, #f1f0ec, var(--bordo) 30%, #e2e0da);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

/* the header */
.head { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .8em; align-items: center; }
.gift {
  width: 3.2em; height: 3.2em; border-radius: 50%; display: grid; place-items: center;
  background: var(--accento-velo);
  box-shadow: inset 0 0 0 1px rgba(107, 76, 246, .12);
}
.gift svg { width: 1.75em; height: 1.75em; display: block; overflow: visible; }
.gift__box, .gift__lid { fill: #fff; stroke: var(--accento); stroke-width: 1.4; stroke-linejoin: round; }
.gift__ribbon { fill: none; stroke: var(--accento); stroke-width: 1.4; }
.gift__bow { fill: var(--accento-velo); stroke: var(--accento); stroke-width: 1.3; stroke-linejoin: round; }
.head__txt { display: grid; gap: .12em; min-width: 0; }
.brand { font-size: .66em; color: var(--testo-3); font-weight: 600; letter-spacing: .02em; }
.title { font-size: 1.12em; font-weight: 680; letter-spacing: -.02em; line-height: 1.15; }
.sub { font-size: .7em; color: var(--testo-2); line-height: 1.35; }

/* the link */
.link {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .5em;
  height: 2.75em; padding: 0 .3em 0 .9em; border-radius: 99em;
  background: var(--tinta);
  box-shadow: inset 0 0 0 1px rgba(var(--ombra), .05), inset 0 1px 2px rgba(var(--ombra), .05);
}
.link__url {
  font-family: "JetBrains Mono Variable", ui-monospace, monospace; font-size: .72em; color: var(--testo-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.link__url b { color: var(--testo); font-weight: 600; }
.copy {
  position: relative; width: 6.1em; height: 2.15em; border-radius: 99em;
  font-size: .78em; font-weight: 620; color: #fff;
  touch-action: manipulation;
}
.copy__bg {
  position: absolute; inset: 0; border-radius: inherit; background: var(--accento);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .22) inset, 0 6px 14px -8px rgba(107, 76, 246, .9);
  transition: transform .5s cubic-bezier(.34, 1.56, .64, 1), background-color .3s ease;
}
.copy.is-done .copy__bg { background: var(--testo); box-shadow: 0 1px 0 rgba(255, 255, 255, .14) inset, 0 6px 14px -8px rgba(22, 20, 26, .7); }
.copy__face { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: .35em; white-space: nowrap; pointer-events: none; }
.copy__face[data-cface="done"] { opacity: 0; }
.copy__face span { display: inline-block; font-stretch: 100%; transition: font-stretch .45s cubic-bezier(.34, 1.56, .64, 1); }
@media (hover: hover) {
  .copy:hover .copy__bg { transform: scale(1.04, 1.1); }
  .copy:hover .copy__face span { font-stretch: 110%; }
}
.copy.is-hover .copy__bg { transform: scale(1.04, 1.1); }
.copy.is-hover .copy__face span { font-stretch: 110%; }
.copy:focus-visible { outline: 2px solid var(--accento); outline-offset: 3px; }
.ico { width: 1.1em; height: 1.1em; display: block; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.ico path[pathLength] { stroke-dasharray: 1 1; stroke-dashoffset: 1; stroke-width: 1.9; }

/* the friends */
.friends { display: grid; border-top: 1px solid var(--linea); }
.friend {
  position: relative;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .65em;
  padding: .55em .35em; border-bottom: 1px solid var(--linea);
}
.friend::before {
  content: ""; position: absolute; inset: 2px -.35em; border-radius: .7em; background: var(--tinta);
  opacity: 0; transition: opacity .25s ease; z-index: -1;
}
@media (hover: hover) { .friend:hover::before { opacity: 1; } }
.friend.is-lit::before { opacity: 1; }
.av {
  width: 2.1em; height: 2.1em; border-radius: 50%; display: grid; place-items: center;
  background: var(--av); color: var(--avt); font-size: .82em; font-weight: 680;
}
.av span { display: block; line-height: 1; }
.who { display: grid; gap: .05em; min-width: 0; }
.who b { font-size: .8em; font-weight: 620; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who small { font-size: .64em; color: var(--testo-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; height: 1.3em; line-height: 1.3em; }
.who small span { display: block; }

/* the state label: its width is set by GSAP from the measured text, so the change never jumps */
.state {
  position: relative; display: block; height: 1.7em; border-radius: 99em; overflow: hidden;
  font-size: .66em; font-weight: 640; white-space: nowrap;
  background: transparent; color: var(--testo-2);
  box-shadow: inset 0 0 0 1px var(--bordo);
  transition: background-color .35s ease, color .35s ease, box-shadow .35s ease;
}
.state__txt { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 0 .75em; }
.state[data-state="joined"] { background: var(--tinta); color: var(--testo); box-shadow: inset 0 0 0 1px rgba(var(--ombra), .04); }
.state[data-state="earned"] { background: var(--accento-velo); color: var(--accento-scuro); box-shadow: inset 0 0 0 1px rgba(107, 76, 246, .18); }
.state__ruler { position: absolute; visibility: hidden; white-space: nowrap; padding: 0 .75em; font-size: .66em; font-weight: 640; }

/* the bar to the next reward */
.goal { display: grid; gap: .5em; }
.goal__txt { font-size: .72em; color: var(--testo-2); height: 1.3em; line-height: 1.3em; overflow: hidden; }
.goal__txt b { color: var(--testo); font-weight: 650; }
.bar { position: relative; height: .42em; border-radius: 99em; background: var(--tinta); box-shadow: inset 0 1px 1px rgba(var(--ombra), .06); }
.bar__fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 100%; border-radius: inherit;
  background: linear-gradient(90deg, #8a70ff, var(--accento));
  box-shadow: 0 0 0 .5px rgba(74, 48, 201, .25);
  transform-origin: 0 50%;
}
.bar__notch { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--carta); opacity: .9; }

/* the credit */
.credit { display: flex; align-items: baseline; justify-content: space-between; padding-top: .1em; }
.credit__lab { font-size: .72em; color: var(--testo-3); font-weight: 560; }
.credit__val { display: inline-flex; align-items: baseline; font-size: 1.5em; font-weight: 680; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

/* the rolling digits: each digit is a window over a column 0-9 */
.roll { display: inline-flex; font-variant-numeric: tabular-nums; white-space: nowrap; }
.roll .ch { display: inline-block; position: relative; height: 1.2em; line-height: 1.2em; overflow: hidden; vertical-align: bottom;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 18%, #000 82%, transparent); mask-image: linear-gradient(180deg, transparent, #000 18%, #000 82%, transparent); }
.roll .col { display: block; will-change: transform; }
.roll .col span { display: block; height: 1.2em; text-align: center; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
