/**
 * Protection visuelle + filigrane élégant (style photographe pro).
 *
 * Site public : motif diagonal + signature (portfolio / lightbox).
 * Espace privé Vendôme : motif « @Pascale Gorce Photographe » uniquement
 * (les photos sont déjà signées dans le fichier).
 */

:root {
	--pg-wm-tile: url("../img/watermark-tile.svg");
	--pg-wm-tile-vs: url("../img/watermark-tile-vs.svg?v=3");
	--pg-wm-sign: url("../img/watermark-signature.png");
	--pg-wm-opacity: 0.55;
	--pg-wm-sign-opacity: 0.4;
	--pg-wm-tile-size: 300px 195px;
}

img,
.mfp-img,
.portfolio img,
.entry-content img,
.dt-gallery img,
.grid-item img,
.wp-post-image {
	-webkit-user-select: none !important;
	-moz-user-select: none !important;
	-ms-user-select: none !important;
	user-select: none !important;
	-webkit-touch-callout: none !important;
	-webkit-user-drag: none !important;
}

/* Les clics passent au parent (lien) : pas de « Enregistrer l'image » via le <img>. */
.portfolio img,
.entry-content img:not(.emoji):not(.wp-smiley),
.dt-gallery img,
.grid-item img,
.mfp-figure img,
.wp-post-image,
.delicious-grid img,
.pg-vs-photo img,
.pg-vs-thumb img,
.pg-wm img {
	pointer-events: none;
}

/* ——— Conteneurs filigranés ——— */
.portfolio .grid-item .img-anchor,
.portfolio .grid-item,
.mfp-figure,
.mfp-image-holder .mfp-content,
.pg-img-shield,
.pg-wm,
.pg-vs-photo__frame,
.pg-vs-thumb,
.entry-content .wp-caption,
.entry-content figure:has(> img),
.single-portfolio .wpb_single_image,
.single-portfolio .vc_single_image-wrapper {
	position: relative;
	isolation: isolate;
}

.portfolio .grid-item .img-anchor,
.pg-wm,
.pg-vs-photo__frame,
.pg-vs-thumb,
.mfp-figure {
	overflow: hidden;
}

.pg-img-shield,
.pg-wm {
	display: inline-block;
	max-width: 100%;
}

.pg-vs-photo__frame.pg-wm {
	display: flex;
	align-items: center;
	justify-content: center;
	width: fit-content;
	max-width: 100%;
	margin-inline: auto;
}

.pg-vs-photo--landscape .pg-vs-photo__frame.pg-wm {
	width: fit-content;
	max-width: 100%;
}

.pg-img-shield img,
.pg-wm img {
	display: block;
	max-width: 100%;
	height: auto;
}

/* Motif diagonal répété */
.portfolio .grid-item .img-anchor::before,
.mfp-figure::before,
.pg-img-shield::before,
.pg-wm::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	pointer-events: none;
	background-image: var(--pg-wm-tile);
	background-repeat: repeat;
	background-size: var(--pg-wm-tile-size);
	background-position: center;
	opacity: var(--pg-wm-opacity);
	mix-blend-mode: normal;
}

/* Au-dessus de la photo, sous le titre au survol (z-index 2 du thème) */
.portfolio .grid-item .img-anchor::before {
	z-index: 1;
}

/* Lightbox / preuves : motif plus haut */
.mfp-figure::before,
.pg-img-shield::before,
.pg-wm::before {
	z-index: 3;
}

/* Signature discrète en bas à droite (vues publiques uniquement) */
.mfp-figure::after,
.pg-img-shield::after,
.pg-wm::after {
	content: "";
	position: absolute;
	z-index: 4;
	right: max(10px, 2.5%);
	bottom: max(10px, 2.5%);
	width: min(160px, 28%);
	aspect-ratio: 507 / 150;
	background-image: var(--pg-wm-sign);
	background-repeat: no-repeat;
	background-size: contain;
	background-position: right bottom;
	opacity: var(--pg-wm-sign-opacity);
	pointer-events: none;
	filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}

/* Sur grilles portfolio : motif seul (pas de signature pour rester léger) */
.portfolio .grid-item .img-anchor::after {
	content: none;
}

/*
 * Espace privé Vendôme Show :
 * photos déjà signées → pas de signature CSS, motif « @Pascale Gorce Photographe ».
 */
.pg-vs-photo__frame,
.pg-vs-thumb.pg-wm,
.pg-vs-gallery-card__cover,
.pg-vs-gallery-hero,
.pg-vs-lightbox__figure {
	position: relative;
	isolation: isolate;
	overflow: hidden;
	--pg-wm-tile: var(--pg-wm-tile-vs);
	--pg-wm-opacity: 0.48;
	--pg-wm-tile-size: 320px 152px;
}

.pg-vs-photo__frame::before,
.pg-vs-thumb.pg-wm::before,
.pg-vs-gallery-card__cover::before,
.pg-vs-gallery-hero::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 3;
	pointer-events: none;
	background-image: var(--pg-wm-tile-vs);
	background-repeat: repeat;
	background-size: var(--pg-wm-tile-size);
	background-position: center;
	opacity: var(--pg-wm-opacity);
}

/* Lightbox VS : le calque .pg-vs-lightbox__wm porte le motif (évite le ::before du <dialog>). */
.pg-vs-lightbox__figure::before,
.pg-vs-lightbox__figure::after {
	content: none !important;
	display: none !important;
}

.pg-vs-photo__frame::after,
.pg-vs-thumb.pg-wm::after,
.pg-vs-cart-photo .pg-wm::after,
.pg-vs-mini-lines .pg-wm::after,
.pg-vs-gallery-card__cover::after,
.pg-vs-gallery-hero::after,
.pg-vs .pg-wm::after {
	content: none !important;
	display: none !important;
}

.pg-vs-cart-photo .pg-wm::before,
.pg-vs-thumb.pg-wm::before,
.pg-vs-mini-lines .pg-wm::before,
.pg-vs-gallery-card__cover::before {
	--pg-wm-opacity: 0.32;
	--pg-wm-tile-size: 260px 124px;
}

/* Accueil : aucune surcouche sur la photo promo (déjà signée / vitrine) */
.home .entry-content .wpb_single_image::before,
.home .entry-content .wpb_single_image::after,
.home .entry-content .vc_single_image-wrapper::before,
.home .entry-content .vc_single_image-wrapper::after,
.home .entry-content .pg-wm::before,
.home .entry-content .pg-wm::after {
	content: none !important;
	display: none !important;
}

/* Miniatures panier / UI : pas de signature trop grande — géré ci-dessus (pg-vs) */

/* Calque de protection clics — pas sur la grille portfolio (hover titre) */
.mfp-figure > .pg-wm-shield,
.pg-img-shield > .pg-wm-shield,
.pg-wm > .pg-wm-shield,
.pg-vs-photo__frame > .pg-wm-shield,
.pg-vs-lightbox__figure > .pg-wm-shield {
	position: absolute;
	inset: 0;
	z-index: 5;
	background: transparent;
	pointer-events: auto;
	-webkit-user-select: none;
	user-select: none;
}

/* Lightbox galerie privée : motif un peu plus marqué */
.pg-vs-lightbox__figure {
	--pg-wm-opacity: 0.55;
	--pg-wm-tile-size: 360px 171px;
}

/* Lightbox : filigrane un peu plus marqué */
.mfp-figure {
	--pg-wm-opacity: 0.62;
	--pg-wm-sign-opacity: 0.5;
	--pg-wm-tile-size: 340px 220px;
}

/* Exclusions : logos, icônes, UI */
.site-branding img,
.site-logo img,
.custom-logo,
.logo img,
#logo img,
.footer-logo img,
img.emoji,
img.wp-smiley,
#headersocial img,
.site-footer img,
.pg-vs-brand img,
.rev-slidebg + img[src*="pixel"],
img[src*="Signature-noire"],
img[src*="Favicon"],
img[src*="favicon"],
img[src*="grid.svg"],
img[width="1"],
img[height="1"] {
	pointer-events: auto;
}

.site-branding::before,
.site-branding::after,
.site-logo::before,
.site-logo::after,
#logo::before,
#logo::after,
.custom-logo-link::before,
.custom-logo-link::after,
.pg-no-wm::before,
.pg-no-wm::after {
	content: none !important;
	display: none !important;
}

/* Toast protection */
.pg-protect-toast {
	position: fixed;
	left: 50%;
	bottom: 1.5rem;
	transform: translateX(-50%) translateY(120%);
	z-index: 100000;
	max-width: min(90vw, 28rem);
	padding: 0.85rem 1.15rem;
	border-radius: 4px;
	background: rgba(10, 10, 10, 0.92);
	color: #fff;
	font-size: 0.9rem;
	line-height: 1.35;
	text-align: center;
	opacity: 0;
	pointer-events: none;
	transition: transform 0.25s ease, opacity 0.25s ease;
}

.pg-protect-toast.is-visible {
	transform: translateX(-50%) translateY(0);
	opacity: 1;
}

@media (max-width: 640px) {
	:root {
		--pg-wm-tile-size: 240px 156px;
		--pg-wm-opacity: 0.5;
	}

	.mfp-figure::after,
	.pg-img-shield::after,
	.pg-wm::after {
		width: min(120px, 36%);
	}
}

@media (prefers-reduced-motion: reduce) {
	.pg-protect-toast {
		transition: none;
	}
}
