/* ============================================================
 * Media Gallery for Elementor
 * ============================================================ */

.emg-gallery {
	--emg-columns: 3;
	--emg-gap: 12px;
	--emg-ratio: 1;
}

/* ---------- Grid ---------- */

.emg-gallery__grid {
	display: grid;
	grid-template-columns: repeat(var(--emg-columns), minmax(0, 1fr));
	gap: var(--emg-gap);
}

.emg-gallery--masonry .emg-gallery__grid {
	display: block;
	column-count: var(--emg-columns);
	column-gap: var(--emg-gap);
}

.emg-gallery--masonry .emg-item {
	break-inside: avoid;
	-webkit-column-break-inside: avoid;
	margin-bottom: var(--emg-gap);
	display: inline-block;
	width: 100%;
}

/* ---------- Elementi ---------- */

.emg-item {
	position: relative;
	overflow: hidden;
	background-color: rgba(0, 0, 0, 0.04);
}

.emg-item.is-hidden {
	display: none;
}

.emg-item__link {
	display: block;
	width: 100%;
	height: 100%;
	padding: 0;
	margin: 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	cursor: pointer;
	text-decoration: none;
}

.emg-item__media {
	position: relative;
	width: 100%;
	height: 100%;
	overflow: hidden;
}

.emg-gallery--grid .emg-item__media {
	aspect-ratio: var(--emg-ratio);
}

.emg-item__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.45s ease, filter 0.45s ease;
}

.emg-gallery--masonry .emg-item__img {
	height: auto;
}

/* Efektet mbi foto */
.emg-gallery--hover-zoom .emg-item:hover .emg-item__img,
.emg-gallery--hover-zoom .emg-item:focus-within .emg-item__img {
	transform: scale(1.08);
}

.emg-gallery--hover-shrink .emg-item:hover .emg-item__img,
.emg-gallery--hover-shrink .emg-item:focus-within .emg-item__img {
	transform: scale(0.94);
}

.emg-gallery--hover-move .emg-item:hover .emg-item__img,
.emg-gallery--hover-move .emg-item:focus-within .emg-item__img {
	transform: scale(1.12) translateX(-3%);
}

.emg-gallery--hover-gray .emg-item__img {
	filter: grayscale(100%);
}

.emg-gallery--hover-gray .emg-item:hover .emg-item__img,
.emg-gallery--hover-gray .emg-item:focus-within .emg-item__img {
	filter: grayscale(0);
}

/* Overlay */
.emg-item__overlay {
	position: absolute;
	inset: 0;
	background-color: rgba(0, 0, 0, 0.15);
	transition: background-color 0.35s ease;
	pointer-events: none;
}

/* Ikona play */
.emg-item__play {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
	color: #fff;
	background-color: rgba(0, 0, 0, 0.45);
	padding: 18px;
	border-radius: 50%;
	transition: background-color 0.3s ease, transform 0.3s ease;
	pointer-events: none;
}

.emg-item__play svg {
	width: 1em;
	height: 1em;
	fill: currentColor;
}

.emg-item:hover .emg-item__play {
	transform: translate(-50%, -50%) scale(1.08);
}

/* Etiketa */
.emg-item__badge {
	position: absolute;
	top: 10px;
	left: 10px;
	padding: 2px 8px;
	font-size: 11px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: #fff;
	background-color: rgba(0, 0, 0, 0.6);
	border-radius: 3px;
	pointer-events: none;
}

/* Titulli / përshkrimi */
.emg-item__content {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	align-items: center;
	padding: 16px;
	pointer-events: none;
	transition: opacity 0.35s ease, transform 0.35s ease;
}

.emg-gallery--caption-hover .emg-item__content {
	opacity: 0;
	transform: translateY(10px);
}

.emg-gallery--caption-hover .emg-item:hover .emg-item__content,
.emg-gallery--caption-hover .emg-item:focus-within .emg-item__content {
	opacity: 1;
	transform: translateY(0);
}

.emg-item__title {
	color: #fff;
	font-weight: 600;
}

.emg-item__desc {
	color: rgba(255, 255, 255, 0.8);
	font-size: 0.85em;
	margin-top: 4px;
}

/* Video inline brenda grid-it */
.emg-item__player {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	background-color: #000;
	z-index: 2;
}

.emg-item__player iframe,
.emg-item__player video {
	width: 100%;
	height: 100%;
	border: 0;
	display: block;
	object-fit: contain;
}

.emg-item.is-playing .emg-item__play,
.emg-item.is-playing .emg-item__overlay,
.emg-item.is-playing .emg-item__content,
.emg-item.is-playing .emg-item__badge {
	display: none;
}

/* ---------- Filtrat ---------- */

.emg-filters {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px;
	margin-bottom: 24px;
}

.emg-filter {
	appearance: none;
	border: 1px solid currentColor;
	background: transparent;
	padding: 8px 16px;
	border-radius: 999px;
	cursor: pointer;
	font: inherit;
	line-height: 1.2;
	transition: color 0.25s ease, background-color 0.25s ease, border-color 0.25s ease;
}

.emg-filter.is-active,
.emg-filter:hover {
	color: #fff;
	background-color: #111;
	border-color: #111;
}

/* ---------- Lightbox i integruar ---------- */

.emg-lightbox {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: none;
	align-items: center;
	justify-content: center;
	background-color: rgba(0, 0, 0, 0.92);
	opacity: 0;
	transition: opacity 0.25s ease;
}

.emg-lightbox.is-open {
	display: flex;
	opacity: 1;
}

.emg-lightbox__stage {
	position: relative;
	width: min(92vw, 1400px);
	max-height: 86vh;
	display: flex;
	align-items: center;
	justify-content: center;
}

.emg-lightbox__stage img {
	max-width: 92vw;
	max-height: 86vh;
	width: auto;
	height: auto;
	display: block;
	object-fit: contain;
}

.emg-lightbox__frame {
	position: relative;
	width: min(92vw, 1400px);
	aspect-ratio: 16 / 9;
	max-height: 86vh;
	background: #000;
}

.emg-lightbox__frame iframe,
.emg-lightbox__frame video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
	display: block;
}

.emg-lightbox__caption {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 24px;
	text-align: center;
	color: #fff;
	padding: 0 60px;
	pointer-events: none;
}

.emg-lightbox__caption strong {
	display: block;
	font-size: 1.05em;
}

.emg-lightbox__caption span {
	display: block;
	font-size: 0.85em;
	opacity: 0.75;
	margin-top: 4px;
}

.emg-lightbox__btn {
	position: absolute;
	appearance: none;
	border: 0;
	background: rgba(255, 255, 255, 0.1);
	color: #fff;
	width: 46px;
	height: 46px;
	border-radius: 50%;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background-color 0.2s ease;
}

.emg-lightbox__btn:hover,
.emg-lightbox__btn:focus-visible {
	background: rgba(255, 255, 255, 0.25);
}

.emg-lightbox__close {
	top: 20px;
	right: 20px;
}

.emg-lightbox__prev {
	top: 50%;
	left: 20px;
	transform: translateY(-50%);
}

.emg-lightbox__next {
	top: 50%;
	right: 20px;
	transform: translateY(-50%);
}

.emg-lightbox__counter {
	position: absolute;
	top: 28px;
	left: 24px;
	color: rgba(255, 255, 255, 0.7);
	font-size: 13px;
	letter-spacing: 0.08em;
}

body.emg-lightbox-open {
	overflow: hidden;
}

/* ---------- Aksesueshmëria ---------- */

.emg-item__link:focus-visible,
.emg-filter:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
	.emg-item__img,
	.emg-item__content,
	.emg-item__overlay,
	.emg-lightbox {
		transition: none !important;
	}
}

@media (max-width: 767px) {
	.emg-lightbox__prev { left: 8px; }
	.emg-lightbox__next { right: 8px; }
	.emg-lightbox__caption { padding: 0 20px; bottom: 12px; }
}
