.cpl-dpg {
	--cpl-dpg-thumb-width: 82px;
	--cpl-dpg-thumb-height: 48px;
	--cpl-dpg-hover-scale: 1.08;
	--cpl-dpg-hover-speed: 350ms;
	--cpl-dpg-image-background: #fff;
	--cpl-dpg-lens-size: 220px;
	--cpl-dpg-lens-zoom: 2;
	--cpl-dpg-lens-border: #777;
	display: grid;
	grid-template-columns: max(120px, var(--cpl-dpg-thumb-width)) minmax(0, 1fr);
	grid-template-areas: "navigation stage";
	gap: 36px;
	width: 100%;
}

.cpl-dpg *,
.cpl-dpg *::before,
.cpl-dpg *::after {
	box-sizing: border-box;
}

.cpl-dpg__stage {
	grid-area: stage;
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 0;
	height: 480px;
	overflow: hidden;
	background-color: var(--cpl-dpg-image-background);
}

.cpl-dpg--lens-zoom .cpl-dpg__stage {
	position: relative;
	overflow: visible;
}

.cpl-dpg__main-button {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	padding: 0;
	border: 0;
	background-color: var(--cpl-dpg-image-background) !important;
	background-image: none !important;
	box-shadow: none !important;
	cursor: zoom-in;
	touch-action: pan-y;
}

.cpl-dpg__main-button:hover,
.cpl-dpg__main-button:focus,
.cpl-dpg__main-button:active,
.cpl-dpg__main-button:disabled {
	border-color: transparent !important;
	background-color: var(--cpl-dpg-image-background) !important;
	background-image: none !important;
	box-shadow: none !important;
	color: inherit !important;
}

.cpl-dpg__main-button:disabled {
	cursor: default;
}

.cpl-dpg__main-button:focus-visible,
.cpl-dpg__thumb:focus-visible,
.cpl-dpg__arrow:focus-visible,
.cpl-dpg__dialog-close:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 3px;
}

.cpl-dpg__main-image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
	object-position: center;
	transform: scale(1);
	transition: transform var(--cpl-dpg-hover-speed) ease;
	will-change: transform;
}

@media (hover: hover) and (pointer: fine) {
	.cpl-dpg--hover-zoom .cpl-dpg__main-button:hover .cpl-dpg__main-image {
		transform: scale(var(--cpl-dpg-hover-scale));
	}
}

.cpl-dpg__zoom-lens {
	position: absolute;
	z-index: 4;
	top: 0;
	left: 0;
	display: none;
	width: var(--cpl-dpg-lens-size);
	height: var(--cpl-dpg-lens-size);
	border: 1px solid var(--cpl-dpg-lens-border);
	background-color: var(--cpl-dpg-image-background);
	background-repeat: no-repeat;
	box-shadow: 0 2px 8px rgb(0 0 0 / 8%);
	pointer-events: none;
}

.cpl-dpg__zoom-lens.is-visible {
	display: block;
}

.cpl-dpg__navigation {
	grid-area: navigation;
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-width: 0;
}

.cpl-dpg__thumbnails {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	width: 100%;
	max-height: 340px;
	padding: 2px;
	overflow-x: hidden;
	overflow-y: auto;
	scrollbar-width: none;
	scroll-behavior: smooth;
	scroll-snap-type: y proximity;
}

.cpl-dpg__thumbnails::-webkit-scrollbar {
	display: none;
}

.cpl-dpg__thumb {
	flex: 0 0 auto;
	width: var(--cpl-dpg-thumb-width);
	height: var(--cpl-dpg-thumb-height);
	padding: 2px;
	border: 1px solid #d9d9d9;
	background-color: #fff !important;
	background-image: none !important;
	box-shadow: none !important;
	cursor: pointer;
	scroll-snap-align: center;
	transition: border-color 160ms ease, opacity 160ms ease;
}

.cpl-dpg__thumb:hover {
	border-color: #777;
	background-color: #fff !important;
	background-image: none !important;
	box-shadow: none !important;
}

.cpl-dpg__thumb:focus,
.cpl-dpg__thumb:active {
	background-color: #fff !important;
	background-image: none !important;
	box-shadow: none !important;
}

.cpl-dpg__thumb[aria-current="true"] {
	border-color: #111;
}

.cpl-dpg__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.cpl-dpg__arrow {
	display: none;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	padding: 0;
	border: 0;
	background-color: transparent !important;
	background-image: none !important;
	box-shadow: none !important;
	color: #666;
	font: 400 38px/1 Arial, sans-serif;
	cursor: pointer;
	transition: color 160ms ease;
}

.cpl-dpg__arrow:not(:disabled):hover {
	color: #111;
	background-color: transparent !important;
	background-image: none !important;
	box-shadow: none !important;
}

.cpl-dpg__arrow:disabled {
	opacity: .3;
	cursor: default;
}

.cpl-dpg__dialog {
	width: min(94vw, 1200px);
	max-width: 1200px;
	height: min(92vh, 900px);
	max-height: 92vh;
	padding: 36px;
	border: 0;
	background: #fff;
	box-shadow: 0 20px 80px rgb(0 0 0 / 28%);
}

.cpl-dpg__dialog::backdrop {
	background: rgb(0 0 0 / 72%);
}

.cpl-dpg__dialog[open] {
	display: flex;
	align-items: center;
	justify-content: center;
}

.cpl-dpg__dialog-image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.cpl-dpg__dialog-close {
	position: absolute;
	z-index: 1;
	top: 6px;
	right: 10px;
	width: 38px;
	height: 38px;
	padding: 0;
	border: 0;
	background-color: transparent !important;
	background-image: none !important;
	box-shadow: none !important;
	color: #111;
	font: 300 34px/1 Arial, sans-serif;
	cursor: pointer;
}

.cpl-dpg__editor-message {
	padding: 18px;
	border: 1px dashed #c7c7c7;
	background: #fafafa;
	color: #555;
	text-align: center;
}

@media (max-width: 767px) {
	.cpl-dpg {
		display: flex;
		flex-direction: column;
		gap: 18px;
	}

	.cpl-dpg__stage {
		order: 1;
		height: 230px;
		overflow: hidden;
	}

	.cpl-dpg__zoom-lens {
		display: none !important;
	}

	.cpl-dpg__navigation {
		order: 2;
		flex-direction: row;
		justify-content: space-between;
		width: 100%;
	}

	.cpl-dpg__thumbnails {
		flex: 1 1 auto;
		flex-direction: row;
		justify-content: flex-start;
		gap: clamp(18px, 12vw, 82px);
		width: auto;
		max-height: none;
		padding: 3px;
		overflow-x: auto;
		overflow-y: hidden;
		scroll-snap-type: x mandatory;
	}

	.cpl-dpg__thumb {
		scroll-snap-align: center;
	}

	.cpl-dpg__arrow {
		display: flex;
		flex: 0 0 38px;
	}

	.cpl-dpg__dialog {
		width: 96vw;
		height: 88vh;
		padding: 32px 12px 12px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.cpl-dpg__thumbnails {
		scroll-behavior: auto;
	}

	.cpl-dpg__thumb {
		transition: none;
	}

	.cpl-dpg__arrow {
		transition: none;
	}

	.cpl-dpg__main-image {
		transition: none;
	}
}
