.notification-toasts {
    position: fixed;
    z-index: 1000;
    inset-inline: 1rem;
    top: calc(1rem + env(safe-area-inset-top, 0px));
    display: flex;
    flex-direction: column;
    gap: .65rem;
    max-height: 60dvh;
    overflow-y: auto;
    pointer-events: none;
}

.notification-toasts:empty { display: none; }

.notification-toast {
    flex-shrink: 0;
    border: 1px solid var(--border);
    border-inline-start: 4px solid var(--forest);
    border-radius: 1rem;
    padding: 1rem;
    color: var(--text);
    background: var(--surface);
    box-shadow: 0 8px 28px rgb(31 36 33 / 18%);
    pointer-events: auto;
    overflow-wrap: anywhere;
    animation: notification-in 250ms ease-out both;
}

.notification-toast--success { border-inline-start-color: var(--forest); background: var(--forest-light); }
.notification-toast--warning { border-inline-start-color: var(--clay); }
.notification-toast__text { margin: 0; }
.notification-toast form:not([hidden]) { margin-top: .75rem; }
.notification-toast.htmx-swapping { animation: notification-out 250ms ease-in both; }

.notification-toasts--login {
    animation: notification-login-end 0s var(--toast-seconds, 8s) forwards;
}

.notification-toasts--login .notification-toast {
    animation: notification-in 250ms ease-out both,
               notification-out 250ms ease-in calc(var(--toast-seconds, 8s) - 250ms) forwards;
}

@keyframes notification-in {
    from { opacity: 0; transform: translateY(-.75rem); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes notification-out {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-.5rem); }
}

@keyframes notification-login-end {
    to { visibility: hidden; }
}

@media (min-width: 640px) {
    .notification-toasts { inset-inline-start: auto; inset-inline-end: 1.5rem; width: min(420px, calc(100% - 3rem)); }
}

@media (prefers-reduced-motion: reduce) {
    .notification-toast { animation-name: notification-fade-in; }
    .notification-toast.htmx-swapping { animation-name: notification-fade-out; }
    .notification-toasts--login .notification-toast { animation-name: notification-fade-in, notification-fade-out; }
}

@keyframes notification-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes notification-fade-out { from { opacity: 1; } to { opacity: 0; } }
