.toast-stack {
  position: fixed;
  right: var(--spacing-xl);
  bottom: var(--spacing-xl);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
  width: min(23rem, calc(100vw - var(--spacing-3xl)));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  padding: var(--spacing-xl);
  font-family: var(--font-body);
  color: var(--foreground-primary);
  background: var(--background-primary);
  border-radius: 20px;
  box-shadow:
    0 1px 2px color-mix(in srgb, var(--infinity) 8%, transparent),
    0 16px 40px -16px color-mix(in srgb, var(--infinity) 40%, transparent);
  opacity: 0;
  translate: 0 var(--spacing-md);
  transition:
    opacity 260ms ease-out,
    translate 260ms cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.is-visible {
  opacity: 1;
  translate: 0 0;
}

.toast.is-leaving {
  opacity: 0;
  translate: 0 var(--spacing-sm);
}

.toast-title {
  font-family: var(--font-display);
  font-size: var(--size-24);
  font-weight: 300;
  line-height: 1.3;
  color: var(--foreground-brand-secondary);
}

.toast-message {
  font-size: var(--size-14);
  line-height: 1.5;
  color: var(--foreground-secondary);
}

.toast-message .inline-link {
  font-size: inherit;
}

.toast-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-sm);

  & > *:first-child {
    flex: 1 1 auto;
  }
}

.toast-actions *[class^="button-"] {
  margin-bottom: 0;
  font-size: var(--size-14);
  padding: var(--spacing-sm) var(--spacing-lg);
}

.toast-close {
  position: absolute;
  top: var(--spacing-md);
  right: var(--spacing-md);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  color: var(--foreground-secondary);
  background: transparent;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: background 200ms ease-out;
}

.toast-close:hover {
  background: var(--light-grey);
}

.toast-close svg {
  display: block;
  width: 16px;
  height: 16px;
}

/* Mobile ≤ 390px */
@media only screen and (max-width: 390px) {
  .toast-stack {
    right: var(--spacing-lg);
    left: var(--spacing-lg);
    bottom: var(--spacing-lg);
    width: auto;
  }

  .toast {
    padding: var(--spacing-lg);
    padding-right: var(--spacing-3xl);
  }

  .toast-actions *[class^="button-"] {
    flex: 1 1 auto;
  }

  .toast-title {
    font-size: var(--size-18);
  }
}
