/**
 * Single product gallery — visible main image with object-fit: contain (flexslider-safe).
 */

body.single-product {
	--americ-gallery-frame-height: min(520px, 62vh);
	--primary-color: #c59412;
	--primary-color-rgb: 197, 148, 18;
	--secondary-color-rgb: 95, 114, 127;
}

.single-product #pxl-content-area div.product .woocommerce-gallery-inner.flex-slider-active,
.single-product > div.product .woocommerce-gallery-inner.flex-slider-active {
	padding-left: 0 !important;
}

.single-product #pxl-content-area div.product .woocommerce-product-gallery,
.single-product > div.product .woocommerce-product-gallery {
	position: relative;
	margin-bottom: 2rem !important;
	width: 100% !important;
}

/* Prev/next: center on main image frame, not whole gallery (thumbnails were pulling arrows down). */
.single-product #pxl-content-area div.product .woocommerce-product-gallery .flex-direction-nav,
.single-product > div.product .woocommerce-product-gallery .flex-direction-nav {
	margin: 0;
	padding: 0;
	list-style: none;
}

.single-product #pxl-content-area div.product .woocommerce-product-gallery .flex-direction-nav .flex-nav-prev,
.single-product > div.product .woocommerce-product-gallery .flex-direction-nav .flex-nav-prev,
.single-product #pxl-content-area div.product .woocommerce-product-gallery .flex-direction-nav .flex-nav-next,
.single-product > div.product .woocommerce-product-gallery .flex-direction-nav .flex-nav-next {
	position: absolute;
	top: calc(var(--americ-gallery-frame-height) / 2) !important;
	left: auto !important;
	right: auto !important;
	transform: translateY(-50%) !important;
	z-index: 5;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.25s ease, visibility 0.25s ease, left 0.25s ease, right 0.25s ease;
}

.single-product #pxl-content-area div.product .woocommerce-product-gallery .flex-direction-nav .flex-nav-prev,
.single-product > div.product .woocommerce-product-gallery .flex-direction-nav .flex-nav-prev {
	left: 0 !important;
}

.single-product #pxl-content-area div.product .woocommerce-product-gallery .flex-direction-nav .flex-nav-next,
.single-product > div.product .woocommerce-product-gallery .flex-direction-nav .flex-nav-next {
	right: 0 !important;
}

.single-product #pxl-content-area div.product .woocommerce-product-gallery:hover .flex-direction-nav .flex-nav-prev,
.single-product > div.product .woocommerce-product-gallery:hover .flex-direction-nav .flex-nav-prev {
	left: 12px !important;
	opacity: 1;
	visibility: visible;
}

.single-product #pxl-content-area div.product .woocommerce-product-gallery:hover .flex-direction-nav .flex-nav-next,
.single-product > div.product .woocommerce-product-gallery:hover .flex-direction-nav .flex-nav-next {
	right: 12px !important;
	opacity: 1;
	visibility: visible;
}

.single-product #pxl-content-area div.product .woocommerce-product-gallery .flex-direction-nav a,
.single-product > div.product .woocommerce-product-gallery .flex-direction-nav a {
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	width: 40px;
	height: 40px;
	padding: 0;
	font-size: 0;
	line-height: 1 !important;
	color: #000;
	background-color: rgba(0, 0, 0, 0.12);
	border-radius: 0;
}

.single-product #pxl-content-area div.product .woocommerce-product-gallery .flex-direction-nav a::before,
.single-product > div.product .woocommerce-product-gallery .flex-direction-nav a::before {
	font-family: "Caseicon", sans-serif;
	font-size: 12px;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
}

.single-product #pxl-content-area div.product .woocommerce-product-gallery .flex-direction-nav .flex-nav-next a::before,
.single-product > div.product .woocommerce-product-gallery .flex-direction-nav .flex-nav-next a::before {
	transform: scaleX(-1);
}

.single-product #pxl-content-area div.product .woocommerce-product-gallery .flex-direction-nav a:hover,
.single-product > div.product .woocommerce-product-gallery .flex-direction-nav a:hover {
	color: #fff;
	background-color: var(--primary-color);
}

.single-product #pxl-content-area div.product .woocommerce-product-gallery .woocommerce-product-gallery__image::before,
.single-product > div.product .woocommerce-product-gallery .woocommerce-product-gallery__image::before {
	display: none !important;
	content: none !important;
}

/* Viewport: fixed clip area — do NOT set height on slides/li (breaks flexslider). */
.single-product #pxl-content-area div.product .woocommerce-product-gallery .flex-viewport,
.single-product > div.product .woocommerce-product-gallery .flex-viewport {
	height: var(--americ-gallery-frame-height) !important;
	max-height: var(--americ-gallery-frame-height) !important;
	border-radius: 0 !important;
	background: #fff !important;
	overflow: hidden !important;
}

.single-product #pxl-content-area div.product .woocommerce-product-gallery .flex-viewport .woocommerce-product-gallery__image,
.single-product > div.product .woocommerce-product-gallery .flex-viewport .woocommerce-product-gallery__image {
	height: auto !important;
	max-height: var(--americ-gallery-frame-height) !important;
	border: none !important;
	box-shadow: none !important;
}

.single-product #pxl-content-area div.product .woocommerce-product-gallery .flex-viewport .woocommerce-product-gallery__image a,
.single-product > div.product .woocommerce-product-gallery .flex-viewport .woocommerce-product-gallery__image a {
	display: block !important;
	width: 100% !important;
	height: auto !important;
	min-height: 0 !important;
	padding: 1rem !important;
	box-sizing: border-box !important;
	border-radius: 0 !important;
	text-align: center;
	line-height: 0;
}

.single-product #pxl-content-area div.product .woocommerce-product-gallery .flex-viewport .woocommerce-product-gallery__image a::before,
.single-product > div.product .woocommerce-product-gallery .flex-viewport .woocommerce-product-gallery__image a::before {
	display: none !important;
}

/* Main slide image only — max dimensions + contain (no height:100% on img). */
.single-product #pxl-content-area div.product .woocommerce-product-gallery .flex-viewport .woocommerce-product-gallery__image img,
.single-product > div.product .woocommerce-product-gallery .flex-viewport .woocommerce-product-gallery__image img {
	display: inline-block !important;
	width: auto !important;
	height: auto !important;
	max-width: calc(100% - 2rem) !important;
	max-height: calc(var(--americ-gallery-frame-height) - 2rem) !important;
	object-fit: contain !important;
	object-position: center center !important;
	margin: 0 auto !important;
	vertical-align: middle;
}

/* Zoom plugin duplicate — keep in flow */
.single-product #pxl-content-area div.product .woocommerce-product-gallery .flex-viewport .zoomImg {
	display: none !important;
}

/* Single image (no flexslider) */
.single-product #pxl-content-area div.product .woocommerce-product-gallery:not(.flexslider) .woocommerce-product-gallery__wrapper > .woocommerce-product-gallery__image:first-child,
.single-product > div.product .woocommerce-product-gallery:not(.flexslider) .woocommerce-product-gallery__wrapper > .woocommerce-product-gallery__image:first-child {
	display: block !important;
	border: 1px solid rgba(var(--primary-color-rgb), 0.4);
	background: #fff;
	text-align: center;
}

.single-product #pxl-content-area div.product .woocommerce-product-gallery:not(.flexslider) .woocommerce-product-gallery__wrapper > .woocommerce-product-gallery__image:first-child a,
.single-product > div.product .woocommerce-product-gallery:not(.flexslider) .woocommerce-product-gallery__wrapper > .woocommerce-product-gallery__image:first-child a {
	display: block !important;
	padding: 1rem !important;
	min-height: 0 !important;
}

.single-product #pxl-content-area div.product .woocommerce-product-gallery:not(.flexslider) .woocommerce-product-gallery__wrapper > .woocommerce-product-gallery__image:first-child img,
.single-product > div.product .woocommerce-product-gallery:not(.flexslider) .woocommerce-product-gallery__wrapper > .woocommerce-product-gallery__image:first-child img {
	max-width: 100% !important;
	max-height: var(--americ-gallery-frame-height) !important;
	width: auto !important;
	height: auto !important;
	object-fit: contain !important;
	margin: 0 auto !important;
}

.single-product #pxl-content-area div.product .woocommerce-product-gallery .woocommerce-product-gallery__wrapper > .woocommerce-product-gallery__image:nth-child(n + 2),
.single-product > div.product .woocommerce-product-gallery .woocommerce-product-gallery__wrapper > .woocommerce-product-gallery__image:nth-child(n + 2) {
	display: inline-block !important;
	vertical-align: top;
	margin-top: 0.75rem;
}

/* Thumbnails */
.single-product #pxl-content-area div.product .woocommerce-product-gallery .flex-control-nav,
.single-product > div.product .woocommerce-product-gallery .flex-control-nav {
	position: static !important;
	left: auto !important;
	top: auto !important;
	display: grid !important;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 0.65rem;
	margin: 1rem 0 0 !important;
	width: 100%;
	padding: 0;
}

.single-product #pxl-content-area div.product .woocommerce-product-gallery .flex-control-nav li,
.single-product > div.product .woocommerce-product-gallery .flex-control-nav li {
	width: 100% !important;
	margin: 0 !important;
	float: none !important;
	padding: 0 !important;
}

.single-product #pxl-content-area div.product .woocommerce-product-gallery .flex-control-nav img,
.single-product > div.product .woocommerce-product-gallery .flex-control-nav img {
	width: 100% !important;
	height: 100% !important;
	aspect-ratio: 1;
	object-fit: cover !important;
	border: 1px solid rgba(var(--secondary-color-rgb), 0.25);
	border-radius: 0;
	opacity: 0.7;
}

.single-product #pxl-content-area div.product .woocommerce-product-gallery .flex-control-nav img.flex-active,
.single-product > div.product .woocommerce-product-gallery .flex-control-nav img.flex-active,
.single-product #pxl-content-area div.product .woocommerce-product-gallery .flex-control-nav img:hover,
.single-product > div.product .woocommerce-product-gallery .flex-control-nav img:hover {
	opacity: 1;
	border-color: var(--primary-color);
}

@media (max-width: 991px) {
	body.single-product {
		--americ-gallery-frame-height: min(420px, 55vh);
	}
}

@media (max-width: 575px) {
	body.single-product {
		--americ-gallery-frame-height: min(320px, 50vh);
	}

	.single-product #pxl-content-area div.product .woocommerce-product-gallery .flex-control-nav,
	.single-product > div.product .woocommerce-product-gallery .flex-control-nav {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

/* PhotoSwipe lightbox — parent theme maps wrong Caseicon glyphs (right arrow on left, pin on right). */
.pswp .pswp__ui .pswp__button:before {
	font-family: "Caseicon", sans-serif;
}

.pswp .pswp__ui .pswp__button--arrow--left:before {
	content: "\f120"; /* caseicon-long-arrow-left */
}

.pswp .pswp__ui .pswp__button--arrow--right:before {
	content: "\f136"; /* caseicon-long-arrow-right-two */
}

/* Brand logo under product title (image only). */
.single-product .americ-child-product-brands {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin: 0.65rem 0 1.25rem;
}

.single-product .americ-child-product-brands__link {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 7.5rem;
	box-sizing: border-box;
	text-decoration: none;
}

.single-product .americ-child-product-brands__link:hover {
	box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12);
	transform: translateY(-2px);
}

.single-product .americ-child-product-brands__link img.brand-thumbnail {
	width: auto;
	max-width: 100%;
	height: auto;
	max-height: 100%;
	object-fit: contain;
	margin: 0;
}
