/**
 * Notices WooCommerce en toasts — voir assets/js/sky-toasts.js.
 * Bas-droite sur desktop (la bannière cookies occupe le bas-gauche),
 * pleine largeur en bas de l'écran sur mobile.
 */

/* Wrappers vidés par les toasts (ils contiennent souvent des espaces, d'où :has). */
.woocommerce-notices-wrapper:not(:has(*)),
.woocommerce-NoticeGroup:not(:has(*)) {
  display: none;
}

.sky-toaster {
  position: fixed;
  right: var(--space-m);
  bottom: var(--space-m);
  z-index: 999999;
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
  width: min(420px, calc(100vw - 2 * var(--space-m)));
  pointer-events: none;
}

.sky-toaster:empty {
  display: none;
}

.sky-toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2xs);
  padding: var(--space-xs);
  border-radius: var(--r-md);
  font-weight: 500;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.12);
  pointer-events: auto;
  animation: sky-toast-in 0.25s ease-out;
}

.sky-toast.is-leaving {
  animation: sky-toast-out 0.2s ease-in forwards;
}

.sky-toast--error {
  background: var(--sky-accent);
  color: var(--sky-white);
}

.sky-toast--success {
  background: var(--sky-soft-blue);
  color: var(--sky-accent-d-3);
}

.sky-toast--info {
  background: #e8ecee;
  color: var(--sky-accent-d-4);
}

/* Symbole "warning" devant les erreurs. */
.sky-toast--error::before {
  content: "";
  flex-shrink: 0;
  width: 1.2rem;
  height: 1.6rem;
  background-color: currentColor;
  -webkit-mask: url("/wp-content/uploads/warning-fill.svg") center / contain
    no-repeat;
  mask: url("/wp-content/uploads/warning-fill.svg") center / contain no-repeat;
}

.sky-toast__content {
  flex: 1;
  min-width: 0;
  line-height: 1.6;
}

/* La notice WooCommerce n'est plus qu'un contenu texte : le toast porte le style. */
.sky-toast .sky-toast__content > *,
.sky-toast .sky-toast__content li {
  all: unset;
  display: block;
}

.sky-toast .sky-toast__content > *::before,
.sky-toast .sky-toast__content li::before {
  content: none;
}

.sky-toast__content li + li {
  margin-top: 0.25em;
}

.sky-toast .sky-toast__content a {
  all: unset;
  color: currentColor;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

/* Bouton "Voir le panier" & co : WooCommerce le place avant le texte, on l'envoie à droite. */
.sky-toast .sky-toast__content a.button {
  float: right;
  margin-left: 0.75em;
}

.sky-toast__content a:focus-visible,
.sky-toast__close:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.sky-toast__close {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity var(--t-fast, 0.15s);
}

.sky-toast__close:hover {
  opacity: 1;
}

@keyframes sky-toast-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

@keyframes sky-toast-out {
  to {
    opacity: 0;
    transform: translateY(12px);
  }
}

@media (max-width: 767px) {
  .sky-toaster {
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 0 var(--space-2xs) calc(var(--space-2xs) + env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  .sky-toast,
  .sky-toast.is-leaving {
    animation: none;
  }
}
