/* ==========================================================================
   Galerija nekretnine
   ========================================================================== */

.nk-gallery {
	--nk-gallery-gap: 10px;
	--nk-gallery-columns: 1fr 1fr;
	--nk-gallery-height: clamp(320px, 42vw, 580px);
	--nk-gallery-radius: 0px;
	--nk-gallery-placeholder: #e6e6e6;
	--nk-gallery-button-bg: #fff;
	--nk-gallery-button-color: #1c1c1c;

	width: 100%;
}

.nk-gallery__grid {
	display: grid;
	grid-template-columns: var(--nk-gallery-columns);
	gap: var(--nk-gallery-gap);
	height: var(--nk-gallery-height);
}

.nk-gallery--count-1 .nk-gallery__grid {
	grid-template-columns: 1fr;
}

.nk-gallery__main {
	position: relative;
	min-width: 0;
	min-height: 0;
}

.nk-gallery__side {
	display: grid;
	grid-auto-rows: minmax(0, 1fr);
	gap: var(--nk-gallery-gap);
	min-width: 0;
	min-height: 0;
}

/* Klikabilna slika (ponaša se kao background: cover) */
.nk-gallery__trigger {
	position: relative;
	display: block;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	overflow: hidden;
	border: 0;
	border-radius: var(--nk-gallery-radius) !important;
	background: var(--nk-gallery-placeholder);
	cursor: zoom-in;
}

.nk-gallery__img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100% !important;
	object-fit: cover;
	display: block;
	transition: transform 0.4s ease;
}

.nk-gallery__trigger:hover .nk-gallery__img {
	transform: scale(1.03);
}

.nk-gallery__trigger:focus-visible {
	outline: 3px solid #fff;
	outline-offset: -6px;
	box-shadow: inset 0 0 0 6px rgba(0, 0, 0, 0.35);
}

/* Dugme "Pogledaj X fotografija" */
.nk-gallery__button {
	position: absolute;
	right: 16px;
	bottom: 16px;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	padding: 0.7em 1.1em;
	border: 0;
	border-radius: 4px;
	background: var(--nk-gallery-button-bg);
	color: var(--nk-gallery-button-color);
	font: inherit;
	font-size: 0.9375rem;
	font-weight: 600;
	line-height: 1.2;
	white-space: nowrap;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
	cursor: pointer;
}

.nk-gallery__button:hover {
	background: #f2f2f2;
}

.nk-gallery__button:focus-visible {
	outline: 3px solid var(--nk-gallery-button-color);
	outline-offset: 2px;
}

.nk-gallery__button-icon {
	flex-shrink: 0;
	fill: currentColor;
}

/* Tablet */
@media (max-width: 1024px) {
	.nk-gallery {
		--nk-gallery-height: clamp(300px, 48vw, 480px);
	}
}

/* Mobilni: glavna slika gore, dve manje ispod u redu */
@media (max-width: 767px) {
	.nk-gallery__grid,
	.nk-gallery--count-1 .nk-gallery__grid {
		grid-template-columns: 1fr;
		height: auto;
	}

	.nk-gallery__side {
		grid-auto-flow: column;
		grid-auto-columns: minmax(0, 1fr);
		grid-auto-rows: auto;
	}

	/*
	 * Slike su ovde u toku dokumenta (ne absolute), pa galerija ima stvarnu
	 * visinu sadržaja. Inače je Elementor flex kontejner u column smeru
	 * skuplja i tekst ispod se preklapa preko slika.
	 */
	.nk-gallery__trigger {
		height: auto;
		padding: 0 !important;
	}

	.nk-gallery__img {
		position: static;
		height: auto !important;
		aspect-ratio: 3 / 2;
	}

	.nk-gallery__main .nk-gallery__img {
		aspect-ratio: 4 / 3;
	}

	.nk-gallery__button {
		right: 12px;
		bottom: 12px;
		padding: 0.6em 0.9em;
		font-size: 0.875rem;
	}
}

/* ==========================================================================
   Lightbox
   ========================================================================== */

html.nk-lightbox-open {
	overflow: hidden;
}

.nk-lightbox {
	width: 100%;
	height: 100%;
	max-width: none;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	background: rgba(12, 12, 12, 0.96);
	color: #fff;
	overflow: hidden;
}

.nk-lightbox::backdrop {
	background: rgba(0, 0, 0, 0.6);
}

.nk-lightbox__stage {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 64px 88px;
	touch-action: pan-y;
	user-select: none;
}

.nk-lightbox__img {
	display: block;
	width: auto;
	height: auto;
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	transition: opacity 0.25s ease;
	-webkit-user-drag: none;
}

.nk-lightbox__img.is-loading {
	opacity: 0;
}

.nk-lightbox__close,
.nk-lightbox__nav {
	position: absolute;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	padding: 0 !important;
	border: 0;
	border-radius: 50% !important;
	background: rgba(255, 255, 255, 0.12);
	color: #fff !important;
	cursor: pointer !important;
	transition: background-color 0.2s ease;
}

.nk-lightbox__close:hover,
.nk-lightbox__nav:hover {
	background: rgba(255, 255, 255, 0.24);
}

.nk-lightbox__close:focus-visible,
.nk-lightbox__nav:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.nk-lightbox__close svg,
.nk-lightbox__nav svg {
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.nk-lightbox__close {
	top: calc(12px + env(safe-area-inset-top, 0px));
	right: 12px;
}

.nk-lightbox__nav {
	top: 50%;
	transform: translateY(-50%);
}

.nk-lightbox__nav--prev {
	left: 20px;
}

.nk-lightbox__nav--next {
	right: 20px;
}

.nk-lightbox__nav[hidden] {
	display: none;
}

.nk-lightbox__counter {
	position: absolute;
	left: 50%;
	bottom: calc(16px + env(safe-area-inset-bottom, 0px));
	z-index: 2;
	margin: 0;
	transform: translateX(-50%);
	font-size: 0.9375rem;
	font-variant-numeric: tabular-nums;
	opacity: 0.85;
}

/* Mobilni lightbox: strelice dole, slika preko cele širine */
@media (max-width: 767px) {
	.nk-lightbox__stage {
		padding: 64px 0 80px;
	}

	.nk-lightbox__nav {
		top: auto;
		bottom: calc(8px + env(safe-area-inset-bottom, 0px));
		transform: none;
	}

	.nk-lightbox__nav--prev {
		left: 12px;
	}

	.nk-lightbox__nav--next {
		right: 12px;
	}

	.nk-lightbox__counter {
		bottom: calc(22px + env(safe-area-inset-bottom, 0px));
	}
}

@media (prefers-reduced-motion: reduce) {
	.nk-gallery__img,
	.nk-lightbox__img,
	.nk-lightbox__close,
	.nk-lightbox__nav {
		transition: none;
	}

	.nk-gallery__trigger:hover .nk-gallery__img {
		transform: none;
	}
}
