/* ==========================================================================
   SH Galéria – frontend
   Premenné (--shg-*) nastavuje PHP inline na .shg-gallery
   ========================================================================== */

.shg-gallery {
	--shg-cols: 3;
	--shg-gap: 12px;
	--shg-radius: 8px;
	--shg-btn-bg: #111111;
	--shg-btn-text: #ffffff;
	--shg-btn-hover: #333333;
	margin: 0 0 1.5em;
}

.shg-gallery *,
.shg-gallery *::before,
.shg-gallery *::after {
	box-sizing: border-box;
}

/* --- Mriežka --- */
.shg-grid {
	display: grid;
	grid-template-columns: repeat(var(--shg-cols), 1fr);
	gap: var(--shg-gap);
}

.shg-item {
	position: relative;
	margin: 0;
	overflow: hidden;
	border-radius: var(--shg-radius);
	background: #f1f1f1;
}

.shg-item .shg-img,
.shg-item img {
	display: block;
	width: 100%;
	height: 100%;
	aspect-ratio: 1 / 1;
	object-fit: cover;
	transition: transform .4s ease;
}

.shg-link {
	display: block;
	cursor: zoom-in;
	line-height: 0;
}

.shg-item:hover .shg-img,
.shg-item:hover img {
	transform: scale(1.04);
}

.shg-caption {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 10px 12px;
	font-size: 13px;
	line-height: 1.3;
	color: #fff;
	background: linear-gradient(to top, rgba(0, 0, 0, .65), transparent);
	opacity: 0;
	transition: opacity .25s ease;
	pointer-events: none;
}

.shg-item:hover .shg-caption {
	opacity: 1;
}

/* --- Skryté fotky (režim „Zobraziť všetky" a stránkovanie) --- */
.shg-item.shg-hidden {
	display: none;
}

/* --- Akcie / tlačidlo --- */
.shg-actions {
	display: flex;
	justify-content: center;
	margin-top: calc(var(--shg-gap) + 6px);
}

.shg-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 12px 26px;
	font-size: 15px;
	font-weight: 600;
	line-height: 1;
	color: var(--shg-btn-text);
	background: var(--shg-btn-bg);
	border: none;
	border-radius: 999px;
	cursor: pointer;
	transition: background-color .2s ease, transform .1s ease;
}

.shg-btn:hover,
.shg-btn:focus-visible {
	background: var(--shg-btn-hover);
}

.shg-btn:active {
	transform: translateY(1px);
}

.shg-btn .shg-count {
	opacity: .75;
	font-weight: 400;
}

/* --- Stránkovanie --- */
.shg-pagination {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 6px;
	margin-top: calc(var(--shg-gap) + 6px);
}

.shg-page {
	min-width: 40px;
	padding: 8px 12px;
	font-size: 14px;
	line-height: 1;
	color: var(--shg-btn-bg);
	background: transparent;
	border: 1px solid var(--shg-btn-bg);
	border-radius: 8px;
	cursor: pointer;
	transition: background-color .15s ease, color .15s ease;
}

.shg-page:hover {
	background: var(--shg-btn-bg);
	color: var(--shg-btn-text);
}

.shg-page.is-active {
	background: var(--shg-btn-bg);
	color: var(--shg-btn-text);
	cursor: default;
}

.shg-page[disabled] {
	opacity: .4;
	cursor: not-allowed;
}

/* ==========================================================================
   Responzivita – počet stĺpcov pre tablet/mobil počíta PHP
   (--shg-cols-tablet, --shg-cols-mobile)
   ========================================================================== */

/* Tablet */
@media (max-width: 1024px) {
	.shg-grid {
		grid-template-columns: repeat(var(--shg-cols-tablet, 3), 1fr);
	}
}

/* Menší tablet / veľký mobil */
@media (max-width: 680px) {
	.shg-grid {
		grid-template-columns: repeat(var(--shg-cols-mobile, 2), 1fr);
	}
}

/* Mobil */
@media (max-width: 420px) {
	.shg-grid {
		grid-template-columns: 1fr;
	}
}

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

.shg-lb {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, .9);
	opacity: 0;
	visibility: hidden;
	transition: opacity .25s ease, visibility .25s ease;
	-webkit-user-select: none;
	user-select: none;
}

.shg-lb.is-open {
	opacity: 1;
	visibility: visible;
}

.shg-lb-figure {
	margin: 0;
	max-width: 92vw;
	max-height: 92vh;
	display: flex;
	flex-direction: column;
	align-items: center;
}

.shg-lb-img {
	max-width: 92vw;
	max-height: 82vh;
	object-fit: contain;
	border-radius: 4px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, .5);
}

.shg-lb-caption {
	margin-top: 12px;
	color: #f0f0f0;
	font-size: 14px;
	text-align: center;
	max-width: 90vw;
}

.shg-lb-btn {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 52px;
	height: 52px;
	display: flex;
	align-items: center;
	justify-content: center;
	border: none;
	border-radius: 50%;
	background: rgba(255, 255, 255, .12);
	color: #fff;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	transition: background-color .2s ease;
}

.shg-lb-btn:hover {
	background: rgba(255, 255, 255, .25);
}

.shg-lb-prev { left: 16px; }
.shg-lb-next { right: 16px; }

.shg-lb-close {
	position: absolute;
	top: 16px;
	right: 16px;
	width: 44px;
	height: 44px;
	font-size: 28px;
	transform: none;
}

.shg-lb-counter {
	position: absolute;
	top: 22px;
	left: 20px;
	color: rgba(255, 255, 255, .8);
	font-size: 13px;
}

@media (max-width: 600px) {
	.shg-lb-btn {
		width: 42px;
		height: 42px;
		font-size: 22px;
	}
	.shg-lb-prev { left: 6px; }
	.shg-lb-next { right: 6px; }
}

/* Rešpektovanie preferencie obmedzeného pohybu */
@media (prefers-reduced-motion: reduce) {
	.shg-item .shg-img,
	.shg-item img,
	.shg-caption,
	.shg-btn,
	.shg-lb,
	.shg-page {
		transition: none;
	}
	.shg-item:hover .shg-img,
	.shg-item:hover img {
		transform: none;
	}
}
