/*
 * The video modal (assets/videos/modal.js), after the reels player on
 * mumuso.com.bd: a 9:16 player centred on a dark backdrop with up/down
 * buttons beside it; full screen on phones. Landscape videos letterbox
 * inside the frame rather than being cropped.
 */
html.kawaii-vmodal-open {
	overflow: hidden;
}

.kawaii-vmodal {
	--kawaii-vmodal-height: min(88dvh, 860px);
	box-sizing: border-box;
	width: 100%;
	max-width: none;
	height: 100%;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--wp--preset--color--white, #fff);
	overflow: hidden;
}

.kawaii-vmodal[open] {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 18px;
}

.kawaii-vmodal::backdrop {
	background: rgba(16, 12, 22, 0.9);
}

.kawaii-vmodal__stage {
	position: relative;
	height: var(--kawaii-vmodal-height);
	aspect-ratio: 9 / 16;
	max-width: calc(100vw - 120px);
	overflow: hidden;
	border-radius: 20px;
	background: #000;
	box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}

/* Stacked: the next video loads hidden on top and fades in once it plays. */
.kawaii-vmodal__video {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
	background: #000;
	cursor: pointer;
	transition: opacity 0.3s ease;
}

.kawaii-vmodal__video.is-entering {
	opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
	.kawaii-vmodal__video {
		transition: none;
	}
}

.kawaii-vmodal__top {
	position: absolute;
	top: 0;
	right: 0;
	left: 0;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px 14px 30px 18px;
	background: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent);
}

.kawaii-vmodal__title {
	flex: 1;
	min-width: 0;
	margin: 0;
	overflow: hidden;
	font-size: 15px;
	font-weight: 800;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.kawaii-vmodal__count {
	font-size: 12px;
	font-weight: 700;
	opacity: 0.8;
}

.kawaii-vmodal__controls {
	position: absolute;
	right: 14px;
	bottom: 14px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.kawaii-vmodal__nav {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.kawaii-vmodal[data-single="true"] .kawaii-vmodal__nav {
	display: none;
}

.kawaii-vmodal__button {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	/* Dark, so the white icons show over light frames of the video too. */
	background: rgba(20, 16, 26, 0.45);
	color: var(--wp--preset--color--white, #fff);
	font-size: 17px;
	cursor: pointer;
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
}

.kawaii-vmodal__button:hover {
	background: rgba(20, 16, 26, 0.65);
}

.kawaii-vmodal__button:focus-visible {
	outline: 3px solid var(--wp--preset--color--accent-1, #ff79a7);
	outline-offset: 2px;
}

.kawaii-vmodal__button:disabled {
	opacity: 0.35;
	cursor: default;
}

.kawaii-vmodal__nav .kawaii-vmodal__button {
	width: 48px;
	height: 48px;
	background: var(--wp--preset--color--white, #fff);
	color: var(--wp--preset--color--contrast, #302a3a);
}

.kawaii-vmodal .kawaii-icon {
	display: block;
	width: 1em;
	height: 1em;
	fill: currentColor;
}

/*
 * The products in the video, along the bottom: thumbnail, name, price and
 * Add (or View). The strip slides sideways a card at a time, by swipe or by
 * the arrows over its ends, each shown while there is more that way.
 */
.kawaii-vmodal__shelf {
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	padding-top: 34px;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.6), transparent);
}

.kawaii-vmodal__shelf[hidden] {
	display: none;
}

.kawaii-vmodal__products {
	display: flex;
	gap: 8px;
	overflow-x: auto;
	padding: 0 12px 12px;
	scroll-padding-inline: 12px;
	scroll-snap-type: x mandatory;
	overscroll-behavior-x: contain;
	scrollbar-width: none;
}

.kawaii-vmodal__products::-webkit-scrollbar {
	display: none;
}

/* Centred on the cards: the shelf's 34px top fade and 12px bottom differ. */
.kawaii-vmodal .kawaii-vmodal__shelf-arrow {
	position: absolute;
	top: calc(50% + 11px);
	z-index: 1;
	width: 32px;
	height: 32px;
	font-size: 12px;
	background: var(--wp--preset--color--white, #fff);
	color: var(--wp--preset--color--contrast, #302a3a);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
	transform: translateY(-50%);
}

.kawaii-vmodal .kawaii-vmodal__shelf-arrow[hidden] {
	display: none;
}

.kawaii-vmodal__shelf-arrow.is-shelf-prev {
	left: 6px;
}

.kawaii-vmodal__shelf-arrow.is-shelf-next {
	right: 6px;
}

.kawaii-vmodal.has-products .kawaii-vmodal__controls {
	bottom: 96px;
}

.kawaii-vmodal__product {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	gap: 8px;
	width: min(250px, 82%);
	margin: 0;
	scroll-snap-align: start;
	padding: 8px;
	border-radius: 14px;
	background: var(--wp--preset--color--white, #fff);
	color: var(--wp--preset--color--contrast, #302a3a);
}

.kawaii-vmodal__product img {
	flex: 0 0 auto;
	width: 48px;
	height: 48px;
	border-radius: 10px;
	object-fit: cover;
	background: #ffe9f1;
}

.kawaii-vmodal__product-text {
	flex: 1;
	min-width: 0;
}

.kawaii-vmodal__product-name {
	margin: 0 0 2px;
	overflow: hidden;
	font-size: 12px;
	font-weight: 700;
	line-height: 1.3;
	white-space: nowrap;
	text-overflow: ellipsis;
}

/* A block with its own line height: inline, a sale price wrapping under the
   regular one took the page's tall line height and left a wide gap. */
.kawaii-vmodal__product-price {
	display: block;
	font-size: 12px;
	font-weight: 900;
	line-height: 1.3;
}

.kawaii-vmodal__product-price del {
	font-weight: 500;
	opacity: 0.6;
}

.kawaii-vmodal__product-price ins {
	text-decoration: none;
}

.kawaii-vmodal .kawaii-vmodal__add {
	position: relative; /* holds the cart toast's "Added ✓" label */
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 76px; /* room for "Added ✓", so the button doesn't resize */
	box-sizing: border-box;
	min-height: 36px;
	margin: 0;
	padding: 0 14px;
	border: 0;
	border-radius: 999px;
	background: var(--wp--preset--color--accent-1, #ff79a7);
	font-size: 11px;
	font-weight: 900;
	line-height: 1;
	color: var(--wp--preset--color--white, #fff);
	text-decoration: none;
}

.kawaii-vmodal .kawaii-vmodal__add.is-link {
	background: var(--wp--preset--color--contrast, #302a3a);
}

.kawaii-vmodal .kawaii-vmodal__add.loading {
	opacity: 0.6;
}

/* cart-toast.css's "Added ✓" is dark for light buttons; this one is pink. */
.kawaii-vmodal .kawaii-vmodal__product .kawaii-vmodal__add[data-kawaii-added]::before {
	color: var(--wp--preset--color--white, #fff);
}

/* WooCommerce adds a "View cart" link after an AJAX add; the toast has one. */
.kawaii-vmodal .added_to_cart {
	display: none;
}

/* Phones: the player fills the screen and the up/down buttons float on it. */
@media (max-width: 650px) {
	.kawaii-vmodal[open] {
		display: block;
	}

	.kawaii-vmodal__stage {
		width: 100%;
		height: 100%;
		max-width: none;
		aspect-ratio: auto;
		border-radius: 0;
	}

	.kawaii-vmodal__top {
		padding-top: max(14px, env(safe-area-inset-top));
	}

	.kawaii-vmodal__nav {
		position: absolute;
		top: 50%;
		right: 14px;
		transform: translateY(-50%);
	}

	.kawaii-vmodal__nav .kawaii-vmodal__button {
		width: 44px;
		height: 44px;
		background: rgba(20, 16, 26, 0.45);
		color: var(--wp--preset--color--white, #fff);
	}

	.kawaii-vmodal__controls {
		bottom: max(14px, env(safe-area-inset-bottom));
	}
}

/* Landscape phones: as tall as the screen allows, nav beside it. */
@media (max-height: 500px) and (orientation: landscape) {
	.kawaii-vmodal {
		--kawaii-vmodal-height: 100dvh;
	}

	.kawaii-vmodal__stage {
		border-radius: 0;
	}
}
