/**
 * On-load "Slide Banner" popup.
 *
 * Replicates the AEON MALL coverflow popup: Swiper `effect: coverflow` with
 * `slidesPerView: 2` + `centeredSlides`, so exactly three slides read — a large
 * centre banner and the two neighbours rotated back on each side, clipped by the
 * swiper's default hidden overflow. Sizing works off a wide container: the
 * centre banner is the middle 50% of it, so the close button, arrows and
 * pagination anchor to the 25% / 75% edges of that centre banner.
 *
 * Self-contained: also declares the overlay base so the popup works on pages
 * that do not load the theme's popup.css (slide pages with no single image).
 */
#magenest-popup.magenest-popup-slider-overlay {
	position: fixed;
	inset: 0;
	display: none;
	align-items: center;
	justify-content: center;
	background-color: rgba(0, 0, 0, 0.32);
	z-index: 9999;
}

#magenest-popup.magenest-popup-slider-overlay.active {
	display: flex;
}

.magenest-popup-slide {
	position: relative;
	/*
	 * The 95vh term caps the whole cluster by viewport height so the tall portrait
	 * banners still fit when the phone is rotated to landscape (very short height).
	 * On a normal tall screen 820px wins, so desktop is unchanged; only short/
	 * landscape viewports shrink the popup to fit. The image keeps width:100%, so
	 * the banners stay flush — the cluster scales as a whole.
	 */
	width: min(94vw, 820px, 95vh);
}

/*
 * Swiper viewport: clip only horizontally so the extra side slides stay hidden,
 * but let slides overflow vertically. With plain `overflow: hidden` the tall
 * portrait banners (whose 3D coverflow transform lifts their top edge above the
 * box mid-transition) get their heads cut off; `overflow-y: visible` keeps the
 * full banner on screen while `overflow-x: clip` still hides the far slides.
 */
.magenest-popup-swiper {
	width: 100%;
	overflow-x: clip;
	overflow-y: visible;
}

.magenest-popup-swiper .swiper-slide {
	transition: opacity 0.35s ease;
}

.magenest-popup-swiper .swiper-slide-active {
	opacity: 1;
	z-index: 2;
}

.magenest-popup-swiper .swiper-slide img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 8px;
}

.magenest-popup-swiper .swiper-slide a {
	display: block;
}

/* Close button on the top-right corner of the centre banner (right edge = 75%). */
.magenest-popup-slide .magenest-popup-close {
	position: absolute;
	top: -12px;
	right: calc(25% - 12px);
	z-index: 6;
	width: 30px;
	height: 30px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 4px 12px rgba(38, 38, 38, 0.16);
	cursor: pointer;
}

.magenest-popup-slide .magenest-popup-close img {
	width: 14px;
	/*
	 * The theme popup.css turns close icons white (filter: brightness(0) invert(1))
	 * for its dark-overlay single popup. Our close button sits on a white circle,
	 * so reset the filter — otherwise the white "x" is invisible on white.
	 */
	filter: none;
}

/* Arrows on the outer edges of the two side banners (slider edges), not the centre. */
.magenest-popup-slide .magenest-popup-prev,
.magenest-popup-slide .magenest-popup-next {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 32px;
	height: 32px;
	margin: 0;
	border-radius: 100px;
	background-color: rgba(255, 255, 255, 0.5);
	background-repeat: no-repeat;
	background-position: center;
	background-size: 24px 24px;
	box-shadow: 0px 2px 12px rgba(170, 24, 122, 0.16);
	z-index: 5;
}

.magenest-popup-slide .magenest-popup-prev {
	left: 8px;
	background-image: url( '../../img/banner-arrow-left.svg' );
}

.magenest-popup-slide .magenest-popup-next {
	right: 8px;
	background-image: url( '../../img/banner-arrow-right.svg' );
}

/* Hide Swiper's default glyph — the SVG background renders the arrow instead. */
.magenest-popup-slide .magenest-popup-prev::after,
.magenest-popup-slide .magenest-popup-next::after {
	content: none;
}

.magenest-popup-slide .swiper-button-disabled {
	opacity: 0.35;
}

/* Pagination dots below the centre banner (absolute so it doesn't offset the arrows). */
.magenest-popup-slide .magenest-popup-pagination {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	margin-top: 16px;
	text-align: center;
}

.magenest-popup-slide .magenest-popup-pagination .swiper-pagination-bullet {
	background-color: rgba(246, 246, 246, 1);
	opacity: 1;
}

.magenest-popup-slide .magenest-popup-pagination .swiper-pagination-bullet-active {
	background-color: rgba(211, 55, 145, 1);
	width: 24px;
	border-radius: 9999px;
	-webkit-border-radius: 9999px;
	-moz-border-radius: 9999px;
	-o-border-radius: 9999px;
}

@media (max-width: 559px) {
	.magenest-popup-slide {
		width: min( 96vw, 56vh );
	}

	/*
	 * Banner fills the full slide width so there is no gap between the centre
	 * banner and the side peeks. At slidesPerView 1.15 the centre banner stays
	 * short enough to fit a phone viewport, so vertical centring never clips it.
	 * A larger radius so all four corners read as clearly rounded on mobile.
	 */
	.magenest-popup-swiper .swiper-slide img {
		width: 100%;
		border-radius: 16px;
		/* Ease the side-banner nudge when Swiper reassigns prev/next classes on a
		 * slide change, so the 88% shift glides in sync with the 300ms slide
		 * transition instead of snapping abruptly mid-animation. */
		/*transition: transform 0.3s ease;*/
	}

	/*
	 * Slide each side banner's image toward the centre so its content clears the
	 * area behind the centre banner's rounded corners — the page background then
	 * shows through those corners, making them read as rounded while the banners
	 * still look flush.
	 *
	 * The value is a PERCENTAGE of the image's own width, so it scales with the
	 * viewport: every part of the layout (slidesPerView 1.15, centeredSlides,
	 * spaceBetween 0) is proportional, so 88% holds on any screen size. It is tied
	 * to slidesPerView 1.15 — re-tune only if that changes. Swiper keeps
	 * .swiper-slide-prev / -next on the current neighbours, so this always targets
	 * the two side banners.
	 */
	/*.magenest-popup-swiper .swiper-slide-prev img {*/
	/*	transform: translateX( 88% );*/
	/*}*/

	/*.magenest-popup-swiper .swiper-slide-next img {*/
	/*	transform: translateX( -88% );*/
	/*}*/

	.magenest-popup-slide .magenest-popup-close {
		top: -12px;
		right: calc(8% - 12px);
	}

	.magenest-popup-slide .magenest-popup-prev,
	.magenest-popup-slide .magenest-popup-next {
		display: none;
	}
}
