/*
 * tvt-toast 1.0.0: the styles of public/js/tvt-toast.js. Plain CSS, loaded by URL (not processed by Vite).
 * The container's place and the slide in / out: colours, size and layout of a toast are Tailwind classes, in its
 * template (components/tools/tvt-toast, presets in config/toasts.php).
 */

/* container: data-tvt-toast-at is the position in use, set by tvt-toast.js from data-tvt-toast-position / -md.
   Above the modals (z-80) and the full-screen dropdowns of search-engines-dd (z-100). The toasts slide in from
   beyond its edge (--tvt-toast-from), which overflow: hidden keeps out of sight. */
[data-tvt-toast-container] {
    --tvt-toast-edge: 0.5rem;

    position: fixed;
    z-index: 110;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

[data-tvt-toast-at^="top"] {
    top: var(--tvt-toast-edge);
}

/* at the bottom the newest toast is the lowest one */
[data-tvt-toast-at^="bottom"] {
    bottom: var(--tvt-toast-edge);
    flex-direction: column-reverse;
}

[data-tvt-toast-at$="right"] {
    --tvt-toast-from: translateX(110%);

    right: var(--tvt-toast-edge);
}

[data-tvt-toast-at$="left"] {
    --tvt-toast-from: translateX(-110%);

    left: var(--tvt-toast-edge);
}

[data-tvt-toast-at$="center"] {
    left: 50%;
    translate: -50% 0;
}

[data-tvt-toast-at="top-center"] {
    --tvt-toast-from: translateY(-110%);
}

[data-tvt-toast-at="bottom-center"] {
    --tvt-toast-from: translateY(110%);
}
/* /container */

/* slide in / out: from the container's edge, from the right for a toast written in a page */
[data-tvt-toast] {
    transform: var(--tvt-toast-from, translateX(110%));
    opacity: 0;
}

[data-tvt-toast].tvt-toast--visible {
    animation: tvt-toast-slide-in 0.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

[data-tvt-toast].tvt-toast--exit {
    animation: tvt-toast-slide-out 0.28s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes tvt-toast-slide-in {
    from {
        transform: var(--tvt-toast-from, translateX(110%));
        opacity: 0;
    }
    to {
        transform: none;
        opacity: 1;
    }
}

@keyframes tvt-toast-slide-out {
    from {
        transform: none;
        opacity: 1;
    }
    to {
        transform: var(--tvt-toast-from, translateX(110%));
        opacity: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    [data-tvt-toast] {
        transform: none;
        opacity: 1;
    }

    [data-tvt-toast].tvt-toast--visible,
    [data-tvt-toast].tvt-toast--exit {
        animation: none;
    }
}
/* /slide in / out */
