/* Advanced Product Gallery
 * Base rules use two-class selectors so Elementor's style controls always win,
 * but theme button / link styles do not.
 */

.apgal {
	--apgal-cols: 3;
	--apgal-gap: 24px;
	--apgal-thumb-size: 60px;
	--apgal-thumb-gap: 10px;
	--apgal-thumbs-space: 14px;
	--apgal-zoom: 1.4;
	--apgal-speed: 250ms;
	--apgal-badge-offset: 12px;
	position: relative;
	width: 100%;
}

.apgal-empty {
	padding: 24px;
	text-align: center;
	opacity: 0.7;
}

/* ---------- Layout: grid & carousel ---------- */

.apgal .apgal-items {
	display: grid;
	grid-template-columns: repeat(var(--apgal-cols), minmax(0, 1fr));
	gap: var(--apgal-gap);
}

.apgal.apgal-layout-carousel .apgal-items {
	display: flex;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	scrollbar-width: none;
	padding: 10px 0 24px;
	margin: -10px 0 -24px;
}

.apgal.apgal-layout-carousel .apgal-items::-webkit-scrollbar {
	display: none;
}

.apgal.apgal-layout-carousel .apgal-item {
	flex: 0 0 calc((100% - (var(--apgal-cols) - 1) * var(--apgal-gap)) / var(--apgal-cols));
	scroll-snap-align: start;
}

.apgal .apgal-carousel {
	position: relative;
}

.apgal .apgal-car-arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 5;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 50%;
	background: #fff;
	color: #1a2e2a;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
	transition: background-color 0.2s, color 0.2s, opacity 0.2s;
}

.apgal .apgal-car-arrow--prev {
	left: 8px;
}

.apgal .apgal-car-arrow--next {
	right: 8px;
}

.apgal .apgal-car-arrow[disabled] {
	opacity: 0.35;
	pointer-events: none;
}

/* ---------- Card ---------- */

.apgal .apgal-item {
	min-width: 0;
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
	transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.apgal .apgal-body {
	margin-top: 14px;
	flex: 1 1 auto;
	text-align: left;
}

/* ---------- Gallery ---------- */

.apgal .apgal-gallery {
	display: flex;
	flex-direction: column;
	gap: var(--apgal-thumbs-space);
	min-width: 0;
}

.apgal .apgal-gallery.apgal-thumbs-top {
	flex-direction: column-reverse;
}

.apgal .apgal-gallery.apgal-thumbs-left {
	flex-direction: row-reverse;
}

.apgal .apgal-gallery.apgal-thumbs-right {
	flex-direction: row;
}

.apgal .apgal-stage {
	flex: 1 1 auto;
	min-width: 0;
}

.apgal .apgal-main {
	position: relative;
	width: 100%;
	overflow: hidden;
	aspect-ratio: 1 / 1;
	border-radius: 14px;
	background-color: #f3f1ee;
}

.apgal .apgal-main-link {
	display: block;
	width: 100%;
	height: 100%;
	color: inherit;
	text-decoration: none;
	outline-offset: -3px;
}

.apgal .click-lightbox .apgal-main-link {
	cursor: zoom-in;
}

.apgal .click-none .apgal-main-link {
	cursor: default;
}

.apgal .apgal-main-img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	transform-origin: var(--apgal-ox, 50%) var(--apgal-oy, 50%);
	transition: transform 0.35s ease;
}

.apgal .has-fade .apgal-main-img {
	transition: transform 0.35s ease, opacity var(--apgal-speed) ease;
}

.apgal .apgal-main-img.is-fading {
	opacity: 0;
}

.apgal .has-zoom .apgal-main:hover .apgal-main-img {
	transform: scale(var(--apgal-zoom));
}

/* ---------- Thumbnails ---------- */

.apgal .apgal-thumbs {
	min-width: 0;
}

.apgal .apgal-thumbs-list {
	display: flex;
	gap: var(--apgal-thumb-gap);
	overflow-x: auto;
	scrollbar-width: thin;
	padding: 1px;
}

.apgal .apgal-thumbs-left .apgal-thumbs,
.apgal .apgal-thumbs-right .apgal-thumbs {
	position: relative;
	flex: 0 0 calc(var(--apgal-thumb-size) + 2px);
}

.apgal .apgal-thumbs-left .apgal-thumbs-list,
.apgal .apgal-thumbs-right .apgal-thumbs-list {
	position: absolute;
	inset: 0;
	flex-direction: column;
	overflow-x: hidden;
	overflow-y: auto;
}

.apgal .apgal-thumb {
	flex: 0 0 auto;
	box-sizing: border-box;
	width: var(--apgal-thumb-size);
	height: var(--apgal-thumb-size);
	margin: 0;
	padding: 2px;
	border: 2px solid transparent;
	border-radius: 10px;
	background: transparent;
	box-shadow: none;
	line-height: 0;
	overflow: hidden;
	cursor: pointer;
	appearance: none;
	transition: border-color 0.2s ease, opacity 0.2s ease;
}

.apgal .apgal-thumb img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	border-radius: inherit;
}

.apgal .apgal-thumb.is-active {
	border-color: #1a2e2a;
}

.apgal .apgal-thumb:focus-visible,
.apgal .apgal-nav:focus-visible,
.apgal .apgal-car-arrow:focus-visible,
.apgal .apgal-main-link:focus-visible {
	outline: 2px solid #2563eb;
	outline-offset: 2px;
}

/* Alignment of the horizontal thumbnail strip (top / bottom). */
.apgal-thumbs-align-center .apgal-thumbs-top .apgal-thumb:first-child,
.apgal-thumbs-align-center .apgal-thumbs-bottom .apgal-thumb:first-child,
.apgal-thumbs-align-end .apgal-thumbs-top .apgal-thumb:first-child,
.apgal-thumbs-align-end .apgal-thumbs-bottom .apgal-thumb:first-child {
	margin-inline-start: auto;
}

.apgal-thumbs-align-center .apgal-thumbs-top .apgal-thumb:last-child,
.apgal-thumbs-align-center .apgal-thumbs-bottom .apgal-thumb:last-child {
	margin-inline-end: auto;
}

/* ---------- Image arrows & counter ---------- */

.apgal .apgal-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 3;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 50%;
	background: #fff;
	color: #1a2e2a;
	font-size: 15px;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
	transition: opacity 0.2s ease, background-color 0.2s ease;
}

.apgal .apgal-nav--prev {
	left: 10px;
}

.apgal .apgal-nav--next {
	right: 10px;
}

.apgal .arrows-hover .apgal-nav {
	opacity: 0;
}

.apgal .arrows-hover .apgal-main:hover .apgal-nav,
.apgal .arrows-hover .apgal-nav:focus-visible {
	opacity: 1;
}

@media (hover: none) {
	.apgal .arrows-hover .apgal-nav {
		opacity: 1;
	}
}

.apgal .apgal-counter {
	position: absolute;
	right: 10px;
	bottom: 10px;
	z-index: 3;
	padding: 3px 10px;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.55);
	color: #fff;
	font-size: 12px;
	line-height: 1.5;
	pointer-events: none;
}

/* ---------- Badges ---------- */

.apgal .apgal-badges {
	position: absolute;
	top: var(--apgal-badge-offset);
	left: var(--apgal-badge-offset);
	z-index: 3;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 6px;
	pointer-events: none;
}

.apgal-badge-right .apgal .apgal-badges {
	left: auto;
	right: var(--apgal-badge-offset);
	align-items: flex-end;
}

.apgal .apgal-badge {
	display: inline-block;
	padding: 4px 11px;
	border-radius: 999px;
	color: #fff;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.4;
}

.apgal .apgal-badge--sale {
	background-color: #e5484d;
}

.apgal .apgal-badge--soldout {
	background-color: #6b7280;
}

/* ---------- Text ---------- */

.apgal .apgal-title {
	margin: 0 0 6px;
	font-size: 16px;
	line-height: 1.35;
}

.apgal .apgal-title a {
	color: inherit;
	text-decoration: none;
}

.apgal .apgal-cat {
	margin: 0 0 4px;
	font-size: 12px;
	opacity: 0.7;
}

.apgal .apgal-rating {
	margin: 0 0 6px;
	line-height: 1;
}

.apgal .apgal-stars {
	position: relative;
	display: inline-block;
	font-size: 16px;
	line-height: 1;
	letter-spacing: 2px;
	vertical-align: middle;
}

.apgal .apgal-stars::before {
	content: "★★★★★";
	color: #d1d5db;
}

.apgal .apgal-stars__fill {
	position: absolute;
	top: 0;
	left: 0;
	overflow: hidden;
	white-space: nowrap;
	color: #f5a623;
}

.apgal .apgal-rating-count {
	font-size: 13px;
	vertical-align: middle;
	opacity: 0.7;
}

.apgal .apgal-price {
	margin: 0 0 8px;
	font-weight: 600;
}

.apgal .apgal-price ins {
	text-decoration: none;
	background: transparent;
}

.apgal .apgal-price del {
	margin-right: 6px;
	font-weight: 400;
	opacity: 0.6;
}

.apgal .apgal-excerpt {
	margin: 0 0 10px;
	font-size: 14px;
	line-height: 1.5;
}

/* ---------- Button ---------- */

.apgal .apgal-btn {
	display: inline-block;
	box-sizing: border-box;
	padding: 10px 20px;
	border: 1px solid transparent;
	border-radius: 10px;
	background-color: #1a2e2a;
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.apgal-btn-full-yes .apgal .apgal-btn {
	display: block;
	width: 100%;
}

.apgal .apgal-btn.loading {
	opacity: 0.6;
	pointer-events: none;
}

.apgal .added_to_cart {
	display: inline-block;
	margin-left: 10px;
	font-size: 13px;
}

/* ---------- Lightbox ---------- */

.apgal-lb {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(10, 14, 13, 0.9);
}

.apgal-lb__img {
	max-width: 92vw;
	max-height: 86vh;
	border-radius: 6px;
	box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
}

.apgal-lb button {
	position: absolute;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.14);
	color: #fff;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.apgal-lb button:hover,
.apgal-lb button:focus-visible {
	background: rgba(255, 255, 255, 0.3);
}

.apgal-lb__close {
	top: 18px;
	right: 18px;
}

.apgal-lb__prev {
	left: 18px;
	top: 50%;
	margin-top: -22px;
}

.apgal-lb__next {
	right: 18px;
	top: 50%;
	margin-top: -22px;
}

.apgal-lb__count {
	position: absolute;
	bottom: 18px;
	left: 50%;
	transform: translateX(-50%);
	color: #fff;
	font-size: 14px;
}

/* ---------- Responsive & motion ---------- */

@media (max-width: 767px) {
	.apgal-lb__prev {
		left: 8px;
	}

	.apgal-lb__next {
		right: 8px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.apgal .apgal-main-img,
	.apgal .apgal-item,
	.apgal .apgal-thumb,
	.apgal.apgal-layout-carousel .apgal-items {
		transition: none;
		scroll-behavior: auto;
	}
}
