/* ── Visual Gallery Shortcode — gallery.css ── */

/* Filter bar */
.vgs-filters {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px;
	margin-bottom: 48px;
}

/* Hide the real radio input, keep it accessible */
.vgs-radio {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
	pointer-events: none;
}

/* Pill label */
.vgs-radio-label {
	cursor: pointer;
}

.vgs-pill {
	display: inline-flex;
	align-items: center;
	border-radius: 9999px;
	padding: 8px 18px;
	font-size: .875rem;
	font-weight: 500;
	line-height: 1;
	border: 1px solid var(--primary);
	background: #ffffff;
	color: #374151;
	transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
	user-select: none;
}

.vgs-radio-label:hover .vgs-pill {
	border-color: var(--primary);
	color: var(--primary);
}

.vgs-radio:checked + .vgs-pill {
	background: var(--primary);
	border-color: var(--primary);
	color: #ffffff;
	box-shadow: 0 2px 10px rgba(37, 99, 235, 0.30);
}

.vgs-radio:focus-visible + .vgs-pill {
	outline: 2px solid var(--primary);
	outline-offset: 3px;
}

/* Grid */
.vgs-grid {
	display: grid;
	gap: 24px;
}

.vgs-cols-3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.vgs-cols-2 { grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); }
.vgs-cols-1 { grid-template-columns: 1fr; }

@media (max-width: 640px) {
	.vgs-cols-3,
	.vgs-cols-2 { grid-template-columns: 1fr; }
}

/* Card */
.vgs-item {
	position: relative;
	overflow: hidden;
	border-radius: 24px;
	border: 1px solid #e5e7eb;
	background: #ffffff;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
	cursor: pointer;
	transition: transform 0.45s ease, box-shadow 0.45s ease;
}

.vgs-item:hover {
	transform: translateY(-5px);
	box-shadow: 0 16px 40px rgba(0, 0, 0, 0.14);
}

/* Hidden when filtered */
.vgs-item[hidden] {
	display: none;
}

/* Thumbnail */
.vgs-thumb {
	aspect-ratio: 4 / 3;
	overflow: hidden;
	background: #f3f4f6;
}

/* Lightbox anchor fills the entire thumb area */
.vgs-thumb a {
	display: block;
	width: 100%;
	height: 100%;
}

.vgs-thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.65s ease;
}

.vgs-item:hover .vgs-thumb img {
	transform: scale(1.08);
}

/* Overlay must not intercept clicks — let them reach the <a> underneath */
.vgs-overlay {
	pointer-events: none;
}

/* Overlay */
.vgs-overlay {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	padding: 24px;
	background: linear-gradient(
		to top,
		rgba(0, 0, 0, 0.80) 0%,
		rgba(0, 0, 0, 0.18) 55%,
		transparent 100%
	);
	opacity: 0;
	transition: opacity 0.45s ease;
}

.vgs-item:hover .vgs-overlay,
.vgs-item:focus-visible .vgs-overlay {
	opacity: 1;
}

.vgs-cat-label {
	font-size: 0.70rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.75);
	margin-bottom: 4px;
}

.vgs-item-title {
	font-size: 1.125rem;
	font-weight: 700;
	color: #ffffff;
	margin: 0 0 8px;
	line-height: 1.3;
}

/* Pill tags */
.vgs-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
}

.vgs-tag {
	display: inline-block;
	background: rgba(255, 255, 255, 0.18);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	color: #ffffff;
	font-size: 0.65rem;
	font-weight: 500;
	padding: 3px 9px;
	border-radius: 9999px;
}

/* Empty state */
.vgs-empty {
	text-align: center;
	color: #6b7280;
	padding: 32px 0;
}

/* Transition for filtered items (fade instead of abrupt hide) */
.vgs-item.vgs-hiding {
	animation: vgsFadeOut 0.2s ease forwards;
}

.vgs-item.vgs-showing {
	animation: vgsFadeIn 0.3s ease forwards;
}

@keyframes vgsFadeOut {
	to { opacity: 0; transform: scale(0.97); }
}

@keyframes vgsFadeIn {
	from { opacity: 0; transform: scale(0.97); }
	to   { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
	.vgs-item,
	.vgs-thumb img,
	.vgs-overlay,
	.vgs-pill {
		transition: none !important;
		animation: none !important;
	}
}

/* ── Built-in Lightbox ─────────────────────────────────────────────────── */

.vgs-lb-overlay {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 99999;
	background: rgba(0, 0, 0, 0.92);
	align-items: center;
	justify-content: center;
	flex-direction: column;
}

.vgs-lb-overlay.is-open {
	display: flex;
	animation: vgsLBFadeIn 0.25s ease;
}

@keyframes vgsLBFadeIn {
	from { opacity: 0; }
	to   { opacity: 1; }
}

.vgs-lb-wrap {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	max-width: 92vw;
	max-height: 82vh;
}

.vgs-lb-img {
	display: block;
	max-width: 92vw;
	max-height: 82vh;
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 8px;
	box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
	transition: opacity 0.2s ease;
}

.vgs-lb-img.is-loading {
	opacity: 0.2;
}

.vgs-lb-caption {
	margin-top: 14px;
	color: rgba(255, 255, 255, 0.75);
	font-size: 0.875rem;
	text-align: center;
	max-width: 640px;
	padding: 0 16px;
}

.vgs-lb-counter {
	margin-top: 6px;
	color: rgba(255, 255, 255, 0.4);
	font-size: 0.75rem;
	letter-spacing: 0.05em;
}

/* Nav + close buttons */
.vgs-lb-close,
.vgs-lb-prev,
.vgs-lb-next {
	position: fixed;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(255, 255, 255, 0.1);
	border: 1px solid rgba(255, 255, 255, 0.15);
	color: #ffffff;
	cursor: pointer;
	border-radius: 50%;
	width: 44px;
	height: 44px;
	font-size: 1.25rem;
	line-height: 1;
	transition: background 0.2s ease;
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
}

.vgs-lb-close:hover,
.vgs-lb-prev:hover,
.vgs-lb-next:hover {
	background: rgba(255, 255, 255, 0.22);
}

.vgs-lb-close {
	top: 20px;
	right: 20px;
	font-size: 1rem;
}

.vgs-lb-prev {
	left: 20px;
	top: 50%;
	transform: translateY(-50%);
	font-size: 1.6rem;
}

.vgs-lb-next {
	right: 20px;
	top: 50%;
	transform: translateY(-50%);
	font-size: 1.6rem;
}

@media (max-width: 640px) {
	.vgs-lb-prev { left: 8px; }
	.vgs-lb-next { right: 8px; }
	.vgs-lb-close { top: 12px; right: 12px; }
	.vgs-lb-img { max-height: 70vh; }
}

@media (prefers-reduced-motion: reduce) {
	.vgs-lb-overlay { animation: none !important; }
	.vgs-lb-img     { transition: none !important; }
}
