/* Messages (toasts) de tout le site : un seul style, quatre couleurs (succès, erreur, alerte, information), clair et sombre. */
.tt-stack { position: fixed; z-index: 1100; inset-block-start: calc(0.75rem + env(safe-area-inset-top, 0px)); inset-inline: 0.75rem; display: grid; gap: 0.6rem; justify-items: center; margin: 0; padding: 0; pointer-events: none; }
@media (min-width: 48rem) { .tt-stack { inset-inline-start: auto; inset-inline-end: 1.25rem; justify-items: end; } }
.tt-stack template { display: none; }

.tt { --tt-c: var(--color-info); position: relative; box-sizing: border-box; inline-size: min(100%, 26rem); display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0.7rem; padding: 0.7rem 0.55rem 0.85rem 0.7rem; background: var(--color-surface); color: var(--color-text); border: 1px solid color-mix(in srgb, var(--tt-c) 38%, var(--color-border)); border-radius: 1rem; box-shadow: 0 12px 32px rgba(8, 24, 16, 0.2), 0 2px 6px rgba(8, 24, 16, 0.12); overflow: hidden; pointer-events: auto; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; transition: transform 0.3s ease, opacity 0.3s ease; animation: tt-in 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.15) backwards; }
.tt::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; inline-size: 4px; background: var(--tt-c); }
.tt--success { --tt-c: var(--color-success); }
.tt--error { --tt-c: var(--color-error); }
.tt--warning { --tt-c: var(--color-warning); }
.tt--info { --tt-c: var(--color-info); }
.tt.is-drag { transition: none; cursor: grabbing; }

.tt__art { display: grid; place-items: center; inline-size: 2.9rem; block-size: 2.9rem; border-radius: 50%; color: var(--tt-c); background: color-mix(in srgb, var(--tt-c) 15%, var(--color-surface)); }
.tt__text { margin: 0; font-size: 0.95rem; line-height: 1.4; overflow-wrap: anywhere; }
.tt__kind { display: block; margin-block-end: 0.1rem; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--tt-c); }
.tt__close { display: grid; place-items: center; inline-size: 2.25rem; block-size: 2.25rem; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--color-text-muted); cursor: pointer; }
.tt__close:hover { background: color-mix(in srgb, var(--tt-c) 14%, transparent); color: var(--color-text); }
.tt__close:focus-visible { outline: 2px solid var(--tt-c); outline-offset: 1px; }
.tt__close svg { inline-size: 1.1rem; block-size: 1.1rem; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }

.tt__bar { position: absolute; inset-inline: 0; inset-block-end: 0; block-size: 3px; background: var(--tt-c); transform-origin: left center; animation: tt-bar var(--tt-time, 5s) linear forwards; }
[dir="rtl"] .tt__bar { transform-origin: right center; }
.tt.is-paused .tt__bar { animation-play-state: paused; }
/* Sans JavaScript : le message s'efface seul au bout de 5 secondes. */
.tt-stack:not(.is-js) .tt { animation: tt-in 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.15) backwards, tt-gone 0.35s ease 5s forwards; }

/* Illustrations (traits, couleur du message) */
.tt-art { inline-size: 2.1rem; block-size: 2.1rem; overflow: visible; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tt-ring, .tt-mark { stroke-dasharray: 1; stroke-dashoffset: 1; animation: tt-draw 0.55s ease-out 0.15s forwards; }
.tt-mark { animation-delay: 0.5s; animation-duration: 0.35s; }
.tt-mark--b { animation-delay: 0.62s; }
.tt-dot { fill: currentColor; stroke: none; transform-box: fill-box; transform-origin: center; animation: tt-pop 0.35s ease-out 0.55s backwards; }
.tt-spark { fill: currentColor; stroke: none; opacity: 0; transform-box: fill-box; transform-origin: center; animation: tt-twinkle 1.8s ease-in-out 0.7s infinite; }
.tt-spark--b { animation-delay: 1.1s; }
.tt-spark--c { fill: none; stroke: currentColor; stroke-width: 1.4; animation-delay: 1.4s; }
.tt-art--success .tt-mark { stroke-width: 2.6; }
.tt-art--error { animation: tt-shake 0.5s ease 0.8s 1; }
.tt-art--warning { transform-origin: center; animation: tt-wobble 2.4s ease-in-out 1s infinite; }
.tt-art--warning .tt-ring { fill: color-mix(in srgb, currentColor 12%, transparent); }
.tt-pulse { stroke-width: 1.5; opacity: 0; transform-box: fill-box; transform-origin: center; animation: tt-ripple 2s ease-out 0.8s infinite; }

@keyframes tt-in { from { opacity: 0; transform: translateY(-1.1rem) scale(0.94); } }
@keyframes tt-gone { to { opacity: 0; visibility: hidden; transform: translateY(-0.6rem); } }
@keyframes tt-bar { to { transform: scaleX(0); } }
@keyframes tt-draw { to { stroke-dashoffset: 0; } }
@keyframes tt-pop { from { opacity: 0; transform: scale(0); } }
@keyframes tt-twinkle { 0%, 100% { opacity: 0; transform: scale(0.4); } 50% { opacity: 0.9; transform: scale(1.1); } }
@keyframes tt-shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-2px) rotate(-4deg); } 40% { transform: translateX(2px) rotate(4deg); } 60% { transform: translateX(-1.5px); } 80% { transform: translateX(1.5px); } }
@keyframes tt-wobble { 0%, 84%, 100% { transform: rotate(0); } 88% { transform: rotate(-7deg); } 92% { transform: rotate(6deg); } 96% { transform: rotate(-3deg); } }
@keyframes tt-ripple { 0% { opacity: 0.6; transform: scale(1); } 100% { opacity: 0; transform: scale(1.35); } }

@media (prefers-reduced-motion: reduce) {
  .tt, .tt-stack:not(.is-js) .tt { animation: none; transition: none; }
  .tt-stack:not(.is-js) .tt { animation: tt-gone 0.01s linear 5s forwards; }
  .tt-ring, .tt-mark { animation: none; stroke-dashoffset: 0; }
  .tt-dot, .tt-art, .tt-pulse { animation: none; }
  .tt-spark { animation: none; opacity: 0; }
  .tt__bar { animation-duration: var(--tt-time, 5s); }
}
@media (forced-colors: active) { .tt { border: 2px solid CanvasText; } .tt__bar, .tt::before { background: Highlight; } }
@media print { .tt-stack { display: none; } }
