/* ==========================================================================
   Menuiserie Fradet - Styles front (galerie + popin)
   ========================================================================== */

/* --- Galerie de photos ------------------------------------------------- */

/* Grille "plate" (site sans thèmes utilisés) : une carte par chantier. */
.fradet-galerie-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 28px;
	margin: 24px 0;
}

/* Avec des thèmes : la grille du haut empile des sections (chacune avec son
   titre), et c'est la grille interne de chaque section qui accueille les
   cartes de chantier. */
.fradet-galerie-grid.fradet-galerie-grid--themed {
	display: block;
}

.fradet-theme-group {
	margin-bottom: 40px;
}

.fradet-theme-group:last-child {
	margin-bottom: 0;
}

.fradet-theme-title {
	margin: 0 0 18px;
	font-size: 1.4rem;
	font-weight: 700;
	color: inherit;
	padding-bottom: 10px;
	border-bottom: 2px solid rgba(0, 0, 0, 0.08);
}

.fradet-theme-chantiers {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 28px;
}

/* Une carte "chantier" : son titre, puis TOUTES ses photos visibles
   directement (pas seulement une vignette de couverture cachant les autres
   photos derrière un clic). */
.fradet-galerie-chantier-title {
	margin: 0 0 8px;
	font-size: 0.95rem;
	font-weight: 600;
	color: inherit;
}

.fradet-galerie-photos {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
	gap: 6px;
}

.fradet-galerie-photo {
	display: block;
	width: 100%;
	padding: 0;
	margin: 0;
	border: 0;
	background: none;
	cursor: zoom-in;
	border-radius: 6px;
	overflow: hidden;
	line-height: 0;
}

.fradet-galerie-photo img {
	width: 100%;
	height: 110px;
	object-fit: cover;
	display: block;
	transition: transform 0.25s ease;
	border-radius: 6px;
}

.fradet-galerie-photo:hover img,
.fradet-galerie-photo:focus img {
	transform: scale(1.05);
}

.fradet-galerie-vide {
	opacity: 0.7;
	font-style: italic;
}

/* Lightbox (agrandissement au clic) */

.fradet-lightbox {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.85);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 32px;
	z-index: 100000;
}

.fradet-lightbox[hidden] {
	display: none;
}

.fradet-lightbox-img {
	max-width: 90vw;
	max-height: 80vh;
	object-fit: contain;
	border-radius: 4px;
}

.fradet-lightbox-caption {
	color: #fff;
	margin-top: 12px;
	text-align: center;
	max-width: 80vw;
}

.fradet-lightbox-counter {
	color: rgba(255, 255, 255, 0.75);
	margin-top: 4px;
	text-align: center;
	font-size: 13px;
}

.fradet-lightbox-close {
	position: absolute;
	top: 16px;
	right: 24px;
	background: none;
	border: 0;
	color: #fff;
	font-size: 40px;
	line-height: 1;
	cursor: pointer;
	padding: 8px;
}

.fradet-lightbox-prev,
.fradet-lightbox-next {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	background: rgba(255, 255, 255, 0.12);
	border: 0;
	color: #fff;
	font-size: 32px;
	line-height: 1;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}

.fradet-lightbox-prev:hover,
.fradet-lightbox-next:hover {
	background: rgba(255, 255, 255, 0.25);
}

.fradet-lightbox-prev {
	left: 12px;
}

.fradet-lightbox-next {
	right: 12px;
}

.fradet-lightbox-prev[hidden],
.fradet-lightbox-next[hidden] {
	display: none;
}

@media (max-width: 600px) {
	.fradet-lightbox {
		padding: 16px;
	}

	.fradet-lightbox-prev,
	.fradet-lightbox-next {
		width: 40px;
		height: 40px;
		font-size: 26px;
	}

	.fradet-lightbox-close {
		top: 8px;
		right: 12px;
		font-size: 32px;
	}

	.fradet-galerie-grid,
	.fradet-theme-chantiers {
		grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
		gap: 16px;
	}

	.fradet-galerie-photos {
		grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
	}

	.fradet-galerie-photo img {
		height: 80px;
	}

	.fradet-theme-title {
		font-size: 1.15rem;
	}
}

/* --- Popin publicitaire -------------------------------------------------- */

.fradet-popup-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 100001;
	padding: 16px;
	opacity: 0;
	transition: opacity 0.2s ease;
}

.fradet-popup-overlay[hidden] {
	display: none;
}

.fradet-popup-overlay.is-visible {
	opacity: 1;
}

.fradet-popup-box {
	position: relative;
	background: #fff;
	border-radius: 8px;
	max-width: 480px;
	width: 100%;
	max-height: 85vh;
	overflow-y: auto;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.fradet-popup-image {
	/* "contain" (au lieu de "cover") affiche l'image entière, sans en
	   recadrer/couper une partie pour remplir une hauteur fixe. Le fond
	   clair comble l'espace qui peut rester sur les côtés ou en haut/bas
	   quand les proportions de l'image ne correspondent pas exactement à
	   celles du cadre. */
	width: 100%;
	max-height: 320px;
	object-fit: contain;
	display: block;
	background: #F7FAFC;
	border-radius: 8px 8px 0 0;
}

.fradet-popup-content {
	padding: 24px;
	text-align: center;
}

.fradet-popup-content p:first-child {
	margin-top: 0;
}

/* Une liste à puces créée depuis l'éditeur du popin reste lisible (texte de
   chaque puce aligné à gauche) tout en étant elle-même centrée dans le
   cadre, comme le reste du contenu. */
.fradet-popup-content ul,
.fradet-popup-content ol {
	display: inline-block;
	text-align: left;
	margin-left: auto;
	margin-right: auto;
}

.fradet-popup-button {
	/* Le thème du site applique parfois ses propres styles globaux aux liens
	   et boutons (couleur, arrondi...) avec une priorité suffisante pour
	   écraser une règle de classe habituelle : on verrouille donc les
	   propriétés visuelles importantes avec !important. */
	display: inline-block !important;
	padding: 10px 22px !important;
	background: #1d3b2a !important;
	color: #fff !important;
	text-decoration: none !important;
	border: 0 !important;
	border-radius: 4px !important;
	font-weight: 600 !important;
	font-size: 0.95rem !important;
	line-height: 1.4 !important;
}

.fradet-popup-button:hover {
	background: #142a1e !important;
	color: #fff !important;
}

.fradet-popup-close {
	/* "all: unset" retire tout style hérité du thème (beaucoup de thèmes et
	   constructeurs de page redéfinissent l'apparence de <button> de façon
	   globale, ce qui donnait ici un rond bleu au lieu du rond blanc voulu),
	   puis on redéfinit exactement l'apparence de ce bouton de fermeture. */
	all: unset;
	box-sizing: border-box;
	position: absolute;
	top: 10px;
	right: 10px;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.95) !important;
	color: #1A202C !important;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 20px;
	font-family: Arial, sans-serif;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 1px 6px rgba(0, 0, 0, 0.25);
	z-index: 2;
}

.fradet-popup-close:hover {
	background: #fff !important;
	color: #C53030 !important;
}
