/* =========================================================================
 * Basket toast + card "Add to basket" mark
 * (inc/basket-toast.php, assets/js/basket-toast.js)
 * ====================================================================== */

/* -------------------------------------------------------------------------
 * Card mark — a small bag in the corner of the photo that expands to read
 * "Add to basket" when pointed at. The mark reacts to itself being hovered,
 * not to the card: card-level hover lights up the whole tile and is a
 * different, much louder thing.
 * ---------------------------------------------------------------------- */

.orbit-card__media {
	position: relative;
}

.orbit-card__buy {
	position: absolute;
	right: 12px;
	bottom: 12px;
	z-index: 9;
	display: inline-flex;
	align-items: center;
	height: 36px;
	padding: 0 10px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.92);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	color: var(--wp--preset--color--navy, #05386b);
	font-family: var(--wp--preset--font-family--system-sans-serif, sans-serif);
	font-size: 12.5px;
	font-weight: 600;
	line-height: 1;
	text-decoration: none;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
	transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
	cursor: pointer;
}

.orbit-card__buy:hover,
.orbit-card__buy:focus-visible {
	background: var(--wp--preset--color--navy, #05386b);
	color: var(--wp--preset--color--white, #fff);
	text-decoration: none;
}

.orbit-card__buy:focus-visible {
	outline: 2px solid var(--wp--preset--color--teal, #379683);
	outline-offset: 2px;
}

.orbit-card__buy-icon {
	flex: none;
	width: 16px;
	height: 16px;
	display: block;
}

.orbit-card__buy-label {
	display: inline-block;
	max-width: 0;
	margin-left: 0;
	opacity: 0;
	overflow: hidden;
	white-space: nowrap;
	transition: max-width 0.22s ease, opacity 0.22s ease, margin 0.22s ease;
}

.orbit-card__buy:hover .orbit-card__buy-label,
.orbit-card__buy:focus-visible .orbit-card__buy-label,
.orbit-card__buy.added .orbit-card__buy-label {
	max-width: 120px;
	margin-left: 7px;
	opacity: 1;
}

/* Settled: in the basket. Stays dark and open so the card remembers. */
.orbit-card__buy.added {
	background: var(--wp--preset--color--navy, #05386b);
	color: var(--wp--preset--color--white, #fff);
}

/* Woo's .loading adds padding-right for its icon-font spinner; the pill
   keeps its shape and just dims. The WooCommerce icon font never loads
   here, so the spinner/tick glyphs would render as tofu. */
.orbit-card__buy.loading {
	opacity: 0.7;
	padding: 0 10px;
}

.orbit-card__buy.loading::after,
.orbit-card__buy.added::after {
	content: none;
}

/* Feedback is the toast, not WooCommerce's inline "View basket" link that
   wc-add-to-cart.js appends after the button. */
.orbit-card__media .added_to_cart {
	display: none;
}

/* Touch has no hover to reveal the label, so it reads open from the start. */
@media (hover: none) {
	.orbit-card__buy-label {
		max-width: 120px;
		margin-left: 7px;
		opacity: 1;
	}
}

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

.orbit-toast,
.orbit-toast *,
.orbit-toast *::before,
.orbit-toast *::after {
	box-sizing: border-box;
}

.orbit-toast {
	position: fixed;
	top: 24px;
	right: 24px;
	width: min(380px, calc(100vw - 32px));
	background: var(--wp--preset--color--white, #fff);
	border: 1px solid var(--wp--preset--color--slate-50, #e5e7eb);
	border-radius: var(--wp--custom--border--radius--small, 12px);
	box-shadow: var(--wp--preset--shadow--natural, 0 18px 50px -12px rgba(0, 0, 0, 0.35));
	z-index: 999930;
	overflow: hidden;
	color: var(--wp--preset--color--black, #111);
	font-family: var(--wp--preset--font-family--system-sans-serif, sans-serif);
	transform: translateX(calc(100% + 48px));
	transition: transform 0.45s cubic-bezier(0.22, 1.2, 0.36, 1);
}

.orbit-toast.is-open {
	transform: translateX(0);
}

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

/* The drawer owns the screen while open. */
body.orbit-basket-lock .orbit-toast {
	opacity: 0;
	pointer-events: none;
}

.orbit-toast__head {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 16px;
	background: var(--wp--preset--color--navy, #05386b);
	color: var(--wp--preset--color--white, #fff);
}

.orbit-toast__tick {
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: var(--wp--preset--color--white, #fff);
	color: var(--wp--preset--color--navy, #05386b);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 12px;
	font-weight: 700;
	flex-shrink: 0;
}

.orbit-toast__title {
	flex: 1;
	font-size: 13px;
	font-weight: 700;
}

.orbit-toast__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	margin: -4px -6px -4px 0;
	padding: 0;
	background: none;
	border: 0;
	border-radius: 50%;
	color: rgba(255, 255, 255, 0.75);
	cursor: pointer;
	line-height: 1;
}

.orbit-toast__close:hover,
.orbit-toast__close:focus-visible {
	color: var(--wp--preset--color--white, #fff);
	background: rgba(255, 255, 255, 0.12);
}

.orbit-toast__item {
	display: grid;
	grid-template-columns: 64px 1fr;
	gap: 14px;
	padding: 16px 16px 4px;
	align-items: center;
}

.orbit-toast__thumb {
	width: 64px;
	height: 64px;
	border-radius: 6px;
	overflow: hidden;
	border: 1px solid var(--wp--preset--color--slate-50, #e5e7eb);
	background: var(--wp--preset--color--offwhite, #f7f7f5);
}

.orbit-toast__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.orbit-toast__copy {
	min-width: 0;
}

.orbit-toast__name {
	font-size: 15px;
	font-weight: 600;
	line-height: 1.25;
	color: var(--wp--preset--color--navy, #05386b);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.orbit-toast__vendor {
	margin-top: 2px;
	font-size: 12px;
	color: #4b5563;
}

.orbit-toast__meta {
	margin-top: 4px;
	font-size: 12.5px;
	color: #4b5563;
}

.orbit-toast__price,
.orbit-toast__price .woocommerce-Price-amount {
	color: var(--wp--preset--color--black, #111);
	font-weight: 600;
}

.orbit-toast__cta {
	display: flex;
	gap: 10px;
	padding: 14px 16px 16px;
}

.orbit-toast__cta .orbit-toast__btn {
	flex: 1;
	margin: 0;
	text-align: center;
	white-space: nowrap;
}

.orbit-toast__timer {
	height: 3px;
	background: var(--wp--preset--color--slate-50, #e5e7eb);
}

.orbit-toast__timer > div {
	height: 100%;
	width: 100%;
	background: var(--wp--preset--color--teal, #379683);
}

.orbit-toast.is-open .orbit-toast__timer > div {
	animation: orbit-toast-drain 6s linear forwards;
}

@keyframes orbit-toast-drain {
	from { width: 100%; }
	to { width: 0; }
}

@media (prefers-reduced-motion: reduce) {
	.orbit-toast { transition: none; }
	.orbit-toast.is-open .orbit-toast__timer > div { animation: none; width: 0; }
	.orbit-card__buy-label { transition: none; }
}

@media (max-width: 520px) {
	.orbit-toast {
		top: 12px;
		right: 16px;
	}
}
