/* Advanced Elementor Gallery - Main Styles */

.aeg-gallery {
	display: grid;
	width: 100%;
	margin: 0;
	padding: 0;
	list-style: none;
	gap: 20px;
	box-sizing: border-box;
}

.aeg-gallery-item {
	position: relative;
	overflow: hidden;
	width: 100%;
	aspect-ratio: auto;
	display: block;
	box-sizing: border-box;
}

.aeg-image-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: block;
    box-sizing: border-box;
}

.aeg-image-wrapper img,
.aeg-image-wrapper .aeg-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Lightbox Link - Must fill the wrapper */
.aeg-lightbox-link {
	display: block;
	width: 100%;
	height: 100%;
	text-decoration: none;
	cursor: pointer;
	overflow: hidden;
	font-size: 0;
	line-height: 0;
}

.aeg-image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
	box-sizing: border-box;
}

/* Overlay Styles */
.aeg-overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	background-color: rgba(0, 0, 0, 0.5);
	opacity: 0;
	transition: opacity 0.3s ease;
	pointer-events: none;
}

.aeg-overlay-text {
	color: white;
	font-weight: 600;
	font-size: 16px;
	letter-spacing: 0.5px;
	text-transform: uppercase;
	user-select: none;
}

/* Hover Effect */
.aeg-gallery-item:hover .aeg-image {
	transform: scale(1.05);
}

.aeg-gallery-item:hover .aeg-overlay {
	opacity: 1;
}

/* Intelligent Layout */
.aeg-layout-intelligent {
	/* Gap and layout handled by JavaScript/inline styles */
}

/* Grid Layout */
.aeg-layout-grid {
	display: grid;
	width: 100%;
}

/* Responsive Grid Layout */
@media (max-width: 1024px) {
	.aeg-layout-grid {
		grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	}
}

@media (max-width: 768px) {
	.aeg-layout-grid {
		grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	}
}

@media (max-width: 480px) {
	.aeg-layout-grid {
		grid-template-columns: 1fr;
	}

	.aeg-overlay-text {
		font-size: 14px;
	}
}

/* Accessibility */
.aeg-gallery-item:focus-within .aeg-overlay {
	opacity: 1;
}

.aeg-lightbox-link:focus {
	outline: 2px solid rgba(0, 0, 0, 0.3);
	outline-offset: 2px;
}

/* Empty State */
.aeg-gallery-empty {
	padding: 40px;
	text-align: center;
	color: #666;
	background-color: #f5f5f5;
	border-radius: 4px;
}

/* Print Styles */
@media print {
	.aeg-overlay {
		display: none;
	}

	.aeg-image {
		transform: none !important;
	}
}

/* Loading State */
.aeg-image[loading="lazy"] {
	background-color: #f0f0f0;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
	.aeg-image,
	.aeg-overlay {
		transition: none;
	}

	.aeg-gallery-item:hover .aeg-image {
		transform: none;
	}
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
	.aeg-gallery-empty {
		background-color: #2a2a2a;
		color: #ccc;
	}
}

/* GLightbox Fixes */
.glightbox-container {
	z-index: 9999 !important;
}

.gslide {
	z-index: 9999 !important;
}

.glightbox-slide {
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
}

.gslide-image img,
.gslide-image picture {
	max-width: 90vw !important;
	max-height: 90vh !important;
	object-fit: contain !important;
}

.gclose,
.gslide-nav {
	z-index: 10000 !important;
	position: relative !important;
}

.gbtn {
	margin: 0 5px !important;
	padding: 8px 12px !important;
}

.glightbox-nav {
	display: flex !important;
	gap: 10px !important;
	align-items: center !important;
	flex-wrap: wrap !important;
}

/* Aspect Ratio Preservation (prevents layout shift) */
.aeg-gallery-item {
	aspect-ratio: auto;
	overflow: hidden;
}

.aeg-layout-grid .aeg-gallery-item {
	aspect-ratio: inherit;
}

/* Touch Device Optimization */
@media (hover: none) and (pointer: coarse) {
	.aeg-overlay {
		opacity: 0.7;
	}

	.aeg-gallery-item:active .aeg-image {
		transform: scale(0.98);
	}
}
