/* Colored, dynamic toast stack (Neo theme). */
#site-messages {
    --toast-radius: var(--neo-radius);
}

.toast-item {
    position: relative;
    overflow: hidden;
    border: var(--neo-border) solid var(--neo-ink);
    box-shadow: var(--neo-shadow-small);
    border-radius: var(--toast-radius);
    background: var(--neo-surface);
    color: var(--neo-text);
    font-family: var(--font-iransans);
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding-inline: 0.875rem;
    animation: toast-in 0.28s cubic-bezier(0.21, 1.02, 0.73, 1) both;
}

.toast-item.is-leaving {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border-radius: var(--neo-radius);
    font-size: 1.15rem;
    background: color-mix(in oklab, currentColor 16%, transparent);
}

.toast-text {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1.7;
}

.toast-close {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: var(--neo-radius);
    font-size: 1rem;
    opacity: 0.75;
    transition: opacity 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.toast-close:hover {
    opacity: 1;
    background: color-mix(in oklab, currentColor 16%, transparent);
    transform: scale(1.06);
}

.toast-close:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
    opacity: 1;
}

.toast-progress {
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    height: 3px;
    background: currentColor;
    opacity: 0.65;
    transform-origin: inline-start;
    animation-name: toast-progress;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
}

.toast-item:hover .toast-progress {
    animation-play-state: paused;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(-12px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toast-progress {
    from {
        transform: scaleX(1);
    }
    to {
        transform: scaleX(0);
    }
}

@media (max-width: 640px) {
    .toast-item {
        width: 100%;
        max-width: 100%;
    }
}

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