/*
 * Proadign Dealer Engine — Gallery Styles
 *
 * Contains only the single-listing gallery, thumbnail,
 * lightbox, counter, fullscreen, and responsive styles.
 */

/* ==================================================
   Gallery — Base
================================================== */

.pde-gallery,
.pde-gallery * {
	box-sizing: border-box;
}

.pde-gallery {
	display: block !important;
	width: 100% !important;
	max-width: none !important;
	margin: 0;
	padding: 0;
}


/* ==================================================
   Gallery — Main Image
================================================== */

.pde-gallery-main {
	position: relative;
	display: block !important;
	align-self: stretch !important;
	width: auto !important;
	max-width: none !important;
	aspect-ratio: 2.3 / 1;
	margin: 0 !important;
	padding: 0 !important;
	background: #fff;
	overflow: hidden;
}

.pde-gallery-main-button {
	position: absolute;
	inset: 0;
	display: none;
	width: 100% !important;
	max-width: none !important;
	height: 100% !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	background: transparent !important;
	box-shadow: none !important;
	cursor: zoom-in;
}

.pde-gallery-main-button.is-active {
	display: block;
}

.pde-gallery-image {
	display: block;
	width: 100% !important;
	max-width: none !important;
	height: 100% !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0;
	object-fit: cover;
}

/* ==================================================
   Gallery — Main Controls
================================================== */

.pde-gallery-main-controls {
	position: absolute;
	inset: 0;
	z-index: 10;
	pointer-events: none;
}

.pde-gallery-counter,
.pde-gallery-fullscreen {
	position: absolute;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 8px 14px;
	border: 0;
	border-radius: 999px;
	background: rgba(0,0,0,.55);
	backdrop-filter: blur(8px);
	color: #fff;
	font-size: .9rem;
	font-weight: 600;
	line-height: 1;
	pointer-events: auto;
}

.pde-gallery-counter {
	left: 16px;
	bottom: 16px;
	pointer-events: none;
}

.pde-gallery-fullscreen {
	top: 16px;
	right: 16px;
	width: 44px;
	height: 44px;
	padding: 0;
	cursor: pointer;
	transition: background .2s ease, transform .2s ease;
}

.pde-gallery-fullscreen:hover {
	background: rgba(0,0,0,.75);
	transform: scale(1.05);
}

.pde-gallery-fullscreen svg {
	width: 20px;
	height: 20px;
}


/* ==================================================
   Gallery — Thumbnails
================================================== */

.pde-gallery-thumbnails {
	position: relative;
	width: 100% !important;
	max-width: 100% !important;
	margin: 8px 0 0 !important;
	padding: 0 !important;
	overflow: hidden;
}

.pde-gallery-thumbs-viewport {
	width: 100%;
	margin: 0;
	padding: 0;
	overflow: hidden;
}

.pde-gallery-thumbs-inner {
	display: flex;
	gap: 4px;
	width: 100%;
	margin: 0;
	padding: 0;
	transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
	will-change: transform;
}

.pde-gallery-thumbnail {
	flex: 0 0 calc((100% - 12px) / 4);
	min-width: 0;
	aspect-ratio: 16 / 9;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	background: transparent !important;
	box-shadow: none !important;
	overflow: hidden;
	cursor: pointer;
	transition: transform 0.2s ease;
}

.pde-gallery-thumbnail img {
	display: block;
	width: 100% !important;
	max-width: none !important;
	height: 100% !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0;
	object-fit: cover;
}

.pde-gallery-thumbnail:hover {
	transform: translateY(-2px);
}


/* ==================================================
   Gallery — Thumbnail Arrows
================================================== */

.pde-gallery-arrow {
	position: absolute;
	top: 50%;
	z-index: 5;
	width: 40px;
	height: 40px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 153, 0, 0.9);
	color: #fff;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	transform: translateY(-50%);
	transition:
		background 0.2s ease,
		transform 0.2s ease,
		opacity 0.2s ease;
}

.pde-gallery-arrow-prev {
	left: 25px;
}

.pde-gallery-arrow-next {
	right: 25px;
}

.pde-gallery-arrow:hover {
	background: #ff9900;
	transform: translateY(-50%) scale(1.08);
}

.pde-gallery-arrow:disabled {
	opacity: 0.35;
	cursor: default;
	transform: translateY(-50%);
}


/* ==================================================
   Gallery — Lightbox
================================================== */

.pde-gallery-lightbox {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	overscroll-behavior: contain;
	touch-action: none;
	isolation: isolate;
	background: rgba(0, 0, 0, 0.92);
}

.pde-gallery-lightbox[hidden] {
	display: none;
}

.pde-gallery-lightbox-content {
	position: relative;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	width: min(90vw, 1400px);
	height: min(85vh, 900px);
	overflow: hidden;
	touch-action: none;
}

.pde-gallery-lightbox-image {
	position: relative;
	z-index: 1;
	display: block;
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	user-select: none;
	-webkit-user-select: none;
	-webkit-user-drag: none;
	touch-action: none;
	transform: translate3d(0, 0, 0) scale(1);
	transform-origin: center center;
	will-change: transform;
}

.pde-gallery-lightbox-image.is-active {
	display: block;
}

/* ==================================================
   Lightbox — Image Transition
================================================== */

.pde-gallery-lightbox-image {
	opacity: 1;

	transition: opacity 0.14s ease;
}

.pde-gallery-lightbox-image.is-changing {
	opacity: 0;
}

/* ==================================================
   Gallery — Lightbox Controls
================================================== */

.pde-gallery-lightbox-close,
.pde-gallery-lightbox-prev,
.pde-gallery-lightbox-next {
	position: fixed;
	z-index: 100;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0;
	padding: 0;
	border: 0;
	color: #fff;
	cursor: pointer;
	pointer-events: auto;
	touch-action: manipulation;
	user-select: none;
	-webkit-user-select: none;
	-webkit-tap-highlight-color: transparent;
}

/* ---------- Close Button ---------- */

.pde-gallery-lightbox-close {
	top: max(16px, env(safe-area-inset-top));
	right: max(16px, env(safe-area-inset-right));

	display: flex;
	align-items: center;
	gap: 8px;

	height: 46px;
	padding: 0 16px;

	border-radius: 999px;

	background: rgba(0, 0, 0, 0.55);
	backdrop-filter: blur(8px);

	font-size: 15px;
	font-weight: 600;

	transition:
		background .2s ease,
		transform .2s ease;
}

.pde-gallery-lightbox-close:hover,
.pde-gallery-lightbox-close:focus-visible {
	background: rgba(0, 0, 0, 0.75);
	transform: scale(1.05);
}

.pde-gallery-lightbox-close-icon {
	font-size: 28px;
	line-height: 1;
}

.pde-gallery-lightbox-close-text {
	font-size: .9rem;
	line-height: 1;
}

/* ---------- Counter ---------- */

.pde-gallery-lightbox-counter {
	position: fixed;

	top: max(16px, env(safe-area-inset-top));
	left: max(16px, env(safe-area-inset-left));

	z-index: 100;

	display: flex;
	align-items: center;
	justify-content: center;

	padding: 8px 14px;

	border-radius: 999px;

	background: rgba(0, 0, 0, 0.55);
	backdrop-filter: blur(8px);

	color: #fff;

	font-size: .9rem;
	font-weight: 600;
	line-height: 1;
}

/* ---------- Navigation ---------- */

.pde-gallery-lightbox-arrow {
	top: 50%;

	width: 48px;
	height: 48px;

	border-radius: 50%;

	background: rgba(255, 255, 255, 0.16);

	font-size: 26px;
	line-height: 1;

	transform: translateY(-50%);

	transition:
		background .2s ease,
		transform .2s ease;
}

.pde-gallery-lightbox-prev {
	left: max(24px, env(safe-area-inset-left));
}

.pde-gallery-lightbox-next {
	right: max(24px, env(safe-area-inset-right));
}

.pde-gallery-lightbox-arrow:hover,
.pde-gallery-lightbox-arrow:focus-visible {
	background: rgba(255, 255, 255, 0.30);
	transform: translateY(-50%) scale(1.05);
}

/* ==================================================
   Gallery — Sticky While Sidebar Scrolls (Desktop)
================================================== */

/*
 * Keeps the gallery visible while the listing sidebar
 * scrolls. Sticky behavior ends automatically when the
 * bottom of the hero row reaches the next full-width
 * section.
 *
 * Override the sticky offset for sites using a sticky
 * header by defining:
 *
 * :root {
 *     --pde-sticky-offset: 96px;
 * }
 */

@media (min-width: 1101px) {

	.pde-listing-hero-row {
		align-items: flex-start;
		overflow: visible !important;
	}

	.pde-listing-hero-row > .et_pb_column:first-child {
		position: sticky;
		top: var(--pde-sticky-offset, 110px);

		align-self: flex-start;
	}

}


/* ==================================================
   Gallery — Responsive: Tablet / Small Laptop
================================================== */

@media (max-width: 1100px) {

	.pde-gallery-thumbnail {
		flex-basis: calc((100% - 8px) / 3);
	}

}


/* ==================================================
   Gallery — Responsive: Mobile
================================================== */

@media (max-width: 767px) {

	.pde-gallery-thumbnail {
		flex-basis: calc((100% - 4px) / 2);
	}

	.pde-gallery-arrow {
		width: 34px;
		height: 34px;
		font-size: 18px;
	}

	.pde-gallery-arrow-prev {
		left: 15px;
	}

	.pde-gallery-arrow-next {
		right: 15px;
	}

	.pde-gallery-lightbox-content {
		width: 100vw;
		height: 100dvh;
	}

	.pde-gallery-lightbox-close {
		top: max(12px, env(safe-area-inset-top));
		right: max(12px, env(safe-area-inset-right));
		width: auto;
		height: 42px;
		padding: 0 12px;
		gap: 6px;
	}

	.pde-gallery-lightbox-close-icon {
		font-size: 24px;
	}

	.pde-gallery-lightbox-close-text {
		font-size: 0.8rem;
	}

	.pde-gallery-lightbox-arrow {
		width: 44px;
		height: 44px;
		font-size: 22px;
	}

	.pde-gallery-lightbox-prev {
		left: max(8px, env(safe-area-inset-left));
	}

	.pde-gallery-lightbox-next {
		right: max(8px, env(safe-area-inset-right));
	}

	.pde-gallery-counter {
		left: 10px;
		bottom: 10px;
		font-size: 0.8rem;
	}

	.pde-gallery-fullscreen {
		top: 10px;
		right: 10px;
		width: 40px;
		height: 40px;
	}

	.pde-gallery-lightbox-counter {
		left: 10px;
		top: 10px;
	}

}