/*
 * Main Gallery – prikaz na stranici.
 * Prijelomi: tablet <= 1024px, mobitel <= 767px (isto kao Elementor).
 */

/* ------------------------------------------------------------------ */
/* Osnova                                                              */
/* ------------------------------------------------------------------ */

.mgal {
	--_gap: var(--mgal-gap, 10px);
	--_cols: var(--mgal-cols, 3);
	--_rowh-n: var(--mgal-row-h, 260);
	--_rowh: calc(var(--_rowh-n) * 1px);
	--_radius: var(--mgal-radius, 0px);
	--_overlay: var(--mgal-overlay, rgba(0, 0, 0, .35));
	--_ease: cubic-bezier(.2, .7, .2, 1);
	position: relative;
	width: 100%;
	box-sizing: border-box;
}
.mgal *,
.mgal *::before,
.mgal *::after { box-sizing: border-box; }

@media (max-width: 1024px) {
	.mgal {
		--_gap: var(--mgal-gap-t, var(--mgal-gap, 10px));
		--_cols: var(--mgal-cols-t, 2);
		--_rowh-n: var(--mgal-row-h-t, 200);
	}
}
@media (max-width: 767px) {
	.mgal {
		--_gap: var(--mgal-gap-m, var(--mgal-gap, 8px));
		--_cols: var(--mgal-cols-m, 1);
		--_rowh-n: var(--mgal-row-h-m, 150);
	}
}

.mgal-items { margin: 0; padding: 0; list-style: none; }
.mgal-item { position: relative; margin: 0; min-width: 0; }
.mgal-item.is-paged,
.mgal-item.is-filtered { display: none !important; }

.mgal-figure { position: relative; margin: 0; padding: 0; height: 100%; }

.mgal-media {
	position: relative;
	overflow: hidden;
	border-radius: var(--_radius);
	background: rgba(127, 127, 127, .14);
	isolation: isolate;
}
.mgal-link {
	display: block;
	width: 100%;
	height: 100%;
	color: inherit;
	text-decoration: none;
	border: 0;
	box-shadow: none;
}
.mgal a.mgal-link { cursor: zoom-in; }
.mgal a.mgal-link:not([data-mgal-lb]) { cursor: pointer; }
.mgal-link:focus { outline: none; }
.mgal-link:focus-visible {
	outline: 3px solid currentColor;
	outline-offset: -3px;
}

.mgal-img {
	display: block;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	margin: 0 !important;
	object-fit: cover;
	border-radius: 0 !important;
	transition: transform .6s var(--_ease), filter .45s ease, opacity .3s ease;
	will-change: transform;
}

/* ------------------------------------------------------------------ */
/* Model: Mreža (grid)                                                  */
/* ------------------------------------------------------------------ */

.mgal--grid .mgal-items {
	display: grid;
	grid-template-columns: repeat(var(--_cols), minmax(0, 1fr));
	gap: var(--_gap);
	align-items: start;
}
.mgal--grid .mgal-media { aspect-ratio: var(--mgal-ratio, 1.5); }
.mgal--grid.mgal--ratio-original .mgal-media { aspect-ratio: var(--mgal-r, 1.5); }

/* ------------------------------------------------------------------ */
/* Model: Masonry                                                      */
/* Bez JS-a: CSS stupci. S JS-om: točan raspored slijeva nadesno.      */
/* ------------------------------------------------------------------ */

.mgal--masonry .mgal-items {
	columns: var(--_cols);
	column-gap: var(--_gap);
}
.mgal--masonry .mgal-item {
	break-inside: avoid;
	margin-bottom: var(--_gap);
}
.mgal--masonry .mgal-media { aspect-ratio: var(--mgal-r, 1.5); }

.mgal--masonry.is-laid .mgal-items {
	columns: auto;
	position: relative;
}
.mgal--masonry.is-laid .mgal-item {
	position: absolute;
	top: 0;
	left: 0;
	margin: 0;
}

/* ------------------------------------------------------------------ */
/* Model: Justified                                                    */
/* Bez JS-a: svaka slika raste razmjerno omjeru (iste visine u redu).  */
/* S JS-om: točni redovi pune širine, bez prerazvučenih redova.        */
/* ------------------------------------------------------------------ */

.mgal--justified .mgal-items {
	display: flex;
	flex-wrap: wrap;
	gap: var(--_gap);
}
.mgal--justified .mgal-items::after {
	content: "";
	flex: 1000000 1 0px; /* zadnji red se ne razvlači */
}
.mgal--justified .mgal-item {
	flex: calc(var(--mgal-r, 1.5) * 100) 1 calc(var(--_rowh) * var(--mgal-r, 1.5));
	max-width: min(100%, calc(var(--_rowh) * var(--mgal-r, 1.5) * 1.6));
}
.mgal--justified .mgal-media { aspect-ratio: var(--mgal-r, 1.5); }

.mgal--justified.is-laid .mgal-items {
	display: block;
	position: relative;
}
.mgal--justified.is-laid .mgal-items::after { content: none; }
.mgal--justified.is-laid .mgal-item {
	position: absolute;
	top: 0;
	left: 0;
	max-width: none;
}

/* ------------------------------------------------------------------ */
/* Prekrivni sloj i ikona                                              */
/* ------------------------------------------------------------------ */

.mgal-overlay {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	opacity: 0;
	pointer-events: none;
	transition: opacity .35s ease;
	z-index: 1;
}
.mgal--overlay .mgal-overlay { background: var(--_overlay); }
.mgal--icon .mgal-overlay::after {
	content: "";
	width: 46px;
	height: 46px;
	border-radius: 50%;
	background: rgba(255, 255, 255, .92) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23111' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cpath d='M15.5 15.5 21 21M10.5 7.5v6M7.5 10.5h6'/%3E%3C/svg%3E") center / 22px no-repeat;
	box-shadow: 0 4px 18px rgba(0, 0, 0, .25);
	transform: scale(.7);
	transition: transform .4s var(--_ease);
}

@media (hover: hover) {
	.mgal-item:hover .mgal-overlay { opacity: 1; }
	.mgal-item:hover .mgal-overlay::after { transform: scale(1); }
}
.mgal-item:focus-within .mgal-overlay { opacity: 1; }
.mgal-item:focus-within .mgal-overlay::after { transform: scale(1); }

/* ------------------------------------------------------------------ */
/* Efekti pri prelasku mišem                                           */
/* ------------------------------------------------------------------ */

@media (hover: hover) {
	.mgal--hover-zoom .mgal-item:hover .mgal-img { transform: scale(1.07); }

	.mgal--hover-zoom-out .mgal-img { transform: scale(1.08); }
	.mgal--hover-zoom-out .mgal-item:hover .mgal-img { transform: scale(1); }

	.mgal--hover-lift .mgal-media { transition: transform .45s var(--_ease), box-shadow .45s var(--_ease); }
	.mgal--hover-lift .mgal-item:hover .mgal-media {
		transform: translateY(-5px);
		box-shadow: 0 14px 30px -10px rgba(0, 0, 0, .45);
	}

	.mgal--hover-grayscale .mgal-img { filter: grayscale(1); }
	.mgal--hover-grayscale .mgal-item:hover .mgal-img { filter: none; }

	.mgal--hover-dim .mgal-items:hover .mgal-item:not(:hover) .mgal-img { filter: brightness(.45) saturate(.7); }
}

/* ------------------------------------------------------------------ */
/* Opisi                                                               */
/* ------------------------------------------------------------------ */

.mgal-caption {
	margin: 0;
	font-size: .9em;
	line-height: 1.4;
	overflow-wrap: anywhere;
}
.mgal--caption-overlay .mgal-caption,
.mgal--caption-bottom .mgal-caption {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 2;
	padding: 28px 14px 12px;
	color: #fff;
	background: linear-gradient(to top, rgba(0, 0, 0, .72), rgba(0, 0, 0, 0));
	border-radius: 0 0 var(--_radius) var(--_radius);
	pointer-events: none;
}
.mgal--caption-overlay .mgal-caption {
	opacity: 0;
	transform: translateY(8px);
	transition: opacity .35s ease, transform .45s var(--_ease);
}
@media (hover: hover) {
	.mgal--caption-overlay .mgal-item:hover .mgal-caption { opacity: 1; transform: none; }
}
@media (hover: none) {
	.mgal--caption-overlay .mgal-caption { opacity: 1; transform: none; }
}
.mgal--caption-overlay .mgal-item:focus-within .mgal-caption { opacity: 1; transform: none; }
.mgal--caption-below .mgal-caption { padding: 8px 2px 0; }

/* ------------------------------------------------------------------ */
/* Animacija pri pojavljivanju (samo kad JS radi)                      */
/* ------------------------------------------------------------------ */

@media (prefers-reduced-motion: no-preference) {
	.mgal.is-js:not(.mgal--entrance-none) .mgal-figure {
		transition: opacity .7s ease, transform .8s var(--_ease);
	}
	.mgal.is-js.mgal--entrance-fade .mgal-item:not(.is-inview) .mgal-figure { opacity: 0; }
	.mgal.is-js.mgal--entrance-rise .mgal-item:not(.is-inview) .mgal-figure { opacity: 0; transform: translateY(28px); }
	.mgal.is-js.mgal--entrance-zoom .mgal-item:not(.is-inview) .mgal-figure { opacity: 0; transform: scale(.94); }
}

/* ------------------------------------------------------------------ */
/* Filtri i "Učitaj još"                                               */
/* ------------------------------------------------------------------ */

.mgal-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 20px;
}
.mgal-filters--center { justify-content: center; }
.mgal-filters--right { justify-content: flex-end; }

.mgal-filter,
.mgal-more {
	font: inherit;
	font-size: .9em;
	line-height: 1.2;
	padding: .6em 1.2em;
	border: 1px solid currentColor;
	border-radius: 999px;
	background: transparent;
	color: inherit;
	cursor: pointer;
	opacity: .75;
	transition: opacity .2s, background-color .2s, color .2s;
}
.mgal-filter:hover,
.mgal-more:hover { opacity: 1; }
.mgal-filter.is-active { opacity: 1; font-weight: 600; }
.mgal-filter:focus-visible,
.mgal-more:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; opacity: 1; }

.mgal-more-wrap { display: flex; justify-content: center; margin-top: 24px; }
.mgal-more { opacity: 1; padding: .8em 2em; }
.mgal-more[hidden] { display: none; }

/* ------------------------------------------------------------------ */
/* Lightbox                                                            */
/* ------------------------------------------------------------------ */

html.mgal-lb-open { overflow: hidden; }

.mgal-lb {
	--lb-bg: rgba(8, 9, 11, .97);
	--lb-fg: #f4f4f5;
	--lb-btn: rgba(255, 255, 255, .1);
	--lb-btn-hover: rgba(255, 255, 255, .22);
	position: fixed;
	inset: 0;
	z-index: 2147483000;
	display: flex;
	flex-direction: column;
	background: var(--lb-bg);
	color: var(--lb-fg);
	font-family: inherit;
	opacity: 0;
	transition: opacity .25s ease;
	-webkit-tap-highlight-color: transparent;
}
.mgal-lb--light {
	--lb-bg: rgba(250, 250, 250, .97);
	--lb-fg: #18181b;
	--lb-btn: rgba(0, 0, 0, .06);
	--lb-btn-hover: rgba(0, 0, 0, .14);
}
.mgal-lb.is-open { opacity: 1; }
.mgal-lb[hidden] { display: none; }
.mgal-lb *,
.mgal-lb *::before { box-sizing: border-box; }

.mgal-lb-bar {
	position: relative;
	z-index: 3;
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 10px 12px;
	flex: 0 0 auto;
}
.mgal-lb-counter {
	margin-right: auto;
	padding-left: 6px;
	font-size: 14px;
	font-variant-numeric: tabular-nums;
	opacity: .8;
}
.mgal-lb-btn {
	display: inline-grid;
	place-items: center;
	width: 44px;
	height: 44px;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 50%;
	background: var(--lb-btn);
	color: inherit;
	cursor: pointer;
	text-decoration: none;
	transition: background-color .2s;
}
.mgal-lb-btn:hover { background: var(--lb-btn-hover); }
.mgal-lb-btn:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.mgal-lb-btn svg { width: 22px; height: 22px; display: block; }
.mgal-lb-btn[hidden] { display: none; }

.mgal-lb-stage {
	position: relative;
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 64px;
	overflow: hidden;
	touch-action: pan-y pinch-zoom;
}
.mgal-lb-img {
	display: block;
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	user-select: none;
	-webkit-user-drag: none;
	transition: opacity .25s ease, transform .3s var(--_ease, ease);
	cursor: zoom-in;
}
.mgal-lb.is-loading .mgal-lb-img { opacity: 0; }
.mgal-lb-stage.is-zoomed {
	display: block;
	overflow: auto;
	padding: 0;
	touch-action: auto;
}
.mgal-lb-stage.is-zoomed .mgal-lb-img {
	max-width: none;
	max-height: none;
	margin: auto;
	cursor: zoom-out;
}

.mgal-lb-spinner {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 40px;
	height: 40px;
	margin: -20px 0 0 -20px;
	border: 3px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	opacity: 0;
	pointer-events: none;
	animation: mgal-spin .8s linear infinite;
	transition: opacity .2s;
}
.mgal-lb.is-loading .mgal-lb-spinner { opacity: .6; transition-delay: .2s; }
@keyframes mgal-spin { to { transform: rotate(360deg); } }

.mgal-lb-error { position: absolute; inset: auto 0 50% 0; text-align: center; opacity: .8; }
.mgal-lb-error[hidden] { display: none; }

.mgal-lb-nav {
	position: absolute;
	top: 50%;
	z-index: 2;
	width: 52px;
	height: 52px;
	margin-top: -26px;
}
.mgal-lb-prev { left: 8px; }
.mgal-lb-next { right: 8px; }
.mgal-lb-nav svg { width: 28px; height: 28px; }

.mgal-lb-caption {
	flex: 0 0 auto;
	max-width: 900px;
	margin: 0 auto;
	padding: 12px 20px 4px;
	text-align: center;
	font-size: 15px;
	line-height: 1.5;
}
.mgal-lb-caption:empty { display: none; }

.mgal-lb-thumbs {
	flex: 0 0 auto;
	display: flex;
	gap: 6px;
	padding: 10px 12px 12px;
	overflow-x: auto;
	scrollbar-width: thin;
	justify-content: safe center;
}
.mgal-lb-thumbs[hidden] { display: none; }
.mgal-lb-thumb {
	flex: 0 0 auto;
	width: 64px;
	height: 48px;
	padding: 0;
	border: 2px solid transparent;
	border-radius: 4px;
	background: none;
	cursor: pointer;
	opacity: .5;
	overflow: hidden;
	transition: opacity .2s, border-color .2s;
}
.mgal-lb-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.mgal-lb-thumb:hover { opacity: .85; }
.mgal-lb-thumb.is-current { opacity: 1; border-color: currentColor; }
.mgal-lb-thumb:focus-visible { outline: 2px solid currentColor; outline-offset: 1px; opacity: 1; }

.mgal-lb.is-zoomed .mgal-lb-nav,
.mgal-lb.is-zoomed .mgal-lb-caption,
.mgal-lb.is-zoomed .mgal-lb-thumbs { opacity: 0; pointer-events: none; }

@media (max-width: 767px) {
	.mgal-lb-stage { padding: 0; }
	.mgal-lb-nav { width: 44px; height: 44px; margin-top: -22px; background: rgba(0, 0, 0, .35); color: #fff; }
	.mgal-lb-prev { left: 6px; }
	.mgal-lb-next { right: 6px; }
	.mgal-lb-thumbs { display: none; }
	.mgal-lb-caption { font-size: 14px; padding: 10px 14px 14px; }
}

@media (prefers-reduced-motion: reduce) {
	.mgal-img,
	.mgal-overlay,
	.mgal-caption,
	.mgal-lb,
	.mgal-lb-img { transition: none !important; }
}

@media print {
	.mgal-item.is-paged { display: block !important; }
	.mgal .mgal-figure { opacity: 1 !important; transform: none !important; }
	.mgal-overlay,
	.mgal-filters,
	.mgal-more-wrap,
	.mgal-lb { display: none !important; }
}
