/* Shared by the full Tailwind build and the homepage's separate critical bundle. */
.toneart-toasts {
    position: fixed;
    top: var(--header-offset, 0px);
    left: 50%;
    transform: translateX(-50%);
    width: min(92vw, 520px);
    max-height: calc(100dvh - var(--header-offset, 0px));
    overflow-y: auto;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    gap: calc(var(--spacing) * 3);
    padding-block: calc(var(--spacing) * 2);
    padding-inline: var(--spacing);
    box-sizing: border-box;
    pointer-events: none;
    /* Hyva dialogs use 50; the header and its cart drawer use 1000. */
    z-index: 40;
    font-family: var(--toneart-font-family, inherit);
}

/* Override the same component embedded in the theme and homepage bundles. */
#toneart-toasts {
    left: 16px;
    right: auto;
    transform: none;
}

.toneart-toast-slot { flex-shrink: 0; }

.toneart-toast {
    --toast-accent: var(--color-blue-500);
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: calc(var(--spacing) * 3);
    padding: calc(var(--spacing) * 3);
    border: 1px solid var(--color-gray-700);
    border-left: var(--spacing) solid var(--toast-accent);
    border-radius: var(--radius-lg);
    box-shadow: none;
    background: var(--toast-surface, var(--background-color));
    color: var(--color-white);
    overflow: hidden;
    pointer-events: auto;
    font-size: var(--text-sm);
    line-height: var(--text-sm--line-height);
}

.toneart-toast[data-type="success"] { --toast-accent: var(--color-green-500); }
.toneart-toast[data-type="error"] { --toast-accent: var(--color-red-500); }
.toneart-toast[data-type="warning"] { --toast-accent: var(--toneart-orange, var(--color-yellow-500)); }

.toneart-toast-icon {
    flex: 0 0 auto;
    color: var(--toast-accent);
    margin-top: calc(var(--spacing) * 2);
}

.toneart-toast-text {
    flex: 1;
    min-width: 0;
    align-self: center;
    overflow-wrap: anywhere;
}

.toneart-toast-text a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: var(--spacing);
    font-weight: var(--font-weight-semibold);
}

.toneart-toast-text a:hover { color: var(--toast-accent); }

.toneart-toast-close {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: calc(var(--spacing) * 10);
    height: calc(var(--spacing) * 10);
    padding: 0;
    border: 0;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--color-gray-300);
    cursor: pointer;
}

.toneart-toast-close:hover { background: var(--color-gray-800); color: var(--color-white); }
.toneart-toast-close:focus-visible,
.toneart-toast-text a:focus-visible { outline: 2px solid var(--color-white); outline-offset: 2px; }

body.light-mode .toneart-toast {
    background: var(--background-color);
    color: var(--text-color);
    border-top-color: var(--color-gray-300);
    border-right-color: var(--color-gray-300);
    border-bottom-color: var(--color-gray-300);
}

body.light-mode .toneart-toast-close { color: var(--color-gray-700); }
body.light-mode .toneart-toast-close:hover {
    background: var(--color-gray-100);
    color: var(--text-color);
}
body.light-mode .toneart-toast-close:focus-visible,
body.light-mode .toneart-toast-text a:focus-visible { outline-color: var(--text-color); }

.toneart-toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: calc(var(--spacing) / 2);
    background: var(--toast-accent);
    transform-origin: left;
}

.toneart-toast-enter { transition: transform 300ms cubic-bezier(0.22,1,0.36,1), opacity 300ms cubic-bezier(0.22,1,0.36,1); }
.toneart-toast-leave { transition: transform 200ms ease-out, opacity 200ms ease-out; }
.toneart-toast-enter-start { opacity: 0; transform: translateY(-12px) scale(.98); }
.toneart-toast-rest { opacity: 1; transform: translateY(0) scale(1); }
.toneart-toast-leave-end { opacity: 0; transform: translateY(-8px); }

@media (width < 768px) {
    .toneart-toasts { width: calc(100% - 32px); padding-inline: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .toneart-toast-enter, .toneart-toast-leave { transition: opacity 75ms linear; }
    .toneart-toast-enter-start, .toneart-toast-rest, .toneart-toast-leave-end { transform: none; }
}

@media print { .toneart-toasts { display: none; } }

/* toast-checkout-fix: always an opaque box. --toast-surface is copied from the page header, which is
   transparent on the checkout, so the page used to show through the message. */
.toneart-toast {
    background: linear-gradient(var(--toast-surface, transparent), var(--toast-surface, transparent)),
        var(--background-color, #171717);
    box-shadow: 0 12px 32px rgba(0, 0, 0, .45);
}
body.light-mode .toneart-toast {
    background: var(--background-color, #fff);
    box-shadow: 0 12px 32px rgba(0, 0, 0, .14);
}
/* Icon by message type in CSS. The checkout's CSP Alpine build skips the x-if icon templates. */
.toneart-toast-icon:not(:has(svg)) {
    width: 24px; height: 24px;
    background: var(--toast-accent);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='2' stroke='black'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='2' stroke='black'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.toneart-toast[data-type="success"] .toneart-toast-icon:not(:has(svg)) { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='2' stroke='black'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='2' stroke='black'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z'/%3E%3C/svg%3E"); }
.toneart-toast[data-type="error"] .toneart-toast-icon:not(:has(svg)) { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='2' stroke='black'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='2' stroke='black'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z'/%3E%3C/svg%3E"); }
.toneart-toast[data-type="warning"] .toneart-toast-icon:not(:has(svg)) { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='2' stroke='black'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='2' stroke='black'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z'/%3E%3C/svg%3E"); }
