/*
 * CMG Lightbox — visionneuse d'article
 * Updated: 2026-08-09 15:20 (Europe/Zurich)
 *
 * Panneau ivoire à deux zones : image à la une et contenu de l'article (titre +
 * détails), avec défilement vertical si le contenu est long. Fond encre, boutons
 * dorés. Toutes les classes sont préfixées cmg-lb pour ne rien percuter du thème.
 *
 * Couleurs : encre #1c1a17, or #a4884f, ivoire #faf8f3.
 */

/* --------------------------------------------------------- survol des images
   (liens image du contenu, quand la visionneuse est fermée) */

.cmg-lb-link {
	display: inline-block;
	position: relative;
	overflow: hidden;
	line-height: 0;
	cursor: zoom-in;
}

.cmg-lb-link img {
	transition: transform 0.5s ease;
}

.cmg-lb-link:hover img,
.cmg-lb-link:focus-visible img {
	transform: scale(1.05);
}

.cmg-lb-link::after {
	content: "";
	position: absolute;
	inset: 0;
	background: rgba(28, 26, 23, 0);
	transition: background 0.3s ease;
}

.cmg-lb-link:hover::after,
.cmg-lb-link:focus-visible::after {
	background: rgba(28, 26, 23, 0.18);
}

.cmg-lb-link::before {
	content: "";
	position: absolute;
	z-index: 1;
	top: 50%;
	left: 50%;
	width: 46px;
	height: 46px;
	margin: -23px 0 0 -23px;
	border-radius: 50%;
	background: rgba(250, 248, 243, 0.92) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a4884f' stroke-width='2' stroke-linecap='round'%3E%3Cline x1='12' y1='7' x2='12' y2='17'/%3E%3Cline x1='7' y1='12' x2='17' y2='12'/%3E%3C/svg%3E") center / 22px 22px no-repeat;
	opacity: 0;
	transform: scale(0.8);
	transition: opacity 0.3s ease, transform 0.3s ease;
	pointer-events: none;
}

.cmg-lb-link:hover::before,
.cmg-lb-link:focus-visible::before {
	opacity: 1;
	transform: scale(1);
}

/* --------------------------------------------------------------- visionneuse */

.cmg-lb {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 3vmin;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
}

.cmg-lb.is-open {
	opacity: 1;
	visibility: visible;
}

/* Navigation article fixe du thème (#prev-post / #next-post) masquée pendant que
   la visionneuse est ouverte, sinon elle dépasse aux bords. */
html.cmg-lb-open #prev-post,
html.cmg-lb-open #next-post {
	display: none;
}

.cmg-lb__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(28, 26, 23, 0.94);
	cursor: pointer;
}

/* Panneau ivoire : image + contenu. */
.cmg-lb__panel {
	position: relative;
	z-index: 1;
	display: flex;
	width: min(1000px, 94vw);
	max-height: 90vh;
	background: #faf8f3;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
	overflow: hidden;
	transform: scale(0.97);
	transition: transform 0.3s ease;
}

.cmg-lb.is-open .cmg-lb__panel {
	transform: none;
}

.cmg-lb__media {
	position: relative;
	flex: 0 0 52%;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #17150f;
}

.cmg-lb__media img {
	display: block;
	width: 100%;
	height: 100%;
	max-height: 90vh;
	object-fit: contain;
}

/* Galerie : flèches sur l'image + compteur, seulement si plusieurs images. */
.cmg-lb__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 46px;
	height: 64px;
	border: 0;
	background: rgba(28, 26, 23, 0.35);
	color: #faf8f3;
	font-size: 34px;
	line-height: 1;
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease;
}

.cmg-lb__nav:hover,
.cmg-lb__nav:focus-visible {
	background: rgba(28, 26, 23, 0.6);
	color: #a4884f;
}

.cmg-lb__prev {
	left: 0;
}

.cmg-lb__next {
	right: 0;
}

.cmg-lb__count {
	position: absolute;
	bottom: 12px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 2;
	padding: 4px 12px;
	background: rgba(28, 26, 23, 0.55);
	color: #faf8f3;
	font-family: "Open Sans", sans-serif;
	font-size: 12px;
	letter-spacing: 0.08em;
}

/* Zone texte, défilable. */
.cmg-lb__body {
	flex: 1 1 48%;
	min-width: 0;
	padding: 40px 44px;
	max-height: 90vh;
	overflow-y: auto;
}

.cmg-lb__title {
	margin: 0 0 20px;
	font-family: "Cormorant Garamond", Georgia, serif;
	font-weight: 500;
	font-size: 30px;
	line-height: 1.2;
	color: #1c1a17;
	text-transform: none;
}

.cmg-lb__content {
	color: #4a443b;
	font-family: "Open Sans", sans-serif;
	font-size: 15px;
	line-height: 1.8;
}

.cmg-lb__content ul,
.cmg-lb__content ol {
	margin: 0;
	padding-left: 1.15em;
}

.cmg-lb__content li {
	margin-bottom: 7px;
}

.cmg-lb__content a {
	color: #a4884f;
}

/* Bouton fermer. */
.cmg-lb__close {
	position: absolute;
	top: 18px;
	right: 22px;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	border: 1px solid rgba(250, 248, 243, 0.4);
	border-radius: 50%;
	background: transparent;
	color: #faf8f3;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.cmg-lb__close:hover,
.cmg-lb__close:focus-visible {
	color: #1c1a17;
	background: #a4884f;
	border-color: #a4884f;
}

/* ------------------------------------------------------------------ mobile */

@media (max-width: 780px) {

	.cmg-lb__panel {
		flex-direction: column;
		width: 94vw;
		overflow-y: auto;
	}

	.cmg-lb__media {
		flex: 0 0 auto;
	}

	.cmg-lb__media img {
		max-height: 52vh;
	}

	.cmg-lb__body {
		max-height: none;
		overflow: visible;
		padding: 26px 22px;
	}

	.cmg-lb__title {
		font-size: 26px;
	}

	.cmg-lb__close {
		top: 10px;
		right: 12px;
		width: 42px;
		height: 42px;
		font-size: 24px;
	}
}

/* ---------------------------------------------------------- reduced motion */

@media (prefers-reduced-motion: reduce) {

	.cmg-lb,
	.cmg-lb__panel,
	.cmg-lb-link img,
	.cmg-lb-link::before,
	.cmg-lb-link::after {
		transition: none;
	}

	.cmg-lb-link:hover img,
	.cmg-lb-link:focus-visible img {
		transform: none;
	}
}
