/* Snackbar.
 *
 * A short, dark confirmation centred at the bottom of the screen
 * (https://www.w3schools.com/howto/howto_js_snackbar.asp). #snacks stacks
 * them; components/_snack renders one. There is no .show class: a snack is
 * only in the DOM while it is showing. It fades in, fades out just before
 * --snack-duration is up, and the alert controller removes it at that point.
 */

#snacks {
  align-items: center;
  bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  left: 50%;
  pointer-events: none;
  position: fixed;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 32px);
  z-index: 30;
}

.snack {
  --snack-fade: 300ms;

  align-items: center;
  animation:
    snack-in var(--snack-fade) ease-out,
    snack-out var(--snack-fade) ease-in calc(var(--snack-duration, 2500ms) - var(--snack-fade)) forwards;
  background-color: var(--w3-ui-surface-on);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.24);
  color: #fff;
  display: flex;
  font-size: 15px;
  gap: 8px;
  min-width: 250px;
  justify-content: center;
  padding: 12px 16px;
  pointer-events: auto;
}

@keyframes snack-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
}

@keyframes snack-out {
  to {
    opacity: 0;
    transform: translateY(16px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .snack {
    animation: none;
  }
}
