:root {
  --fondo: #ffffff;
  --carta: #ffffff;
  --testo: #18181b;
  --testo-2: #71717a;
  --testo-3: #a1a1aa;
  --bordo: rgba(17, 17, 19, 0.13);
  --verde: #0f9d63;
  --verde-tenue: #e8f7ef;
  --verde-bordo: rgba(15, 157, 99, 0.32);
  --rosso: #c8424a;
  --rosso-tenue: #fcefef;
  --rosso-bordo: rgba(200, 66, 74, 0.28);
  --focus: #6d5efc;
}

* { box-sizing: border-box; margin: 0; }

html, body { height: 100%; }

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

.stage {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}

/* the pill: GSAP owns its transform (scale, y) and width; the tint and the inner row are children */
.repost {
  position: relative;
  height: 60px;
  padding: 0 22px 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--carta);
  color: var(--testo);
  font: inherit;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  box-shadow: inset 0 0 0 1px var(--bordo), 0 1px 2px rgba(17, 17, 19, 0.05), 0 10px 24px -14px rgba(17, 17, 19, 0.35);
  transition: box-shadow 0.25s ease;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.repost:focus { outline: none; }
.repost:focus-visible { box-shadow: inset 0 0 0 1px var(--bordo), 0 0 0 3px #ffffff, 0 0 0 5px var(--focus); }

@media (hover: hover) {
  .repost:hover { box-shadow: inset 0 0 0 1px rgba(17, 17, 19, 0.22), 0 1px 2px rgba(17, 17, 19, 0.06), 0 14px 28px -14px rgba(17, 17, 19, 0.4); }
}

/* the tint spreads from the icon: a circle that GSAP grows */
.repost__tint {
  position: absolute;
  left: 30px;
  top: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border-radius: 50%;
  background: var(--verde-tenue);
  transform: scale(0);
  z-index: -1;
  pointer-events: none;
}

.repost__inner {
  display: flex;
  align-items: center;
  height: 100%;
  gap: 10px;
}

.repost__icon {
  position: relative;
  flex: none;
  width: 24px;
  height: 24px;
}

.loop {
  position: absolute;
  inset: 0;
  width: 24px;
  height: 24px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.loop--trail { opacity: 0; stroke-width: 1.4; }

.burst {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 60px;
  height: 60px;
  margin: -30px 0 0 -30px;
  overflow: visible;
  stroke: var(--verde);
  stroke-width: 1.6;
  stroke-linecap: round;
  pointer-events: none;
}

/* one word at a time in a window one line high: the old one leaves, then the new one comes in */
.repost__label {
  position: relative;
  display: block;
  height: 22px;
  overflow: hidden;
  font-size: 16px;
  line-height: 22px;
  font-weight: 560;
  font-stretch: 104%;
  letter-spacing: -0.005em;
  white-space: nowrap;
}
.lab { display: block; }

.repost__rule {
  flex: none;
  width: 1px;
  height: 20px;
  background: currentColor;
  opacity: 0.16;
}

.repost__count {
  display: flex;
  height: 22px;
  overflow: hidden;
  font-size: 15px;
  line-height: 22px;
  font-weight: 480;
  font-variant-numeric: tabular-nums;
  color: var(--testo-2);
}
.digit { position: relative; display: block; height: 22px; overflow: hidden; }
.digit__col { display: flex; flex-direction: column; }
.digit__col span { display: block; height: 22px; }
.sep { display: block; }

.ghost {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  fill: #18181b;
  stroke: #ffffff;
  stroke-width: 1.3;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.22));
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .repost { transition: none; }
}
