/*
	F8 Image Protection 1.0.8
	Black-file overlay decoy + href poisoning + drag / long-press / print
	hardening. Everything is scoped under body.is-image-protected (added by
	PHP, and JS-added on pages whose HTML was cached before activation), so
	deactivating the plugin removes every behavior at once.

	1.0.8 (v9): plugins-page Description shortened to "Photo DRM". No CSS
	changes from 1.0.7.

	1.0.7 (v8): no menu suppression anywhere — the decoy keeps its long-press
	callout everywhere by design, and the href poisoning (image-protection.js)
	makes every link action deliver the black file. The v6 callout-suppression
	experiment is gone.
*/


/* ---------------------------------------------------------------------------
   1. Hardening on the real images: no drag-to-desktop ghost, no text/image
      selection, no iOS long-press save sheet ON THE REAL IMAGE. The decoy on
      top keeps its callout — its sheet only ever hands over the black file.
      (draggable="false" for Firefox is set by image-protection.js.)
--------------------------------------------------------------------------- */

.is-image-protected .p-image img,
.is-image-protected .entry-content img,
.is-image-protected .gallery-item img,
.is-image-protected .iasg figure img,
.is-image-protected .wp-block-gallery img,
.is-image-protected .wp-block-image img,
.is-image-protected img.mfp-img {
	-webkit-user-drag: none;
	user-drag: none;
	-webkit-user-select: none;
	user-select: none;
	-webkit-touch-callout: none;
}


/* ---------------------------------------------------------------------------
   2. Positioned frames so the decoy can sit exactly over each image.
      .p-image a scales on hover (theme zoom effect) — a decoy inside it
      scales along and stays aligned.
--------------------------------------------------------------------------- */

.is-image-protected .p-image a,
.is-image-protected .iasg figure,
.is-image-protected .mfp-figure,
.is-image-protected .f8-decoy-frame {
	position: relative;
}

/* Anchors wrapping a linked image become the decoy frame. They must
   shrink-wrap the image so the decoy covers exactly the photo — scoped to
   figure/gallery anchors so .p-image a keeps the theme's flex display. */
.is-image-protected figure > a.f8-decoy-frame,
.is-image-protected .gallery-item a.f8-decoy-frame {
	display: inline-block;
	max-width: 100%;
	line-height: 0;
	vertical-align: top;
}


/* ---------------------------------------------------------------------------
   3. The decoy: a real black PNG riding on top of every image at opacity 0.
      Invisible on screen, but it is what the browser hit-tests — so
      save-as, copy-image, drag and open-in-new-tab all yield the black file.
      Since 1.0.3 the decoy pins itself inline; these rules are the belt.
      The long-press callout stays ENABLED on the decoy by design.
--------------------------------------------------------------------------- */

.is-image-protected img.f8-image-decoy {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0;
	border-radius: 0;
	opacity: 0;
	z-index: 5;
	object-fit: fill;
	transform: none;
	-webkit-touch-callout: default !important;
	-webkit-user-select: auto !important;
	user-select: auto !important;
}

/* Lightbox variant: cover only Magnific Popup's image strip. The 40px top
   and bottom zones hold the close button and the title/counter bar — they
   stay clickable. !important so these offsets beat the decoy's inline pin. */
.is-image-protected .mfp-figure img.f8-image-decoy {
	top: 40px !important;
	bottom: 40px !important;
	height: auto !important;
}

/* Captions stay readable, selectable and clickable above the decoy. */
.is-image-protected .f8-decoy-frame figcaption,
.is-image-protected figure figcaption {
	position: relative;
	z-index: 6;
}


/* ---------------------------------------------------------------------------
   4. No-JS fallback: even before (or without) JavaScript, an empty overlay
      on the portfolio grid anchors keeps right-click and drag off the image
      element itself.
--------------------------------------------------------------------------- */

.is-image-protected .p-image a::after {
	content: "";
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 1;
}


/* ---------------------------------------------------------------------------
   5. Print blackout: Ctrl+P / save-as-PDF gets black rectangles where the
      decoy rides, and nothing at all from any unwrapped stragglers.
--------------------------------------------------------------------------- */

@media print {

	.is-image-protected .p-image img:not(.f8-image-decoy),
	.is-image-protected .entry-content img:not(.f8-image-decoy),
	.is-image-protected .gallery-item img:not(.f8-image-decoy),
	.is-image-protected .iasg figure img:not(.f8-image-decoy),
	.is-image-protected .wp-block-gallery img:not(.f8-image-decoy),
	.is-image-protected .wp-block-image img:not(.f8-image-decoy),
	.is-image-protected img.mfp-img {
		visibility: hidden !important;
	}

	.is-image-protected img.f8-image-decoy {
		opacity: 1 !important;
	}
}
