/**
 * Cart Toast — layout for the fixed stack.
 *
 * Type, colours, spacing, background, and border on each notice stay with
 * Divi. This file only places the stack and gives a toast a readable default
 * before those options are set.
 */

.spruce-cart-toasts {
	position: fixed;
	z-index: 100001;
	right: max(1rem, env(safe-area-inset-right));
	bottom: max(1rem, env(safe-area-inset-bottom));
	display: flex;
	flex-direction: column;
	align-items: stretch;
	width: min(22rem, calc(100vw - 2rem));
	gap: 0.75rem;
	margin: 0;
	pointer-events: none;
}

.spruce-cart-toasts--preview {
	position: static;
	z-index: auto;
	right: auto;
	bottom: auto;
	width: min(22rem, 100%);
	margin-left: auto;
	pointer-events: auto;
}

.spruce-cart-toast {
	display: grid;
	grid-template-columns: 4.5rem minmax(0, 1fr);
	grid-template-areas:
		"media copy"
		"media action";
	align-items: center;
	column-gap: 0.75rem;
	row-gap: 0.35rem;
	box-sizing: border-box;
	width: 100%;
	margin: 0;
	padding: 0.75rem;
	border: 1px solid rgba(0, 0, 0, 0.12);
	border-radius: 10px;
	background: #fff;
	box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
	color: #1a1a1a;
	font: inherit;
	font-size: 0.9375rem;
	line-height: 1.35;
	text-align: start;
	pointer-events: auto;
	animation: spruce-cart-toast-in 0.18s ease;
}

.spruce-cart-toast[hidden] {
	display: none;
}

.spruce-cart-toast.is-leaving {
	animation: spruce-cart-toast-out 0.35s ease forwards;
}

.spruce-cart-toast__media {
	grid-area: media;
	width: 4.5rem;
	height: 4.5rem;
	overflow: hidden;
	border-radius: 6px;
	background: #f3f3f3;
}

.spruce-cart-toast__img,
.spruce-cart-toast__placeholder {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.spruce-cart-toast__copy {
	display: flex;
	grid-area: copy;
	align-self: end;
	flex-direction: column;
	gap: 0.15rem;
	min-width: 0;
}

.spruce-cart-toast__title {
	display: block;
	overflow: hidden;
	font-weight: 700;
	font-size: 1rem;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.spruce-cart-toast__product {
	display: flex;
	flex-direction: column;
	gap: 0.1rem;
	min-width: 0;
	font-size: 0.875rem;
}

.spruce-cart-toast__name {
	display: -webkit-box;
	overflow: hidden;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
}

.spruce-cart-toast__meta {
	display: block;
	overflow: hidden;
	font-weight: 700;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.spruce-cart-toast__cart {
	display: inline-flex;
	grid-area: action;
	align-self: end;
	justify-self: end;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	width: 2rem;
	height: 2rem;
	margin: 0;
	padding: 0.3rem;
	border: 1px solid rgba(0, 0, 0, 0.16);
	border-radius: 999px;
	background: #fff;
	color: inherit;
	line-height: 1;
	text-decoration: none;
}

.spruce-cart-toast__cart:hover,
.spruce-cart-toast__cart:focus {
	color: inherit;
	text-decoration: none;
}

.spruce-cart-toast__cart:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.spruce-cart-toast__icon {
	display: block;
	width: 1.15em;
	height: 1.15em;
}

@keyframes spruce-cart-toast-in {
	from {
		opacity: 0;
		transform: translateY(0.4rem);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

@keyframes spruce-cart-toast-out {
	to {
		opacity: 0;
	}
}

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