/* Cronosmedia Product Gallery Captions - stile front-end */

.cmpg-wrapper {
	margin: 40px 0;
	clear: both;
}

.cmpg-title {
	margin-bottom: 20px;
}

/* Immagine principale a larghezza piena */
.cmpg-main {
	width: 100%;
	margin-bottom: var(--cmpg-gap, 12px);
}

.cmpg-main-image-holder {
	width: 100%;
	overflow: hidden;
	border-radius: var(--cmpg-radius, 6px);
	background: #fafafa;
}

.cmpg-main-image {
	display: block;
	width: 100%;
	height: auto;
	object-fit: contain;
}

/* Griglia miniature */
.cmpg-thumbs {
	display: grid;
	grid-template-columns: repeat(var(--cmpg-cols-desktop, 4), 1fr);
	gap: var(--cmpg-gap, 12px);
}

@media (max-width: 1024px) {
	.cmpg-thumbs {
		grid-template-columns: repeat(var(--cmpg-cols-tablet, 3), 1fr);
	}
}

@media (max-width: 600px) {
	.cmpg-thumbs {
		grid-template-columns: repeat(var(--cmpg-cols-mobile, 2), 1fr);
	}
}

.cmpg-thumb-wrap {
	display: flex;
	flex-direction: column;
}

.cmpg-thumb {
	padding: 0;
	margin: 0;
	border: 2px solid transparent;
	border-radius: var(--cmpg-radius, 6px);
	background: #fafafa;
	cursor: pointer;
	overflow: hidden;
	aspect-ratio: 1 / 1;
	display: block;
	width: 100%;
	transition: border-color 0.2s ease, opacity 0.2s ease;
}

.cmpg-thumb:hover {
	opacity: 0.85;
}

.cmpg-thumb.is-active {
	border-color: var(--cmpg-caption-color, #333333);
}

.cmpg-thumb-image {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.cmpg-caption {
	margin-top: 6px;
	padding: 6px 10px;
	font-size: 0.8rem;
	line-height: 1.3;
	text-align: center;
	background-color: var(--cmpg-caption-bg, #f5f5f5);
	color: var(--cmpg-caption-color, #333333);
	border-radius: var(--cmpg-radius, 6px);
}

/* Modal di ingrandimento */
body.cmpg-modal-open {
	overflow: hidden;
}

.cmpg-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: none;
	align-items: center;
	justify-content: center;
}

.cmpg-modal.is-open {
	display: flex;
}

.cmpg-modal-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.88);
}

.cmpg-modal-content {
	position: relative;
	z-index: 1;
	max-width: 92vw;
	max-height: 90vh;
	display: flex;
	flex-direction: column;
	align-items: center;
}

.cmpg-modal-image {
	display: block;
	max-width: 92vw;
	max-height: 80vh;
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 4px;
	background: #111;
}

.cmpg-modal-caption {
	margin-top: 14px;
	color: #fff;
	font-size: 0.9rem;
	text-align: center;
	max-width: 80vw;
}

.cmpg-modal-close,
.cmpg-modal-prev,
.cmpg-modal-next {
	position: absolute;
	z-index: 2;
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
	border: none;
	cursor: pointer;
	border-radius: 50%;
	width: 44px;
	height: 44px;
	font-size: 1.1rem;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background-color 0.2s ease;
}

.cmpg-modal-close:hover,
.cmpg-modal-prev:hover,
.cmpg-modal-next:hover {
	background: rgba(255, 255, 255, 0.25);
}

.cmpg-modal-close {
	top: 20px;
	right: 20px;
}

.cmpg-modal-prev {
	left: 20px;
	top: 50%;
	transform: translateY(-50%);
}

.cmpg-modal-next {
	right: 20px;
	top: 50%;
	transform: translateY(-50%);
}

@media (max-width: 600px) {
	.cmpg-modal-prev,
	.cmpg-modal-next {
		width: 38px;
		height: 38px;
	}
	.cmpg-modal-close {
		top: 10px;
		right: 10px;
	}
	.cmpg-modal-prev {
		left: 10px;
	}
	.cmpg-modal-next {
		right: 10px;
	}
}
