/* Qutob Reference Product Gallery — scoped to WooCommerce product pages. */

/* Keep the PhotoSwipe lightbox above sticky headers and navigation. */
.pswp {
	z-index: 9999 !important;
}

.qrg-active div.product {
	--qrg-primary: var(--bs-ec-primary, #fed700);
	--qrg-dot: #bcbcbc;
	--qrg-arrow-bg: #010101;
	--qrg-arrow-color: #fff;
	--qrg-zoom: #7895a5;
}

.qrg-active div.product::after {
	display: table;
	clear: both;
	content: "";
}

/* Reference desktop proportions: gallery 5/12 and product summary 7/12. */
@media (min-width: 992px) {
	.qrg-active div.product div.images.woocommerce-product-gallery {
		float: left;
		width: 41.666667%;
		margin: 0 0 90px;
		padding-right: 15px;
	}

	.qrg-active div.product div.summary.entry-summary {
		float: right;
		width: 58.333333%;
		padding-left: 15px;
	}
}

.qrg-active .woocommerce-product-gallery {
	position: relative;
	box-sizing: border-box;
	opacity: 1 !important;
}

.qrg-active .woocommerce-product-gallery *,
.qrg-active .woocommerce-product-gallery *::before,
.qrg-active .woocommerce-product-gallery *::after {
	box-sizing: border-box;
}

.qrg-active .woocommerce-product-gallery .flex-viewport {
	margin-bottom: 12px;
}

.qrg-active .woocommerce-product-gallery__wrapper,
.qrg-active .woocommerce-product-gallery__image {
	margin: 0;
	padding: 0;
}

.qrg-active .woocommerce-product-gallery__image > a {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 400px;
	background: #fff;
}

.qrg-active .woocommerce-product-gallery__image img {
	display: block;
	width: auto !important;
	max-width: 100%;
	height: auto !important;
	max-height: 400px;
	margin: 0 auto;
	object-fit: contain;
	box-shadow: none;
}

/* WooCommerce zoom/lightbox trigger. */
.qrg-active .woocommerce-product-gallery__trigger {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 30;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border: 0;
	border-radius: 0;
	background: transparent;
	box-shadow: none;
	font-size: 0;
	text-decoration: none;
}

.qrg-active .woocommerce-product-gallery__trigger::before {
	position: relative;
	top: auto;
	left: auto;
	display: block;
	width: 14px;
	height: 14px;
	border: 2px solid var(--qrg-zoom);
	border-radius: 50%;
	content: "";
}

.qrg-active .woocommerce-product-gallery__trigger::after {
	position: absolute;
	top: 24px;
	left: 24px;
	display: block;
	width: 7px;
	height: 2px;
	border: 0;
	border-radius: 0;
	background: var(--qrg-zoom);
	content: "";
	transform: rotate(45deg);
}

/* All thumbnails remain available inside a five-at-a-time horizontal slider. */
.qrg-active .woocommerce-product-gallery .flex-control-thumbs {
	display: flex;
	flex-flow: row nowrap;
	gap: 0;
	width: calc(100% + 10px);
	margin: 0 -5px;
	padding: 0;
	overflow-x: auto;
	overflow-y: hidden;
	list-style: none;
	scroll-behavior: smooth;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
}

.qrg-active .woocommerce-product-gallery .flex-control-thumbs::-webkit-scrollbar {
	display: none;
}

.qrg-active .woocommerce-product-gallery .flex-control-thumbs li {
	flex: 0 0 20%;
	width: 20%;
	margin: 0;
	padding: 5px;
	list-style: none;
	cursor: pointer;
	scroll-snap-align: start;
}

/* Keep the reference five-column thumbnail size while allowing extra rows. */

.qrg-active .woocommerce-product-gallery .flex-control-thumbs li img {
	display: block;
	width: 100% !important;
	height: auto !important;
	aspect-ratio: 1 / 1;
	margin: 0 auto;
	padding: 0;
	border: 1px solid #fff;
	border-bottom: 2px solid transparent;
	border-radius: 0;
	opacity: 1;
	object-fit: contain;
	cursor: pointer;
	transition: border-color 180ms ease;
}

.qrg-active .woocommerce-product-gallery .flex-control-thumbs li img:hover {
	border-bottom-color: #ddd;
}

.qrg-active .woocommerce-product-gallery .flex-control-thumbs li img.flex-active {
	border-bottom-color: var(--qrg-primary);
}

/* Reference-style direction controls, inserted by gallery.js. */
.qrg-active .qrg-direction-nav {
	position: static;
	margin: 0;
	padding: 0;
	list-style: none;
	opacity: 0;
	transition: opacity 180ms ease;
}

.qrg-active .woocommerce-product-gallery:hover .qrg-direction-nav,
.qrg-active .woocommerce-product-gallery:focus-within .qrg-direction-nav {
	opacity: 1;
}

.qrg-active .qrg-direction-nav li {
	margin: 0;
	padding: 0;
	list-style: none;
}

.qrg-active .qrg-direction-nav button {
	position: absolute;
	top: 200px;
	z-index: 25;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	color: var(--qrg-arrow-color);
	background: var(--qrg-arrow-bg);
	box-shadow: none;
	opacity: 0.6;
	cursor: pointer;
	transform: translateY(-50%);
	transition: opacity 180ms ease;
}

.qrg-active .qrg-direction-nav button:hover,
.qrg-active .qrg-direction-nav button:focus {
	color: var(--qrg-arrow-color);
	background: var(--qrg-arrow-bg);
	opacity: 1;
	outline: none;
}

.qrg-active .qrg-direction-nav .qrg-prev {
	left: 10px;
}

.qrg-active .qrg-direction-nav .qrg-next {
	right: 10px;
}

.qrg-active .qrg-direction-nav button::before {
	display: block;
	width: 10px;
	height: 10px;
	border-top: 2px solid currentColor;
	border-right: 2px solid currentColor;
	content: "";
}

.qrg-active .qrg-direction-nav .qrg-prev::before {
	transform: rotate(-135deg);
}

.qrg-active .qrg-direction-nav .qrg-next::before {
	transform: rotate(45deg);
}

.qrg-active .qrg-direction-nav button:disabled {
	z-index: -1;
	opacity: 0;
	pointer-events: none;
}

/* Thumbnail carousel shell and optional circular controls. */
.qrg-active .qrg-thumbs-shell {
	position: relative;
	width: 100%;
	padding: 0 32px;
}

.qrg-active .qrg-thumbs-shell .flex-control-thumbs {
	width: calc(100% + 10px);
}

.qrg-active .qrg-thumb-arrow {
	position: absolute;
	top: 50%;
	z-index: 20;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	color: var(--qrg-arrow-color);
	background: var(--qrg-arrow-bg);
	box-shadow: none;
	opacity: 0.72;
	cursor: pointer;
	transform: translateY(-50%);
	transition: opacity 180ms ease;
}

.qrg-active .qrg-thumb-arrow:hover,
.qrg-active .qrg-thumb-arrow:focus {
	color: var(--qrg-arrow-color);
	background: var(--qrg-arrow-bg);
	opacity: 1;
	outline: none;
}

.qrg-active .qrg-thumb-prev {
	left: 0;
}

.qrg-active .qrg-thumb-next {
	right: 0;
}

.qrg-active .qrg-thumb-arrow::before {
	display: block;
	width: 7px;
	height: 7px;
	border-top: 2px solid currentColor;
	border-right: 2px solid currentColor;
	content: "";
}

.qrg-active .qrg-thumb-prev::before {
	margin-left: 3px;
	transform: rotate(-135deg);
}

.qrg-active .qrg-thumb-next::before {
	margin-right: 3px;
	transform: rotate(45deg);
}

.qrg-active .qrg-thumb-arrow:disabled {
	opacity: 0.2;
	cursor: default;
}

/* One dot per product image. */
.qrg-active .qrg-dots {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 14px;
	margin: 0;
	padding: 10px 0 0;
	list-style: none;
}

.qrg-active .qrg-dots li {
	margin: 0;
	padding: 0;
	list-style: none;
}

.qrg-active .qrg-dot {
	display: block;
	width: 8px;
	height: 8px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 20px;
	background: var(--qrg-dot);
	box-shadow: none;
	font-size: 0;
	cursor: pointer;
	transition: width 180ms ease, background-color 180ms ease;
}

.qrg-active .qrg-dot:hover,
.qrg-active .qrg-dot:focus {
	background: var(--qrg-dot);
	outline: none;
}

.qrg-active .qrg-dot.is-active {
	width: 30px;
	background: var(--qrg-primary);
}

@media (max-width: 991px) {
	.qrg-active div.product div.images.woocommerce-product-gallery,
	.qrg-active div.product div.summary.entry-summary {
		float: none;
		width: 100%;
		padding-right: 0;
		padding-left: 0;
	}

	.qrg-active div.product div.images.woocommerce-product-gallery {
		margin-bottom: 35px;
	}
}

@media (max-width: 767px) {
	.qrg-active .woocommerce-product-gallery__image > a {
		height: 350px;
	}

	.qrg-active .woocommerce-product-gallery__image img {
		max-height: 350px;
	}

	.qrg-active .qrg-direction-nav {
		opacity: 1;
	}

	.qrg-active .qrg-direction-nav button {
		top: 175px;
		width: 40px;
		height: 40px;
	}

	.qrg-active .qrg-direction-nav .qrg-prev {
		left: 5px;
	}

	.qrg-active .qrg-direction-nav .qrg-next {
		right: 5px;
	}

	.qrg-active .qrg-dots {
		gap: 10px;
	}
}

@media (max-width: 479px) {
	.qrg-active .woocommerce-product-gallery__image > a {
		height: 300px;
	}

	.qrg-active .woocommerce-product-gallery__image img {
		max-height: 300px;
	}

	.qrg-active .qrg-direction-nav button {
		top: 150px;
		width: 38px;
		height: 38px;
	}

	.qrg-active .qrg-thumbs-shell {
		padding-right: 28px;
		padding-left: 28px;
	}

	.qrg-active .qrg-thumb-arrow {
		width: 25px;
		height: 25px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.qrg-active .woocommerce-product-gallery .flex-control-thumbs,
	.qrg-active .qrg-direction-nav,
	.qrg-active .qrg-direction-nav button {
		scroll-behavior: auto;
		transition: none;
	}
}
