/* ==========================================================================
   Image Gallery Widget for Elementor — Frontend Styles
   ========================================================================== */

.hgw-gallery-wrap {
	width: 100%;
}

/* ---- Layout: Grid ---- */
.hgw-gallery.hgw-layout-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 16px;
}

/* ---- Layout: Masonry (CSS columns) ---- */
.hgw-gallery.hgw-layout-masonry {
	column-count: 3;
	column-gap: 16px;
}
.hgw-layout-masonry .hgw-item {
	display: inline-block;
	width: 100%;
	break-inside: avoid;
	margin-bottom: 16px;
}

/* ---- Layout: Carousel (Swiper) ---- */
.hgw-gallery.hgw-layout-carousel.swiper {
	width: 100%;
	overflow: hidden;
	padding-bottom: 40px;
}
.hgw-layout-carousel .swiper-slide {
	height: auto;
}
.hgw-gallery.hgw-layout-carousel .swiper-button-next,
.hgw-gallery.hgw-layout-carousel .swiper-button-prev {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background-color: rgba(20, 20, 20, 0.35);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	border: 1px solid rgba(255, 255, 255, 0.25);
	color: #fff;
	opacity: 0;
	transform: translateY(0);
	transition: opacity 300ms ease, transform 300ms ease, background-color 300ms ease;
}
.hgw-gallery.hgw-layout-carousel.swiper:hover .swiper-button-next,
.hgw-gallery.hgw-layout-carousel.swiper:hover .swiper-button-prev {
	opacity: 1;
}
.hgw-gallery.hgw-layout-carousel .swiper-button-next:hover,
.hgw-gallery.hgw-layout-carousel .swiper-button-prev:hover {
	background-color: rgba(20, 20, 20, 0.55);
	transform: scale(1.06);
}
.hgw-gallery.hgw-layout-carousel .swiper-button-next:after,
.hgw-gallery.hgw-layout-carousel .swiper-button-prev:after {
	font-size: 15px;
	font-weight: 700;
}
.hgw-gallery.hgw-layout-carousel .swiper-pagination-bullet {
	width: 8px;
	height: 8px;
	background: rgba(120, 120, 120, 0.5);
	opacity: 1;
	border-radius: 4px;
	transition: width 300ms ease, background-color 300ms ease;
}
.hgw-gallery.hgw-layout-carousel .swiper-pagination-bullet-active {
	width: 24px;
	background: #fff;
}

/* touch devices always show arrows (no hover) */
@media (hover: none) {
	.hgw-gallery.hgw-layout-carousel .swiper-button-next,
	.hgw-gallery.hgw-layout-carousel .swiper-button-prev {
		opacity: 1;
	}
}

/* ---- Item base ---- */
.hgw-item {
	position: relative;
	display: block;
	overflow: hidden;
	text-decoration: none;
	background: #eee;
	cursor: pointer;
	transition-property: transform, box-shadow;
	transition-timing-function: cubic-bezier(0.22, 0.75, 0.32, 1);
	transition-duration: 450ms;
}
.hgw-item img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition-property: transform, filter, opacity;
	transition-timing-function: cubic-bezier(0.22, 0.75, 0.32, 1);
	transition-duration: 450ms;
}

/* ---- Aspect ratios (grid / carousel only) ---- */
.hgw-item.hgw-ratio-1-1 { aspect-ratio: 1 / 1; }
.hgw-item.hgw-ratio-4-3 { aspect-ratio: 4 / 3; }
.hgw-item.hgw-ratio-3-4 { aspect-ratio: 3 / 4; }
.hgw-item.hgw-ratio-16-9 { aspect-ratio: 16 / 9; }
.hgw-item.hgw-ratio-9-16 { aspect-ratio: 9 / 16; }
.hgw-item.hgw-ratio-1-1 img,
.hgw-item.hgw-ratio-4-3 img,
.hgw-item.hgw-ratio-3-4 img,
.hgw-item.hgw-ratio-16-9 img,
.hgw-item.hgw-ratio-9-16 img {
	position: absolute;
	top: 0;
	left: 0;
}

/* ---- Caption (plain, no overlay) ---- */
.hgw-caption-plain {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 10px 12px;
	font-size: 14px;
	background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
	color: #fff;
	pointer-events: none;
}

/* ---- Overlay base ---- */
.hgw-overlay {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 8px;
	text-align: center;
	background-color: rgba(20, 20, 20, 0.65);
	opacity: 0;
	transition-property: opacity, transform;
	transition-timing-function: ease;
	transition-duration: 400ms;
	padding: 16px;
}
.hgw-overlay-icon {
	width: 44px;
	height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	color: #fff;
	background: rgba(255, 255, 255, 0.12);
	border: 1px solid rgba(255, 255, 255, 0.35);
	-webkit-backdrop-filter: blur(4px);
	backdrop-filter: blur(4px);
	transform: scale(0.85);
	opacity: 0;
	transition: transform 400ms cubic-bezier(0.22, 0.75, 0.32, 1), opacity 400ms ease;
}
.hgw-item:hover .hgw-overlay-icon {
	transform: scale(1);
	opacity: 1;
}
.hgw-caption {
	color: #fff;
	font-size: 14px;
	font-weight: 500;
	letter-spacing: 0.01em;
	line-height: 1.4;
}

/* =========================================================
   HOVER EFFECTS
   ========================================================= */

/* Lift + Shadow */
.hgw-gallery[data-hover="lift"] .hgw-item:hover {
	transform: translateY(-10px);
	box-shadow: 0 24px 45px rgba(15, 15, 20, 0.22);
}
.hgw-gallery[data-hover="lift"] .hgw-item:hover img {
	transform: scale(1.04);
}

/* Gradient Reveal */
.hgw-gallery[data-hover="gradient-reveal"] .hgw-overlay {
	background: linear-gradient(to top, rgba(0, 0, 0, 0.72) 0%, rgba(0, 0, 0, 0.15) 55%, rgba(0, 0, 0, 0) 100%);
	opacity: 1;
	align-items: flex-start;
	justify-content: flex-end;
	padding: 18px;
}
.hgw-gallery[data-hover="gradient-reveal"] .hgw-overlay-icon {
	position: absolute;
	top: 14px;
	right: 14px;
}
.hgw-gallery[data-hover="gradient-reveal"] .hgw-caption {
	transform: translateY(14px);
	opacity: 0;
	transition: transform 400ms cubic-bezier(0.22, 0.75, 0.32, 1), opacity 400ms ease;
}
.hgw-gallery[data-hover="gradient-reveal"] .hgw-item:hover .hgw-caption {
	transform: translateY(0);
	opacity: 1;
}
.hgw-gallery[data-hover="gradient-reveal"] .hgw-item:hover img {
	transform: scale(1.06);
}

/* Zoom In */
.hgw-gallery[data-hover="zoom-in"] .hgw-item:hover img {
	transform: scale(1.12);
}

/* Zoom Out (starts slightly zoomed, settles on hover) */
.hgw-gallery[data-hover="zoom-out"] .hgw-item img {
	transform: scale(1.1);
}
.hgw-gallery[data-hover="zoom-out"] .hgw-item:hover img {
	transform: scale(1);
}

/* Grayscale to Color */
.hgw-gallery[data-hover="grayscale-color"] .hgw-item img {
	filter: grayscale(100%);
}
.hgw-gallery[data-hover="grayscale-color"] .hgw-item:hover img {
	filter: grayscale(0%);
	transform: scale(1.05);
}

/* Blur Out */
.hgw-gallery[data-hover="blur-out"] .hgw-item:hover img {
	filter: blur(4px);
	transform: scale(1.08);
}

/* Overlay Fade */
.hgw-gallery[data-hover="overlay-fade"] .hgw-item:hover .hgw-overlay {
	opacity: 1;
}
.hgw-gallery[data-hover="overlay-fade"] .hgw-item:hover img {
	transform: scale(1.05);
}

/* Overlay Slide Up */
.hgw-gallery[data-hover="overlay-slide-up"] .hgw-overlay {
	transform: translateY(100%);
	opacity: 1;
}
.hgw-gallery[data-hover="overlay-slide-up"] .hgw-item:hover .hgw-overlay {
	transform: translateY(0);
}

/* Overlay Push (caption pushes up from bottom, image dims) */
.hgw-gallery[data-hover="overlay-push"] .hgw-overlay {
	background-color: rgba(0, 0, 0, 0.55);
	align-items: flex-end;
	opacity: 0;
}
.hgw-gallery[data-hover="overlay-push"] .hgw-overlay .hgw-caption {
	transform: translateY(20px);
	transition: transform 400ms ease;
}
.hgw-gallery[data-hover="overlay-push"] .hgw-item:hover .hgw-overlay {
	opacity: 1;
}
.hgw-gallery[data-hover="overlay-push"] .hgw-item:hover .hgw-overlay .hgw-caption {
	transform: translateY(0);
}

/* 3D Tilt */
.hgw-gallery[data-hover="tilt"] .hgw-item {
	transform-style: preserve-3d;
	perspective: 800px;
	transition: transform 400ms ease;
}
.hgw-gallery[data-hover="tilt"] .hgw-item:hover {
	transform: rotateX(4deg) rotateY(-4deg) scale(1.02);
}

/* =========================================================
   ENTRANCE ANIMATIONS
   ========================================================= */
.hgw-item {
	opacity: 1;
}
.hgw-gallery[data-animation]:not([data-animation="none"]) .hgw-item {
	opacity: 0;
}
.hgw-gallery[data-animation]:not([data-animation="none"]) .hgw-item.hgw-in-view {
	animation-name: var(--hgw-anim-name, hgwFadeIn);
	animation-fill-mode: forwards;
	animation-duration: var(--hgw-anim-duration, 600ms);
	animation-delay: var(--hgw-delay, 0ms);
	animation-timing-function: ease-out;
}

@keyframes hgwFadeIn {
	from { opacity: 0; }
	to   { opacity: 1; }
}
@keyframes hgwFadeInUp {
	from { opacity: 0; transform: translateY(30px); }
	to   { opacity: 1; transform: translateY(0); }
}
@keyframes hgwFadeInDown {
	from { opacity: 0; transform: translateY(-30px); }
	to   { opacity: 1; transform: translateY(0); }
}
@keyframes hgwZoomIn {
	from { opacity: 0; transform: scale(0.85); }
	to   { opacity: 1; transform: scale(1); }
}
@keyframes hgwSlideInLeft {
	from { opacity: 0; transform: translateX(-40px); }
	to   { opacity: 1; transform: translateX(0); }
}
@keyframes hgwSlideInRight {
	from { opacity: 0; transform: translateX(40px); }
	to   { opacity: 1; transform: translateX(0); }
}

/* =========================================================
   RESPONSIVE FALLBACKS (in case JS hasn't run yet)
   ========================================================= */
@media (max-width: 1024px) {
	.hgw-gallery.hgw-layout-grid,
	.hgw-gallery.hgw-layout-masonry {
		grid-template-columns: repeat(2, 1fr);
		column-count: 2;
	}
}
@media (max-width: 600px) {
	.hgw-gallery.hgw-layout-grid,
	.hgw-gallery.hgw-layout-masonry {
		grid-template-columns: repeat(1, 1fr);
		column-count: 1;
	}
}

/* =========================================================
   CUSTOM LIGHTBOX (built-in — does not depend on Elementor's
   global lightbox setting)
   ========================================================= */
.hgw-lightbox-overlay {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(8, 8, 10, 0.92);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
	opacity: 0;
	visibility: hidden;
	transition: opacity 350ms ease, visibility 350ms ease;
	padding: 24px;
}
.hgw-lightbox-overlay.hgw-lightbox-active {
	opacity: 1;
	visibility: visible;
}
.hgw-lightbox-figure {
	position: relative;
	max-width: 92vw;
	max-height: 90vh;
	display: flex;
	flex-direction: column;
	align-items: center;
	transform: scale(0.92);
	opacity: 0;
	transition: transform 400ms cubic-bezier(0.22, 0.75, 0.32, 1), opacity 350ms ease;
}
.hgw-lightbox-overlay.hgw-lightbox-active .hgw-lightbox-figure {
	transform: scale(1);
	opacity: 1;
}
.hgw-lightbox-figure img {
	display: block;
	max-width: 92vw;
	max-height: 78vh;
	width: auto;
	height: auto;
	border-radius: 10px;
	box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}
.hgw-lightbox-caption {
	margin-top: 16px;
	color: #f5f5f5;
	font-size: 14px;
	font-weight: 500;
	letter-spacing: 0.01em;
	text-align: center;
	max-width: 70vw;
}
.hgw-lightbox-counter {
	margin-top: 6px;
	color: rgba(255, 255, 255, 0.5);
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}
.hgw-lightbox-close,
.hgw-lightbox-prev,
.hgw-lightbox-next {
	position: fixed;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 46px;
	height: 46px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.08);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
	border: 1px solid rgba(255, 255, 255, 0.18);
	color: #fff;
	cursor: pointer;
	transition: background-color 250ms ease, transform 250ms ease;
}
.hgw-lightbox-close:hover,
.hgw-lightbox-prev:hover,
.hgw-lightbox-next:hover {
	background: rgba(255, 255, 255, 0.2);
	transform: scale(1.07);
}
.hgw-lightbox-prev:active,
.hgw-lightbox-next:active {
	transform: scale(0.95);
}
.hgw-lightbox-close {
	top: 22px;
	right: 22px;
}
.hgw-lightbox-prev {
	left: 22px;
	top: 50%;
	transform: translateY(-50%);
}
.hgw-lightbox-next {
	right: 22px;
	top: 50%;
	transform: translateY(-50%);
}
.hgw-lightbox-prev:hover {
	transform: translateY(-50%) scale(1.07);
}
.hgw-lightbox-next:hover {
	transform: translateY(-50%) scale(1.07);
}
body.hgw-lightbox-open {
	overflow: hidden;
}
@media (max-width: 640px) {
	.hgw-lightbox-close,
	.hgw-lightbox-prev,
	.hgw-lightbox-next {
		width: 38px;
		height: 38px;
	}
	.hgw-lightbox-close {
		top: 12px;
		right: 12px;
	}
	.hgw-lightbox-prev {
		left: 8px;
	}
	.hgw-lightbox-next {
		right: 8px;
	}
	.hgw-lightbox-figure img {
		max-height: 68vh;
	}
}
