/* =====================================================================
   Galerie – prohlížeč fotografií (mobile-first)
   ===================================================================== */
html.gl-lock, html.gl-lock body { overflow: hidden !important; overscroll-behavior: none; }

.gl {
	position: fixed; inset: 0; z-index: 100000;
	width: 100%; height: 100%; height: 100dvh;
	touch-action: none; user-select: none; -webkit-user-select: none;
	-webkit-tap-highlight-color: transparent;
	outline: none; overflow: hidden;
	font-family: 'Roboto', sans-serif;
	color: #fff;
}
.gl-bg {
	position: absolute; inset: 0; background: #0b0908;
	opacity: 0; transition: opacity .3s ease;
}
.gl.gl-open .gl-bg { opacity: 1; }
.gl.gl-closing .gl-bg { opacity: 0 !important; transition: opacity .25s ease; }
.gl.gl-closing .gl-track { opacity: 0; transition: opacity .25s ease; }

.gl-track { position: absolute; inset: 0; will-change: transform; }
.gl-slide {
	position: absolute; top: 0; left: 0; width: 100%; height: 100%;
	display: flex; align-items: center; justify-content: center;
	transition: transform .3s cubic-bezier(.2,.8,.2,1), opacity .3s;
	will-change: transform;
}
.gl-zoom {
	width: 100%; height: 100%;
	display: flex; align-items: center; justify-content: center;
	transform-origin: 50% 50%; will-change: transform;
}
.gl-img {
	max-width: 100%; max-height: 100%; width: auto; height: auto;
	object-fit: contain; display: block;
	pointer-events: auto; -webkit-user-drag: none;
	transition: filter .35s ease;
}
/* rozmazaný náhled, než se načte plné rozlišení */
.gl-img.is-thumb { filter: blur(6px); width: 100%; height: 100%; }

.gl-spin {
	position: absolute; top: 50%; left: 50%; width: 38px; height: 38px; margin: -19px 0 0 -19px;
	border: 3px solid rgba(255,255,255,.25); border-top-color: #fad851; border-radius: 50%;
	animation: gl-spin .8s linear infinite; pointer-events: none;
}
.gl-slide.is-loaded .gl-spin { display: none; }
@keyframes gl-spin { to { transform: rotate(360deg); } }

/* horní lišta */
.gl-top, .gl-bottom {
	position: absolute; left: 0; right: 0; z-index: 2;
	transition: opacity .25s ease, transform .25s ease;
}
.gl-top {
	top: 0; display: flex; align-items: center; justify-content: space-between;
	padding: calc(8px + env(safe-area-inset-top)) calc(8px + env(safe-area-inset-right)) 24px calc(16px + env(safe-area-inset-left));
	background: linear-gradient(rgba(0,0,0,.6), rgba(0,0,0,0));
}
.gl-count { font-size: 15px; font-weight: 600; letter-spacing: .5px; font-variant-numeric: tabular-nums; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.gl-actions { display: flex; gap: 4px; }

.gl-btn {
	appearance: none; -webkit-appearance: none;
	display: inline-flex; align-items: center; justify-content: center;
	width: 46px; height: 46px; padding: 0; margin: 0;
	border: 0; border-radius: 50%;
	background: rgba(255,255,255,.12); color: #fff !important;
	cursor: pointer; text-decoration: none;
	-webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
	transition: background .2s, transform .15s, opacity .2s;
}
.gl-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.gl-btn:active { transform: scale(.9); background: rgba(255,255,255,.28); }
.gl-btn:focus-visible { outline: 3px solid #fad851; outline-offset: 2px; }
@media (hover: hover) { .gl-btn:hover { background: rgba(255,255,255,.25); } }

/* šipky – na mobilu skryté (ovládá se swipem), na PC po stranách */
.gl-arrow {
	position: absolute; top: 50%; z-index: 2; margin-top: -28px;
	width: 56px; height: 56px; display: none;
}
.gl-prev { left: 16px; }
.gl-next { right: 16px; }
.gl-arrow[disabled] { opacity: 0; pointer-events: none; }
@media (hover: hover) and (pointer: fine) { .gl-arrow { display: inline-flex; } }

/* spodní lišta – popisek + náhledy */
.gl-bottom {
	bottom: 0;
	padding: 28px 0 calc(10px + env(safe-area-inset-bottom));
	background: linear-gradient(rgba(0,0,0,0), rgba(0,0,0,.65));
}
.gl-caption {
	padding: 0 16px 10px; font-size: 15px; line-height: 1.4; text-align: center;
	text-shadow: 0 1px 3px rgba(0,0,0,.7);
}
.gl-thumbs {
	display: flex; gap: 6px; overflow-x: auto; overflow-y: hidden;
	padding: 4px 16px; scroll-padding: 0 16px;
	scrollbar-width: none; -webkit-overflow-scrolling: touch;
	touch-action: pan-x;
}
.gl-thumbs::-webkit-scrollbar { display: none; }
.gl-thumb {
	flex: 0 0 auto; width: 54px; height: 54px; padding: 0; margin: 0;
	border: 0; border-radius: 10px; overflow: hidden; cursor: pointer;
	background: #222; opacity: .5; transform: scale(.92);
	transition: opacity .2s, transform .2s, box-shadow .2s;
}
.gl-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.gl-thumb.is-active { opacity: 1; transform: scale(1); box-shadow: 0 0 0 2px #fad851; }
.gl-thumb:focus-visible { outline: 2px solid #fad851; outline-offset: 2px; }
.gl-single .gl-thumbs, .gl-single .gl-count { display: none; }

/* skrytí ovládání (klepnutí / přiblížení / tažení dolů) */
.gl-ui-hidden .gl-top, .gl-zoomed .gl-top { opacity: 0; transform: translateY(-12px); pointer-events: none; }
.gl-ui-hidden .gl-bottom, .gl-zoomed .gl-bottom { opacity: 0; transform: translateY(12px); pointer-events: none; }
.gl-ui-hidden .gl-arrow, .gl-zoomed .gl-arrow, .gl-ui-hide-temp .gl-arrow,
.gl-ui-hide-temp .gl-top, .gl-ui-hide-temp .gl-bottom { opacity: 0; pointer-events: none; }
/* při zavřené liště ponecháme křížek dostupný */
.gl-zoomed .gl-top { opacity: 1; transform: none; pointer-events: auto; background: none; }
.gl-zoomed .gl-top .gl-count, .gl-zoomed .gl-top .gl-btn:not(.gl-close) { opacity: 0; pointer-events: none; }

.gl-zoomed .gl-img { cursor: grab; }
@media (hover: hover) and (pointer: fine) { .gl-img { cursor: zoom-in; } .gl-zoomed .gl-img { cursor: grab; } }

@media (min-width: 768px) {
	.gl-thumb { width: 64px; height: 64px; }
	.gl-top { padding-left: 24px; padding-right: 16px; }
	.gl-slide { padding: 80px 90px; box-sizing: border-box; }
}

@media (prefers-reduced-motion: reduce) {
	.gl *, .gl-bg { transition-duration: .01s !important; animation-duration: .01s !important; }
}
