/**
 * Styles Front-End — WP Photo Gallery Studio
 * Couvre : Albums, Barre de choix de colonnes, Chargement progressif transparent, Grille, Masonry stable, Carrousel, J'aime ❤️, Filigrane et Lightbox.
 */

.wppg-gallery-wrapper,
.wppg-album-portal {
	--wppg-cols: 3;
	--wppg-album-cols: 3;
	--wppg-gap: 16px;
	--wppg-radius: 8px;
	--wppg-ratio: 4 / 3;
	margin: 2rem 0;
	box-sizing: border-box;
	width: 100%;
}

.wppg-gallery-wrapper *,
.wppg-gallery-wrapper *::before,
.wppg-gallery-wrapper *::after,
.wppg-album-portal *,
.wppg-album-portal *::before,
.wppg-album-portal *::after {
	box-sizing: border-box;
}

.wppg-notice,
.wppg-block-placeholder-msg {
	padding: 16px 20px;
	background: #f0f6fc;
	border-left: 4px solid #2271b1;
	color: #1d2327;
	border-radius: 4px;
	font-size: 14px;
}

/* ==========================================================================
   0. BARRE D'OUTILS UTILISATEUR (CHOIX DU NOMBRE DE COLONNES)
   ========================================================================== */
.wppg-user-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 18px;
	padding: 10px 14px;
	background: #f9fafb;
	border: 1px solid #e5e7eb;
	border-radius: 10px;
}

.wppg-photos-count-badge {
	font-size: 13.5px;
	font-weight: 600;
	color: #4b5563;
}

.wppg-col-switcher {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	flex-wrap: wrap;
}

.wppg-col-switcher-label {
	font-size: 13px;
	font-weight: 600;
	color: #4b5563;
	margin-right: 4px;
}

button.wppg-col-btn {
	appearance: none;
	-webkit-appearance: none;
	width: 34px !important;
	height: 34px !important;
	min-width: 34px !important;
	padding: 0 !important;
	border-radius: 8px !important;
	border: 1px solid #d1d5db !important;
	background: #ffffff !important;
	color: #374151 !important;
	font-size: 13.5px !important;
	font-weight: 700 !important;
	line-height: 1 !important;
	cursor: pointer;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	box-shadow: none !important;
	transition: all 0.18s ease;
}

button.wppg-col-btn:hover {
	border-color: #111827 !important;
	color: #111827 !important;
	background: #f3f4f6 !important;
}

button.wppg-col-btn.active {
	background: #111827 !important;
	color: #ffffff !important;
	border-color: #111827 !important;
	box-shadow: 0 2px 6px rgba(17, 24, 39, 0.2) !important;
}

/* ==========================================================================
   0b. SYSTÈME D'ALBUMS (PORTAIL DE NAVIGATION ENTRE LES GALERIES)
   ========================================================================== */
.wppg-album-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-bottom: 24px;
}

button.wppg-album-filter-btn {
	appearance: none;
	-webkit-appearance: none;
	background: #f3f4f6 !important;
	color: #374151 !important;
	border: 1px solid #e5e7eb !important;
	padding: 8px 18px !important;
	border-radius: 999px !important;
	font-size: 14px !important;
	font-weight: 600 !important;
	line-height: 1.3 !important;
	cursor: pointer;
	transition: all 0.2s ease;
	box-shadow: none !important;
}

button.wppg-album-filter-btn:hover {
	background: #e5e7eb !important;
	color: #111827 !important;
}

button.wppg-album-filter-btn.active {
	background: #111827 !important;
	color: #ffffff !important;
	border-color: #111827 !important;
}

.wppg-album-cards-grid {
	display: grid;
	grid-template-columns: repeat(var(--wppg-album-cols, 3), minmax(0, 1fr));
	gap: 28px;
}

.wppg-album-card {
	cursor: pointer;
	display: flex;
	flex-direction: column;
	background: #ffffff;
	border-radius: 14px;
	padding: 12px;
	border: 1px solid rgba(0, 0, 0, 0.08);
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
	transition: transform 0.28s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.28s ease;
}

.wppg-album-card:hover {
	transform: translateY(-6px);
	box-shadow: 0 16px 32px rgba(0, 0, 0, 0.12);
}

.wppg-album-card-stack {
	position: relative;
	padding-top: 8px;
}

.wppg-album-card-backlayer {
	position: absolute;
	top: 0;
	left: 14px;
	right: 14px;
	height: 100%;
	border-radius: 10px;
	background-size: cover;
	background-position: center;
	opacity: 0.45;
	transform: translateY(-4px) scale(0.96);
	transition: transform 0.3s ease;
	z-index: 1;
}

.wppg-album-card:hover .wppg-album-card-backlayer {
	transform: translateY(-8px) rotate(1.5deg) scale(0.97);
}

.wppg-album-card-cover {
	position: relative;
	z-index: 2;
	aspect-ratio: 4 / 3;
	border-radius: 10px;
	overflow: hidden;
	background: #e5e7eb;
}

.wppg-album-card-cover img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.45s ease;
}

.wppg-album-card:hover .wppg-album-card-cover img {
	transform: scale(1.06);
}

.wppg-album-card-count {
	position: absolute;
	bottom: 10px;
	right: 10px;
	background: rgba(17, 24, 39, 0.82);
	backdrop-filter: blur(4px);
	color: #ffffff;
	font-size: 12px;
	font-weight: 600;
	padding: 5px 10px;
	border-radius: 999px;
	display: inline-flex;
	align-items: center;
	gap: 5px;
}

.wppg-album-card-body {
	padding: 14px 6px 6px;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.wppg-album-card-tags {
	font-size: 11.5px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #6b7280;
}

.wppg-album-card-title {
	margin: 0 !important;
	font-size: 18px !important;
	font-weight: 700 !important;
	color: #111827 !important;
	line-height: 1.3 !important;
}

.wppg-album-card-cta {
	margin-top: 4px;
	font-size: 13.5px;
	font-weight: 600;
	color: #2563eb;
	transition: transform 0.2s ease;
}

.wppg-album-card:hover .wppg-album-card-cta {
	transform: translateX(4px);
}

/* Barre de navigation quand une galerie d'album est ouverte */
.wppg-album-nav-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 14px 20px;
	background: #f9fafb;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	margin-bottom: 20px;
}

button.wppg-album-back-btn {
	appearance: none;
	-webkit-appearance: none;
	background: #ffffff !important;
	color: #111827 !important;
	border: 1px solid #d1d5db !important;
	padding: 9px 16px !important;
	border-radius: 8px !important;
	font-size: 14px !important;
	font-weight: 600 !important;
	line-height: 1.2 !important;
	cursor: pointer;
	display: inline-flex !important;
	align-items: center;
	gap: 8px;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
	transition: all 0.2s ease;
}

button.wppg-album-back-btn:hover {
	background: #111827 !important;
	color: #ffffff !important;
	border-color: #111827 !important;
}

.wppg-album-active-header {
	display: flex;
	align-items: center;
	gap: 12px;
}

.wppg-album-active-title {
	margin: 0 !important;
	font-size: 20px !important;
	font-weight: 700 !important;
	color: #111827 !important;
}

.wppg-album-active-badge {
	background: #e5e7eb;
	color: #374151;
	font-size: 12.5px;
	font-weight: 600;
	padding: 4px 10px;
	border-radius: 999px;
}

/* ==========================================================================
   1. DISPOSITION : GRILLE RÉGULIÈRE (GRID)
   ========================================================================== */
.wppg-layout-grid .wppg-items-container {
	display: grid;
	grid-template-columns: repeat(var(--wppg-cols, 3), minmax(0, 1fr));
	gap: var(--wppg-gap, 16px);
}

.wppg-layout-grid .wppg-item-media {
	aspect-ratio: var(--wppg-ratio, 4 / 3);
}

.wppg-layout-grid .wppg-item-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* ==========================================================================
   2. DISPOSITION : MASONRY STABLE (ZÉRO SAUT DE COLONNE AU SCROLL)
   ========================================================================== */
/* Avant initialisation JS (ou dans l'éditeur) */
.wppg-layout-masonry .wppg-items-container:not(.wppg-masonry-ready) {
	column-count: var(--wppg-cols, 3);
	column-gap: var(--wppg-gap, 16px);
}

.wppg-layout-masonry .wppg-items-container:not(.wppg-masonry-ready) .wppg-item {
	break-inside: avoid;
	margin: 0 0 var(--wppg-gap, 16px) 0;
	display: inline-block;
	width: 100%;
}

/* Une fois initialisé par JS : colonnes flex verticales 100% stables */
.wppg-layout-masonry .wppg-items-container.wppg-masonry-ready {
	display: grid;
	grid-template-columns: repeat(var(--wppg-cols, 3), minmax(0, 1fr));
	gap: var(--wppg-gap, 16px);
	align-items: start;
}

.wppg-masonry-col {
	display: flex;
	flex-direction: column;
	gap: var(--wppg-gap, 16px);
	min-width: 0;
}

.wppg-layout-masonry .wppg-item-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* ==========================================================================
   3. DISPOSITION : CARROUSEL / SLIDER
   ========================================================================== */
.wppg-carousel-container {
	position: relative;
	width: 100%;
}

.wppg-carousel-viewport {
	overflow: hidden;
	width: 100%;
	border-radius: var(--wppg-radius, 8px);
}

.wppg-carousel-track {
	display: flex;
	gap: var(--wppg-gap, 16px);
	transition: transform 0.45s cubic-bezier(0.25, 1, 0.5, 1);
	will-change: transform;
}

.wppg-layout-carousel .wppg-item {
	flex: 0 0 calc((100% - (var(--wppg-cols, 3) - 1) * var(--wppg-gap, 16px)) / var(--wppg-cols, 3));
	min-width: 0;
}

.wppg-layout-carousel .wppg-item-media {
	aspect-ratio: var(--wppg-ratio, 4 / 3);
}

.wppg-layout-carousel .wppg-item-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

button.wppg-carousel-btn {
	appearance: none;
	-webkit-appearance: none;
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 5;
	width: 44px !important;
	height: 44px !important;
	min-width: 44px !important;
	padding: 0 !important;
	border-radius: 50% !important;
	border: none !important;
	background: rgba(17, 24, 39, 0.78) !important;
	color: #fff !important;
	cursor: pointer;
	display: flex !important;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25) !important;
	transition: background 0.2s ease, transform 0.2s ease;
}

button.wppg-carousel-btn:hover {
	background: rgba(17, 24, 39, 0.95) !important;
	transform: translateY(-50%) scale(1.08);
}

.wppg-carousel-prev {
	left: 12px;
}

.wppg-carousel-next {
	right: 12px;
}

.wppg-carousel-dots {
	display: flex;
	justify-content: center;
	gap: 8px;
	margin-top: 14px;
}

button.wppg-carousel-dot {
	appearance: none;
	-webkit-appearance: none;
	width: 10px !important;
	height: 10px !important;
	min-width: 10px !important;
	border-radius: 999px !important;
	border: none !important;
	background: rgba(0, 0, 0, 0.22) !important;
	padding: 0 !important;
	cursor: pointer;
	transition: all 0.25s ease;
}

button.wppg-carousel-dot.active {
	width: 26px !important;
	background: #111827 !important;
}

/* ==========================================================================
   4. CARTES PHOTOS, SURVOL, BOUTON J'AIME ❤️ & TÉLÉCHARGEMENT
   ========================================================================== */
.wppg-item {
	margin: 0;
	position: relative;
}

.wppg-item-media {
	position: relative;
	overflow: hidden;
	border-radius: var(--wppg-radius, 8px);
	background: #f3f4f6;
}

.wppg-item-img {
	display: block;
	transition: transform 0.45s cubic-bezier(0.25, 1, 0.5, 1);
	user-select: none;
}

/* Animations au survol */
.wppg-hover-zoom .wppg-item:hover .wppg-item-img {
	transform: scale(1.06);
}

.wppg-hover-lift .wppg-item {
	transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.wppg-hover-lift .wppg-item:hover {
	transform: translateY(-5px);
}

.wppg-hover-lift .wppg-item:hover .wppg-item-media {
	box-shadow: 0 12px 24px -6px rgba(0, 0, 0, 0.22);
}

/* Overlay & Actions (J'aime ❤️ / Télécharger) */
.wppg-item-overlay {
	position: absolute;
	inset: 0;
	background: linear-gradient(
		to top,
		rgba(0, 0, 0, 0.62) 0%,
		rgba(0, 0, 0, 0.1) 40%,
		rgba(0, 0, 0, 0.02) 100%
	);
	opacity: 0;
	transition: opacity 0.22s ease;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	padding: 12px;
	z-index: 3;
}

.wppg-item:hover .wppg-item-overlay,
.wppg-item:focus-within .wppg-item-overlay {
	opacity: 1;
}

.wppg-item-actions {
	display: flex;
	justify-content: flex-end;
	align-items: center;
	gap: 8px;
}

/* Reset strict des boutons d'actions pour éviter toute déformation par le thème WP */
a.wppg-action-btn,
button.wppg-action-btn {
	appearance: none;
	-webkit-appearance: none;
	height: 38px !important;
	min-width: 38px !important;
	padding: 0 10px !important;
	border-radius: 999px !important;
	border: none !important;
	background: rgba(255, 255, 255, 0.94) !important;
	color: #111827 !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	gap: 5px;
	cursor: pointer;
	text-decoration: none !important;
	font-size: 13px !important;
	font-weight: 700 !important;
	line-height: 1 !important;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.22) !important;
	transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease;
}

a.wppg-download-btn {
	width: 38px !important;
	padding: 0 !important;
}

a.wppg-action-btn:hover,
button.wppg-action-btn:hover {
	background: #ffffff !important;
	color: #000000 !important;
	transform: scale(1.08);
}

a.wppg-action-btn svg,
button.wppg-action-btn svg {
	width: 18px !important;
	height: 18px !important;
	flex-shrink: 0;
	stroke: currentColor;
}

/* État "J'aime" actif (Cœur rouge/rose) */
button.wppg-like-btn.is-liked,
button.wppg-lb-like-btn.is-liked {
	color: #e11d48 !important;
}

button.wppg-like-btn.is-liked .wppg-heart-icon,
button.wppg-lb-like-btn.is-liked .wppg-heart-icon {
	fill: #e11d48 !important;
	stroke: #e11d48 !important;
	animation: wppgHeartPop 0.32s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.wppg-like-count:empty {
	display: none;
}

@keyframes wppgHeartPop {
	0% {
		transform: scale(0.8);
	}
	50% {
		transform: scale(1.32);
	}
	100% {
		transform: scale(1);
	}
}

.wppg-item-hover-caption {
	color: #ffffff;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.35;
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
	margin-top: auto;
}

.wppg-item-caption-below {
	padding: 8px 4px 2px;
	font-size: 13.5px;
	color: #4b5563;
	line-height: 1.4;
}

/* ==========================================================================
   5. FILIGRANE (WATERMARK)
   ========================================================================== */
.wppg-watermark {
	position: absolute;
	z-index: 2;
	pointer-events: none;
	user-select: none;
	display: flex;
	padding: 12px;
}

.wppg-wm-pos-bottom-right {
	bottom: 0;
	right: 0;
}
.wppg-wm-pos-bottom-left {
	bottom: 0;
	left: 0;
}
.wppg-wm-pos-top-right {
	top: 0;
	right: 0;
}
.wppg-wm-pos-top-left {
	top: 0;
	left: 0;
}
.wppg-wm-pos-center {
	inset: 0;
	align-items: center;
	justify-content: center;
}
.wppg-wm-pos-tile {
	inset: -20%;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}

.wppg-wm-tile-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 32px;
	transform: rotate(-28deg);
	width: 140%;
	height: 140%;
	align-items: center;
	justify-items: center;
}

.wppg-wm-text {
	color: #ffffff;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85), 0 0 2px rgba(0, 0, 0, 0.6);
	white-space: nowrap;
}

.wppg-wm-size-small .wppg-wm-text {
	font-size: 12px;
}
.wppg-wm-size-medium .wppg-wm-text {
	font-size: 16px;
}
.wppg-wm-size-large .wppg-wm-text {
	font-size: 22px;
}

.wppg-wm-logo {
	display: block;
	height: auto;
	filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5));
}
.wppg-wm-size-small .wppg-wm-logo {
	max-width: 65px;
	max-height: 36px;
}
.wppg-wm-size-medium .wppg-wm-logo {
	max-width: 110px;
	max-height: 55px;
}
.wppg-wm-size-large .wppg-wm-logo {
	max-width: 165px;
	max-height: 85px;
}

/* ==========================================================================
   6. VISIONNEUSE PLEIN ÉCRAN (LIGHTBOX)
   ========================================================================== */
.wppg-lightbox {
	position: fixed;
	inset: 0;
	z-index: 999999;
	background: rgba(10, 12, 16, 0.94);
	backdrop-filter: blur(8px);
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.25s ease, visibility 0.25s ease;
	user-select: none;
}

.wppg-lightbox.is-open {
	opacity: 1;
	visibility: visible;
}

.wppg-lb-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 24px;
	color: #f3f4f6;
	z-index: 5;
}

.wppg-lb-counter {
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.05em;
	background: rgba(255, 255, 255, 0.1);
	padding: 6px 12px;
	border-radius: 999px;
}

.wppg-lb-toolbar {
	display: flex;
	align-items: center;
	gap: 10px;
}

a.wppg-lb-btn,
button.wppg-lb-btn {
	appearance: none;
	-webkit-appearance: none;
	min-width: 42px !important;
	height: 42px !important;
	padding: 0 12px !important;
	border-radius: 999px !important;
	border: none !important;
	background: rgba(255, 255, 255, 0.14) !important;
	color: #fff !important;
	cursor: pointer;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	gap: 6px;
	font-size: 13px !important;
	font-weight: 700 !important;
	text-decoration: none !important;
	transition: background 0.2s ease, transform 0.2s ease;
}

a.wppg-lb-btn:hover,
button.wppg-lb-btn:hover {
	background: rgba(255, 255, 255, 0.26) !important;
	color: #fff !important;
	transform: scale(1.06);
}

.wppg-lb-stage {
	position: relative;
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	padding: 10px 64px;
}

.wppg-lb-image-wrap {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	max-width: 100%;
	max-height: 80vh;
	transition: transform 0.3s ease;
}

.wppg-lightbox.is-zoomed .wppg-lb-image-wrap {
	transform: scale(1.65);
	cursor: zoom-out;
}

.wppg-lb-img {
	max-width: 100%;
	max-height: 80vh;
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 4px;
	box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
	display: block;
}

button.wppg-lb-nav {
	appearance: none;
	-webkit-appearance: none;
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 48px !important;
	height: 48px !important;
	min-width: 48px !important;
	padding: 0 !important;
	border-radius: 50% !important;
	border: none !important;
	background: rgba(255, 255, 255, 0.14) !important;
	color: #fff !important;
	cursor: pointer;
	display: flex !important;
	align-items: center;
	justify-content: center;
	z-index: 5;
	transition: background 0.2s ease, transform 0.2s ease;
}

button.wppg-lb-nav:hover {
	background: rgba(255, 255, 255, 0.28) !important;
	transform: translateY(-50%) scale(1.08);
}

.wppg-lb-prev {
	left: 20px;
}

.wppg-lb-next {
	right: 20px;
}

.wppg-lb-footer {
	padding: 14px 24px 22px;
	text-align: center;
	color: #f9fafb;
	font-size: 15px;
	min-height: 48px;
}

/* ==========================================================================
   7. RESPONSIVE (TABLETTE & MOBILE)
   ========================================================================== */
@media (max-width: 992px) {
	.wppg-album-cards-grid {
		grid-template-columns: repeat(min(var(--wppg-album-cols, 3), 2), minmax(0, 1fr));
	}
	.wppg-layout-grid:not(.wppg-user-custom-cols) .wppg-items-container {
		grid-template-columns: repeat(min(var(--wppg-cols, 3), 2), minmax(0, 1fr));
	}
	.wppg-layout-masonry:not(.wppg-user-custom-cols) .wppg-items-container.wppg-masonry-ready {
		grid-template-columns: repeat(min(var(--wppg-cols, 3), 2), minmax(0, 1fr));
	}
	.wppg-layout-carousel:not(.wppg-user-custom-cols) .wppg-item {
		flex: 0 0 calc((100% - var(--wppg-gap, 16px)) / min(var(--wppg-cols, 3), 2));
	}
}

@media (max-width: 600px) {
	.wppg-album-cards-grid {
		grid-template-columns: 1fr;
	}
	.wppg-layout-grid:not(.wppg-user-custom-cols) .wppg-items-container {
		grid-template-columns: 1fr;
	}
	.wppg-layout-masonry:not(.wppg-user-custom-cols) .wppg-items-container.wppg-masonry-ready {
		grid-template-columns: 1fr;
	}
	.wppg-layout-carousel:not(.wppg-user-custom-cols) .wppg-item {
		flex: 0 0 100%;
	}
	.wppg-lb-stage {
		padding: 10px 16px;
	}
	.wppg-lb-prev {
		left: 8px;
	}
	.wppg-lb-next {
		right: 8px;
	}
}
