/* ==========================================================================
   Filterable Gallery Widget
   ========================================================================== */

/* ---------- Filter bar ---------- */
.fg-filter-bar {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px;
	margin-bottom: 32px;
}

.fg-pill {
	display: inline-block;
	background: #f5ece8;
	color: #5c3d35;
	border: none;
	outline: none;
	cursor: pointer;
	border-radius: 50px;
	padding: 8px 20px;
	font-size: 14px;
	font-family: inherit;
	line-height: 1.4;
	white-space: nowrap;
	-webkit-appearance: none;
	appearance: none;
	transition: background-color 0.25s ease, color 0.25s ease;
}

.fg-pill.fg-active,
.fg-pill:hover {
	background: #7a2530;
	color: #fff;
}

.fg-pill:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

/* ---------- Masonry grid (CSS multi-column, matches reference layout) ---------- */
.fg-grid {
	column-count: var(--fg-cols-desktop, 3);
	column-gap: 16px;
}

/* ---------- Item ---------- */
.fg-item {
	position: relative;
	display: block;
	overflow: hidden;
	border-radius: 12px;
	margin-bottom: 16px;
	cursor: pointer;
	break-inside: avoid;
	-webkit-column-break-inside: avoid;
	/* Safari: keep border-radius clipping during img scale */
	transform: translateZ(0);
	isolation: isolate;
}

.fg-item img {
	width: 100%;
	height: auto;
	object-fit: cover;
	display: block;
	border-radius: 12px;
	transition: transform 0.4s ease;
}

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

/* ---------- Hover overlay ---------- */
.fg-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0);
	display: flex;
	align-items: flex-end;
	justify-content: flex-start;
	padding: 16px;
	pointer-events: none;
	transition: background-color 0.3s ease;
}

.fg-item:hover .fg-overlay {
	background: rgba(0, 0, 0, 0.45);
}

.fg-overlay-label {
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.4;
	background: rgba(255, 255, 255, 0.15);
	-webkit-backdrop-filter: blur(2px);
	backdrop-filter: blur(2px);
	padding: 4px 14px;
	border-radius: 20px;
	opacity: 0;
	transform: translateY(8px);
	transition: opacity 0.3s ease, transform 0.3s ease;
}

.fg-item:hover .fg-overlay-label {
	opacity: 1;
	transform: translateY(0);
}

/* ---------- Filtering ---------- */
.fg-item.fg-hidden {
	display: none;
}

.fg-item.fg-show {
	animation: fgFadeIn 0.35s ease both;
}

@keyframes fgFadeIn {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* ---------- Responsive columns ---------- */
@media (max-width: 1024px) {
	.fg-grid {
		column-count: var(--fg-cols-tablet, 2);
	}
}

@media (max-width: 767px) {
	.fg-grid {
		column-count: var(--fg-cols-mobile, 1);
	}
}

/* ---------- Lightbox ---------- */
.fg-lightbox {
	position: fixed;
	inset: 0;
	z-index: 99999;
	background: rgba(40, 24, 20, 0.95);
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.25s ease, visibility 0.25s ease;
}

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

.fg-lightbox-img {
	max-width: 88vw;
	max-height: 86vh;
	width: auto;
	height: auto;
	display: block;
	border-radius: 4px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
	transform: scale(0.96);
	transition: transform 0.25s ease;
}

.fg-lightbox.fg-lightbox-open .fg-lightbox-img {
	transform: scale(1);
}

.fg-lightbox-close,
.fg-lightbox-nav {
	position: absolute;
	background: transparent;
	border: none;
	color: #fff;
	cursor: pointer;
	line-height: 1;
	padding: 12px;
	opacity: 0.85;
	transition: opacity 0.2s ease;
	-webkit-appearance: none;
	appearance: none;
}

.fg-lightbox-close:hover,
.fg-lightbox-nav:hover {
	opacity: 1;
}

.fg-lightbox-close:focus-visible,
.fg-lightbox-nav:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.fg-lightbox-close {
	top: 24px;
	right: 32px;
	font-size: 28px;
}

.fg-lightbox-nav {
	top: 50%;
	transform: translateY(-50%);
	font-size: 32px;
}

.fg-lightbox-prev {
	left: 24px;
}

.fg-lightbox-next {
	right: 24px;
}

@media (max-width: 767px) {
	.fg-lightbox-img {
		max-width: 94vw;
	}
	.fg-lightbox-close {
		top: 12px;
		right: 12px;
	}
	.fg-lightbox-prev {
		left: 6px;
	}
	.fg-lightbox-next {
		right: 6px;
	}
}

/* Scroll lock while lightbox is open */
body.fg-no-scroll {
	overflow: hidden;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
	.fg-pill,
	.fg-item img,
	.fg-overlay,
	.fg-overlay-label,
	.fg-lightbox,
	.fg-lightbox-img {
		transition: none;
	}
	.fg-item.fg-show {
		animation: none;
	}
}
