.sip-overlay {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgba(0, 0, 0, 0.7);
	opacity: 0;
	transition: opacity 0.25s ease;
	box-sizing: border-box;
}
.sip-overlay[hidden] { display: none; }
.sip-overlay.sip-open { opacity: 1; }

.sip-dialog {
	position: relative;
	/* largeur = min(largeur max, écran, hauteur dispo × ratio) → l'image tient toujours entière */
	width: min(var(--sip-maxw, 600px), 100%, calc((100vh - 32px) * var(--sip-ratio, 1)));
	width: min(var(--sip-maxw, 600px), 100%, calc((100dvh - 32px) * var(--sip-ratio, 1)));
	transform: scale(0.96);
	transition: transform 0.25s ease;
}
.sip-overlay.sip-open .sip-dialog { transform: scale(1); }

.sip-dialog .sip-image,
.sip-dialog img {
	display: block;
	width: 100%;
	height: auto;
	max-width: 100%;
	margin: 0;
	border-radius: 6px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}
.sip-link { display: block; }

.sip-close {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 2;
	width: 40px;
	height: 40px;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 50%;
	background: #fff;
	color: #222;
	font: 400 28px/40px Arial, sans-serif;
	text-align: center;
	cursor: pointer;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
	transition: transform 0.15s ease;
}
.sip-close:hover { transform: scale(1.08); background: #fff; color: #000; }
.sip-close:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

body.sip-noscroll { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
	.sip-overlay, .sip-dialog { transition: none; }
}
