/* Overlia Photo Guard, front-end styles. Scoped to protected images only. */

img.ovpg-img {
	-webkit-user-drag: none;
	-khtml-user-drag: none;
	-moz-user-drag: none;
	user-drag: none;
	-webkit-touch-callout: none;
	-webkit-user-select: none;
	user-select: none;
}

/* Above the core lightbox overlay (100000), which the window and the badge
   both have to sit on top of when a photo is expanded. */
.ovpg-badge {
	position: fixed;
	z-index: 100001;
	padding: 4px 9px;
	border-radius: 999px;
	background: rgba( 17, 17, 17, 0.62 );
	color: #fff;
	font-family: var( --ovpg-font, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif );
	font-size: 11px;
	font-weight: 500;
	line-height: 1.4;
	letter-spacing: 0.02em;
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.15s ease;
	backdrop-filter: blur( 6px );
}

.ovpg-badge.is-visible {
	opacity: 1;
}

.ovpg-modal {
	position: fixed;
	inset: 0;
	z-index: 100002;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.ovpg-modal[hidden] {
	display: none;
}

.ovpg-backdrop {
	position: absolute;
	inset: 0;
	background: rgba( 10, 10, 12, 0.66 );
	backdrop-filter: blur( 3px );
	opacity: 0;
	transition: opacity 0.18s ease;
}

.ovpg-modal.is-open .ovpg-backdrop {
	opacity: 1;
}

.ovpg-panel {
	position: relative;
	width: min( 420px, 100% );
	box-sizing: border-box;
	padding: 28px 26px 22px;
	border-radius: 14px;
	background: #fff;
	color: #16181d;
	box-shadow: 0 18px 50px rgba( 0, 0, 0, 0.32 );
	text-align: center;
	/* Both set from the settings; without them the window follows the theme. */
	font-family: var( --ovpg-font, inherit );
	font-size: var( --ovpg-size, 15px );
	transform: translateY( 8px ) scale( 0.98 );
	opacity: 0;
	transition: transform 0.18s ease, opacity 0.18s ease;
}

.ovpg-modal.is-open .ovpg-panel {
	transform: none;
	opacity: 1;
}

.ovpg-mark {
	width: 44px;
	height: 44px;
	margin: 0 auto 14px;
	border-radius: 50%;
	background: #16181d;
	color: #fff;
	font: 600 22px/44px Georgia, "Times New Roman", serif;
}

/*
 * Logo variant: the bundled SVG is white on transparent, so it is painted as a
 * mask filled with the panel's own text colour, one file, both themes.
 * The class is only added when the browser supports masks; otherwise the ©
 * glyph above stays in place.
 */
.ovpg-modal.ovpg-has-logo .ovpg-mark {
	width: min( 190px, 60% );
	height: 54px;
	margin: 2px auto 18px;
	border-radius: 0;
	color: inherit; /* the base rule paints the © badge white */
	background: currentColor;
	font-size: 0;
	-webkit-mask: var( --ovpg-logo ) no-repeat center / contain;
	mask: var( --ovpg-logo ) no-repeat center / contain;
}

.ovpg-title {
	margin: 0 0 10px;
	/* Pinned: themes (and wp-admin) often set a colour on every h2, which would
	   otherwise leave a dark heading on the dark window. */
	color: inherit;
	font-size: 1.27em;
	line-height: 1.3;
	font-weight: 600;
}

.ovpg-text {
	margin: 0 0 20px;
	font-size: 0.97em;
	line-height: 1.6;
	color: #4a4f58;
}

.ovpg-actions {
	display: flex;
	gap: 8px;
	justify-content: center;
	flex-wrap: wrap;
}

.ovpg-btn {
	display: inline-block;
	padding: 10px 18px;
	border: 1px solid transparent;
	border-radius: 8px;
	font-family: inherit;
	font-size: 0.93em;
	font-weight: 500;
	line-height: 1.2;
	letter-spacing: 0.06em; /* uppercase needs the extra air */
	text-transform: uppercase;
	cursor: pointer;
	text-decoration: none;
}

.ovpg-btn-primary {
	background: #16181d;
	color: #fff;
}

.ovpg-btn-primary:hover,
.ovpg-btn-primary:focus {
	background: #2c313a;
	color: #fff;
}

.ovpg-btn-close {
	background: transparent;
	border-color: #d5d8de;
	color: #4a4f58;
}

.ovpg-btn-close:hover,
.ovpg-btn-close:focus {
	border-color: #16181d;
	color: #16181d;
}

/* Applied by the script when the page it sits on is dark. */
.ovpg-modal.ovpg-on-dark .ovpg-panel {
	background: #1b1d22;
	color: #f2f3f5;
}

.ovpg-modal.ovpg-on-dark .ovpg-mark {
	background: #f2f3f5;
	color: #16181d;
}

.ovpg-modal.ovpg-on-dark.ovpg-has-logo .ovpg-mark {
	color: inherit;
	background: currentColor; /* the panel's light-on-dark text colour */
}

.ovpg-modal.ovpg-on-dark .ovpg-text {
	color: #b7bcc5;
}

.ovpg-modal.ovpg-on-dark .ovpg-btn-primary {
	background: #f2f3f5;
	color: #16181d;
}

.ovpg-modal.ovpg-on-dark .ovpg-btn-primary:hover,
.ovpg-modal.ovpg-on-dark .ovpg-btn-primary:focus {
	background: #fff;
	color: #16181d;
}

.ovpg-modal.ovpg-on-dark .ovpg-btn-close {
	border-color: #3a3e46;
	color: #b7bcc5;
}

/*
 * Print. "Print to PDF" is a copy nobody thinks to guard against, so on paper
 * a protected photo becomes an empty frame with a note. The note is generated
 * content, so it lands wherever the photo was without touching the markup.
 */
@media print {
	.ovpg-print-hide img.ovpg-img {
		visibility: hidden;
	}

	.ovpg-print-hide figure:has( > img.ovpg-img ),
	.ovpg-print-hide figure:has( > a > img.ovpg-img ),
	.ovpg-print-hide figure:has( > picture > img.ovpg-img ) {
		position: relative;
	}

	.ovpg-print-hide figure:has( > img.ovpg-img )::after,
	.ovpg-print-hide figure:has( > a > img.ovpg-img )::after,
	.ovpg-print-hide figure:has( > picture > img.ovpg-img )::after {
		content: var( --ovpg-print-note, "\00a9" );
		position: absolute;
		top: 50%;
		left: 50%;
		transform: translate( -50%, -50% );
		max-width: 80%;
		padding: 10px 16px;
		border: 1px solid #000;
		color: #000;
		font: 500 12px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
		text-align: center;
	}

	/* The window and the badge are screen furniture. */
	.ovpg-modal,
	.ovpg-badge {
		display: none !important;
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.ovpg-backdrop,
	.ovpg-panel,
	.ovpg-badge {
		transition: none;
	}
}
