/**
 * Galerie ACF — shortcode [abrinor_acf field="photos"]
 */

.abrinor-lc-acf-field--gallery {
	display: block;
	width: 100%;
	max-width: 100%;
}

.abrinor-lc-acf-field--gallery .abrinor-lc-acf-gallery-wrap {
	display: block;
	width: 100%;
	max-width: 100%;
}

.abrinor-lc-acf-gallery {
	--abrinor-gallery-radius: 10px;
	position: relative;
	width: 100%;
	max-width: 100%;
	overflow: hidden;
}

/* Coins arrondis sur la galerie (desktop + mobile), hors lightbox */
.abrinor-lc-acf-gallery__desktop .abrinor-lc-acf-gallery__main,
.abrinor-lc-acf-gallery__desktop .abrinor-lc-acf-gallery__grid-cell,
.abrinor-lc-acf-gallery__desktop .abrinor-lc-acf-gallery__grid-cell-inner,
.abrinor-lc-acf-gallery__desktop .abrinor-lc-acf-gallery__trigger,
.abrinor-lc-acf-gallery__mobile .abrinor-lc-acf-gallery__mobile-swiper .swiper-slide,
.abrinor-lc-acf-gallery__mobile .abrinor-lc-acf-gallery__trigger {
	border-radius: var(--abrinor-gallery-radius) !important;
	overflow: hidden;
}

.abrinor-lc-acf-gallery__desktop .abrinor-lc-acf-gallery__trigger img,
.abrinor-lc-acf-gallery__mobile .abrinor-lc-acf-gallery__trigger img {
	border-radius: var(--abrinor-gallery-radius) !important;
}

.abrinor-lc-acf-gallery img {
	max-width: none !important;
}

/* —— Desktop mosaïque —— */
.abrinor-lc-acf-gallery__desktop {
	display: none;
}

.abrinor-lc-acf-gallery__desktop-inner {
	display: grid;
	grid-template-columns: 1fr 1fr;
	grid-template-rows: 1fr;
	gap: 10px;
	align-items: stretch;
	width: 100%;
	min-width: 0;
}

.abrinor-lc-acf-gallery__main {
	position: relative;
	min-width: 0;
	height: 100%;
	overflow: hidden;
}

.abrinor-lc-acf-gallery__grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	grid-template-rows: 1fr 1fr;
	gap: 10px;
	min-width: 0;
	height: 100%;
	overflow: hidden;
}

.abrinor-lc-acf-gallery__grid--count-1 {
	grid-template-columns: 1fr;
	grid-template-rows: 1fr;
}

.abrinor-lc-acf-gallery__grid--count-2 {
	grid-template-columns: 1fr;
	grid-template-rows: 1fr 1fr;
}

.abrinor-lc-acf-gallery__grid--count-3 {
	grid-template-columns: 1fr 1fr;
	grid-template-rows: 1fr 1fr;
}

.abrinor-lc-acf-gallery__grid--count-3 .abrinor-lc-acf-gallery__grid-cell:first-child {
	grid-column: 1 / -1;
}

.abrinor-lc-acf-gallery__grid-cell {
	position: relative;
	min-width: 0;
	min-height: 0;
	height: 100%;
	overflow: hidden;
}

.abrinor-lc-acf-gallery__grid-cell-inner {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	overflow: hidden;
}

.abrinor-lc-acf-gallery--count-1 .abrinor-lc-acf-gallery__desktop-inner {
	grid-template-columns: 1fr;
}

.abrinor-lc-acf-gallery--count-1 .abrinor-lc-acf-gallery__grid {
	display: none;
}

.abrinor-lc-acf-gallery__trigger {
	display: block;
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	background: #e8e8e8;
	cursor: pointer;
	overflow: hidden;
	transition: box-shadow 0.25s ease;
	-webkit-appearance: none;
	appearance: none;
}

.abrinor-lc-acf-gallery__trigger:hover,
.abrinor-lc-acf-gallery__trigger:focus-visible {
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
	outline: none;
}

.abrinor-lc-acf-gallery__trigger img {
	position: absolute;
	inset: 0;
	display: block;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	max-height: none !important;
	object-fit: cover !important;
	object-position: center center;
}

.abrinor-lc-acf-gallery__more {
	position: absolute;
	right: 12px;
	bottom: 12px;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 16px;
	font-size: 0.875rem;
	font-weight: 600;
	line-height: 1.2;
	color: #fff;
	background: rgba(0, 0, 0, 0.72);
	backdrop-filter: blur(4px);
	border: 0;
	cursor: pointer;
	pointer-events: auto;
	user-select: none;
}

.abrinor-lc-acf-gallery__more-arrow {
	display: inline-flex;
	flex-shrink: 0;
	align-items: center;
	justify-content: center;
	line-height: 0;
}

.abrinor-lc-acf-gallery__more-arrow svg {
	display: block;
}

.abrinor-lc-acf-gallery__grid-cell-inner--has-more .abrinor-lc-acf-gallery__trigger::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.35) 0%, transparent 55%);
	pointer-events: none;
}

/* —— Mobile carrousel (Swiper) —— */
.abrinor-lc-acf-gallery__mobile {
	display: block;
	width: 100%;
	margin-inline: auto;
}

.abrinor-lc-acf-gallery__mobile-swiper {
	width: 100%;
	overflow: hidden;
	padding-bottom: 28px;
}

.abrinor-lc-acf-gallery__mobile-swiper .swiper-wrapper {
	align-items: center;
}

.abrinor-lc-acf-gallery__mobile-swiper .swiper-slide {
	width: 86%;
	max-width: 420px;
	height: 280px;
}

.abrinor-lc-acf-gallery--count-1 .abrinor-lc-acf-gallery__mobile-swiper .swiper-slide {
	width: 100%;
	max-width: none;
}

.abrinor-lc-acf-gallery__trigger--mobile {
	position: relative;
	width: 100%;
	height: 100%;
	min-height: 280px;
}

.abrinor-lc-acf-gallery__mobile-pagination {
	bottom: 0 !important;
}

.abrinor-lc-acf-gallery__mobile-pagination .swiper-pagination-bullet {
	width: 7px;
	height: 7px;
	background: rgba(0, 0, 0, 0.28);
	opacity: 1;
	transition: transform 0.25s ease, background 0.25s ease;
}

.abrinor-lc-acf-gallery__mobile-pagination .swiper-pagination-bullet-active {
	background: rgba(0, 0, 0, 0.72);
	transform: scale(1.15);
}

/* —— Lightbox (Swiper) —— */
.abrinor-lc-acf-gallery__lightbox {
	--abrinor-gallery-accent: #4c585c;
	position: fixed;
	inset: 0;
	z-index: 1000100;
	isolation: isolate;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	box-sizing: border-box;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.35s ease, visibility 0.35s ease;
}

.abrinor-lc-acf-gallery__lightbox.is-open {
	opacity: 1;
	visibility: visible;
}

.abrinor-lc-acf-gallery__lightbox[hidden] {
	display: flex !important;
}

.abrinor-lc-acf-gallery__lightbox-backdrop {
	position: absolute;
	inset: 0;
	z-index: 0;
	background: rgba(8, 8, 12, 0.92);
	backdrop-filter: blur(8px);
	cursor: pointer;
}

.abrinor-lc-acf-gallery__lightbox-dialog {
	position: relative;
	z-index: 1;
	width: min(1200px, 100%);
	min-height: min(100%, 100vh);
	max-height: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	transform: scale(0.94);
	transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.abrinor-lc-acf-gallery__lightbox.is-open .abrinor-lc-acf-gallery__lightbox-dialog {
	transform: scale(1);
}

.abrinor-lc-acf-gallery__lightbox-swiper {
	width: 100%;
	height: min(80vh, 900px);
	overflow: hidden;
}

.abrinor-lc-acf-gallery__lightbox-swiper .swiper-wrapper {
	align-items: center;
}

.abrinor-lc-acf-gallery__lightbox-swiper .swiper-slide {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 100%;
}

.abrinor-lc-acf-gallery__lightbox-stage {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	min-height: 60vh;
	max-height: calc(100vh - 120px);
	user-select: none;
	-webkit-user-select: none;
}

.abrinor-lc-acf-gallery__lightbox-image {
	max-width: 100%;
	max-height: calc(100vh - 120px);
	width: auto;
	height: auto;
	object-fit: contain;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
	pointer-events: none;
	-webkit-user-drag: none;
	user-drag: none;
}

.abrinor-lc-acf-gallery__lightbox-close {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 3;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border: 0;
	border-radius: 0;
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease;
}

.abrinor-lc-acf-gallery__lightbox-close:hover,
.abrinor-lc-acf-gallery__lightbox-close:focus-visible {
	background: var(--abrinor-gallery-accent, #4c585c);
	color: #fff;
	outline: none;
}

.abrinor-lc-acf-gallery__lightbox-close [aria-hidden="true"] {
	display: block;
	transform: translateY(-4px);
}

.abrinor-lc-acf-gallery__lightbox-nav {
	position: absolute;
	top: 50%;
	z-index: 3;
	width: 48px;
	height: 48px;
	margin-top: 0;
	border: 0;
	background: rgba(255, 255, 255, 0.14);
	color: #fff;
	transition: background 0.2s ease;
}

.abrinor-lc-acf-gallery__lightbox-nav::after {
	font-size: 18px;
	font-weight: 700;
}

.abrinor-lc-acf-gallery__lightbox-nav:hover,
.abrinor-lc-acf-gallery__lightbox-nav:focus-visible {
	background: rgba(255, 255, 255, 0.3);
	outline: none;
}

.abrinor-lc-acf-gallery__lightbox-nav--prev {
	left: -64px;
}

.abrinor-lc-acf-gallery__lightbox-nav--next {
	right: -64px;
}

.abrinor-lc-acf-gallery__lightbox-dialog--has-thumbs .abrinor-lc-acf-gallery__lightbox-swiper {
	height: min(68vh, 760px);
}

.abrinor-lc-acf-gallery__lightbox-dialog--has-thumbs .abrinor-lc-acf-gallery__lightbox-stage {
	min-height: 0;
	max-height: calc(100vh - 250px);
}

.abrinor-lc-acf-gallery__lightbox-dialog--has-thumbs .abrinor-lc-acf-gallery__lightbox-image {
	max-height: calc(100vh - 250px);
}

.abrinor-lc-acf-gallery__lightbox-thumbs {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	max-width: 100%;
	margin-top: 16px;
	padding: 4px 2px 2px;
	overflow-x: auto;
	overflow-y: hidden;
	scrollbar-width: thin;
	scrollbar-color: rgba(255, 255, 255, 0.35) transparent;
	-webkit-overflow-scrolling: touch;
}

.abrinor-lc-acf-gallery__lightbox-thumbs::-webkit-scrollbar {
	height: 6px;
}

.abrinor-lc-acf-gallery__lightbox-thumbs::-webkit-scrollbar-thumb {
	background: rgba(255, 255, 255, 0.35);
	border-radius: 999px;
}

.abrinor-lc-acf-gallery__lightbox-thumb {
	flex: 0 0 auto;
	width: 100px;
	height: 80px;
	margin: 0;
	padding: 0;
	border: 2px solid transparent;
	background: rgba(255, 255, 255, 0.08);
	cursor: pointer;
	overflow: hidden !important;
	opacity: 0.72;
	-webkit-appearance: none;
	appearance: none;
	transition: border-color 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
}

.abrinor-lc-acf-gallery__lightbox button.abrinor-lc-acf-gallery__lightbox-thumb,
.abrinor-lc-acf-gallery__lightbox .abrinor-lc-acf-gallery__lightbox-thumb {
	border-radius: 10px !important;
}

.abrinor-lc-acf-gallery__lightbox button.abrinor-lc-acf-gallery__lightbox-thumb img.abrinor-lc-acf-gallery__lightbox-thumb-image,
.abrinor-lc-acf-gallery__lightbox .abrinor-lc-acf-gallery__lightbox-thumb-image {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: 10px !important;
	clip-path: inset(0 round 10px);
	object-fit: cover;
	pointer-events: none;
}

.abrinor-lc-acf-gallery__lightbox-thumb:hover,
.abrinor-lc-acf-gallery__lightbox-thumb:focus-visible {
	opacity: 1;
	border-color: rgba(255, 255, 255, 0.45);
	outline: none;
}

.abrinor-lc-acf-gallery__lightbox-thumb.is-active {
	opacity: 1;
	border-color: var(--abrinor-gallery-accent, #4c585c);
	box-shadow: 0 0 0 1px var(--abrinor-gallery-accent, #4c585c);
}

.abrinor-lc-acf-gallery__lightbox-pagination {
	position: relative;
	bottom: auto !important;
	margin-top: 16px;
	color: rgba(255, 255, 255, 0.85);
	font-size: 0.9rem;
	text-align: center;
}

.abrinor-lc-acf-gallery__lightbox-pagination .swiper-pagination-current,
.abrinor-lc-acf-gallery__lightbox-pagination .swiper-pagination-total {
	font-weight: 600;
}

body.abrinor-lc-acf-gallery-open {
	overflow: hidden;
}

@media (min-width: 992px) {
	.abrinor-lc-acf-gallery__desktop {
		display: block;
	}

	.abrinor-lc-acf-gallery__mobile {
		display: none;
	}

	/* min-height mosaïque : desktop uniquement (évite tout effet de hauteur en mobile) */
	.abrinor-lc-acf-gallery__desktop-inner {
		grid-template-rows: minmax(520px, 1fr);
		min-height: 520px;
	}

	.abrinor-lc-acf-gallery__main,
	.abrinor-lc-acf-gallery__grid {
		min-height: 520px;
	}
}

@media (max-width: 1100px) {
	.abrinor-lc-acf-gallery__lightbox-nav--prev {
		left: 8px;
	}

	.abrinor-lc-acf-gallery__lightbox-nav--next {
		right: 8px;
	}
}

@media (max-width: 991px) {
	.abrinor-lc-acf-gallery__lightbox-dialog {
		width: 100%;
		padding-inline: 0;
	}

	.abrinor-lc-acf-gallery__lightbox-swiper {
		height: calc(100vh - 100px);
	}

	.abrinor-lc-acf-gallery__lightbox-dialog--has-thumbs .abrinor-lc-acf-gallery__lightbox-swiper {
		height: calc(100vh - 210px);
	}

	.abrinor-lc-acf-gallery__lightbox-stage {
		min-height: 0;
		max-height: calc(100vh - 100px);
	}

	.abrinor-lc-acf-gallery__lightbox-dialog--has-thumbs .abrinor-lc-acf-gallery__lightbox-stage {
		max-height: calc(100vh - 210px);
	}

	.abrinor-lc-acf-gallery__lightbox-image {
		max-height: calc(100vh - 100px);
		margin-inline: auto;
	}

	.abrinor-lc-acf-gallery__lightbox-dialog--has-thumbs .abrinor-lc-acf-gallery__lightbox-image {
		max-height: calc(100vh - 210px);
	}

	.abrinor-lc-acf-gallery__lightbox-thumbs {
		margin-top: 12px;
		padding-inline: 12px;
		justify-content: center;
	}
}
