/* Lightbox — zdieľaný modul.
   Používa ho blok kst/galeria-mriezka AJ obrázky v obsahu stránok
   (kst-content-lightbox.js). Preto žije tu, nie v style.css bloku:
   stránka ako /archiv/ blok galérie neobsahuje, a jeho štýl by sa
   tam nezaradil. */


/* ---- Lightbox ---- */
html.kst-lightbox-open {
	overflow: hidden;
}

.kst-lightbox {
	position: fixed;
	inset: 0;
	z-index: 9999;
	background: rgba(16, 18, 30, .94);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
}

.kst-lightbox[hidden] {
	display: none;
}

.kst-lightbox__dialog {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 1rem;
	max-width: min(1200px, 96vw);
	max-height: 94vh;
}

.kst-lightbox__figure {
	position: relative; /* anchors the loading spinner */
	margin: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: .75rem;
	/* No max-height clip here: it was smaller than the image + caption, so a
	   2-line caption overflowed the figure and collided with the download
	   button below. Let the figure size to its content; the dialog (94vh) and
	   the image's own max-height keep the whole stack inside the viewport. */
	min-height: 0;
}

.kst-lightbox__img {
	max-width: 100%;
	/* Leaves headroom under the image for the caption + download button so they
	   never overlap, even on short landscape viewports. */
	max-height: 68vh;
	object-fit: contain;
	border-radius: 6px;
	background: #000;
	/* Gentle fade between photos so a swap reads as a transition, not a jump. */
	transition: opacity .25s ease;
}

.kst-lightbox__img.is-loading {
	opacity: .3;
}

.kst-lightbox__spinner {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 44px;
	height: 44px;
	margin: -22px 0 0 -22px;
	border: 3px solid rgba(255, 255, 255, .25);
	border-top-color: #fff;
	border-radius: 50%;
	animation: kst-lb-spin .8s linear infinite;
	display: none;
	pointer-events: none;
}

.kst-lightbox__spinner.is-on {
	display: block;
}

@keyframes kst-lb-spin {
	to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
	.kst-lightbox__img { transition: none; }
	.kst-lightbox__spinner { animation: none; }
}

.kst-lightbox__caption {
	color: #fff;
	font-size: 1.125rem;
	text-align: center;
}

.kst-lightbox__cap-text {
	display: block;
	font-weight: 600;
	line-height: 1.35;
}

.kst-lightbox__cap-meta {
	display: block;
	margin-top: .25rem;
	font-size: .9375rem;
	color: rgba(255, 255, 255, .72);
}

.kst-lightbox__btn {
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 52px;
	min-height: 52px;
	/* Solid dark disc + white glyph + faint light ring: readable over BOTH a
	   bright sky and a dark photo (a translucent-white chip washed out on
	   bright shots). Standard PhotoSwipe/Google-Photos control treatment. */
	border: 1px solid rgba(255, 255, 255, .38);
	border-radius: 50%;
	background: rgba(16, 18, 30, .72);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	box-shadow: 0 2px 12px rgba(0, 0, 0, .45);
	color: #fff;
	font-size: 1.75rem;
	line-height: 1;
	cursor: pointer;
	/* No transform on the transition — a hover/scale would override the arrows'
	   translateY(-50%) centering and drop them; steady colour feedback only. */
	transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}

/* Steady, non-moving hover: better for a senior audience (motion disorients) and
   it removes the transform that used to fight the arrows' vertical centering. */
.kst-lightbox__btn:hover {
	background: rgba(16, 18, 30, .92);
	border-color: rgba(255, 255, 255, .8);
}

/* Circular focus ring via box-shadow (follows border-radius:50%); `outline`
   rendered as a hard rectangle around the round disc. Keyboard-only. */
.kst-lightbox__btn:focus-visible {
	outline: none;
	border-color: rgba(255, 255, 255, .8);
	box-shadow: 0 2px 12px rgba(0, 0, 0, .45),
		0 0 0 3px var(--wp--preset--color--gold, #b8924a);
}

/* Fixed to the viewport's top-right corner: always the same, predictable spot
   for the close control (never floating over the middle of the photo). */
.kst-lightbox__close {
	position: fixed;
	top: 1rem;
	right: 1rem;
	z-index: 2;
}

/* Fixed to the viewport edges (like the close button) + z-index above the photo.
   Was absolute-to-dialog with a negative offset, so on a portrait photo the 52px
   disc overlapped the image edge AND the prev arrow (before the figure in DOM)
   rendered BEHIND it. Fixed edges = consistent, always on top, never hidden. */
.kst-lightbox__prev,
.kst-lightbox__next {
	position: fixed;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
}

.kst-lightbox__prev { left: 1rem; }
.kst-lightbox__next { right: 1rem; }

.kst-lightbox__download {
	display: inline-flex;
	align-items: center;
	gap: .55rem;
	min-height: 44px;
	padding: .6rem 1.2rem;
	font-size: 1.0625rem;
	background: var(--wp--preset--color--gold, #b8924a);
	/* Near-black navy text: navy #1a2761 on gold was 4.81:1 (passed AA but
	   tight for senior users). Gold is mid-luminance so 7:1 AAA is
	   unreachable on it with any text; #0a0f1f maxes the dark-text contrast
	   at 6.58:1 while keeping the brand gold background intact. */
	color: #0a0f1f;
	font-weight: 700;
	border-radius: 6px;
	text-decoration: none;
}

.kst-lightbox__download:focus-visible {
	outline: 3px solid #fff;
	outline-offset: 2px;
}

/* Download button is a single click target: icon + a two-line label (action +
   a small "it's the full-quality original" hint). The hint lives INSIDE the
   button so there's never a separate, ambiguous piece of text to aim at. */
.kst-lightbox__dl-labels {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	line-height: 1.15;
}

.kst-lightbox__dl-main {
	font-weight: 700;
}

.kst-lightbox__dl-sub {
	font-size: .8125rem;
	font-weight: 500;
	color: rgba(10, 15, 31, .78);
}

/* Persistent position counter, top-left — mirrors the close button top-right for
   a balanced frame, and always shows "where am I" without cluttering the caption. */
.kst-lightbox__counter {
	position: fixed;
	top: 1rem;
	left: 1rem;
	display: flex;
	align-items: center;
	min-height: 40px;
	padding: 0 .95rem;
	border-radius: 999px;
	background: rgba(16, 18, 30, .72);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	border: 1px solid rgba(255, 255, 255, .28);
	color: #fff;
	font-size: 1rem;
	font-weight: 600;
	letter-spacing: .02em;
}

/* Dialog is programmatically focused (focus "home") — no ring on the container. */
.kst-lightbox__dialog:focus {
	outline: none;
}

@media (max-width: 600px) {
	.kst-lightbox__prev { left: 0; }
	.kst-lightbox__next { right: 0; }
}

/* ---- Obrázky v obsahu stránok (kst-content-lightbox.js) ---- */

/* Bez tohto sa na obyčajnom obrázku nedá spoznať, že sa dá zväčšiť —
   predtým to bol odkaz s kurzorom ruky, teraz je to lightbox trigger. */
.kst-content-photo {
	cursor: zoom-in;
}

a.kst-content-photo,
a.kst-content-photo:hover {
	text-decoration: none;
}

.kst-content-photo img,
img.kst-content-photo {
	transition: filter .18s ease, transform .18s ease;
}

.kst-content-photo:hover img,
img.kst-content-photo:hover,
.kst-content-photo:focus-visible img,
img.kst-content-photo:focus-visible {
	filter: brightness(1.04);
}

.kst-content-photo:focus-visible,
img.kst-content-photo:focus-visible {
	outline: 3px solid var(--wp--preset--color--gold, #b8924a);
	outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
	.kst-content-photo img,
	img.kst-content-photo {
		transition: none;
	}
}
