/* =========================================================================
   YESRH Event Gallery
   All selectors are prefixed .yg- to stay clear of Bootstrap 3 (.nav-tabs, .modal, .tab-content…).
   Brand it by overriding the variables, e.g. in the theme CSS:
   .yg { --yg-accent: #c8102e; }
   ========================================================================= */

.yg {
	--yg-accent: #14213d;          /* active tab / buttons */
	--yg-accent-text: #fff;
	--yg-text: #1d2433;
	--yg-muted: #6b7385;
	--yg-surface: #f2f4f7;         /* tab bar + image placeholder */
	--yg-radius: 14px;
	--yg-gap: 14px;
	--yg-min-col: 260px;
	--yg-row: 230px;               /* mosaic row height */
	--yg-ratio: 4/3;               /* uniform tile ratio (set by shortcode) */
	--yg-ease: cubic-bezier(.2, .7, .2, 1);

	color: var(--yg-text);
	margin: 0 auto 48px;
}
.yg *, .yg *::before, .yg *::after { box-sizing: border-box; }

/* ---------- Tabs ---------- */
.yg-tabs {
	display: flex;
	gap: 6px;
	width: max-content;
	max-width: 100%;
	margin: 0 auto 28px;
	padding: 6px;
	background: var(--yg-surface);
	border-radius: 999px;
	overflow-x: auto;
	scroll-snap-type: x proximity;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
}
.yg-tabs::-webkit-scrollbar { display: none; }

.yg-tab {
	appearance: none;
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 10px 18px;
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: var(--yg-muted);
	font: inherit;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;
	white-space: nowrap;
	cursor: pointer;
	scroll-snap-align: center;
	transition: background-color .25s var(--yg-ease), color .25s var(--yg-ease), box-shadow .25s var(--yg-ease);
}
.yg-tab:hover { color: var(--yg-text); }
.yg-tab:focus { outline: none; }
.yg-tab:focus-visible { outline: 2px solid var(--yg-accent); outline-offset: 2px; }
.yg-tab.is-active {
	background: var(--yg-accent);
	color: var(--yg-accent-text);
	box-shadow: 0 6px 16px -6px rgba(20, 33, 61, .45);
}
.yg-tab__count {
	min-width: 24px;
	padding: 2px 7px;
	border-radius: 999px;
	background: rgba(0, 0, 0, .07);
	font-size: 12px;
	font-weight: 700;
	text-align: center;
}
.yg-tab.is-active .yg-tab__count { background: rgba(255, 255, 255, .2); }

/* ---------- Grid ---------- */
.yg-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(var(--yg-min-col), 1fr));
	gap: var(--yg-gap);
}
.yg--mosaic .yg-grid {
	grid-auto-rows: var(--yg-row);
	grid-auto-flow: row dense;
}

.yg-item {
	position: relative;
	margin: 0;            /* reset normalize.css figure margin */
	min-width: 0;
	border-radius: var(--yg-radius);
	overflow: hidden;
	background: var(--yg-surface);
	isolation: isolate;
}
.yg-item[hidden] { display: none !important; }
.yg--uniform .yg-item { aspect-ratio: var(--yg-ratio); }
.yg--mosaic .yg-item.is-tall { grid-row: span 2; }
.yg--mosaic .yg-item.is-big  { grid-row: span 2; grid-column: span 2; }

/* skeleton shimmer while the thumbnail loads */
.yg-item::before {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .55) 50%, transparent 70%);
	background-size: 200% 100%;
	animation: yg-shimmer 1.3s linear infinite;
	z-index: 0;
}
.yg-item.is-loaded::before { display: none; }
@keyframes yg-shimmer { to { background-position: -200% 0; } }

.yg-link {
	position: relative;
	display: block;
	width: 100%;
	height: 100%;
	color: #fff;
	z-index: 1;
}
.yg-link:focus { outline: none; }
.yg-link:focus-visible { outline: 3px solid var(--yg-accent); outline-offset: -3px; border-radius: var(--yg-radius); }

.yg-img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	opacity: 0;
	transform: scale(1.02);
	transition: opacity .5s var(--yg-ease), transform .7s var(--yg-ease);
}
.yg-item.is-loaded .yg-img { opacity: 1; transform: scale(1); }
.yg:not(.yg--js) .yg-img { opacity: 1; transform: none; } /* no-JS fallback */

/* hover overlay */
.yg-link::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, rgba(10, 14, 25, 0) 45%, rgba(10, 14, 25, .55) 100%);
	opacity: 0;
	transition: opacity .35s var(--yg-ease);
}
.yg-zoom {
	position: absolute;
	right: 14px;
	bottom: 14px;
	z-index: 2;
	display: grid;
	place-items: center;
	width: 42px;
	height: 42px;
	border-radius: 50%;
	background: rgba(255, 255, 255, .18);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	opacity: 0;
	transform: translateY(8px);
	transition: opacity .35s var(--yg-ease), transform .35s var(--yg-ease);
}
@media (hover: hover) {
	.yg-link:hover .yg-img { transform: scale(1.06); }
	.yg-link:hover::after,
	.yg-link:hover .yg-zoom { opacity: 1; transform: none; }
}
.yg-link:focus-visible::after,
.yg-link:focus-visible .yg-zoom { opacity: 1; transform: none; }

/* enter animation when switching tabs / loading more */
.yg-item.is-in { animation: yg-in .5s var(--yg-ease) both; animation-delay: var(--yg-delay, 0ms); }
@keyframes yg-in {
	from { opacity: 0; transform: translateY(14px) scale(.98); }
	to   { opacity: 1; transform: none; }
}

/* ---------- Load more ---------- */
.yg-more-wrap { text-align: center; margin-top: 30px; }
.yg-more {
	appearance: none;
	padding: 13px 30px;
	border: 2px solid var(--yg-accent);
	border-radius: 999px;
	background: transparent;
	color: var(--yg-accent);
	font: inherit;
	font-weight: 700;
	cursor: pointer;
	transition: background-color .25s, color .25s;
}
.yg-more:hover, .yg-more:focus-visible { background: var(--yg-accent); color: var(--yg-accent-text); outline: none; }
.yg-more[hidden] { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 991px) {
	.yg { --yg-min-col: 220px; --yg-row: 200px; }
}
@media (max-width: 767px) {
	.yg { --yg-gap: 8px; --yg-radius: 10px; --yg-row: 150px; }
	.yg-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.yg-tabs { margin-bottom: 18px; border-radius: 16px; }
	.yg-tab { padding: 9px 14px; font-size: 14px; }
	.yg-zoom { display: none; }
}

/* =========================================================================
   Lightbox
   ========================================================================= */
html.yg-lock, html.yg-lock body { overflow: hidden !important; }

.yg-lb {
	--lb-btn: 48px;
	position: fixed;
	inset: 0;
	z-index: 100000;        /* above Bootstrap 3 navbar (1030) + modals (1050) */
	display: grid;
	grid-template-rows: auto 1fr auto auto;
	background: rgba(8, 10, 16, .97);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
	color: #fff;
	opacity: 0;
	visibility: hidden;
	transition: opacity .3s var(--yg-ease, ease), visibility 0s linear .3s;
	-webkit-tap-highlight-color: transparent;
	user-select: none;
}
.yg-lb.is-open { opacity: 1; visibility: visible; transition-delay: 0s; }
.yg-lb *, .yg-lb *::before, .yg-lb *::after { box-sizing: border-box; }

.yg-lb__bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 18px;
	font-size: 14px;
	font-weight: 600;
	letter-spacing: .04em;
	color: rgba(255, 255, 255, .8);
}

.yg-lb__btn {
	appearance: none;
	display: grid;
	place-items: center;
	width: var(--lb-btn);
	height: var(--lb-btn);
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .1);
	color: #fff;
	cursor: pointer;
	transition: background-color .2s, transform .2s;
}
.yg-lb__btn:hover { background: rgba(255, 255, 255, .22); }
.yg-lb__btn:focus { outline: none; }
.yg-lb__btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.yg-lb__btn svg { width: 22px; height: 22px; }

.yg-lb__stage {
	position: relative;
	display: grid;
	place-items: center;
	min-height: 0;
	overflow: hidden;
	touch-action: pan-y pinch-zoom;
}
.yg-lb__img {
	position: absolute;
	inset: 0;
	margin: auto;
	display: block;
	max-width: calc(100% - 168px);   /* room for the arrows */
	max-height: calc(100% - 8px);
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 6px;
	box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .6);
	opacity: 0;
	transition: opacity .3s var(--yg-ease, ease);
	-webkit-user-drag: none;
}
.yg-lb__img.is-shown { opacity: 1; animation: yg-lb-in .4s var(--yg-ease, ease) both; }
.yg-lb[data-dir="next"] .yg-lb__img.is-shown { --from: 40px; }
.yg-lb[data-dir="prev"] .yg-lb__img.is-shown { --from: -40px; }
@keyframes yg-lb-in {
	from { opacity: 0; transform: translateX(var(--from, 0)) scale(.97); }
	to   { opacity: 1; transform: none; }
}
.yg-lb__img.is-dragging { transition: none; animation: none; }

.yg-lb__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
}
.yg-lb__nav:hover { transform: translateY(-50%) scale(1.06); }
.yg-lb__prev { left: 18px; }
.yg-lb__next { right: 18px; }
.yg-lb.is-single .yg-lb__nav,
.yg-lb.is-single .yg-lb__thumbs { display: none; }

.yg-lb__spinner {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 38px;
	height: 38px;
	margin: -19px 0 0 -19px;
	border: 3px solid rgba(255, 255, 255, .2);
	border-top-color: #fff;
	border-radius: 50%;
	animation: yg-spin .8s linear infinite;
	opacity: 0;
	transition: opacity .2s;
	pointer-events: none;
}
.yg-lb.is-loading .yg-lb__spinner { opacity: 1; }
@keyframes yg-spin { to { transform: rotate(360deg); } }

.yg-lb__caption {
	min-height: 20px;
	padding: 12px 20px 0;
	text-align: center;
	font-size: 15px;
	line-height: 1.5;
	color: rgba(255, 255, 255, .85);
}
.yg-lb__caption:empty { padding: 0; min-height: 0; }

.yg-lb__thumbs {
	display: flex;
	gap: 8px;
	padding: 14px 18px 18px;
	overflow-x: auto;
	scrollbar-width: thin;
	scrollbar-color: rgba(255, 255, 255, .25) transparent;
}
.yg-lb__thumb {
	appearance: none;
	flex: 0 0 auto;
	width: 72px;
	height: 54px;
	margin: 0;
	padding: 0;
	border: 2px solid transparent;
	border-radius: 8px;
	overflow: hidden;
	background: rgba(255, 255, 255, .06);
	opacity: .45;
	cursor: pointer;
	transition: opacity .2s, border-color .2s;
}
.yg-lb__thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.yg-lb__thumb:hover { opacity: .85; }
.yg-lb__thumb:focus { outline: none; }
.yg-lb__thumb:focus-visible { border-color: rgba(255, 255, 255, .7); }
.yg-lb__thumb.is-active { opacity: 1; border-color: #fff; }
.yg-lb__thumbs::after { content: ""; flex: 0 0 1px; } /* end padding in overflow */

@media (max-width: 767px) {
	.yg-lb { --lb-btn: 42px; }
	.yg-lb__img { max-width: calc(100% - 16px); max-height: calc(100% - 70px); }
	.yg-lb__nav { top: auto; bottom: 10px; transform: none; background: rgba(0, 0, 0, .45); }
	.yg-lb__nav:hover { transform: none; }
	.yg-lb__prev { left: 10px; }
	.yg-lb__next { right: 10px; }
	.yg-lb__thumb { width: 56px; height: 42px; }
	.yg-lb__thumbs { padding: 10px 10px 14px; }
}
@media (max-height: 560px) {
	.yg-lb__thumbs { display: none; }
}

@media (prefers-reduced-motion: reduce) {
	.yg *, .yg-lb, .yg-lb * { animation: none !important; transition: none !important; }
}
