/**
* Marketplace listing gallery: desktop mosaic, mobile carousel, zoom lightbox.
* Loaded from themes/wireframe/marketplaces/item/default.php - not from a Joomla template.
*/

/* Marketplace item gallery: responsive mosaic, mobile carousel and zoom */
#es .es-marketplace-mosaic {
	margin-bottom: 20px;
	position: relative;
	display: grid;
	width: 100%;
	gap: 4px;
	overflow: hidden;
	border-radius: 12px;
	background: #111;
}

#es .es-marketplace-mosaic__item {
	-webkit-appearance: none;
	appearance: none;
	position: relative;
	display: block;
	width: 100%;
	height: 100%;
	min-width: 0;
	min-height: 0;
	margin: 0;
	padding: 0;
	overflow: hidden;
	border: 0;
	background: #111;
	cursor: zoom-in;
}

#es .es-marketplace-mosaic__item:focus-visible {
	z-index: 2;
	outline: 3px solid #4a90e2;
	outline-offset: -3px;
}

#es .es-marketplace-mosaic__item img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	max-height: none;
	object-fit: cover;
	object-position: center;
	transition: transform 180ms ease;
}

#es .es-marketplace-mosaic__item:hover img {
	transform: scale(1.02);
}

#es .es-marketplace-mosaic[data-count="1"] {
	height: clamp(300px, 50vw, 500px);
	grid-template-columns: 1fr;
}

#es .es-marketplace-mosaic[data-count="1"] .es-marketplace-mosaic__item::before {
	content: "";
	position: absolute;
	inset: -24px;
	background: var(--mosaic-photo) center / cover no-repeat;
	filter: blur(18px);
	transform: scale(1.08);
	pointer-events: none;
}

#es .es-marketplace-mosaic[data-count="1"] img {
	position: relative;
	z-index: 1;
	object-fit: contain;
}

#es .es-marketplace-mosaic[data-count="2"] {
	height: clamp(300px, 50vw, 500px);
	grid-template-columns: 1fr 1fr;
}

#es .es-marketplace-mosaic[data-count="3"],
#es .es-marketplace-mosaic[data-count]:not([data-count="1"]):not([data-count="2"]) {
	height: clamp(300px, 50vw, 500px);
	grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
	grid-template-rows: 1fr 1fr;
}

#es .es-marketplace-mosaic[data-count="3"] .es-marketplace-mosaic__item:first-child,
#es .es-marketplace-mosaic[data-count]:not([data-count="1"]):not([data-count="2"]) .es-marketplace-mosaic__item:first-child {
	grid-row: 1 / span 2;
}

#es .es-marketplace-mosaic[data-count="3"] .es-marketplace-mosaic__item:nth-child(2),
#es .es-marketplace-mosaic[data-count]:not([data-count="1"]):not([data-count="2"]) .es-marketplace-mosaic__item:nth-child(2) {
	grid-column: 2;
	grid-row: 1;
}

#es .es-marketplace-mosaic[data-count="3"] .es-marketplace-mosaic__item:nth-child(3),
#es .es-marketplace-mosaic[data-count]:not([data-count="1"]):not([data-count="2"]) .es-marketplace-mosaic__item:nth-child(3) {
	grid-column: 2;
	grid-row: 2;
}

#es .es-marketplace-mosaic[data-count]:not([data-count="1"]):not([data-count="2"]):not([data-count="3"]) .es-marketplace-mosaic__item:nth-child(n+4) {
	display: none;
}

#es .es-marketplace-mosaic__more {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.5);
	color: #fff;
	font-size: clamp(24px, 4vw, 36px);
	font-weight: 700;
	pointer-events: none;
}

#es .es-marketplace-mobile-counter {
	display: none;
}

body.es-marketplace-lightbox-open {
	overflow: hidden;
}

.es-marketplace-lightbox[hidden] {
	display: none !important;
}

.es-marketplace-lightbox {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: block;
	background: rgba(0, 0, 0, 1);
	transition: background-color 180ms ease;
}

.es-marketplace-lightbox.is-closing {
	pointer-events: none;
}

.es-marketplace-lightbox.is-switching {
	pointer-events: none;
}

.es-marketplace-lightbox.is-dragging {
	transition: none;
}

.es-marketplace-lightbox__viewport {
	position: absolute;
	inset: 64px 70px 72px;
	overflow: auto;
	overscroll-behavior: contain;
	scrollbar-width: none;
	-ms-overflow-style: none;
	cursor: grab;
	touch-action: none;
}

.es-marketplace-lightbox__viewport::-webkit-scrollbar {
	display: none;
}

.es-marketplace-lightbox__canvas {
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 100%;
	min-height: 100%;
	transition: transform 180ms ease;
	will-change: transform;
}

.es-marketplace-lightbox__canvas--incoming {
	position: absolute;
	top: 0;
	left: 0;
	pointer-events: none;
}

.es-marketplace-lightbox__canvas img {
	flex: 0 0 auto;
	width: auto;
	height: auto;
	max-width: none;
	max-height: none;
	object-fit: contain;
	user-select: none;
}

.es-marketplace-lightbox__close,
.es-marketplace-lightbox__nav,
.es-marketplace-lightbox__toolbar button {
	border: 0;
	background: rgba(255, 255, 255, 0.14);
	color: #fff;
	cursor: pointer;
}

.es-marketplace-lightbox__close,
.es-marketplace-lightbox__nav {
	position: absolute;
	z-index: 2;
	border-radius: 50%;
}

.es-marketplace-lightbox__close {
	top: 14px;
	right: 14px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	font-size: 0;
	line-height: 1;
}

.es-marketplace-lightbox__close::before,
.es-marketplace-lightbox__close::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 22px;
	height: 3px;
	border-radius: 2px;
	background: #fff;
}

.es-marketplace-lightbox__close::before {
	transform: translate(-50%, -50%) rotate(45deg);
}

.es-marketplace-lightbox__close::after {
	transform: translate(-50%, -50%) rotate(-45deg);
}

.es-marketplace-lightbox__nav {
	top: 50%;
	width: 48px;
	height: 48px;
	margin-top: -24px;
}

.es-marketplace-lightbox__nav--prev {
	left: 12px;
}

.es-marketplace-lightbox__nav--next {
	right: 12px;
}

.es-marketplace-lightbox__nav--prev::before,
.es-marketplace-lightbox__nav--next::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	display: block;
	width: 13px;
	height: 13px;
	margin: 0 !important;
	border-top: 2px solid #fff;
	border-right: 2px solid #fff;
}

.es-marketplace-lightbox__nav--prev::before {
	transform: translate(calc(-50% + 2px), -50%) rotate(-135deg);
}

.es-marketplace-lightbox__nav--next::before {
	transform: translate(calc(-50% - 2px), -50%) rotate(45deg);
}

.es-marketplace-lightbox__toolbar {
	position: absolute;
	right: 50%;
	bottom: 14px;
	z-index: 2;
	display: flex;
	align-items: center;
	gap: 8px;
	transform: translateX(50%);
	color: #fff;
}

.es-marketplace-lightbox__toolbar button {
	min-width: 42px;
	height: 42px;
	padding: 0 12px;
	border-radius: 21px;
	font-size: 18px;
}

.es-marketplace-lightbox__toolbar button:disabled {
	opacity: 0.4;
	cursor: default;
}

.es-marketplace-lightbox__counter {
	min-width: 58px;
	text-align: center;
	font-weight: 600;
}

.es-marketplace-lightbox__viewport.is-dragging {
	cursor: grabbing;
}

.es-marketplace-lightbox__viewport.is-dragging .es-marketplace-lightbox__canvas {
	transition: none;
}

#es .es-profile-header-nav-slider {
	z-index: 0;
}

/* Touch gestures for both the current gallery and the legacy Swiper fallback */
#es .es-marketplace-gallery-top {
	touch-action: pan-y pinch-zoom;
}

@media (max-width: 767px) {
	#es .es-marketplace-mosaic,
	#es .es-marketplace-mosaic[data-count="1"],
	#es .es-marketplace-mosaic[data-count="2"],
	#es .es-marketplace-mosaic[data-count="3"],
	#es .es-marketplace-mosaic[data-count]:not([data-count="1"]):not([data-count="2"]),
	#es.is-mobile .es-marketplace-mosaic {
		display: flex !important;
		height: auto !important;
		gap: 0;
		overflow-x: auto !important;
		overflow-y: hidden !important;
		grid-template: none !important;
		grid-template-columns: none !important;
		grid-template-rows: none !important;
		scroll-behavior: smooth;
		scroll-snap-type: x mandatory;
		scrollbar-width: none;
		-webkit-overflow-scrolling: touch;
		touch-action: pan-x pan-y pinch-zoom;
		overscroll-behavior-x: contain;
	}

	#es .es-marketplace-mosaic::-webkit-scrollbar {
		display: none;
	}

	#es .es-marketplace-mosaic .es-marketplace-mosaic__item,
	#es .es-marketplace-mosaic .es-marketplace-mosaic__item:first-child,
	#es .es-marketplace-mosaic .es-marketplace-mosaic__item:nth-child(2),
	#es .es-marketplace-mosaic .es-marketplace-mosaic__item:nth-child(3),
	#es .es-marketplace-mosaic .es-marketplace-mosaic__item:nth-child(n+4),
	#es.is-mobile .es-marketplace-mosaic .es-marketplace-mosaic__item {
		display: block !important;
		flex: 0 0 100% !important;
		width: 100% !important;
		height: auto !important;
		aspect-ratio: 4 / 3 !important;
		grid-row: auto !important;
		grid-column: auto !important;
		border-radius: 0;
		scroll-snap-align: start;
		scroll-snap-stop: always;
	}

	#es .es-marketplace-mosaic[data-count="1"] .es-marketplace-mosaic__item::before {
		display: none;
	}

	#es .es-marketplace-mosaic[data-count="1"] img {
		object-fit: cover;
	}

	#es .es-marketplace-mosaic__item:hover img {
		transform: none;
	}

	#es .es-marketplace-mosaic__more {
		display: none;
	}

	#es .es-marketplace-mobile-counter {
		position: absolute;
		right: 12px;
		bottom: 12px;
		display: block;
		padding: 5px 9px;
		border-radius: 14px;
		background: rgba(0, 0, 0, 0.65);
		color: #fff;
		font-size: 12px;
		font-weight: 600;
		line-height: 1;
		pointer-events: none;
	}

	.es-marketplace-lightbox__viewport {
		inset: 62px 0 72px;
		margin-right: 0;
		margin-left: 0;
		padding-right: 0;
		padding-left: 0;
	}

	.es-marketplace-lightbox__canvas {
		margin-right: 0;
		margin-left: 0;
		padding-right: 0;
		padding-left: 0;
	}

	.es-marketplace-lightbox__canvas img {
		margin-right: 0;
		margin-left: 0;
	}

	.es-marketplace-lightbox__nav {
		top: auto;
		bottom: 13px;
		width: 42px;
		height: 42px;
		margin: 0;
	}

	.es-marketplace-lightbox__nav--prev {
		left: 12px;
	}

	.es-marketplace-lightbox__nav--next {
		right: 12px;
	}

	.es-marketplace-lightbox__toolbar {
		bottom: 13px;
		gap: 5px;
	}

	.es-marketplace-lightbox__counter {
		display: none;
	}

	.es-marketplace-lightbox__toolbar button {
		min-width: 40px;
		height: 42px;
		padding: 0 10px;
	}

	#es .es-marketplace-mosaic__item,
	#es .es-marketplace-mosaic__item:hover,
	#es .es-marketplace-mosaic__item:focus,
	#es .es-marketplace-mosaic__item:active {
		opacity: 1;
		background: #111;
		outline: none;
		box-shadow: none;
		filter: none;
		-webkit-tap-highlight-color: transparent;
	}

	#es .es-marketplace-mosaic__item img,
	#es .es-marketplace-mosaic__item:hover img,
	#es .es-marketplace-mosaic__item:focus img,
	#es .es-marketplace-mosaic__item:active img {
		opacity: 1;
		filter: none;
		transform: none;
	}

	.es-marketplace-lightbox__close:focus,
	.es-marketplace-lightbox__nav:focus,
	.es-marketplace-lightbox__toolbar button:focus {
		outline: none;
		box-shadow: none;
	}
}
