/* Toast messages (the toastr library inside the theme's plugin bundle), the same on every page.

   The theme draws a toast as white text on its green, purple, amber or red. Three of the four could
   not be read: success 2.27 to 1, warning 1.69, error 3.86, where 4.5 is the mark. Here every toast
   is one plain card, light in light mode and dark in dark mode, and its kind shows in the shape and
   colour of its icon and in the edge on the left.

   How long a toast stays, its close button and what a screen reader is told are in toastMessages.js.
   The theme forces padding, border, shadow and corners on a toast, so these four are forced here too. */

/* Below the top bar, so the bell and the user menu stay free. toastMessages.js measures the bar. */
#toastr-container.toastr-top-right {
    top: var(--phs-toast-top, 12px);
    right: 16px;
}

#toastr-container > .toastr {
    --phs-toast-accent: #6d28d9;
    width: min(380px, calc(100vw - 32px));
    padding: 14px 46px 14px 54px !important;
    background-color: #ffffff;
    background-image: none !important; /* the library's white picture; the icon is drawn below */
    color: #1f2937;
    border-left: 6px solid var(--phs-toast-accent) !important;
    border-radius: 6px 0.65rem 0.65rem 6px !important;
    box-shadow: 0 0 0 1px #cbd5e1, 0 10px 30px rgba(0, 0, 0, 0.14) !important;
    opacity: 1;
}

#toastr-container > .toastr-success {
    --phs-toast-accent: #0f7a3a;
}

#toastr-container > .toastr-info {
    --phs-toast-accent: #6d28d9;
}

#toastr-container > .toastr-warning {
    --phs-toast-accent: #a15c00;
}

#toastr-container > .toastr-error {
    --phs-toast-accent: #c8163f;
}

#toastr-container > .toastr .toastr-title {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.4;
}

#toastr-container > .toastr .toastr-message {
    font-size: 1.1rem;
    font-weight: 500;
    line-height: 1.4;
}

/* the library makes a link in a message white */
#toastr-container > .toastr .toastr-message a,
#toastr-container > .toastr .toastr-message label {
    color: inherit;
    text-decoration: underline;
}

/* One shape per kind, so the kind does not hang on colour alone: tick, i, triangle, cross. */
#toastr-container > .toastr::before {
    content: "";
    position: absolute;
    left: 18px;
    top: 15px;
    width: 22px;
    height: 22px;
    background-color: var(--phs-toast-accent);
    -webkit-mask: center / contain no-repeat;
    mask: center / contain no-repeat;
}

#toastr-container > .toastr-success::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm4.7 7.7-5.4 5.9a1 1 0 0 1-1.45.03L7.3 13.1a1 1 0 1 1 1.4-1.4l1.8 1.78 4.72-5.16a1 1 0 0 1 1.48 1.36z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm4.7 7.7-5.4 5.9a1 1 0 0 1-1.45.03L7.3 13.1a1 1 0 1 1 1.4-1.4l1.8 1.78 4.72-5.16a1 1 0 0 1 1.48 1.36z'/%3E%3C/svg%3E");
}

#toastr-container > .toastr-info::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm0 4.6a1.3 1.3 0 1 1 0 2.6 1.3 1.3 0 0 1 0-2.6zm1.9 10.6h-3.8a.9.9 0 0 1 0-1.8h1v-3.3h-.7a.9.9 0 0 1 0-1.8H12a.9.9 0 0 1 .9.9v4.2h1a.9.9 0 0 1 0 1.8z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm0 4.6a1.3 1.3 0 1 1 0 2.6 1.3 1.3 0 0 1 0-2.6zm1.9 10.6h-3.8a.9.9 0 0 1 0-1.8h1v-3.3h-.7a.9.9 0 0 1 0-1.8H12a.9.9 0 0 1 .9.9v4.2h1a.9.9 0 0 1 0 1.8z'/%3E%3C/svg%3E");
}

#toastr-container > .toastr-warning::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M13.73 3.5a2 2 0 0 0-3.46 0L1.9 18a2 2 0 0 0 1.73 3h16.74a2 2 0 0 0 1.73-3L13.73 3.5zM12 8.6a1 1 0 0 1 1 1v4.3a1 1 0 0 1-2 0V9.6a1 1 0 0 1 1-1zm0 9.5a1.25 1.25 0 1 1 0-2.5 1.25 1.25 0 0 1 0 2.5z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M13.73 3.5a2 2 0 0 0-3.46 0L1.9 18a2 2 0 0 0 1.73 3h16.74a2 2 0 0 0 1.73-3L13.73 3.5zM12 8.6a1 1 0 0 1 1 1v4.3a1 1 0 0 1-2 0V9.6a1 1 0 0 1 1-1zm0 9.5a1.25 1.25 0 1 1 0-2.5 1.25 1.25 0 0 1 0 2.5z'/%3E%3C/svg%3E");
}

#toastr-container > .toastr-error::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm3.7 12.3a1 1 0 0 1-1.4 1.4L12 13.4l-2.3 2.3a1 1 0 0 1-1.4-1.4l2.3-2.3-2.3-2.3a1 1 0 0 1 1.4-1.4l2.3 2.3 2.3-2.3a1 1 0 0 1 1.4 1.4L13.4 12l2.3 2.3z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm3.7 12.3a1 1 0 0 1-1.4 1.4L12 13.4l-2.3 2.3a1 1 0 0 1-1.4-1.4l2.3-2.3-2.3-2.3a1 1 0 0 1 1.4-1.4l2.3 2.3 2.3-2.3a1 1 0 0 1 1.4 1.4L13.4 12l2.3 2.3z'/%3E%3C/svg%3E");
}

/* The close button is a real button (toastMessages.js), so the keyboard can reach it. The theme
   draws its cross with a mask on the button itself; here the cross is the button's ::before. */
#toastr-container > .toastr .toastr-close-button {
    position: absolute;
    top: 8px;
    right: 8px;
    float: none;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    font-size: 0;
    line-height: 1;
    opacity: 1;
    text-shadow: none;
    color: #4b5563;
    background-color: transparent;
    -webkit-mask: none;
    mask: none;
}

#toastr-container > .toastr .toastr-close-button::before {
    content: "";
    position: absolute;
    inset: 7px;
    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M1.3 1.3l11.4 11.4M12.7 1.3L1.3 12.7' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M1.3 1.3l11.4 11.4M12.7 1.3L1.3 12.7' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

#toastr-container > .toastr .toastr-close-button:hover,
#toastr-container > .toastr .toastr-close-button:focus {
    color: #1f2937;
    background-color: rgba(107, 114, 128, 0.18);
    opacity: 1;
}

#toastr-container > .toastr .toastr-close-button:focus-visible {
    outline: 0;
    box-shadow: var(--phs-focus-ring);
}

/* Windows high contrast mode takes background colours away, and the icon and the cross are drawn
   with one. They keep a colour there that stands out from the card. */
@media (forced-colors: active) {
    #toastr-container > .toastr::before,
    #toastr-container > .toastr .toastr-close-button::before {
        forced-color-adjust: none;
        background-color: CanvasText;
    }
}

/* ---- dark mode ---- */
[data-theme="dark"] #toastr-container > .toastr {
    background-color: #262639;
    color: #e5e7eb;
    box-shadow: 0 0 0 1px #4b5068, 0 10px 30px rgba(0, 0, 0, 0.5) !important;
}

[data-theme="dark"] #toastr-container > .toastr-success {
    --phs-toast-accent: #4ade80;
}

[data-theme="dark"] #toastr-container > .toastr-info {
    --phs-toast-accent: #a78bfa;
}

[data-theme="dark"] #toastr-container > .toastr-warning {
    --phs-toast-accent: #fbbf24;
}

[data-theme="dark"] #toastr-container > .toastr-error {
    --phs-toast-accent: #fb7185;
}

[data-theme="dark"] #toastr-container > .toastr .toastr-close-button {
    color: #cbd5e1;
}

[data-theme="dark"] #toastr-container > .toastr .toastr-close-button:hover,
[data-theme="dark"] #toastr-container > .toastr .toastr-close-button:focus {
    color: #f8fafc;
    background-color: rgba(203, 213, 225, 0.16);
}
