:root {
  --fondo: #ffffff;
  --carta: #ffffff;
  --testo: #111114;
  --testo-2: #6b6b74;
  --testo-3: #a1a1aa;
  --linea: rgba(17, 17, 20, 0.08);
  --linea-forte: rgba(17, 17, 20, 0.14);
  --accento: #4f46e5;
  --accento-tenue: rgba(79, 70, 229, 0.1);
  --accento-chiaro: #eef0ff;
}

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

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

/* the comment sits a little high, so the card has room to open below the words */
.comment {
  width: min(420px, 100%);
  margin-bottom: min(30vh, 210px);
  padding: 16px 18px 14px;
  border: 1px solid var(--linea);
  border-radius: 16px;
  background: var(--carta);
  box-shadow: 0 1px 2px rgba(17, 17, 20, 0.04);
}

.comment__head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--testo-2);
  white-space: nowrap;
}

.comment__me {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 650;
  color: #fff;
  background: #27272a;
  flex: none;
}

.comment__who { color: var(--testo); font-weight: 600; }

.comment__where {
  margin-left: auto;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--testo-3);
}

.comment__text {
  margin-top: 10px;
  font-size: clamp(14px, 3.9vw, 16px);
  line-height: 1.6;
  color: #2a2a30;
}

.mention {
  position: relative;
  display: inline-block;
  padding: 0 3px;
  margin: 0 -1px;
  border: 0;
  border-radius: 6px;
  background: none;
  font: inherit;
  font-weight: 600;
  color: var(--accento);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.mention__bg {
  position: absolute;
  inset: 1px 0;
  border-radius: 6px;
  background: var(--accento-tenue);
  transform-origin: 50% 100%;
}

.mention__txt { position: relative; }

.mention:focus-visible { outline: 2px solid var(--accento); outline-offset: 2px; }

.comment__foot {
  display: flex;
  gap: 14px;
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--testo-3);
}

.comment__app { margin-left: auto; }

/* the card: .pop is moved by GSAP (x, y), .pop__card is scaled out of the mention */
.pop {
  position: absolute;
  left: 0;
  top: 0;
  width: min(264px, calc(100vw - 32px));
  pointer-events: none;
  z-index: 3;
}

.pop.is-open { pointer-events: auto; }

.pop__card {
  --o: 0;
  padding: 16px;
  border-radius: 18px;
  background: var(--carta);
  border: 1px solid var(--linea);
  box-shadow:
    0 calc(var(--o) * 18px) calc(var(--o) * 44px) rgba(24, 22, 60, calc(var(--o) * 0.16)),
    0 calc(var(--o) * 2px) calc(var(--o) * 6px) rgba(24, 22, 60, calc(var(--o) * 0.06));
  opacity: 0;
  visibility: hidden;
}

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

.avatar {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(150deg, #e9e8ff, #c9c6ff);
}

.avatar__ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1.5px solid var(--accento);
  opacity: 0.55;
}

.avatar__ini {
  font-size: 15px;
  font-weight: 680;
  color: #3730a3;
  letter-spacing: 0.01em;
}

.pop__status {
  padding: 4px 9px;
  border-radius: 99px;
  font-size: 11.5px;
  color: var(--testo-2);
  background: #f4f4f5;
}

.pop__name {
  margin-top: 12px;
  font-size: 16px;
  font-weight: 650;
  font-variation-settings: "wdth" 104;
}

.pop__role { margin-top: 1px; font-size: 13px; color: var(--testo-2); }

.pop__place {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--testo-3);
}

.pop__place svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
}

.pop__stats {
  display: flex;
  gap: 18px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--linea);
}

.stat { display: flex; align-items: baseline; gap: 5px; font-size: 13px; }

.stat__num {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--testo);
}

.stat__lab { color: var(--testo-2); }

[data-followers] {
  display: inline-block;
  height: 1.25em;
  overflow: hidden;
  vertical-align: bottom;
}

.roll { display: flex; flex-direction: column; line-height: 1.25em; }

.pop__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}

.btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--linea-forte);
  background: #fff;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--testo);
  cursor: pointer;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.btn:focus-visible { outline: 2px solid var(--accento); outline-offset: 2px; }

.btn__lab, .btn__tick, .btn__icon { position: relative; }

.btn--follow { border-color: transparent; color: #fff; }

.btn__fill {
  position: absolute;
  inset: 0;
  background: var(--testo);
  border-radius: inherit;
}

.btn__tick {
  width: 0;
  height: 14px;
  fill: none;
  stroke: var(--testo);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn__icon {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linejoin: round;
}

.btn.is-hover { background: #f6f6f7; }

.btn--follow.is-hover { background: #fff; }

.btn--follow.is-hover .btn__fill { background: #2a2a30; }

@media (hover: hover) {
  .btn--msg:hover { background: #f6f6f7; }
  .btn--follow:hover .btn__fill { background: #2a2a30; }
}

.ghost {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  fill: #111114;
  stroke: #fff;
  stroke-width: 1.4;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.18));
  pointer-events: none;
  z-index: 5;
  opacity: 0;
}

@media (max-width: 380px) {
  .comment { padding: 14px 14px 12px; }
  .comment__where { display: none; }
}

/* short boxes (the phone preview is 341 by 410): the comment goes to the top and the card gets compact,
   so it always opens under the mention without covering it */
@media (max-height: 520px) {
  .stage { place-items: start center; padding-top: 12px; }
  .comment { margin-bottom: 0; padding: 12px 14px 10px; }
  .comment__text { margin-top: 8px; line-height: 1.5; }
  .comment__foot { margin-top: 8px; }
  .pop__card { padding: 12px 14px; border-radius: 16px; }
  .avatar { width: 36px; height: 36px; }
  .avatar__ini { font-size: 13px; }
  .pop__name { margin-top: 8px; font-size: 15px; }
  .pop__role { font-size: 12.5px; }
  .pop__place { margin-top: 5px; }
  .pop__stats { margin-top: 8px; padding-top: 8px; }
  .pop__actions { margin-top: 10px; }
  .btn { height: 32px; font-size: 13px; }
}
