
/* POPUP */

#popup {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0,0,0,0.82);
	z-index: 99999;
	display: none;
}

/*
 * Le conteneur n'a plus de largeur/hauteur fixe : il se dimensionne sur
 * l'image réelle puis est centré avec un transform, ce qui fonctionne
 * quelle que soit la taille de l'image envoyée (recommandée mais plus
 * obligatoire). max-width/max-height empêchent tout débordement sur
 * petit écran, et l'image n'est jamais agrandie au-delà de sa taille
 * réelle : la qualité d'affichage est ainsi toujours optimale (pas de
 * flou par sur-étirement).
 */
#popupImage {
	position: absolute;
	top: 50%;
	left: 50%;
	max-width: min(700px, 92vw);
	max-height: 85vh;
	transform: translate(-50%, -50%) scale(0.94);
	opacity: 0;
	transition: transform .25s ease, opacity .25s ease;
}

#popupImage.popup-visible {
	transform: translate(-50%, -50%) scale(1);
	opacity: 1;
}

#popupImage img {
	display: block;
	max-width: min(700px, 92vw);
	max-height: 85vh;
	width: auto;
	height: auto;
	box-shadow: 0px 4px 30px rgba(0,0,0,0.5);
	border-radius: 6px;
	transition: transform .2s ease;
}

/* Lien enrobant l'image : effet de survol + badge d'invitation au clic */
.popupLien {
	position: relative;
	display: block;
}

.popupLien:hover img {
	transform: scale(1.012);
}

.popupBadge {
	position: absolute;
	left: 50%;
	bottom: 18px;
	transform: translate(-50%, 6px);
	background: rgba(0,0,0,0.78);
	color: #fff;
	font-size: 13px;
	font-weight: 600;
	padding: 8px 18px;
	border-radius: 999px;
	white-space: nowrap;
	pointer-events: none;
	opacity: 0;
	transition: opacity .18s ease, transform .18s ease;
}

.popupBadge svg {
	width: 12px;
	height: 12px;
	margin-left: 4px;
	vertical-align: middle;
}

.popupLien:hover .popupBadge {
	opacity: 1;
	transform: translate(-50%, 0);
}

/* Croix de fermeture, dessinée en CSS (nette à toutes les résolutions) */
#popupClose {
	position: absolute;
	top: -15px;
	right: -15px;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0px 2px 10px rgba(0,0,0,0.4);
	cursor: pointer;
	z-index: 2;
	transition: transform .15s ease, background .15s ease;
}

#popupClose:hover {
	transform: scale(1.1);
	background: #f2f2f2;
}

#popupClose::before,
#popupClose::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 14px;
	height: 2px;
	background: #333;
	border-radius: 2px;
}

#popupClose::before { transform: translate(-50%, -50%) rotate(45deg); }
#popupClose::after { transform: translate(-50%, -50%) rotate(-45deg); }

#popupSmartphone {
	display: none;
}

/* FIN POPUP */

@media (max-width: 750px) {

	#popupSmartphone {
		position: fixed;
		top: 0;
		left: 0;
		width: 100%;
		height: 100%;
		background: rgba(0,0,0,0.82);
		display: none;
		z-index: 99999;
	}

	/*
	 * Même logique que sur ordinateur : l'image smartphone garde ses
	 * dimensions réelles (jusqu'à occuper la quasi-totalité de l'écran),
	 * sans être agrandie au-delà de sa taille d'origine.
	 */
	#popupSmartphoneImage {
		position: absolute;
		top: 50%;
		left: 50%;
		max-width: 92vw;
		max-height: 82vh;
		transform: translate(-50%, -50%) scale(0.96);
		opacity: 0;
		transition: transform .25s ease, opacity .25s ease;
	}

	#popupSmartphoneImage.popup-visible {
		transform: translate(-50%, -50%) scale(1);
		opacity: 1;
	}

	#popupSmartphoneImage img {
		display: block;
		max-width: 92vw;
		max-height: 82vh;
		width: auto;
		height: auto;
		box-shadow: 0px 4px 24px rgba(0,0,0,0.5);
		border-radius: 4px;
	}

	#popupSmartphoneImage a {
		display: block;
	}

	/* Sur mobile il n'y a pas de survol : le badge reste visible en permanence */
	#popupSmartphoneImage .popupBadge {
		opacity: 1;
		transform: translate(-50%, 0);
		bottom: 14px;
		font-size: 12.5px;
		padding: 7px 15px;
	}

	#popupSmartphoneClose {
		position: absolute;
		top: 16px;
		right: 16px;
		width: 38px;
		height: 38px;
		border-radius: 50%;
		background: rgba(0,0,0,0.5);
		z-index: 2;
		cursor: pointer;
	}

	#popupSmartphoneClose::before,
	#popupSmartphoneClose::after {
		content: "";
		position: absolute;
		top: 50%;
		left: 50%;
		width: 16px;
		height: 2px;
		background: #fff;
		border-radius: 2px;
	}

	#popupSmartphoneClose::before { transform: translate(-50%, -50%) rotate(45deg); }
	#popupSmartphoneClose::after { transform: translate(-50%, -50%) rotate(-45deg); }

}
