/* The Join call button of a made-up video call app, alone on black. The pill is one element moved by GSAP (width,
   lift, press); its body, grain and light sit in a clipped layer inside it. Inside, every part (the faces, the
   words, the green disc, the controls) is placed by GSAP with x, so the layout of each state is measured in the
   script and the parts can travel on their own springs. A GSAP element never has a transform in the CSS. */
:root {
  --page: #000000;            /* the page */
  --pill-top: #24262d;        /* the top of the pill's body */
  --pill-bottom: #0e0f13;     /* the bottom of the pill's body */
  --ink: #f3f4f8;             /* the words on the pill */
  --muted: #8d90a0;           /* the small words */
  --accent: #3ee08a;          /* the join disc, the speaker ring and the equalizer */
  --leave: #ff5a52;           /* the Leave button */
  --you: #3ee08a;             /* your avatar */
  --p1: #ffb35c;              /* the first person in the call */
  --p2: #ff86ac;              /* the second person */
  --p3: #7fb0ff;              /* the third person */
}

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

html, body { height: 100%; }

body {
  background: var(--page);
  color: var(--ink);
  font-family: "Mona Sans Variable", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

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

.wrap {
  position: relative;
  width: min(340px, calc(100vw - 16px));
  height: 120px;
}

/* ---- the pill ---- */
.pill {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 266px;
  height: 60px;
  border-radius: 999px;
  --mx: 50%;
  z-index: 2;
}

.pill__glow {
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  box-shadow: 0 0 0 1px rgba(62, 224, 138, 0.45), 0 0 26px 2px rgba(62, 224, 138, 0.22);
  opacity: 0;
  pointer-events: none;
}

.pill__clip {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  background: linear-gradient(180deg, var(--pill-top), var(--pill-bottom));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.11),
    inset 0 -1px 0 rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.05),
    0 2px 4px rgba(0, 0, 0, 0.6),
    0 18px 36px -14px rgba(0, 0, 0, 0.9),
    0 26px 50px -24px rgba(62, 224, 138, 0.2);
  isolation: isolate;
}
.pill.is-on .pill__clip {
  background:
    radial-gradient(90px 60px at 50px 50%, rgba(62, 224, 138, 0.1), rgba(62, 224, 138, 0) 70%),
    linear-gradient(180deg, var(--pill-top), var(--pill-bottom));
}

.pill__grain {
  position: absolute;
  inset: 0;
  opacity: 0.07;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='120' height='120' filter='url(%23n)'/></svg>");
  pointer-events: none;
}

.pill__sheen {
  position: absolute;
  top: -20%;
  bottom: -20%;
  left: 0;
  width: 120px;
  background: linear-gradient(100deg, rgba(170, 255, 210, 0) 10%, rgba(170, 255, 210, 0.06) 38%, rgba(255, 255, 255, 0.14) 50%, rgba(170, 255, 210, 0.06) 62%, rgba(170, 255, 210, 0) 90%);
  filter: blur(3px);
  opacity: 0;
  pointer-events: none;
}

/* the 1px edge that takes the light where the pointer is */
.pill__edge {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: radial-gradient(140px 70px at var(--mx) 0%, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.1) 60%, rgba(255, 255, 255, 0.03));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  opacity: 0.4;
  transition: opacity 0.35s ease;
  pointer-events: none;
  z-index: 6;
}
.pill.is-hot .pill__edge { opacity: 1; }

/* ---- the faces ---- */
.faces {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}
.face {
  position: absolute;
  left: 0;
  top: 15px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 680;
  font-stretch: 112%;
  letter-spacing: 0.01em;
  color: #121318;
  background:
    radial-gradient(120% 90% at 30% 18%, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 52%),
    linear-gradient(160deg, var(--c), color-mix(in srgb, var(--c) 60%, #000));
  box-shadow:
    0 0 0 2px #17181d,
    0 0 0 2px rgba(62, 224, 138, 0),
    inset 0 -2px 3px rgba(0, 0, 0, 0.18),
    0 6px 12px -6px rgba(0, 0, 0, 0.9);
  transition: box-shadow 0.35s ease;
}
/* whoever is speaking gets a thin green ring outside the dark separator */
.face.is-speaking {
  box-shadow:
    0 0 0 2px #17181d,
    0 0 0 3.5px var(--accent),
    inset 0 -2px 3px rgba(0, 0, 0, 0.18),
    0 6px 12px -6px rgba(0, 0, 0, 0.9);
}
/* the face on the left sits on top of the next one */
.face--you { z-index: 4; }
.face:nth-child(2) { z-index: 3; }
.face:nth-child(3) { z-index: 2; }
.face:nth-child(4) { z-index: 1; }
.face--you { font-size: 9.5px; font-stretch: 100%; letter-spacing: 0; }

/* ---- the words ---- */
.words {
  position: absolute;
  left: 0;
  top: 12px;
  height: 36px;
  overflow: hidden;
  pointer-events: none;
  z-index: 2;
}
.state {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  white-space: nowrap;
}
.label {
  height: 20px;
  line-height: 20px;
  font-size: 15.5px;
  font-weight: 580;
  letter-spacing: -0.005em;
  font-stretch: 100%;
  transition: font-stretch 0.45s cubic-bezier(0.3, 1.6, 0.5, 1);
}
.pill.is-hot .state[data-state="idle"] .label { font-stretch: 108%; }
.label--clock { font-variant-numeric: tabular-nums; font-weight: 600; }
.sub {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 16px;
  line-height: 16px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
}
.sub--muted { color: var(--muted); }
.sep { opacity: 0.6; }
.clock { font-variant-numeric: tabular-nums; }

/* three thin bars: someone is talking */
.eq {
  display: inline-flex;
  align-items: flex-end;
  gap: 1.5px;
  height: 9px;
  margin-right: 1px;
}
.eq i {
  display: block;
  width: 2px;
  height: 9px;
  border-radius: 1px;
  background: var(--accent);
  transform-origin: 50% 100%;
}

/* ---- the green disc ---- */
.disc {
  position: absolute;
  left: 0;
  top: 10px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(120% 90% at 30% 15%, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0) 55%),
    linear-gradient(170deg, var(--accent), color-mix(in srgb, var(--accent) 62%, #000));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -2px 4px rgba(0, 0, 0, 0.2),
    0 0 0 1px rgba(0, 0, 0, 0.4),
    0 8px 18px -8px rgba(62, 224, 138, 0.7);
  pointer-events: none;
  z-index: 3;
}
.disc svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: #0b1a12;
  stroke-width: 1.8;
  stroke-linejoin: round;
  stroke-linecap: round;
}

/* the whole pill is the Join button while idle */
.join {
  position: absolute;
  inset: 0;
  border: 0;
  border-radius: inherit;
  background: none;
  font-size: 0;
  color: transparent;
  cursor: pointer;
  outline: none;
  z-index: 5;
}
.join:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }

/* ---- the controls in the call ---- */
.controls {
  position: absolute;
  left: 0;
  top: 12px;
  display: flex;
  gap: 5px;
  z-index: 5;
  visibility: hidden;
}
.ctl, .leave {
  height: 36px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  cursor: pointer;
  outline: none;
  display: grid;
  place-items: center;
  transition: background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}
.ctl {
  width: 32px;
  color: var(--ink);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.05));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.ctl svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
}
.ctl .slash { stroke: #121318; stroke-width: 1.9; }
.ctl[aria-pressed="true"] {
  color: #121318;
  background: linear-gradient(180deg, #f6f7fa, #d9dbe2);
  box-shadow: inset 0 1px 0 #ffffff, 0 4px 10px -4px rgba(0, 0, 0, 0.8);
}
.leave {
  width: 58px;
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 620;
  font-stretch: 104%;
  background:
    radial-gradient(120% 90% at 30% 10%, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0) 55%),
    linear-gradient(170deg, var(--leave), color-mix(in srgb, var(--leave) 70%, #000));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), inset 0 -2px 4px rgba(0, 0, 0, 0.18), 0 6px 14px -6px rgba(255, 90, 82, 0.7);
}
.ctl:focus-visible, .leave:focus-visible { box-shadow: 0 0 0 2px #000, 0 0 0 3.5px var(--accent); }
@media (hover: hover) {
  .ctl:hover { background: linear-gradient(180deg, rgba(255, 255, 255, 0.17), rgba(255, 255, 255, 0.08)); }
  .ctl[aria-pressed="true"]:hover { background: linear-gradient(180deg, #ffffff, #e4e6ec); }
  .leave:hover { filter: brightness(1.08); }
}

/* ---- the drawn pointer of the autopilot ---- */
.ghost {
  position: fixed;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  pointer-events: none;
  fill: #ffffff;
  stroke: #111216;
  stroke-width: 1.4;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
  opacity: 0;
  visibility: hidden;
  z-index: 9;
}

/* the small muted badge on your face */
.badge {
  position: absolute;
  right: -5px;
  bottom: -4px;
  width: 15px;
  height: 15px;
  overflow: visible;
}
.badge circle { fill: #f3f4f8; stroke: #15161b; stroke-width: 1.6; }
.badge path { fill: none; stroke: #121318; stroke-width: 1.3; stroke-linecap: round; }
