.launcher {
  position: sticky;
  bottom: calc(18px + env(safe-area-inset-bottom));
  height: 0;
  z-index: 61;
}

.wa-button {
  --button-size: 52px;
  --expanded-width: 196px;
  position: absolute;
  bottom: 0;
  right: 18px;
  display: block;
  box-sizing: border-box;
  width: var(--button-size);
  height: var(--button-size);
  overflow: hidden;
  border: 1px solid #25d366;
  border-radius: 999px;
  background: #128c4a;
  color: #fff;
  text-decoration: none;
  box-shadow: 0 10px 30px rgb(0 0 0 / 35%);
  transition: background .2s;
}

.greeting-visible { animation: unfold 4s cubic-bezier(.4, 0, .4, 1) both; }
.greeting-visible .wa-label { animation: greeting 4s ease both; }

.wa-button:hover { background: #107b41; }
.wa-button:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }

.wa-icon {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  place-items: center;
  width: calc(var(--button-size) - 2px);
  height: calc(var(--button-size) - 2px);
}

.wa-label {
  position: absolute;
  inset: 0 var(--button-size) 0 20px;
  display: flex;
  align-items: center;
  font: 600 14px/1 var(--font);
  white-space: nowrap;
  overflow: hidden;
  opacity: 0;
}

/* The right edge and icon stay still as the green pill extends and retracts. */
@keyframes unfold {
  0%, 100% { width: var(--button-size); }
  10%, 85% { width: var(--expanded-width); }
}

@keyframes greeting {
  0%, 98%, 100% { opacity: 0; }
  10%, 85% { opacity: 1; }
}

@media (max-width: 639px) {

  .wa-button {
    --button-size: 44px;
    --expanded-width: 180px;
    right: 12px;
  }
  .wa-icon svg { width: 25px; height: 25px; }
}
