/**
 * Media condivisi Tapirulan.
 *
 * Questo file raccoglie gli stili portabili per gallery native WordPress,
 * lightbox e carousel. È intenzionalmente separato dal CSS dei template mostre.
 */

:where(.entry-content, .post-content, .ct-entry-content, .wp-block-post-content, .main-gallery-content, .tapirulan-lightbox-scope) img {
	height: auto;
	max-width: 100%;
}

.tapirulan-acf-media__title {
	font-size: 1.35rem;
	line-height: 1.25;
	margin: 0 0 18px;
}

:where(.entry-content, .post-content, .ct-entry-content, .wp-block-post-content, .main-gallery-content, .tapirulan-lightbox-scope) figure,
:where(.entry-content, .post-content, .ct-entry-content, .wp-block-post-content, .main-gallery-content, .tapirulan-lightbox-scope) .wp-caption {
	height: auto;
	max-width: 100%;
}

:where(.entry-content, .post-content, .ct-entry-content, .wp-block-post-content, .main-gallery-content, .tapirulan-lightbox-scope) .gallery {
	--tapirulan-gallery-columns: 3;
	display: grid;
	gap: 18px;
	grid-template-columns: repeat(var(--tapirulan-gallery-columns), minmax(0, 1fr));
	margin: 0 0 28px;
}

:where(.entry-content, .post-content, .ct-entry-content, .wp-block-post-content, .main-gallery-content, .tapirulan-lightbox-scope) .gallery-columns-1 {
	--tapirulan-gallery-columns: 1;
}

:where(.entry-content, .post-content, .ct-entry-content, .wp-block-post-content, .main-gallery-content, .tapirulan-lightbox-scope) .gallery-columns-2 {
	--tapirulan-gallery-columns: 2;
}

:where(.entry-content, .post-content, .ct-entry-content, .wp-block-post-content, .main-gallery-content, .tapirulan-lightbox-scope) .gallery-columns-3 {
	--tapirulan-gallery-columns: 3;
}

:where(.entry-content, .post-content, .ct-entry-content, .wp-block-post-content, .main-gallery-content, .tapirulan-lightbox-scope) .gallery-columns-4 {
	--tapirulan-gallery-columns: 4;
}

:where(.entry-content, .post-content, .ct-entry-content, .wp-block-post-content, .main-gallery-content, .tapirulan-lightbox-scope) .gallery-columns-5 {
	--tapirulan-gallery-columns: 5;
}

:where(.entry-content, .post-content, .ct-entry-content, .wp-block-post-content, .main-gallery-content, .tapirulan-lightbox-scope) .gallery-columns-6 {
	--tapirulan-gallery-columns: 6;
}

:where(.entry-content, .post-content, .ct-entry-content, .wp-block-post-content, .main-gallery-content, .tapirulan-lightbox-scope) .gallery-columns-7 {
	--tapirulan-gallery-columns: 7;
}

:where(.entry-content, .post-content, .ct-entry-content, .wp-block-post-content, .main-gallery-content, .tapirulan-lightbox-scope) .gallery-columns-8 {
	--tapirulan-gallery-columns: 8;
}

:where(.entry-content, .post-content, .ct-entry-content, .wp-block-post-content, .main-gallery-content, .tapirulan-lightbox-scope) .gallery-columns-9 {
	--tapirulan-gallery-columns: 9;
}

:where(.entry-content, .post-content, .ct-entry-content, .wp-block-post-content, .main-gallery-content, .tapirulan-lightbox-scope) .gallery br {
	display: none;
}

:where(.entry-content, .post-content, .ct-entry-content, .wp-block-post-content, .main-gallery-content, .tapirulan-lightbox-scope) .gallery .gallery-item {
	float: none !important;
	margin: 0 !important;
	max-width: none;
	overflow: hidden;
	position: relative;
	width: auto !important;
}

:where(.entry-content, .post-content, .ct-entry-content, .wp-block-post-content, .main-gallery-content, .tapirulan-lightbox-scope) .gallery .gallery-icon {
	height: auto;
	margin: 0;
	padding: 0;
}

:where(.entry-content, .post-content, .ct-entry-content, .wp-block-post-content, .main-gallery-content, .tapirulan-lightbox-scope) .gallery .gallery-icon a {
	aspect-ratio: 1 / 1;
	display: block;
	overflow: hidden;
	position: relative;
}

:where(.entry-content, .post-content, .ct-entry-content, .wp-block-post-content, .main-gallery-content, .tapirulan-lightbox-scope) .gallery .gallery-icon img {
	border: 0 !important;
	display: block;
	height: 100%;
	max-width: none;
	object-fit: cover;
	transition: transform 180ms ease;
	width: 100%;
}

:where(.entry-content, .post-content, .ct-entry-content, .wp-block-post-content, .main-gallery-content, .tapirulan-lightbox-scope) .gallery .gallery-caption {
	background: rgba(0, 0, 0, 0.72);
	bottom: 0;
	color: #ffffff;
	font-size: 11px;
	left: 0;
	line-height: 1.35;
	margin: 0;
	opacity: 0;
	padding: 8px 10px;
	position: absolute;
	right: 0;
	text-align: center;
	transform: translateY(100%);
	transition: opacity 180ms ease, transform 180ms ease;
	z-index: 2;
}

:where(.entry-content, .post-content, .ct-entry-content, .wp-block-post-content, .main-gallery-content, .tapirulan-lightbox-scope) .gallery .gallery-item:hover .gallery-caption,
:where(.entry-content, .post-content, .ct-entry-content, .wp-block-post-content, .main-gallery-content, .tapirulan-lightbox-scope) .gallery .gallery-item:focus-within .gallery-caption {
	opacity: 1;
	transform: translateY(0);
}

:where(.entry-content, .post-content, .ct-entry-content, .wp-block-post-content, .main-gallery-content, .tapirulan-lightbox-scope) .gallery .gallery-item:hover .gallery-icon img,
:where(.entry-content, .post-content, .ct-entry-content, .wp-block-post-content, .main-gallery-content, .tapirulan-lightbox-scope) .gallery .gallery-item:focus-within .gallery-icon img {
	transform: scale(1.03);
}

.tapirulan-carousel.is-enhanced .tapirulan-carousel__slide,
.tapirulan-mostra-setup-carousel.is-enhanced .tapirulan-mostra-setup-slide {
	display: none;
}

.tapirulan-carousel.is-enhanced .tapirulan-carousel__slide.is-active,
.tapirulan-mostra-setup-carousel.is-enhanced .tapirulan-mostra-setup-slide.is-active {
	display: grid;
}

.tapirulan-carousel-controls {
	align-items: center;
	display: flex;
	gap: 10px;
	justify-content: center;
	margin-top: 18px;
}

.tapirulan-carousel-button {
	align-items: center;
	background: #222222;
	border: 0;
	color: #ffffff;
	cursor: pointer;
	display: inline-flex;
	font-size: 16px;
	height: 38px;
	justify-content: center;
	line-height: 1;
	min-width: 38px;
	padding: 0 12px;
}

.tapirulan-carousel-button:disabled {
	cursor: default;
	opacity: 0.35;
}

.tapirulan-carousel-status {
	color: #777777;
	font-size: 12px;
	min-width: 58px;
	text-align: center;
}

.tapirulan-acf-carousel {
	--tapirulan-carousel-per-slide: 2;
	margin: 0 0 28px;
}

.tapirulan-acf-carousel__slide {
	display: grid;
	gap: 18px;
	grid-template-columns: repeat(var(--tapirulan-carousel-per-slide), minmax(0, 1fr));
}

.tapirulan-acf-carousel__item {
	background: #f1f1f1;
	display: block;
	overflow: hidden;
}

.tapirulan-acf-carousel__item img {
	aspect-ratio: 4 / 3;
	display: block;
	height: 100%;
	object-fit: cover;
	transition: transform 180ms ease;
	width: 100%;
}

.tapirulan-acf-carousel__item:hover img,
.tapirulan-acf-carousel__item:focus img {
	transform: scale(1.025);
}

.tapirulan-acf-carousel__figure {
	margin: 0;
}

.tapirulan-acf-carousel__caption {
	color: #777777;
	font-size: 12px;
	line-height: 1.45;
	margin: 8px 0 0;
	text-align: center;
}

.tapirulan-lightbox {
	align-items: center;
	background: rgba(0, 0, 0, 0.88);
	bottom: 0;
	display: none;
	justify-content: center;
	left: 0;
	padding: 28px;
	position: fixed;
	right: 0;
	top: 0;
	z-index: 999999;
}

.tapirulan-lightbox.is-open {
	display: flex;
}

.tapirulan-lightbox__figure {
	margin: 0;
	max-height: 100%;
	max-width: min(1100px, 100%);
	position: relative;
}

.tapirulan-lightbox__image {
	display: block;
	max-height: calc(100vh - 120px);
	max-width: 100%;
	object-fit: contain;
}

.tapirulan-lightbox__caption {
	color: #ffffff;
	font-size: 13px;
	line-height: 1.45;
	margin-top: 12px;
	text-align: center;
}

.tapirulan-lightbox__button {
	align-items: center;
	background: rgba(255, 255, 255, 0.14);
	border: 0;
	color: #ffffff;
	cursor: pointer;
	display: inline-flex;
	font-size: 28px;
	height: 44px;
	justify-content: center;
	line-height: 1;
	position: absolute;
	width: 44px;
}

.tapirulan-lightbox__button:hover,
.tapirulan-lightbox__button:focus {
	background: rgba(255, 255, 255, 0.26);
}

.tapirulan-lightbox__close {
	right: 18px;
	top: 18px;
}

.tapirulan-lightbox__prev,
.tapirulan-lightbox__next {
	top: 50%;
	transform: translateY(-50%);
}

.tapirulan-lightbox__prev {
	left: 18px;
}

.tapirulan-lightbox__next {
	right: 18px;
}

.tapirulan-lightbox__button[hidden] {
	display: none;
}

@media (max-width: 600px) {
	:where(.entry-content, .post-content, .ct-entry-content, .wp-block-post-content, .main-gallery-content, .tapirulan-lightbox-scope) .gallery {
		--tapirulan-gallery-columns: 2;
	}

	.tapirulan-lightbox {
		padding: 18px;
	}

	.tapirulan-lightbox__button {
		height: 38px;
		width: 38px;
	}

	.tapirulan-acf-carousel {
		--tapirulan-carousel-per-slide: 1;
	}
}
