/**
 * RomanZ Markup Gallery widget styles.
 * Scoped under .elementor-widget-romanz_markup_gallery
 * Lightbox CSS is global (shared with carousel-widget when both are on the page).
 * Credit: RomanZ Media Group — https://roman.agency/
 */

/* Do not add global rules on .elementor-location-header — it breaks sticky/admin offsets. */

/* ═══════════════════════════════════════════════════════════════════════════
   GRID
═══════════════════════════════════════════════════════════════════════════ */

.elementor-widget-romanz_markup_gallery .itg-gallery {
	--itg-gap: 16px;
}

.elementor-widget-romanz_markup_gallery .itg-gallery__title {
	margin: 0 0 1em;
	font-size: 1.25em;
}

.elementor-widget-romanz_markup_gallery .itg-gallery__grid {
	display: grid;
	gap: var(--itg-gap);
	grid-template-columns: repeat(3, 1fr);
}

.elementor-widget-romanz_markup_gallery .itg-gallery__item {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

/* Uniform cell — fixed aspect ratio */
.elementor-widget-romanz_markup_gallery .itg-gallery__link,
.elementor-widget-romanz_markup_gallery .itg-gallery__trigger {
	display: block;
	line-height: 0;
	overflow: hidden;
	width: 100%;
	aspect-ratio: 16 / 9;
	border: none;
	padding: 0;
	background: none;
	cursor: pointer;
	font: inherit;
	/* Subtle scale on hover — desktop only */
	transition: transform 0.25s ease;
}

.elementor-widget-romanz_markup_gallery .itg-gallery__link:hover,
.elementor-widget-romanz_markup_gallery .itg-gallery__trigger:hover {
	transform: scale(1.02);
}

.elementor-widget-romanz_markup_gallery .itg-gallery__link:focus-visible,
.elementor-widget-romanz_markup_gallery .itg-gallery__trigger:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.elementor-widget-romanz_markup_gallery .itg-gallery__link picture,
.elementor-widget-romanz_markup_gallery .itg-gallery__trigger picture {
	display: block;
	width: 100%;
	height: 100%;
}

.elementor-widget-romanz_markup_gallery .itg-gallery__img,
.elementor-widget-romanz_markup_gallery .itg-gallery__link img,
.elementor-widget-romanz_markup_gallery .itg-gallery__trigger img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	vertical-align: middle;
}

.elementor-widget-romanz_markup_gallery .itg-gallery__caption {
	display: block;
	margin-top: 0.5em;
	font-size: 0.875em;
	color: inherit;
	opacity: 0.85;
}

/* ── Responsive grid columns ─────────────────────────────────────────────── */

@media (max-width: 1024px) {
	.elementor-widget-romanz_markup_gallery .itg-gallery__grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 767px) {
	.elementor-widget-romanz_markup_gallery .itg-gallery__grid {
		grid-template-columns: 1fr;
	}

	/* No scale on touch — avoids jitter */
	.elementor-widget-romanz_markup_gallery .itg-gallery__link:hover,
	.elementor-widget-romanz_markup_gallery .itg-gallery__trigger:hover {
		transform: none;
	}
}

/* ═══════════════════════════════════════════════════════════════════════════
   LOAD-MORE
═══════════════════════════════════════════════════════════════════════════ */

.elementor-widget-romanz_markup_gallery .itg-gallery__item--hidden {
	display: none !important;
}

.elementor-widget-romanz_markup_gallery .itg-gallery__load-more {
	display: block;
	margin: 1.5rem auto 0;
	padding: var(--itg-lm-padding-v, 0.625em) var(--itg-lm-padding-h, 1.5em);
	border: none;
	border-radius: var(--itg-lm-radius, 4px);
	background-color: var(--itg-lm-bg, #111);
	color: var(--itg-lm-color, #fff);
	font-size: 0.9375rem;
	font-weight: 500;
	cursor: pointer;
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.elementor-widget-romanz_markup_gallery .itg-gallery__load-more:hover {
	opacity: 0.82;
	transform: translateY(-1px);
}

.elementor-widget-romanz_markup_gallery .itg-gallery__load-more:active {
	transform: translateY(0);
}

/* ═══════════════════════════════════════════════════════════════════════════
   LIGHTBOX  (global — appended to <body>, shared with the carousel widget)
═══════════════════════════════════════════════════════════════════════════ */

/* Keep the injected root completely out of normal document flow.
   This prevents any accidental vertical gap near header/menu. */
#rmz-gfe-lightbox-root {
	position: fixed;
	inset: 0;
	width: 0;
	height: 0;
	pointer-events: none;
	z-index: 999999;
}

/* ── Base overlay ─────────────────────────────────────────────────────────── */
/* No body/html overflow via JS — avoids Elementor sticky header offset bugs. */

.rmz-gfe-lightbox {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: none;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.85);
	-webkit-backdrop-filter: blur(24px) saturate(120%);
	backdrop-filter: blur(24px) saturate(120%);
	box-sizing: border-box;
	overscroll-behavior: contain;
	/* Desktop: center-aligned with padding for side arrows */
	padding: 2rem calc(var(--itg-btn-size, 48px) + 1.5rem);
	min-height: 100vh;
	min-height: 100dvh;
}

#rmz-gfe-lightbox-root .rmz-gfe-lightbox {
	pointer-events: auto;
}

.rmz-gfe-lightbox--open {
	display: flex;
	/* Trap gestures on the overlay only — do not touch document.body */
	overflow: hidden;
	touch-action: none;
	overscroll-behavior: none;
}

/* ── Content area ─────────────────────────────────────────────────────────── */

.rmz-gfe-lightbox__content {
	position: relative;
	z-index: 1;
	width: min(70vw, 100%);
	max-height: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
}

.rmz-gfe-lightbox__img {
	width: 100%;
	max-width: 100%;
	max-height: calc(100vh - 8rem);
	height: auto;
	object-fit: contain;
	/* Smooth cross-fade between images */
	transition: opacity 0.18s ease;
}

.rmz-gfe-lightbox__img.rmz-gfe-lightbox__img--loading {
	opacity: 0;
}

.rmz-gfe-lightbox__caption {
	margin-top: 0.875rem;
	padding: 0 0.5rem;
	color: rgba(255, 255, 255, 0.85);
	font-size: 0.9375rem;
	line-height: 1.5;
	text-align: center;
	max-width: 80vw;
}

/* ── Desktop buttons (close / prev / next) ────────────────────────────────── */

/* All three share the same base */
.rmz-gfe-lightbox__close,
.rmz-gfe-lightbox__prev,
.rmz-gfe-lightbox__next {
	position: absolute;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	border: none;
	padding: 0;
	background-color: var(--itg-btn-color, rgba(0, 0, 0, 0.55));
	width:  var(--itg-btn-size, 48px);
	height: var(--itg-btn-size, 48px);
	border-radius: 50%;
	cursor: pointer;
	transition: background-color 0.18s ease, transform 0.15s ease;
	-webkit-tap-highlight-color: transparent;
}

.rmz-gfe-lightbox__close:hover,
.rmz-gfe-lightbox__prev:hover,
.rmz-gfe-lightbox__next:hover {
	background-color: var(--itg-btn-hover, rgba(0, 0, 0, 0.8));
}

.rmz-gfe-lightbox__prev:hover { transform: translateY(-50%) translateX(-2px); }
.rmz-gfe-lightbox__next:hover { transform: translateY(-50%) translateX(2px); }

/* Arrows hidden by default — fade in on overlay hover / focus */
.rmz-gfe-lightbox__prev,
.rmz-gfe-lightbox__next {
	opacity: 0;
	transition: opacity 0.22s ease, background-color 0.18s ease, transform 0.15s ease;
}
.rmz-gfe-lightbox:hover .rmz-gfe-lightbox__prev,
.rmz-gfe-lightbox:hover .rmz-gfe-lightbox__next,
.rmz-gfe-lightbox__prev:focus-visible,
.rmz-gfe-lightbox__next:focus-visible {
	opacity: 1;
}

.rmz-gfe-lightbox__close:focus-visible,
.rmz-gfe-lightbox__prev:focus-visible,
.rmz-gfe-lightbox__next:focus-visible {
	outline: 2px solid var(--itg-btn-icon-color, #fff);
	outline-offset: 2px;
}

/* Icon via mask — `color` prop controls icon tint via currentColor on ::before */
.rmz-gfe-lightbox__close::before,
.rmz-gfe-lightbox__prev::before,
.rmz-gfe-lightbox__next::before {
	content: '';
	display: block;
	width: 22px;
	height: 22px;
	flex-shrink: 0;
	background-color: var(--itg-btn-icon-color, #fff);
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	-webkit-mask-position: center;
	mask-position: center;
	-webkit-mask-size: contain;
	mask-size: contain;
}

.rmz-gfe-lightbox__close { top: 1rem; right: 1rem; }

.rmz-gfe-lightbox__close::before {
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M18 6L6 18M6 6l12 12'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M18 6L6 18M6 6l12 12'/%3E%3C/svg%3E");
}

.rmz-gfe-lightbox__prev { left: 1rem; top: 50%; transform: translateY(-50%); }

.rmz-gfe-lightbox__prev::before {
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='15 18 9 12 15 6'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='15 18 9 12 15 6'/%3E%3C/svg%3E");
}

.rmz-gfe-lightbox__next { right: 1rem; top: 50%; transform: translateY(-50%); }

.rmz-gfe-lightbox__next::before {
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 18 15 12 9 6'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 18 15 12 9 6'/%3E%3C/svg%3E");
}

/* ── Mobile bottom navigation bar ─────────────────────────────────────────── */
/* Desktop: nav bar stays hidden */
.rmz-gfe-lightbox__nav { display: none; }

@media (max-width: 767px) {
	/* Full viewport, column layout */
	.rmz-gfe-lightbox {
		padding: 0;
		flex-direction: column;
		justify-content: flex-start;
		align-items: stretch;
		height: 100vh;
		height: 100dvh;
	}

	/* Close button — floating top-right with blur backing */
	.rmz-gfe-lightbox__close {
		top: max(env(safe-area-inset-top, 0px), 0.75rem);
		right: 0.75rem;
		background: rgba(0, 0, 0, 0.6);
		-webkit-backdrop-filter: blur(8px);
		backdrop-filter: blur(8px);
		width: 44px;
		height: 44px;
		z-index: 10;
	}

	/* Side arrows hidden — nav bar handles navigation */
	.rmz-gfe-lightbox__prev,
	.rmz-gfe-lightbox__next {
		display: none !important;
	}

	/* Image area fills available space */
	.rmz-gfe-lightbox__content {
		flex: 1;
		width: 100%;
		/* Push content below the floating close button */
		padding-top: max(calc(env(safe-area-inset-top, 0px) + 0.75rem + 44px), 4rem);
		overflow: hidden;
		justify-content: center;
		max-height: none;
	}

	.rmz-gfe-lightbox__img {
		max-height: 100%;
		max-width: 100%;
		object-fit: contain;
		flex-shrink: 1;
	}

	.rmz-gfe-lightbox__caption {
		margin-top: 0.5rem;
		padding: 0.5rem 1.25rem;
		font-size: 0.875rem;
		max-width: 100%;
		text-align: center;
	}

	/* ── Bottom nav bar — the premium mobile element ─────────────────────── */
	.rmz-gfe-lightbox__nav {
		display: flex;
		flex-direction: column;
		width: 100%;
		flex-shrink: 0;
		background: rgba(10, 10, 10, 0.88);
		-webkit-backdrop-filter: blur(20px) saturate(180%);
		backdrop-filter: blur(20px) saturate(180%);
		border-top: 1px solid rgba(255, 255, 255, 0.07);
	}

	/* Thin progress line — shows position in the gallery */
	.rmz-gfe-lightbox__progress {
		width: 100%;
		height: 2px;
		background: rgba(255, 255, 255, 0.12);
		flex-shrink: 0;
	}

	.rmz-gfe-lightbox__progress-fill {
		height: 100%;
		background: rgba(255, 255, 255, 0.75);
		/* Animate width on slide change */
		transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
		will-change: width;
	}

	/* Row with prev button, counter, next button */
	.rmz-gfe-lightbox__nav-btns {
		display: flex;
		align-items: stretch;
		/* Safe area for iPhone home indicator */
		padding-bottom: env(safe-area-inset-bottom, 0px);
		min-height: 3.5rem;
	}

	/* Prev / Next — full-height tap zones */
	.rmz-gfe-lightbox__nav-prev,
	.rmz-gfe-lightbox__nav-next {
		display: flex;
		align-items: center;
		justify-content: center;
		flex: 0 0 5rem;
		border: none;
		background: transparent;
		color: rgba(255, 255, 255, 0.9);
		cursor: pointer;
		-webkit-tap-highlight-color: transparent;
		transition: background-color 0.12s ease, opacity 0.12s ease;
	}

	.rmz-gfe-lightbox__nav-prev:active,
	.rmz-gfe-lightbox__nav-next:active {
		background: rgba(255, 255, 255, 0.09);
	}

	.rmz-gfe-lightbox__nav-prev:focus-visible,
	.rmz-gfe-lightbox__nav-next:focus-visible {
		outline: 2px solid rgba(255, 255, 255, 0.5);
		outline-offset: -3px;
	}

	/* Arrow icons — identical SVG masks to the desktop side buttons */
	.rmz-gfe-lightbox__nav-prev::before,
	.rmz-gfe-lightbox__nav-next::before {
		content: '';
		display: block;
		width: 26px;
		height: 26px;
		background-color: var(--itg-btn-icon-color, #fff);
		-webkit-mask-repeat: no-repeat;
		mask-repeat: no-repeat;
		-webkit-mask-position: center;
		mask-position: center;
		-webkit-mask-size: contain;
		mask-size: contain;
	}

	.rmz-gfe-lightbox__nav-prev::before {
		-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='15 18 9 12 15 6'/%3E%3C/svg%3E");
		mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='15 18 9 12 15 6'/%3E%3C/svg%3E");
	}

	.rmz-gfe-lightbox__nav-next::before {
		-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 18 15 12 9 6'/%3E%3C/svg%3E");
		mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 18 15 12 9 6'/%3E%3C/svg%3E");
	}

	/* Counter — position indicator, center of the nav bar */
	.rmz-gfe-lightbox__counter {
		flex: 1;
		display: flex;
		align-items: center;
		justify-content: center;
		color: rgba(255, 255, 255, 0.88);
		font-size: 0.875rem;
		font-weight: 500;
		letter-spacing: 0.06em;
		font-variant-numeric: tabular-nums;
		user-select: none;
	}
}

/* ── Reduced motion ───────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
	.elementor-widget-romanz_markup_gallery .itg-gallery__link,
	.elementor-widget-romanz_markup_gallery .itg-gallery__trigger,
	.elementor-widget-romanz_markup_gallery .itg-gallery__load-more,
	.rmz-gfe-lightbox__close,
	.rmz-gfe-lightbox__prev,
	.rmz-gfe-lightbox__next,
	.rmz-gfe-lightbox__progress-fill,
	.rmz-gfe-lightbox__img {
		transition: none !important;
	}
}
