.badge {
  align-items: center;
  background-color: var(--badge-background, var(--color-bg));
  border: 1px solid var(--badge-border-color, var(--color-border));
  border-radius: var(--badge-radius, var(--rounded-3xl));
  color: var(--badge-color, var(--color-text));
  column-gap: var(--size-1);
  display: inline-flex;
  flex-shrink: 0;
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  justify-content: center;
  line-height: var(--leading-tight);
  min-inline-size: var(--badge-min-inline-size, 0);
  padding: var(--badge-padding, .125rem .5rem);
  white-space: nowrap;

  .icon {
    --icon-size: var(--size-3);
  }
}

.badge--primary {
  --badge-background: var(--color-primary);
  --badge-border-color: transparent;
  --badge-color: var(--color-text-reversed);
}

.badge--secondary {
  --badge-background: var(--color-secondary);
  --badge-border-color: transparent;
  --badge-color: var(--color-text);
}

.badge--negative {
  --badge-background: var(--color-surface-negative);
  --badge-border-color: transparent;
  --badge-color: var(--color-text-negative);
}

/*
 * Usability spec 03 §3 -- the badge that explains itself (shared/_badge_hint).
 * The trigger is a real <button> so tap and keyboard reach the popover; it is
 * reset to nothing so the badge inside looks exactly as it did.
 */
.badge-hint {
  display: inline-flex;
}

.badge-hint__trigger {
  background: none;
  border: 0;
  border-radius: var(--badge-radius, var(--rounded-3xl));
  color: inherit;
  cursor: help;
  font: inherit;
  padding: 0;

  &:focus-visible {
    outline: 2px solid var(--color-selected-dark);
    outline-offset: 2px;
  }
}

.badge-hint__title {
  font-weight: var(--font-semibold);
}

.badge-hint__list {
  list-style: disc;
  padding-inline-start: var(--size-4);
}

/* Usability spec 01 §2.3 -- the stage badge's list of seven stages, current one marked. */
.badge-hint__stages > li + li { margin-block-start: var(--size-1); }

.badge-hint__stages > [aria-current] { font-weight: var(--font-semibold); }
