/* ============ Comparateurs avant/après (avant-apres.php + js/avant-apres.js) ============
   Dimensions en pixels et non en rem : knacss.css, chargé sur les pages projet, pose
   html{font-size:62.5%} (voir la note dans styles.css sur le widget d'avis).
   Couleurs toujours explicites : styles.css impose *{color:#000}. */

.avant-apres-titre {
	margin: 40px 0 8px;
	text-align: center;
	font-size: 26px;
	font-weight: normal;
	color: #0D5B5E;
}
.avant-apres-liste {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(260px, 420px));
	justify-content: center;
	gap: 32px;
	margin: 24px auto 40px;
}
.avant-apres {
	margin: 0;
}
/* Hauteur réservée par padding-top (3:4) plutôt que aspect-ratio : fonctionne aussi
   sur les navigateurs anciens, et rien ne bouge pendant le chargement des photos. */
.avant-apres-cadre {
	position: relative;
	height: 0;
	padding-top: 133.333%;
	overflow: hidden;
	background: #F0F0E7;
	--position: 50%;
}
.avant-apres-cadre img {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	-webkit-user-select: none;
	user-select: none;
}
/* La photo « avant » n'est visible qu'à gauche de la barre. */
.avant-apres-cadre .avant-apres-avant {
	-webkit-clip-path: inset(0 calc(100% - var(--position)) 0 0);
	clip-path: inset(0 calc(100% - var(--position)) 0 0);
}
/* Barre verticale */
.avant-apres-cadre::after {
	content: '';
	position: absolute;
	top: 0;
	bottom: 0;
	left: var(--position);
	width: 3px;
	margin-left: -1px;
	background: #fff;
	box-shadow: 0 0 6px rgba(0, 0, 0, 0.45);
	z-index: 2;
	pointer-events: none;
}
/* Poignée ronde au milieu de la barre */
.avant-apres-cadre::before {
	content: '\2039\00a0\203A';
	position: absolute;
	top: 50%;
	left: var(--position);
	width: 44px;
	height: 44px;
	margin: -22px 0 0 -22px;
	border-radius: 50%;
	background: #fff;
	color: #0D5B5E;
	font-size: 24px;
	font-weight: bold;
	line-height: 40px;
	text-align: center;
	box-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
	z-index: 3;
	pointer-events: none;
}
.avant-apres-cadre:focus-within::before {
	outline: 3px solid #0D5B5E;
	outline-offset: 2px;
}
/* Le vrai curseur : un input range invisible étendu sur toute la photo.
   touch-action: pan-y laisse le défilement vertical de la page au doigt. */
.avant-apres-cadre .avant-apres-curseur {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	opacity: 0;
	cursor: ew-resize;
	z-index: 4;
	touch-action: pan-y;
	-webkit-appearance: none;
	appearance: none;
}
.avant-apres-cadre .avant-apres-etiquette {
	position: absolute;
	top: 12px;
	padding: 4px 10px;
	background: rgba(255, 255, 255, 0.85);
	color: #0D5B5E;
	font-size: 13px;
	font-weight: bold;
	letter-spacing: 1px;
	text-transform: uppercase;
	z-index: 1;
	pointer-events: none;
}
.avant-apres-cadre .avant-apres-etiquette-avant {
	left: 12px;
}
.avant-apres-cadre .avant-apres-etiquette-apres {
	right: 12px;
}
.avant-apres figcaption {
	margin-top: 10px;
	text-align: center;
	font-size: 17px;
	color: #0D5B5E;
}
