/* Media Gallery Pro – frontend styly */

.mgp-gallery {
	--mgp-columns: 3;
	--mgp-gap: 12px;
	--mgp-radius: 8px;
	--mgp-aspect-ratio: 1 / 1;
	display: grid;
	grid-template-columns: repeat( var( --mgp-columns ), 1fr );
	gap: var( --mgp-gap );
	margin: 1.5em 0;
}

/* Responzivní breakpointy – na menších šířkách omezíme maximální počet sloupců,
   bez ohledu na hodnotu nastavenou v administraci. */
@media ( max-width: 1200px ) {
	.mgp-gallery {
		grid-template-columns: repeat( min( var( --mgp-columns ), 4 ), 1fr );
	}
}

@media ( max-width: 900px ) {
	.mgp-gallery {
		grid-template-columns: repeat( min( var( --mgp-columns ), 3 ), 1fr );
	}
}

@media ( max-width: 600px ) {
	.mgp-gallery {
		grid-template-columns: repeat( min( var( --mgp-columns ), 2 ), 1fr );
		--mgp-gap: 8px;
	}
}

@media ( max-width: 400px ) {
	.mgp-gallery {
		grid-template-columns: 1fr;
	}
}

/* --------------------------------------------------------------------- */
/* Masonry styl (alternativa ke Grid) - položky mají přirozenou výšku a    */
/* skládají se do sloupců jako dlaždice (řešeno čistě CSS, bez JS).       */
/* --------------------------------------------------------------------- */

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

.mgp-gallery--masonry .mgp-item {
	display: inline-block;
	width: 100%;
	aspect-ratio: auto;
	break-inside: avoid;
	margin: 0 0 var( --mgp-gap );
}

.mgp-gallery--masonry .mgp-item img {
	height: auto;
}

.mgp-gallery--masonry .mgp-item--video .mgp-video-thumb,
.mgp-gallery--masonry .mgp-item--external .mgp-video-thumb {
	height: auto;
}

.mgp-gallery--masonry .mgp-item--video .mgp-video-thumb img,
.mgp-gallery--masonry .mgp-item--external .mgp-video-thumb img,
.mgp-gallery--masonry .mgp-item--video .mgp-video-thumb video {
	width: 100%;
	height: auto;
	object-fit: initial;
	display: block;
}

@media ( max-width: 1200px ) {
	.mgp-gallery--masonry {
		column-count: min( var( --mgp-columns ), 4 );
	}
}

@media ( max-width: 900px ) {
	.mgp-gallery--masonry {
		column-count: min( var( --mgp-columns ), 3 );
	}
}

@media ( max-width: 600px ) {
	.mgp-gallery--masonry {
		column-count: min( var( --mgp-columns ), 2 );
	}
}

@media ( max-width: 400px ) {
	.mgp-gallery--masonry {
		column-count: 1;
	}
}

/* Automatický počet sloupců ("auto") - mřížka/masonry si sloupce spočítá sama
   dle dostupné šířky, bez potřeby ručně nastavovat konkrétní číslo. Cílová šířka
   náhledu (--mgp-auto-col-width) se nastavuje u galerie (nebo v přehledu globálně). */
.mgp-gallery.mgp-gallery--auto-cols {
	grid-template-columns: repeat( auto-fill, minmax( var( --mgp-auto-col-width, 180px ), 1fr ) );
}

.mgp-gallery--masonry.mgp-gallery--auto-cols {
	column-count: auto;
	column-width: var( --mgp-auto-col-width, 200px );
}

.mgp-item {
	position: relative;
	margin: 0;
	overflow: hidden;
	border-radius: var( --mgp-radius, 8px );
	background: #f0f0f1;
	cursor: pointer;
	aspect-ratio: var( --mgp-aspect-ratio, 1 / 1 );
	outline-offset: 3px;
}

.mgp-item img,
.mgp-item video {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.35s ease;
}

.mgp-item:hover img,
.mgp-item:hover video,
.mgp-item:focus-visible img,
.mgp-item:focus-visible video {
	transform: scale( 1.05 );
}

.mgp-item--video .mgp-video-thumb {
	position: relative;
	display: block;
	width: 100%;
	height: 100%;
}

.mgp-play-icon {
	position: absolute;
	inset: 0;
	margin: auto;
	width: 56px;
	height: 56px;
	border-radius: 50%;
	background: rgba( 0, 0, 0, 0.55 );
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	pointer-events: none;
}

.mgp-provider-badge {
	position: absolute;
	top: 8px;
	right: 8px;
	background: rgba( 0, 0, 0, 0.65 );
	color: #fff;
	font-size: 10px;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	padding: 2px 7px;
	border-radius: 3px;
	pointer-events: none;
}

.mgp-caption {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 8px 10px;
	font-size: 13px;
	line-height: 1.3;
	color: #fff;
	background: linear-gradient( to top, rgba( 0, 0, 0, 0.75 ), rgba( 0, 0, 0, 0 ) );
	opacity: 0;
	transition: opacity 0.25s ease;
}

.mgp-item:hover .mgp-caption,
.mgp-item:focus-visible .mgp-caption {
	opacity: 1;
}

.mgp-empty-notice {
	opacity: 0.7;
	font-style: italic;
}

.mgp-gallery-description {
	margin: 0 0 1.2em;
	font-size: 1rem;
	line-height: 1.6;
	opacity: 0.85;
}

/* --------------------------------------------------------------------- */
/* Limit počtu zobrazených položek u jedné galerie ("Zobrazit další")     */
/* --------------------------------------------------------------------- */

.mgp-item.mgp-is-paged-out {
	display: none !important;
}

.mgp-load-more-wrap {
	display: flex;
	justify-content: center;
	margin-top: 1.75em;
}

.mgp-load-more {
	appearance: none;
	border: 1px solid var( --mgp-accent, #1d4f6e );
	background: transparent;
	color: var( --mgp-accent, #1d4f6e );
	padding: 10px 28px;
	border-radius: var( --mgp-btn-radius, 999px );
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease;
}

.mgp-load-more:hover {
	background: var( --mgp-accent, #1d4f6e );
	color: var( --mgp-accent-text, #fff );
}

/* --------------------------------------------------------------------- */
/* Přehled galerií (mřížka náhledů více galerií, odkaz na jejich stránku) */
/* --------------------------------------------------------------------- */

.mgp-overview {
	--mgp-ov-columns: 3;
	--mgp-ov-gap: 16px;
	--mgp-ov-radius: 8px;
	--mgp-ov-title-size: 16px;
	display: grid;
	grid-template-columns: repeat( var( --mgp-ov-columns ), 1fr );
	grid-auto-flow: dense;
	gap: var( --mgp-ov-gap );
	margin: 1.5em 0;
}

@media ( max-width: 1200px ) {
	.mgp-overview {
		grid-template-columns: repeat( min( var( --mgp-ov-columns ), 4 ), 1fr );
	}
}

@media ( max-width: 900px ) {
	.mgp-overview {
		grid-template-columns: repeat( min( var( --mgp-ov-columns ), 3 ), 1fr );
	}
}

@media ( max-width: 600px ) {
	.mgp-overview {
		grid-template-columns: repeat( min( var( --mgp-ov-columns ), 2 ), 1fr );
		--mgp-ov-gap: 10px;
	}
}

@media ( max-width: 400px ) {
	.mgp-overview {
		grid-template-columns: 1fr;
	}
}

/* Automatický počet sloupců ("auto") v přehledu galerií. */
.mgp-overview.mgp-overview--auto-cols {
	grid-template-columns: repeat( auto-fill, minmax( var( --mgp-ov-auto-col-width, 220px ), 1fr ) );
}

.mgp-overview-item {
	position: relative;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background: var( --mgp-ov-card-bg, transparent );
	border: 1px solid var( --mgp-ov-border-color, rgba( 0, 0, 0, 0.08 ) );
	border-radius: var( --mgp-ov-radius, 8px );
	text-decoration: none;
	color: inherit;
	transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.mgp-overview-item:hover,
.mgp-overview-item:focus-visible {
	transform: translateY( -3px );
	border-color: var( --mgp-accent, #1d4f6e );
	box-shadow: 0 8px 20px rgba( 0, 0, 0, 0.12 );
}

.mgp-overview-item:focus-visible {
	outline: 2px solid var( --mgp-accent, #1d4f6e );
	outline-offset: 2px;
}

/* "Hlavní galerie" - první zvýrazněná dlaždice přes 2×2 buňky mřížky.
   Každá další zvýrazněná galerie (obecný sourozenec za první) se místo toho
   zobrazí jako pruh přes celou šířku - dvě velké dlaždice vedle sebe by se
   do mřížky nevešly a vznikaly by prázdné díry. */
.mgp-overview-item--featured {
	grid-column: span 2;
	grid-row: span 2;
}

.mgp-overview-item--featured .mgp-overview-thumb {
	aspect-ratio: 1 / 1;
	height: 100%;
}

.mgp-overview-item--featured .mgp-overview-title {
	font-size: calc( var( --mgp-ov-title-size, 16px ) * 1.4 );
}

.mgp-overview-item--featured ~ .mgp-overview-item--featured {
	grid-column: 1 / -1;
	grid-row: span 1;
}

.mgp-overview-item--featured ~ .mgp-overview-item--featured .mgp-overview-thumb {
	aspect-ratio: 3 / 1;
}

@media ( max-width: 600px ) {
	.mgp-overview-item--featured,
	.mgp-overview-item--featured ~ .mgp-overview-item--featured {
		grid-column: span 1;
		grid-row: span 1;
	}
	.mgp-overview-item--featured .mgp-overview-thumb,
	.mgp-overview-item--featured ~ .mgp-overview-item--featured .mgp-overview-thumb {
		aspect-ratio: 4 / 3;
	}
	.mgp-overview-item--featured .mgp-overview-title {
		font-size: var( --mgp-ov-title-size, 16px );
	}
}

.mgp-overview-thumb {
	position: relative;
	display: block;
	aspect-ratio: var( --mgp-ov-ratio, 4 / 3 );
	height: 100%;
	overflow: hidden;
	background: #f0f0f1;
}

.mgp-overview-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.35s ease;
}

.mgp-overview-item:hover .mgp-overview-thumb img,
.mgp-overview-item:focus-visible .mgp-overview-thumb img {
	transform: scale( 1.04 );
}

.mgp-overview-thumb-placeholder {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #a7aaad;
}

/* --- Odznaky (kategorie vlevo nahoře, počet médií vpravo nahoře) ------- */
.mgp-overview-badge {
	position: absolute;
	top: 10px;
	z-index: 2;
	padding: 4px 10px;
	border-radius: 999px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	white-space: nowrap;
}

.mgp-overview-badge--tag {
	left: 10px;
	background: var( --mgp-accent, #1d4f6e );
	color: var( --mgp-accent-text, #fff );
}

.mgp-overview-badge--count {
	right: 10px;
	background: rgba( 0, 0, 0, 0.6 );
	color: #fff;
	backdrop-filter: blur( 3px );
}

/* --- Popisek (datum + titulek) ----------------------------------------- */
.mgp-overview-info {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.mgp-overview-meta {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	opacity: 0.75;
}

.mgp-overview-title {
	font-size: var( --mgp-ov-title-size, 16px );
	line-height: 1.3;
	font-weight: 700;
	text-transform: var( --mgp-ov-title-transform, none );
	margin: 0;
}

/* below (výchozí): popisek jako samostatný blok pod náhledem. */
.mgp-overview-item--title-below .mgp-overview-info--below {
	padding: 12px 4px 4px;
}

.mgp-overview-item--title-below .mgp-overview-title {
	color: var( --mgp-ov-title-color, inherit );
}

/* overlay: popisek přes spodní část náhledu (vždy viditelný, ne jen při hoveru). */
.mgp-overview-item--title-overlay .mgp-overview-thumb::after {
	content: '';
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 60%;
	background: linear-gradient( to top, var( --mgp-ov-gradient-color, rgba( 0, 0, 0, 0.8 ) ), rgba( 0, 0, 0, 0 ) );
	pointer-events: none;
}

.mgp-overview-item--title-overlay .mgp-overview-info {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 2;
	padding: 28px 14px 12px;
	color: #fff;
}

.mgp-overview-item--title-overlay .mgp-overview-title {
	color: var( --mgp-ov-title-color, #fff );
}

.mgp-overview-item--title-overlay .mgp-overview-meta {
	color: var( --mgp-accent-text, #fff );
	opacity: 0.85;
}

.mgp-overview-item--title-hidden .mgp-overview-info {
	display: none;
}

/* --------------------------------------------------------------------- */
/* Filtrovací tlačítka nad přehledem galerií (dle kategorie / roku)       */
/* --------------------------------------------------------------------- */

.mgp-overview-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 20px;
	margin: 0 0 1.25em;
}

.mgp-overview-filter-group {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.mgp-overview-filter-btn {
	appearance: none;
	border: 1px solid rgba( 0, 0, 0, 0.15 );
	background: transparent;
	color: inherit;
	padding: 6px 16px;
	border-radius: var( --mgp-btn-radius, 999px );
	font-size: 14px;
	line-height: 1.4;
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.mgp-overview-filter-btn:hover {
	border-color: currentColor;
}

.mgp-overview-filter-btn.is-active {
	color: var( --mgp-accent-text, #fff );
	background: var( --mgp-accent, #1d4f6e );
	border-color: var( --mgp-accent, #1d4f6e );
}

.mgp-overview-item.mgp-is-filtered-out {
	display: none !important;
}

.mgp-overview-item.mgp-is-paged-out {
	display: none !important;
}

.mgp-overview-no-matches {
	opacity: 0.7;
	font-style: italic;
}

.mgp-overview-load-more-wrap {
	display: flex;
	justify-content: center;
	margin-top: 1.75em;
}

.mgp-overview-load-more {
	appearance: none;
	border: 1px solid var( --mgp-accent, #1d4f6e );
	background: transparent;
	color: var( --mgp-accent, #1d4f6e );
	padding: 10px 28px;
	border-radius: var( --mgp-btn-radius, 999px );
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease;
}

.mgp-overview-load-more:hover {
	background: var( --mgp-accent, #1d4f6e );
	border-color: var( --mgp-accent, #1d4f6e );
	color: var( --mgp-accent-text, #fff );
}

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

.mgp-lightbox {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var( --mgp-lightbox-overlay, rgba( 10, 10, 12, 0.92 ) );
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.25s ease;
}

.mgp-lightbox.is-open {
	opacity: 1;
	visibility: visible;
}

.mgp-lightbox-stage {
	position: relative;
	max-width: 92vw;
	max-height: 86vh;
	display: flex;
	align-items: center;
	justify-content: center;
}

.mgp-lightbox-stage img,
.mgp-lightbox-stage video {
	max-width: 92vw;
	max-height: 80vh;
	border-radius: 4px;
	box-shadow: 0 10px 40px rgba( 0, 0, 0, 0.5 );
}

.mgp-lightbox-stage iframe.mgp-lightbox-iframe {
	width: min( 92vw, 1100px );
	aspect-ratio: 16 / 9;
	height: auto;
	max-height: 80vh;
	border: 0;
	border-radius: 4px;
	box-shadow: 0 10px 40px rgba( 0, 0, 0, 0.5 );
}

.mgp-lightbox-caption {
	position: absolute;
	left: 0;
	right: 0;
	bottom: -42px;
	text-align: center;
	color: #f2f2f2;
	font-size: 14px;
}

.mgp-lightbox-close,
.mgp-lightbox-prev,
.mgp-lightbox-next {
	position: absolute;
	background: rgba( 255, 255, 255, 0.14 );
	border: none;
	color: #fff;
	width: 56px;
	height: 56px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	transition: background 0.2s ease;
}

.mgp-lightbox-close:hover,
.mgp-lightbox-prev:hover,
.mgp-lightbox-next:hover {
	background: rgba( 255, 255, 255, 0.28 );
}

.mgp-lightbox-close {
	top: 20px;
	right: 20px;
}

/* top:0 + bottom:0 + margin:auto centruje spolehlivě i na mobilu s dynamickou
   lištou prohlížeče, kde by "top:50%" s transformem mohlo sedět mimo viditelnou oblast. */
.mgp-lightbox-prev,
.mgp-lightbox-next {
	top: 0;
	bottom: 0;
	margin-top: auto;
	margin-bottom: auto;
}

.mgp-lightbox-prev {
	left: 20px;
}

.mgp-lightbox-next {
	right: 20px;
}

@media ( max-width: 600px ) {
	.mgp-lightbox-prev,
	.mgp-lightbox-next {
		width: 46px;
		height: 46px;
		font-size: 22px;
	}
	.mgp-lightbox-close {
		width: 46px;
		height: 46px;
		font-size: 22px;
		top: 10px;
		right: 10px;
	}
	.mgp-lightbox-prev {
		left: 10px;
	}
	.mgp-lightbox-next {
		right: 10px;
	}
}
