/**
 * Toast notifications — add-to-cart feedback (and any future trigger).
 *
 * Site-wide stack pinned top-right on desktop, full-width top-center on
 * small screens. Each toast is a self-contained card; the stack just
 * positions and gaps them. JS owns lifecycle (mount, slide-in, dismiss,
 * unmount).
 *
 * Surfaces this covers:
 *   - Shop archive + taxonomy AJAX add-to-cart (`woocommerce_enable_ajax_add_to_cart` = yes)
 *   - Quick-view modal add-to-cart (also AJAX)
 *   - PDP single-product form submit (non-AJAX) — cookie-flag fallback
 *     set by inc/woocommerce.php, read by toast.js on next page load
 *
 * Tokens reused from variable.css so toast colours stay in lockstep with
 * notice banners (wc-notices.css). The visual differentiator is
 * elevation (shadow + slide-in) and positioning, not colour.
 *
 * Page-speed budget: ~2 KB CSS / ~700 B gzipped. Tiny.
 */

/* --- Stack container --- */

.ellisons-toast-stack {
	position: fixed;
	top: 24px;
	right: 24px;
	z-index: 9999;
	display: flex;
	flex-direction: column;
	gap: 10px;
	width: 360px;
	max-width: calc(100vw - 32px);
	pointer-events: none;
}

/* --- Toast card --- */

.ellisons-toast {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 14px 16px;
	background: var(--white, #fff);
	border-left: 3px solid var(--text-secondary, #888);
	border-radius: 4px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
	font-size: 14px;
	line-height: 1.5;
	color: var(--text-primary, #232323);
	pointer-events: auto;
	transform: translateX(110%);
	opacity: 0;
	transition: transform 280ms ease, opacity 220ms ease;
}

.ellisons-toast.is-visible {
	transform: translateX(0);
	opacity: 1;
}

.ellisons-toast.is-leaving {
	transform: translateX(110%);
	opacity: 0;
}

/* --- Icon column --- */

.ellisons-toast__icon {
	flex-shrink: 0;
	font-size: 18px;
	line-height: 1.4;
	margin-top: 1px;
	color: var(--text-secondary, #888);
}

/* --- Body column --- */

.ellisons-toast__body {
	flex: 1 1 auto;
	min-width: 0;
}

.ellisons-toast__title {
	margin: 0 0 2px;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.35;
	color: var(--text-primary, #232323);
	letter-spacing: 0;
}

.ellisons-toast__message {
	margin: 0;
	font-size: 13px;
	line-height: 1.45;
	color: var(--text-secondary, #808080);
	word-break: break-word;
}

.ellisons-toast__link {
	display: inline-block;
	margin-top: 6px;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--text-primary, #232323);
	text-decoration: none;
	border-bottom: 1px solid currentColor;
	padding-bottom: 1px;
	transition: color 160ms ease, border-color 160ms ease;
}

.ellisons-toast__link:hover,
.ellisons-toast__link:focus-visible {
	color: var(--gold-color, #c7a267);
	border-color: var(--gold-color, #c7a267);
	text-decoration: none;
}

/* --- Close button --- */

.ellisons-toast__close {
	flex-shrink: 0;
	width: 22px;
	height: 22px;
	padding: 0;
	margin: -2px -4px 0 4px;
	background: transparent;
	border: 0;
	color: var(--text-tertiary, #939393);
	font-size: 16px;
	line-height: 1;
	cursor: pointer;
	border-radius: 2px;
	transition: color 160ms ease, background 160ms ease;
}

.ellisons-toast__close:hover,
.ellisons-toast__close:focus-visible {
	color: var(--text-primary, #232323);
	background: rgba(0, 0, 0, 0.04);
	outline: none;
}

/* --- Variants --- */

.ellisons-toast--success {
	border-left-color: var(--success-green, #16b36e);
}

.ellisons-toast--success .ellisons-toast__icon {
	color: var(--success-green, #16b36e);
}

.ellisons-toast--error {
	border-left-color: var(--danger-red-border, #c0392b);
}

.ellisons-toast--error .ellisons-toast__icon {
	color: var(--danger-red-border, #c0392b);
}

.ellisons-toast--error .ellisons-toast__title {
	color: var(--danger-red-border, #c0392b);
}

/* --- Progress bar (auto-dismiss timer indicator) --- */

.ellisons-toast__progress {
	position: absolute;
	left: 0;
	bottom: 0;
	height: 2px;
	width: 100%;
	background: currentColor;
	opacity: 0.35;
	transform-origin: left center;
	transform: scaleX(1);
}

.ellisons-toast {
	position: relative;
	overflow: hidden;
}

.ellisons-toast.is-visible .ellisons-toast__progress {
	transition: transform linear;
	transform: scaleX(0);
}

.ellisons-toast--success .ellisons-toast__progress {
	color: var(--success-green, #16b36e);
}

.ellisons-toast--error .ellisons-toast__progress {
	color: var(--danger-red-border, #c0392b);
}

.ellisons-toast.is-paused .ellisons-toast__progress {
	transition: none;
}

/* --- Mobile: full-width banner at the top --- */

@media (max-width: 575.98px) {
	.ellisons-toast-stack {
		top: 12px;
		right: 12px;
		left: 12px;
		width: auto;
		max-width: none;
	}

	.ellisons-toast {
		transform: translateY(-120%);
	}

	.ellisons-toast.is-visible {
		transform: translateY(0);
	}

	.ellisons-toast.is-leaving {
		transform: translateY(-120%);
	}
}

/* --- Reduced motion: no slide, no progress animation --- */

@media (prefers-reduced-motion: reduce) {
	.ellisons-toast {
		transition: opacity 160ms ease;
		transform: none;
	}

	.ellisons-toast.is-leaving {
		transform: none;
	}

	.ellisons-toast.is-visible .ellisons-toast__progress {
		transition: none;
		transform: scaleX(0);
	}
}
