/* ==========================================================================
   Product Modal — Page-scroll overlay (Stripe pattern)
   The modal wrapper scrolls the full page; content is not capped at viewport.
   Content inside reuses single-product__* classes for identical layout.
   ========================================================================== */

/* ---------- Wrapper (scrollable layer) ---------- */
.product-modal {
	position: fixed;
	inset: 0;
	z-index: 9999;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	visibility: hidden;
	opacity: 0;
	transition: visibility 0s 0.3s, opacity 0.3s ease;
}

.product-modal.active {
	visibility: visible;
	opacity: 1;
	transition: visibility 0s, opacity 0.3s ease;
}

/* ---------- Backdrop ---------- */
.product-modal__overlay {
	position: fixed;
	inset: 0;
	background: rgba(19, 49, 86, 0.85);
	pointer-events: none;
}

/* ---------- Container ---------- */
.product-modal__container {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: 1200px;
	margin: 160px auto;
	background: #ffffff;
	border-radius: 24px;
	overflow: hidden;
	box-shadow: 0 24px 48px rgba(10, 37, 64, 0.2);
	transform: translateY(12px);
	transition: transform 0.3s ease;
}

.product-modal.active .product-modal__container {
	transform: translateY(0);
}

/* ---------- Close button (inside container) ---------- */
.product-modal__close {
	position: absolute;
	top: 16px;
	right: 16px;
	z-index: 2;
	width: 40px;
	height: 40px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	border: none;
	background: rgba(255, 255, 255, 0.95);
	color: #425466;
	cursor: pointer;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
	transition: background 0.2s ease, color 0.2s ease;
}

.product-modal__close:hover {
	background: #ffffff;
	color: #0a2540;
}

/* ---------- Snap architecture (desktop: transparent passthrough) ---------- */
.product-modal__snap-container,
.product-modal__snap-content {
	display: contents;
}

.product-modal__snap-spacer {
	display: none;
}

/* ---------- Drag handle (hidden on desktop) ---------- */
.product-modal__drag-handle-area {
	display: none;
}

/* ---------- Body scroll lock ---------- */
body.product-modal-open {
	overflow: hidden;
}

/* ---------- Single-product overrides inside modal ---------- */

/* Remove outer page padding/background — modal provides its own container */
.product-modal main.single-product,
.product-modal .single-product {
	padding: 0;
	background: none;
}

/* Card fills the modal — no extra margin/shadow needed */
.product-modal .single-product__card {
	margin-top: 0;
	border-radius: 0;
	box-shadow: none;
}

/* No sidebar in modal — content area takes full width */
.product-modal .single-product__body--no-sidebar {
	display: block;
}

.product-modal .single-product__body--no-sidebar .single-product__content-area {
	padding: 0 40px 60px;
}

/* ==========================================================================
   Responsive — Tablet (≤1080px)
   ========================================================================== */
@media (max-width: 1080px) {
	.product-modal__container {
		max-width: calc(100% - 48px);
	}
}

/* ==========================================================================
   Responsive — Mobile (≤768px)
   ========================================================================== */
@media (max-width: 768px) {

	/* Scrolling moves to the snap container on mobile */
	.product-modal {
		overflow: hidden;
	}

	/* ---------- Snap container ---------- */
	.product-modal__snap-container {
		display: block;
		position: fixed;
		inset: 0;
		overflow-y: scroll;
		scroll-snap-type: y mandatory;
		overscroll-behavior: none;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;           /* Firefox */
		-ms-overflow-style: none;        /* IE/Edge */
	}

	.product-modal__snap-container::-webkit-scrollbar {
		display: none;                   /* Chrome/Safari */
	}

	/* ---------- Snap spacer (dismiss target) ---------- */
	.product-modal__snap-spacer {
		display: block;
		height: 100vh;
		height: 100dvh;
		scroll-snap-align: start;
		scroll-snap-stop: always;
	}

	/* ---------- Snap content wrapper ---------- */
	.product-modal__snap-content {
		display: block;
		scroll-snap-align: end;
	}

	/* ---------- Container ---------- */
	.product-modal__container {
		max-width: 100%;
		margin: 0;
		border-radius: 16px 16px 0 0;
		height: calc(100vh - 48px);
		height: calc(100dvh - 48px);
		overflow-y: auto;
		overflow-x: hidden;
		transform: none;
		box-shadow: none;
	}

	.product-modal.active .product-modal__container {
		transform: none;
	}

	/* ---------- Drag handle area (progressive blur) ---------- */
	.product-modal__drag-handle-area {
		display: block;
		position: sticky;
		top: 0;
		z-index: 10;
		height: 30px;
		margin-bottom: -30px;
		touch-action: none;
	}

	.product-modal__drag-handle-area::before {
		content: '';
		position: absolute;
		inset: 0;
		-webkit-backdrop-filter: blur(4px);
		backdrop-filter: blur(4px);
		-webkit-mask-image: linear-gradient(to bottom, black 0%, black 40%, transparent 100%);
		mask-image: linear-gradient(to bottom, black 0%, black 40%, transparent 100%);
		pointer-events: none;
	}

	.product-modal__drag-icon {
		position: absolute;
		top: 12px;
		left: 50%;
		transform: translateX(-50%);
		display: block;
		line-height: 0;
		z-index: 1;
	}

	/* ---------- Close button ---------- */
	.product-modal__close {
		top: 32px;
		right: 12px;
	}

	/* ---------- Content padding ---------- */
	.product-modal .single-product__body--no-sidebar .single-product__content-area {
		padding: 0 16px 40px;
	}
}
