/* =========================================================================
 * Porsel Galeries — styles frontend
 * ====================================================================== */

/* ---- Liste des galeries (cartes) ---- */
.porsel-gal-cards {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 22px;
	margin: 1.5rem 0;
}
.porsel-gal-card {
	display: flex;
	flex-direction: column;
	border-radius: 14px;
	overflow: hidden;
	text-decoration: none;
	color: inherit;
	background: #fff;
	box-shadow: 0 2px 10px rgba(0, 0, 0, .08);
	transition: transform .2s ease, box-shadow .2s ease;
}
.porsel-gal-card:hover {
	transform: translateY(-4px);
	box-shadow: 0 10px 28px rgba(0, 0, 0, .16);
}
.porsel-gal-card-img {
	display: block;
	aspect-ratio: 4 / 3;
	background-size: cover;
	background-position: center;
	background-color: #ececec;
}
.porsel-gal-card-body {
	display: flex;
	flex-direction: column;
	gap: 3px;
	padding: 13px 15px 15px;
}
.porsel-gal-card-title {
	font-weight: 600;
	font-size: 1.08rem;
	line-height: 1.25;
}
.porsel-gal-card-count {
	font-size: .85rem;
	opacity: .55;
}
.porsel-gal-empty {
	opacity: .6;
	font-style: italic;
}

/* ---- Item commun ---- */
.porsel-gal {
	margin: 1.5rem 0;
}
.porsel-gal-item {
	display: block;
	overflow: hidden;
	border-radius: 8px;
	cursor: zoom-in;
	background: #f1f1f1;
}
.porsel-gal-item img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform .4s ease;
}
.porsel-gal-item:hover img {
	transform: scale(1.045);
}

/* ---- Grille carrée ---- */
.porsel-gal--grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
	gap: 10px;
}
.porsel-gal--grid .porsel-gal-item {
	aspect-ratio: 1 / 1;
}

/* ---- Mosaïque ---- */
.porsel-gal--masonry {
	column-count: 3;
	column-gap: 10px;
}
.porsel-gal--masonry .porsel-gal-item {
	margin: 0 0 10px;
	break-inside: avoid;
}
.porsel-gal--masonry .porsel-gal-item img {
	height: auto;
}
@media (max-width: 900px) {
	.porsel-gal--masonry { column-count: 2; }
}
@media (max-width: 520px) {
	.porsel-gal--masonry { column-count: 1; }
}

/* ---- Justifié ---- */
.porsel-gal--justified {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}
.porsel-gal--justified .porsel-gal-item {
	flex: 0 0 auto;
	height: 220px;
}

/* ---- Carrousel ---- */
.porsel-gal-carousel-wrap {
	position: relative;
}
.porsel-gal--carousel {
	display: flex;
	gap: 12px;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	padding-bottom: 12px;
	-webkit-overflow-scrolling: touch;
}
.porsel-gal--carousel::-webkit-scrollbar { height: 8px; }
.porsel-gal--carousel::-webkit-scrollbar-thumb { background: rgba(0,0,0,.2); border-radius: 4px; }
.porsel-gal--carousel .porsel-gal-item {
	flex: 0 0 auto;
	width: min(78%, 560px);
	height: 380px;
	scroll-snap-align: center;
}
.porsel-gal-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
	width: 46px;
	height: 46px;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .92);
	box-shadow: 0 2px 8px rgba(0, 0, 0, .22);
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	color: #222;
}
.porsel-gal-nav:hover { background: #fff; }
.porsel-gal-nav--prev { left: 8px; }
.porsel-gal-nav--next { right: 8px; }

/* ---- Lightbox ---- */
.porsel-lb {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: none;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, .92);
	-webkit-backdrop-filter: blur(2px);
	backdrop-filter: blur(2px);
	overflow: hidden;
}
.porsel-lb.is-open { display: flex; }
.porsel-lb-figure {
	margin: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	max-width: 92vw;
	max-height: 90vh;
}
.porsel-lb-img {
	max-width: 92vw;
	max-height: 84vh;
	object-fit: contain;
	border-radius: 4px;
	box-shadow: 0 12px 48px rgba(0, 0, 0, .55);
	cursor: zoom-in;
	touch-action: none;
	transform-origin: center center;
	will-change: transform;
}
.porsel-lb.is-zoomed .porsel-lb-img { cursor: grab; }
.porsel-lb-img.is-grabbing { cursor: grabbing; }
.porsel-lb.is-zoomed .porsel-lb-cap,
.porsel-lb.is-zoomed .porsel-lb-hint { display: none !important; }
.porsel-lb-cap {
	color: #eaeaea;
	margin-top: 14px;
	font-size: .95rem;
	text-align: center;
	max-width: 80vw;
}
.porsel-lb-close,
.porsel-lb-arrow {
	background: none;
	border: 0;
	color: #fff;
	cursor: pointer;
	opacity: .75;
	transition: opacity .15s ease;
	z-index: 2;
}
.porsel-lb-close:hover,
.porsel-lb-arrow:hover { opacity: 1; }
.porsel-lb-close {
	position: absolute;
	top: 16px;
	right: 24px;
	font-size: 36px;
	line-height: 1;
}
.porsel-lb-arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	font-size: 52px;
	line-height: 1;
	padding: 0 20px;
	user-select: none;
}
.porsel-lb-prev { left: 6px; }
.porsel-lb-next { right: 6px; }
.porsel-lb-counter {
	position: absolute;
	bottom: 18px;
	left: 50%;
	transform: translateX(-50%);
	color: #ccc;
	font-size: .85rem;
}
.porsel-lb-hint {
	position: absolute;
	bottom: 40px;
	left: 50%;
	transform: translateX(-50%);
	color: #999;
	font-size: .75rem;
	pointer-events: none;
}
@media (max-width: 600px) {
	.porsel-lb-arrow { font-size: 38px; padding: 0 10px; }
	.porsel-lb-hint { display: none; }
}

/* ---- Image isolée rendue zoomable ---- */
.porsel-zoom,
#zoom { cursor: zoom-in; }
.porsel-zoom img,
#zoom img { cursor: zoom-in; }
