/* La Perle look for the theme-koneesi cart drawer and toasts; mini-cart design: docs/migration/design.md §2.5. */

:root {
	--nomon-toast-accent: var(--wp--preset--color--black);
	--nomon-toast-danger: #b3261e;
	--nomon-toast-success: var(--wp--preset--color--black);
	--nomon-toast-border: var(--wp--preset--color--mid-grey);
	--nomon-toast-text: var(--wp--preset--color--black);
	--nomon-toast-text-light: #767676;
	--nomon-toast-radius: 0;
}

body.nomon-cart-is-open {
	overflow: hidden;
}

.nomon-cart-trigger {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	background: var(--wp--preset--color--light-grey);
	color: var(--wp--preset--color--black);
	cursor: pointer;
	transition: background 0.2s;
}

.nomon-cart-trigger:hover {
	background: var(--wp--preset--color--mid-grey);
}

/* Centres the bubble on the icon's top-right corner: (44px button - 22px icon) / 2. */
.nomon-cart-trigger__count {
	position: absolute;
	top: 11px;
	right: 11px;
	display: grid;
	place-items: center;
	width: 18px;
	height: 18px;
	background: var(--wp--preset--color--black);
	color: var(--wp--preset--color--white);
	font-size: 10px;
	font-weight: 700;
	line-height: 1;
	transform: translate(50%, -50%);
}

.nomon-cart-trigger__count--hidden {
	display: none;
}

.nomon-cart-panel {
	position: fixed;
	inset: 0;
	z-index: 100000;
	visibility: hidden;
	pointer-events: none;
	transition: visibility 0s 0.2s;
}

.nomon-cart-panel.is-open {
	visibility: visible;
	pointer-events: auto;
	transition: visibility 0s;
}

.nomon-cart-backdrop {
	position: absolute;
	inset: 0;
	background: rgb(0 0 0 / 25%);
	opacity: 0;
	transition: opacity 0.2s ease-in-out;
}

.nomon-cart-drawer {
	position: absolute;
	inset: 0 0 0 auto;
	display: flex;
	flex-direction: column;
	width: 400px;
	max-width: 100%;
	padding: 30px;
	overflow-y: auto;
	overscroll-behavior: contain;
	border-left: 1px solid #dddedf;
	background: var(--wp--preset--color--white);
	color: var(--wp--preset--color--text);
	transform: translateX(100%);
	transition: transform 0.2s ease-in-out;
}

.nomon-cart-panel.is-open .nomon-cart-backdrop {
	opacity: 1;
}

.nomon-cart-panel.is-open .nomon-cart-drawer {
	transform: none;
}

@media (max-width: 478px) {
	.nomon-cart-drawer {
		width: 70%;
	}
}

.nomon-cart-header {
	margin-bottom: 25px;
}

.nomon-cart-header__title {
	display: block;
	color: var(--wp--preset--color--black);
	font-size: var(--wp--preset--font-size--lg);
	font-weight: 500;
	line-height: 1.4;
}

/* Keyboard-only: live has no visible close control (Esc and the overlay close it). */
.nomon-cart-header__close {
	position: absolute;
	top: 5px;
	left: 5px;
	display: flex;
	padding: 5px;
	color: var(--wp--preset--color--black);
	cursor: pointer;
	opacity: 0;
}

.nomon-cart-header__close:focus-visible {
	opacity: 1;
}

/* Order moves the bar from Koneesi's top slot to just above the summary. */
.nomon-cart-shipping-progress {
	order: 1;
	margin-top: auto;
	padding-block: 20px 15px;
	font-size: var(--wp--preset--font-size--sm);
}

:is(.nomon-cart-summary, .nomon-cart-summary__checkout) {
	order: 2;
}

.nomon-cart-drawer:has(.nomon-cart-items--empty) .nomon-cart-shipping-progress {
	display: none;
}

.nomon-cart-shipping-progress:not([style*="none"]) ~ .nomon-cart-summary {
	margin-top: 0;
}

.nomon-cart-shipping-progress__bar {
	height: 4px;
	background: #dddedf;
}

.nomon-cart-shipping-progress__fill {
	width: 0;
	height: 100%;
	background: var(--wp--preset--color--black);
	transition: width 0.4s ease;
}

.nomon-cart-shipping-progress__message {
	margin: 5px 0 0;
}

.nomon-cart-items--empty {
	display: flex;
	flex: 1;
	align-items: center;
	justify-content: center;
}

.nomon-cart-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 15px;
	text-align: center;
}

.nomon-cart-empty__icon svg {
	width: 32px;
	height: 32px;
	color: #767676;
}

.nomon-cart-empty__message {
	margin: 0;
}

.nomon-cart-item {
	display: grid;
	grid-template-columns: 80px 1fr;
	gap: 15px;
	margin-bottom: 15px;
	transition: opacity 0.2s;
}

@media (max-width: 478px) {
	.nomon-cart-item {
		grid-template-columns: 70px 1fr;
	}
}

.nomon-cart-item.is-loading {
	opacity: 0.5;
	pointer-events: none;
}

.nomon-cart-item__image {
	aspect-ratio: 1;
}

.nomon-cart-item__image-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.nomon-cart-item__details {
	display: flex;
	flex-direction: column;
	gap: 5px;
	min-width: 0;
}

.nomon-cart-item__top {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 10px;
}

.nomon-cart-item__name {
	color: var(--wp--preset--color--black);
	font-size: 16.5px;
	font-weight: 500;
	line-height: 1.4;
}

.nomon-cart-item__variation {
	margin-top: -4px;
	color: var(--wp--preset--color--grey);
	font-size: 13px;
	line-height: 1.4;
}

.nomon-cart-item__remove {
	display: flex;
	flex-shrink: 0;
	padding: 3px;
	color: var(--wp--preset--color--black);
	cursor: pointer;
}

.nomon-cart-item__remove svg {
	width: 12px;
	height: 12px;
}

.nomon-cart-item__bottom {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	color: var(--wp--preset--color--black);
}

.nomon-cart-item__qty-controls {
	display: inline-flex;
	align-items: center;
	border: 1px solid #dddedf;
}

.nomon-cart-item__qty-btn {
	display: grid;
	place-items: center;
	width: 26px;
	height: 26px;
	color: var(--wp--preset--color--black);
	cursor: pointer;
}

.nomon-cart-item__qty-btn:disabled {
	cursor: not-allowed;
	opacity: 0.3;
}

.nomon-cart-item__qty-btn svg {
	width: 10px;
	height: 10px;
	stroke-width: 1.5;
}

.nomon-cart-item__qty-btn svg * {
	vector-effect: non-scaling-stroke;
}

.nomon-cart-item__qty-value {
	min-width: 20px;
	text-align: center;
}

.nomon-cart-item__price {
	display: flex;
	gap: 5px;
	margin-left: auto;
}

.nomon-cart-item__price-original {
	color: #767676;
	text-decoration: line-through;
}

.nomon-cart-summary {
	margin-top: auto;
	padding-top: 20px;
	border-top: 1px solid #dddedf;
}

.nomon-cart-summary__row {
	display: flex;
	justify-content: space-between;
}

:is(.nomon-cart-summary__checkout, .nomon-cart-empty__cta) {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 15px;
	background: var(--wp--preset--color--black);
	color: var(--wp--preset--color--white);
	font-size: 15px;
	font-weight: 700;
	line-height: 40px;
	text-align: center;
	text-decoration: none;
	transition: background 0.2s;
}

:is(.nomon-cart-summary__checkout, .nomon-cart-empty__cta):hover {
	background: var(--wp--preset--color--grey);
}

/* Bleeds through the drawer's 30px padding to sit full-width on its bottom edge. */
.nomon-cart-summary__checkout {
	margin: 20px -30px -30px;
	line-height: 56px;
}

.product-single .single_add_to_cart_button.nomon-atc-success {
	pointer-events: none;
}

.nomon-atc-icon {
	display: inline-flex;
	align-items: center;
	vertical-align: middle;
	margin-block: -0.125em;
	animation: nomon-atc-icon-in 0.45s cubic-bezier(0.19, 1, 0.22, 1) both;
}

.nomon-atc-icon svg {
	display: block;
	width: 1.25em;
	height: 1.25em;
}

.nomon-atc-label {
	display: inline-block;
	max-width: 0;
	overflow: hidden;
	vertical-align: middle;
	white-space: nowrap;
	opacity: 0;
	animation: nomon-atc-label-in 0.35s ease 0.45s both;
}

@keyframes nomon-atc-icon-in {
	from { transform: translateX(-2.5em); opacity: 0; }
	to { transform: translateX(0); opacity: 1; }
}

@keyframes nomon-atc-label-in {
	from { max-width: 0; margin-left: 0; opacity: 0; }
	to { max-width: 24ch; margin-left: 0.5rem; opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
	.nomon-cart-panel,
	.nomon-cart-backdrop,
	.nomon-cart-drawer,
	.nomon-cart-item {
		transition: none;
	}

	.nomon-atc-icon {
		animation: none;
	}

	.nomon-atc-label {
		max-width: 24ch;
		margin-left: 0.5rem;
		opacity: 1;
		animation: none;
	}
}
