/* Notifications (toasts.js) and the visually hidden utility. */

/* Notifications (toasts.js): a stack in the bottom-right corner, newest at
   the bottom; full width above the bottom edge on phones. */
.toast-region {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  display: grid;
  gap: 10px;
  width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  padding: 14px 12px 14px 16px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--toast-accent, var(--success));
  border-radius: 10px;
  background: var(--bg-elevated);
  box-shadow: 0 14px 34px rgb(0 0 0 / 40%);
  color: var(--text-primary);
  pointer-events: auto;
  animation: toast-in 0.18s ease-out;
}

.toast[data-tone="success"] {
  --toast-accent: var(--success);
}

.toast[data-tone="warning"] {
  --toast-accent: var(--warning);
}

.toast[data-tone="error"] {
  --toast-accent: var(--danger);
}

.toast-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: var(--toast-accent);
  background: color-mix(in srgb, var(--toast-accent) 14%, transparent);
}

.toast-body {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding-top: 4px;
}

.toast-body strong {
  font-size: 13px;
  font-weight: 600;
}

.toast-body p {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.toast-close {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin: -8px -6px -8px 0;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
}

.toast-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.toast-close:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 0;
}

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

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

@media (max-width: 640px) {
  .toast-region {
    right: 16px;
    bottom: 16px;
    left: 16px;
    width: auto;
  }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
