.btn {
  --btn-background: var(--color-primary);
  --btn-color: #fff;
  --btn-border: transparent;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2xs);
  padding: var(--space-xs) var(--space-md);
  border: 1px solid var(--btn-border);
  border-radius: var(--radius-full);
  background-color: var(--btn-background);
  color: var(--btn-color);
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  line-height: 1.4;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn:not([disabled]):hover {
  --btn-background: var(--color-primary-hover);
}

/* A pixel of give, so the press is felt before the answer comes back. */
.btn:not([disabled]):active {
  transform: translateY(1px);
}

.btn[disabled] {
  cursor: not-allowed;
  opacity: 0.6;
}

/* Turbo désactive le bouton d'envoi le temps de la requête : on en profite pour
   montrer que ça travaille, sinon le clic reste sans réponse visible. Le
   pseudo-élément est un item du flex, donc le `gap` du bouton l'écarte du
   libellé sans marge à régler. */
.btn[type="submit"][disabled]::after {
  content: "";
  flex: 0 0 auto;
  width: 0.9em;
  height: 0.9em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.7s linear infinite;
}

/* Un bouton que l'on grise pour faire patienter — pas pour envoyer quoi que ce
   soit — ne doit rien faire tourner. */
.btn--no-spinner[type="submit"][disabled]::after {
  content: none;
}

@keyframes btn-spin {
  to {
    transform: rotate(1turn);
  }
}

/* Sans mouvement, l'anneau reste : il respire au lieu de tourner. */
@media (prefers-reduced-motion: reduce) {
  .btn[type="submit"][disabled]::after {
    animation: btn-spin-pulse 1.6s ease-in-out infinite;
  }
}

@keyframes btn-spin-pulse {
  50% {
    opacity: 0.25;
  }
}

.btn--full {
  width: 100%;
}

/* A logo carried into a button — Google's, for now. Sized in the markup too, so
   the line does not jump before the stylesheet lands. */
.btn__icon {
  flex: 0 0 auto;
  width: 1.125rem;
  height: 1.125rem;
}

/* What the press costs, said on the button itself. Set back from the label so
   the button still reads as one word to act on and the price as a footnote. */
.btn__aside {
  font-weight: var(--weight-regular);
  opacity: 0.6;
}

.btn--small {
  padding: var(--space-3xs) var(--space-sm);
  font-size: var(--text-sm);
}

.btn--ghost {
  --btn-background: transparent;
  --btn-color: var(--color-text);
  --btn-border: var(--color-border-strong);
}

.btn--ghost:not([disabled]):hover {
  --btn-background: var(--color-surface-sunken);
}

.btn--danger {
  --btn-background: transparent;
  --btn-color: var(--color-danger);
  --btn-border: transparent;
}

.btn--danger:not([disabled]):hover {
  --btn-background: var(--color-building-soft);
}
