.alert {
    position: fixed;
    inset: calc(var(--space-2) + var(--alert-offset, 0px)) 0 auto 0;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-2) var(--space-2) var(--space-6);
    margin: 0 auto;
    width: fit-content;
    max-width: calc(100% - 1.5rem);
    border: none;
    overflow: visible;
    text-align: center;
    color: var(--color-on-status);
    font-weight: var(--font-weight-strong);
    font-size: var(--text-sm);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    animation: alert-in var(--duration-slow) var(--ease);
    transition: inset var(--duration-base) var(--ease);
}

.alert.info {
    background-color: var(--color-success);
}

.alert.error {
    background-color: var(--color-danger);
}

.alert.warning {
    background-color: var(--color-warning);
}

/* Moved into a dialog opened over it, or out of one closed: it stays put */
.alert.moved {
    animation: none;
}

/* Going: alert.js removes it when this ends */
.alert.leaving {
    animation: alert-out var(--duration-slow) var(--ease) forwards;
}

.alert-text {
    flex: 1;
}

.alert-close {
    display: grid;
    place-items: center;
    flex: none;
    width: var(--icon-button-size);
    height: var(--icon-button-size);
    padding: 0;
    border: none;
    border-radius: var(--radius-sm);
    background: none;
    color: inherit;
    cursor: pointer;
}

.alert-close:hover,
.keyboard .alert-close:focus {
    background-color: var(--color-fill-strong);
}

.alert-close > svg {
    width: 10px;
    height: 10px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
}

@keyframes alert-in {
    from {
        transform: translateY(-5rem);
        opacity: 0;
    }
}

@keyframes alert-out {
    to {
        transform: translateY(-5rem);
        opacity: 0;
    }
}

/* No sliding: the messages just come and go */
@media (prefers-reduced-motion: reduce) {
    .alert,
    .alert.leaving {
        animation: none;
        transition: none;
    }
}
