/**
 * Kicks toast notifications — page-global.
 *
 * Renders a stack of slide-in cards in the top-right corner of the
 * viewport. Designed for the "Added to cart" flow, but reusable for
 * any transient message the site wants to surface.
 *
 * Scoped under .cb-toast so it works anywhere in the DOM — not tied
 * to a specific page template.
 */

.cb-toast-stack {
	position: fixed;
	top: 20px;
	right: 20px;
	z-index: 9999;
	display: flex;
	flex-direction: column;
	gap: 12px;
	pointer-events: none;
	max-width: 380px;
	width: calc(100vw - 40px);
}

.cb-toast {
	background: #ffffff;
	color: #0a0a0a;
	border-radius: 14px;
	box-shadow: 0 12px 40px rgba(10, 14, 24, 0.18), 0 2px 8px rgba(10, 14, 24, 0.08);
	overflow: hidden;
	pointer-events: auto;
	font-family: "Archivo", "Inter", system-ui, -apple-system, sans-serif;
	transform: translateX(calc(100% + 30px));
	opacity: 0;
	transition:
		transform 0.42s cubic-bezier(0.22, 1.3, 0.36, 1),
		opacity 0.25s ease;
	position: relative;
	isolation: isolate;
}

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

.cb-toast.is-leaving {
	transform: translateX(calc(100% + 30px));
	opacity: 0;
}

/* Progress bar (auto-dismiss timer) */
.cb-toast::after {
	content: "";
	position: absolute;
	left: 0; bottom: 0;
	height: 3px;
	width: 100%;
	background: #c6f24a;
	transform-origin: left center;
	transform: scaleX(1);
	z-index: 2;
}
.cb-toast.is-visible::after {
	animation: cb-toast-progress var(--cb-toast-duration, 5000ms) linear forwards;
}
@keyframes cb-toast-progress {
	to { transform: scaleX(0); }
}

/* Success variant — the default for add-to-cart */
.cb-toast--success {
	border-top: 1px solid rgba(10, 14, 24, 0.05);
}

/* Error variant */
.cb-toast--error::after { background: #ef4444; }

.cb-toast__inner {
	display: flex;
	align-items: stretch;
	gap: 14px;
	padding: 14px;
}

.cb-toast__icon {
	width: 36px;
	height: 36px;
	flex: 0 0 36px;
	border-radius: 50%;
	background: #c6f24a;
	color: #0a0a0a;
	display: grid;
	place-items: center;
	font-weight: 800;
	font-size: 18px;
	line-height: 1;
	align-self: flex-start;
	margin-top: 4px;
}
.cb-toast--error .cb-toast__icon {
	background: #fee2e2;
	color: #991b1b;
}

.cb-toast__image {
	width: 64px;
	height: 64px;
	flex: 0 0 64px;
	border-radius: 10px;
	overflow: hidden;
	background: #f5f5f5;
}
.cb-toast__image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}
/* If both icon and image provided, we show just the image */
.cb-toast__inner:has(.cb-toast__image) .cb-toast__icon { display: none; }

.cb-toast__body {
	flex: 1 1 auto;
	min-width: 0;
	padding-top: 2px;
}

.cb-toast__kicker {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: #16a34a;
	margin: 0 0 4px;
	display: flex;
	align-items: center;
	gap: 6px;
}
.cb-toast--error .cb-toast__kicker { color: #991b1b; }
.cb-toast__kicker-check {
	display: inline-grid;
	place-items: center;
	width: 14px; height: 14px;
	border-radius: 50%;
	background: #16a34a;
	color: #fff;
	font-size: 9px;
}
.cb-toast--error .cb-toast__kicker-check {
	background: #ef4444;
}

.cb-toast__title {
	font-size: 14px;
	font-weight: 700;
	color: #0a0a0a;
	margin: 0 0 2px;
	line-height: 1.35;
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

.cb-toast__meta {
	font-size: 12px;
	color: #6b6b6b;
	margin: 0 0 10px;
	line-height: 1.4;
}

.cb-toast__actions {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}

.cb-toast__btn {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 7px 14px;
	border-radius: 999px;
	font-family: inherit;
	font-weight: 700;
	font-size: 12px;
	letter-spacing: 0.04em;
	cursor: pointer;
	border: 0;
	text-decoration: none;
	line-height: 1;
	transition: background 0.15s ease, transform 0.1s ease;
}
.cb-toast__btn:hover { transform: translateY(-1px); }
.cb-toast__btn--primary {
	background: #0a0a0a;
	color: #ffffff;
}
.cb-toast__btn--primary:hover { background: #1f2937; }
.cb-toast__btn--ghost {
	background: transparent;
	color: #6b6b6b;
	padding-left: 10px;
	padding-right: 10px;
}
.cb-toast__btn--ghost:hover { color: #0a0a0a; background: #f5f5f5; }

.cb-toast__close {
	position: absolute;
	top: 8px;
	right: 8px;
	width: 24px;
	height: 24px;
	padding: 0;
	border: 0;
	background: transparent;
	cursor: pointer;
	color: #9ca3af;
	border-radius: 50%;
	display: grid;
	place-items: center;
	transition: background 0.15s ease, color 0.15s ease;
	font-size: 16px;
	line-height: 1;
}
.cb-toast__close:hover {
	background: #f5f5f5;
	color: #0a0a0a;
}

/* Mobile — full width */
@media (max-width: 520px) {
	.cb-toast-stack {
		top: auto;
		bottom: 20px;
		right: 20px;
		left: 20px;
		max-width: none;
		width: auto;
	}
	.cb-toast {
		transform: translateY(calc(100% + 30px));
	}
	.cb-toast.is-visible { transform: translateY(0); }
	.cb-toast.is-leaving { transform: translateY(calc(100% + 30px)); }
}

/* Respect reduced-motion */
@media (prefers-reduced-motion: reduce) {
	.cb-toast { transition: opacity 0.2s ease; transform: none; }
	.cb-toast.is-leaving { transform: none; }
	.cb-toast.is-visible::after { animation: none; }
}
