/**
 * Portfolio image lightbox fixes.
 *
 * Portfolio screenshots open in BeTheme's Magnific Popup. By default the popup
 * (.mfp-bg / .mfp-wrap, z-index 9042/9043) sits BELOW the sticky header
 * (z-index ~9999), so the header overlapped the popup and hid the close (×)
 * button, which is pinned to the image's top edge. Very tall screenshots also
 * overflowed the viewport. Fixes: lift the popup above the header, cap the
 * image to the viewport, and keep the close button on-screen at the top-right.
 *
 * A couple of Simple Lightbox (.slb_*) safeguards are included too, harmless if
 * that lightbox never opens.
 */

/* --- Magnific Popup (the active portfolio lightbox) ---------------------- */

.mfp-bg {
	z-index: 100000 !important;
}

.mfp-wrap {
	z-index: 100001 !important;
}

/* Cap the image so the whole thing fits on screen with room for the close (×). */
.mfp-wrap .mfp-content {
	max-height: 94vh;
}

.mfp-wrap img.mfp-img {
	max-height: 88vh !important;
	width: auto !important;
	padding: 8px 0 !important;
}

/* Zoom in/out (added by xl-portfolio-lightbox.js). The image above is sized to
   "fit" at scale 1; the script applies transform:scale()/translate() on top. */
.mfp-wrap.xl-mfp-has-zoom img.mfp-img {
	transform-origin: center center;
	cursor: zoom-in;
	will-change: transform;
}

.mfp-wrap.xl-mfp-zoomed img.mfp-img {
	cursor: grab;
}

.mfp-wrap.xl-mfp-grabbing img.mfp-img {
	cursor: grabbing;
}

.xl-mfp-zoom-ui {
	position: fixed;
	top: 12px;
	left: 50%;
	transform: translateX(-50%);
	display: flex;
	gap: 8px;
	z-index: 100003;
}

.xl-mfp-zoom-ui button {
	width: 42px;
	height: 42px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 9px;
	background: rgba(0, 0, 0, .55);
	color: #fff;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: background .15s ease;
}

.xl-mfp-zoom-ui button:hover,
.xl-mfp-zoom-ui button:focus {
	background: rgba(0, 0, 0, .85);
	outline: none;
}

/* Pin the close button to the top-right corner of the viewport so it is always
   visible regardless of image height (default is top:-40px on the figure, which
   lands under the header for tall images). */
.mfp-wrap button.mfp-close,
.mfp-wrap .mfp-close {
	position: fixed !important;
	top: 10px !important;
	right: 14px !important;
	width: 44px !important;
	height: 44px !important;
	line-height: 44px !important;
	padding: 0 !important;
	color: #fff !important;
	opacity: 1 !important;
	z-index: 100002 !important;
}

/* --- Simple Lightbox safeguards (only if it handles the link) ------------ */

#slb_viewer_wrap {
	z-index: 100000 !important;
}

#slb_viewer_wrap .slb_template_tag_item_content img {
	max-height: 88vh !important;
	width: auto !important;
	height: auto !important;
}
