/* WebIQ_Gallery — Frontend styles */
.webiq-gallery {
	--webiq-radius: 16px;
	--webiq-gap: 14px;
	--webiq-gallery-ratio: 1 / 1;
	--webiq-cols: 4;
	--webiq-toggle-duration: 260ms;

	--webiq-shadow: 0 10px 28px rgba(0, 0, 0, 0.10);
	--webiq-shadow-soft: 0 8px 18px rgba(0, 0, 0, 0.08);
	--webiq-ring: 0 0 0 4px rgba(59, 130, 246, 0.35);
}

.webiq-gallery * {
	box-sizing: border-box;
}

.webiq-gallery__grid {
	display: grid;
	position: relative; /* needed for animated clones on hide */
	/* auto-fit makes items always stretch to full container width (no empty columns) */
	grid-template-columns: repeat(var(--webiq-cols, 4), minmax(0, 1fr));
	gap: var(--webiq-gap);
}


.webiq-gallery__item {
	position: relative;
	width: 100%;
	aspect-ratio: var(--webiq-gallery-ratio);
	border: 0;
	padding: 0;
	margin: 0;
	background: transparent !important;
	border-radius: var(--webiq-radius);
	overflow: hidden;
	cursor: pointer;
	box-shadow: var(--webiq-shadow-soft);
	opacity: 1;
	transition: box-shadow 180ms ease, opacity var(--webiq-toggle-duration, 260ms) ease;
}

.webiq-gallery__item.webiq-is-enter,
.webiq-gallery__item.webiq-is-leave {
	opacity: 0;
}

.webiq-gallery__item:focus-visible {
	outline: none;
	box-shadow: var(--webiq-shadow-soft), var(--webiq-ring);
}


/* Ensure thumbnails ALWAYS fill the aspect-ratio box (prevents "grey fields"/letterboxing
   when a theme/builder forces img{height:auto} or similar). */
.webiq-gallery__item img,
.webiq-gallery__img {
	width: 100%;
	height: 100% !important;
	display: block;
	max-width: none !important;
	object-fit: cover !important;
	object-position: center;
	transform: none; /* avoid GPU blurring in some cases */
	transition: transform 360ms ease;
}

.webiq-gallery__overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.0);
	transition: background 360ms ease;
	pointer-events: none;
}

.webiq-gallery__item:hover .webiq-gallery__img {
	transform: scale(1.06);
}

.webiq-gallery__item:hover .webiq-gallery__overlay {
	background: rgba(0, 0, 0, 0.18);
}

.webiq-gallery__item.webiq-is-hidden {
	display: none;
}

.webiq-gallery__footer {
	margin-top: 18px;
}

.webiq-gallery__footer-inner {
	display: flex;
	justify-content: flex-start;
	gap: 12px;
	flex-wrap: wrap;
	align-items: center;
}

.webiq-gallery__btn {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 16px 16px;
	border-radius: 10px;
	border: 2px solid #d1d5db;
	background: #fff;
	box-shadow: none;
	font-weight: 400;
	line-height: 1;
	letter-spacing: 0.2px;
	cursor: pointer;
	text-decoration: none;
	transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, opacity 160ms ease;
}

.webiq-gallery__btn:hover {
	background: #f9fafb;
	border-color: #c7cdd6;
	transform: translateY(-1px);
	box-shadow: none;
}

.webiq-gallery__btn:active {
	transform: translateY(0);
	box-shadow: none;
}

.webiq-gallery__btn:focus-visible {
	outline: none;
	box-shadow: var(--webiq-ring, 0 0 0 4px rgba(59, 130, 246, 0.35));
}

.webiq-gallery__btn-icon {
	font-size: 24px;
	width: 24px;
	height: 24px;
	line-height: 24px;
	color: #9ca3af;
}

span.webiq-gallery__btn-text {
	color: #787e8b;
}

/* Ensure all gallery buttons share the same default (light) look */
.webiq-gallery__btn.webiq-gallery__more,
.webiq-gallery__btn.webiq-gallery__less,
.webiq-gallery__btn.webiq-gallery__extra {
	background: #fff;
	border: 2px solid #d1d5db;
}

/* Dark buttons option (per-gallery) */
.webiq-gallery.webiq-dark-buttons .webiq-gallery__btn {
	background: #6b7280;
	border: 0;
}

.webiq-gallery.webiq-dark-buttons .webiq-gallery__btn:hover {
	background: #5f6673;
	border-color: transparent;
}

.webiq-gallery.webiq-dark-buttons .webiq-gallery__btn-icon {
	color: #ffffff;
}

.webiq-gallery.webiq-dark-buttons span.webiq-gallery__btn-text {
	color: #ffffff;
}

/* Toggle buttons state */
.webiq-gallery__less {
	display: none;
}

/* After clicking "Show more" we switch to expanded state (mutual exclusive buttons) */
.webiq-gallery.is-expanded .webiq-gallery__less {
	display: inline-flex;
}

.webiq-gallery.is-expanded .webiq-gallery__more {
	display: none;
}

.webiq-gallery.webiq-no-toggle .webiq-gallery__more,
.webiq-gallery.webiq-no-toggle .webiq-gallery__less {
	display: none;
}

/* Lightbox */
.webiq-lightbox {
	--webiq-lb-maxw: 94vw;
	--webiq-lb-maxh: 92vh;
	--webiq-lb-nav-size: 46px;
	--webiq-lb-nav-offset: 20px;
	--webiq-lb-nav-gap: 20px;
	overflow: hidden;
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 18px;
}

.webiq-lightbox.is-open {
	display: flex;
}

.webiq-lightbox__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.72);
	backdrop-filter: blur(6px);
}

.webiq-lightbox__dialog {
	position: relative;
	width: min(var(--webiq-lb-maxw, 94vw), 100vw);
	max-width: 100vw;
	max-height: min(var(--webiq-lb-maxh, 92vh), 100vh);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	z-index: 1;
}

.webiq-lightbox__stage {
	position: relative;
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	/* Keep navigation buttons OUTSIDE the image area */
	padding: 0 calc(var(--webiq-lb-nav-offset, 20px) + var(--webiq-lb-nav-size, 46px) + var(--webiq-lb-nav-gap, 20px));
	min-height: 260px;
	overflow: hidden;
}

.webiq-lightbox__img {
	max-width: 100%;
	max-height: calc(var(--webiq-lb-maxh, 92vh) - 120px);
	border-radius: 18px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
	background: rgba(255, 255, 255, 0.02);
	user-select: none;
	-webkit-user-drag: none;
}

.webiq-lightbox__btn {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	border: 0;
	width: var(--webiq-lb-nav-size, 46px);
	height: var(--webiq-lb-nav-size, 46px);
	border-radius: 12px;
	background: rgba(0, 0, 0, 0.45);
	border: 1px solid rgba(255, 255, 255, 0.16);
	color: #fff;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 12px 26px rgba(0, 0, 0, 0.30);
	transition: transform 140ms ease, background 140ms ease;
}

.webiq-icon {
	width: 22px;
	height: 22px;
	display: block;
}

.webiq-lightbox__btn:hover {
	background: rgba(0, 0, 0, 0.58);
	transform: translateY(-50%) scale(1.02);
}

.webiq-lightbox__btn:active {
	transform: translateY(-50%) scale(0.98);
}

.webiq-lightbox__btn:focus-visible {
	outline: none;
	box-shadow: 0 12px 26px rgba(0, 0, 0, 0.30), var(--webiq-ring, 0 0 0 4px rgba(59, 130, 246, 0.35));
}

.webiq-lightbox__btn--prev {
	left: var(--webiq-lb-nav-offset, 20px);
}

.webiq-lightbox__btn--next {
	right: var(--webiq-lb-nav-offset, 20px);
}

@media (max-width: 700px) {
	.webiq-lightbox {
		padding: 0;
		--webiq-lb-maxw: 100vw;
		--webiq-lb-maxh: 100vh;
		--webiq-lb-nav-offset: 12px;
		--webiq-lb-nav-gap: 0px;
	}
	.webiq-lightbox__dialog {
		width: 100%;
		max-width: 100%;
		max-height: 100vh;
	}
	/* On mobile: image is full width, arrows INSIDE the image */
	.webiq-lightbox__stage {
		padding: 0;
	}
	.webiq-lightbox__img {
		width: 100%;
		max-width: 100%;
		max-height: 82vh;
		border-radius: 0;
	}
	.webiq-lightbox__btn {
		top: 50%;
		transform: translateY(-50%);
	}
	.webiq-lightbox__btn--prev {
		left: 12px;
	}
	.webiq-lightbox__btn--next {
		right: 12px;
	}
}


/* Temporary clones for smooth hide animation */
.webiq-gallery__clone {
	position: absolute;
	margin: 0;
	padding: 0;
	pointer-events: none;
	z-index: 2;
}

.webiq-lightbox__close {
	position: fixed;
	top: 18px;
	right: 18px;
	border: 0;
	width: 42px;
	height: 42px;
	border-radius: 12px;
	background: rgba(0, 0, 0, 0.45);
	color: #fff;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 12px 26px rgba(0, 0, 0, 0.30);
	transition: background 140ms ease, transform 140ms ease;
}

.webiq-lightbox__close:hover {
	background: rgba(0, 0, 0, 0.58);
	transform: scale(1.02);
}

.webiq-lightbox__close:active {
	transform: scale(0.98);
}

.webiq-lightbox__close:focus-visible {
	outline: none;
	box-shadow: 0 12px 26px rgba(0, 0, 0, 0.30), var(--webiq-ring, 0 0 0 4px rgba(59, 130, 246, 0.35));
}

.webiq-lightbox__counter {
	position: fixed;
	left: 50%;
	bottom: 18px;
	transform: translateX(-50%);
	color: rgba(255, 255, 255, 0.86);
	font-weight: 600;
	font-size: 13px;
	letter-spacing: 0.3px;
	user-select: none;
}

.webiq-lightbox__spinner {
	position: absolute;
	width: 44px;
	height: 44px;
	border-radius: 999px;
	border: 3px solid rgba(255, 255, 255, 0.22);
	border-top-color: rgba(255, 255, 255, 0.90);
	animation: webiqSpin 0.9s linear infinite;
	opacity: 0;
}

.webiq-lightbox.is-loading .webiq-lightbox__spinner {
	opacity: 1;
}

@keyframes webiqSpin {
	to { transform: rotate(360deg); }
}
