/* ==========================================================================
   Pomegranate Featured Gallery
   ========================================================================== */

.pg-gallery {
	position: relative;
	display: grid;
	grid-template-columns: 1fr 1fr;
	grid-template-rows: 1fr;
	gap: 8px;
	width: 100%;
	box-sizing: border-box;
	direction: rtl;
}

/* Critical: min-* 0 lets grid items shrink below intrinsic image size */
.pg-gallery > .pg-main,
.pg-gallery > .pg-grid {
	min-width: 0;
	min-height: 0;
	height: 100%;
	width: 100%;
}

.pg-gallery .pg-cell {
	position: relative;
	overflow: hidden;
	width: 100%;
	height: 100%;
	min-width: 0;
	min-height: 0;
	border-radius: 6px;
	background: #f0f0f0;
	box-sizing: border-box;
	isolation: isolate;
}

/* Force images to fill cells regardless of theme/Elementor rules */
.pg-gallery img {
	display: block !important;
	width: 100% !important;
	height: 100% !important;
	max-width: 100% !important;
	min-height: 0 !important;
	object-fit: cover !important;
	object-position: center !important;
	transition: transform .5s ease;
}

/* Hidden anchors keep tiny size — used only for lightbox slideshow grouping */
.pg-gallery .pg-hidden,
.pg-gallery .pg-hidden a,
.pg-gallery .pg-hidden img {
	width: 1px !important;
	height: 1px !important;
	min-width: 0 !important;
	min-height: 0 !important;
}

/* Hover overlay (visual feedback only — cells are not clickable) */
.pg-gallery .pg-cell::after {
	content: "";
	position: absolute;
	inset: 0;
	background-color: transparent;
	transition: background-color .25s ease;
	pointer-events: none;
	z-index: 1;
}
.pg-gallery .pg-cell:hover::after {
	background-color: rgba(0,0,0,0.10);
}

.pg-hover-yes .pg-gallery .pg-cell:hover img {
	transform: scale(1.05);
}

/* ==========================================================================
   Thumbs grid — 3 cols × 2 rows
   ========================================================================== */
.pg-grid {
	display: grid;
	grid-template-columns: 1fr 1fr 1fr;
	grid-template-rows: 1fr 1fr;
	gap: 8px;
}
.pg-grid > .pg-cell {
	min-width: 0;
	min-height: 0;
}

/* ==========================================================================
   "All photos" button
   ========================================================================== */
.pg-button {
	--pg-btn-h: 12px;
	--pg-btn-v: 12px;

	position: absolute;
	z-index: 3;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 14px;
	background-color: #7A2D52;
	color: #fff;
	font-family: inherit;
	font-size: 14px;
	font-weight: 600;
	line-height: 1;
	border: 0;
	border-radius: 6px;
	cursor: pointer;
	white-space: nowrap;
	box-shadow: 0 2px 8px rgba(0,0,0,0.25);
	transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease;
	appearance: none;
	-webkit-appearance: none;
}
.pg-button:hover {
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.pg-button:active {
	transform: translateY(0);
}
.pg-button:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}
.pg-button svg { flex-shrink: 0; }

/* Position — controlled by toggle classes from Elementor controls */
.pg-btn-h-left  .pg-button { left:  var(--pg-btn-h); right: auto; }
.pg-btn-h-right .pg-button { right: var(--pg-btn-h); left:  auto; }
.pg-btn-v-bottom .pg-button { bottom: var(--pg-btn-v); top: auto; }
.pg-btn-v-top    .pg-button { top:    var(--pg-btn-v); bottom: auto; }

/* Default fallback if classes are missing */
.pg-button:not([style]) { bottom: var(--pg-btn-v); left: var(--pg-btn-h); }

/* ==========================================================================
   Hidden lightbox-slideshow anchors
   ========================================================================== */
.pg-hidden {
	position: absolute;
	top: 0;
	left: 0;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
	padding: 0;
	margin: -1px;
	pointer-events: none;
}
.pg-hidden a {
	pointer-events: auto;          /* must be reachable by .click() */
}

/* Editor placeholder */
.pg-empty {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 200px;
	padding: 24px;
	background: #f7f7f7;
	border: 2px dashed #ccc;
	color: #777;
	font-size: 14px;
	text-align: center;
}

/* ==========================================================================
   Mobile
   ========================================================================== */
@media (max-width: 767px) {
	.pg-gallery {
		grid-template-columns: 1fr;
		grid-template-rows: auto auto;
		height: auto !important;
	}
	.pg-main  { aspect-ratio: 4 / 3; height: auto; }
	.pg-grid {
		grid-template-columns: repeat(3, 1fr);
		grid-template-rows: 1fr 1fr;
		aspect-ratio: 3 / 2;
		height: auto;
	}
	.pg-button {
		font-size: 12px;
		padding: 8px 10px;
	}
	.pg-button svg { width: 14px; height: 14px; }
}
