/**
 * Advanced Gallery Showcase — frontend styles.
 * Themeable values are CSS custom properties; the shortcode sets them via a
 * scoped <style> block, the Elementor widget via its own control selectors.
 */

.ags-gallery {
	--ags-bg: #0b0b0d;
	--ags-card-bg: #141417;
	--ags-text: #f5f5f6;
	--ags-muted: #9a9aa2;
	--ags-border: #26262b;
	--ags-accent: #e8973a;
	--ags-hover: #f0a85a;
	--ags-font-family: inherit;
	--ags-title-font: "EB Garamond", Georgia, "Times New Roman", serif;
	--ags-font-size: 16px;
	--ags-font-weight: 400;
	--ags-line-height: 1.5;
	--ags-radius: 16px;
	--ags-shadow: 0 2px 8px rgba(0, 0, 0, .25);
	--ags-padding: 16px;
	--ags-gap: 20px;
	--ags-card-border-width: 0px;
	--ags-card-border-color: #26262b;
	--ags-cols: 3;
	--ags-cols-tablet: 2;
	--ags-cols-mobile: 1;

	background: var(--ags-bg);
	color: var(--ags-text);
	font-family: var(--ags-font-family);
	font-size: var(--ags-font-size);
	font-weight: var(--ags-font-weight);
	line-height: var(--ags-line-height);
	width: 100%;
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

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

/* ---------- Filter pills ---------- */
.ags-filters {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 12px;
	margin-bottom: calc(var(--ags-gap) + 8px);
}

.ags-filter {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	appearance: none;
	cursor: pointer;
	border: 1px solid var(--ags-border);
	background: transparent;
	color: var(--ags-text);
	font: inherit;
	font-size: .95em;
	padding: 10px 20px;
	border-radius: 999px;
	transition: color .2s ease, border-color .2s ease, background-color .2s ease;
}

.ags-filter:hover,
.ags-filter:focus-visible {
	border-color: var(--ags-hover);
	outline: none;
}

.ags-filter.is-active {
	color: #1a1207;
	background: var(--ags-accent);
	border-color: var(--ags-accent);
	font-weight: 600;
}

.ags-filter-count {
	font-size: .85em;
	opacity: .55;
}

.ags-filter.is-active .ags-filter-count {
	opacity: .7;
}

/* ---------- Grid: uniform ---------- */
.ags-grid--grid {
	display: grid;
	grid-template-columns: repeat(var(--ags-cols), minmax(0, 1fr));
	gap: var(--ags-gap);
}

.ags-grid--grid .ags-card-img {
	aspect-ratio: 4 / 3;
	height: 100%;
}

/* ---------- Grid: masonry (CSS columns) ---------- */
.ags-grid--masonry {
	column-count: var(--ags-cols);
	column-gap: var(--ags-gap);
}

.ags-grid--masonry .ags-card {
	break-inside: avoid;
	-webkit-column-break-inside: avoid;
	margin-bottom: var(--ags-gap);
	display: block;
	width: 100%;
}

/* ---------- Card ---------- */
.ags-card {
	position: relative;
	border-radius: var(--ags-radius);
	overflow: hidden;
	background: var(--ags-card-bg);
	box-shadow: var(--ags-shadow);
	border: var(--ags-card-border-width) solid var(--ags-card-border-color);
}

.ags-card-link {
	display: block;
	position: relative;
	color: inherit;
	text-decoration: none;
	cursor: pointer;
}

.ags-card-img {
	display: block;
	width: 100%;
	object-fit: cover;
	transition: transform .5s ease;
}

.ags-card:hover .ags-card-img {
	transform: scale(1.04);
}

.ags-card-noimg {
	display: block;
	width: 100%;
	aspect-ratio: 4 / 3;
	background:
		repeating-linear-gradient(45deg, #15151a, #15151a 12px, #1b1b22 12px, #1b1b22 24px);
}

/* Hover-reveal caption */
.ags-card-overlay {
	position: absolute;
	inset: auto 0 0 0;
	z-index: 1;
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: calc(var(--ags-padding) + 8px) var(--ags-padding) var(--ags-padding);
	background: linear-gradient(to top, rgba(0, 0, 0, .85) 0%, rgba(0, 0, 0, .55) 45%, rgba(0, 0, 0, 0) 100%);
	opacity: 0;
	transform: translateY(10px);
	transition: opacity .3s ease, transform .3s ease;
	pointer-events: none;
}

.ags-card:hover .ags-card-overlay,
.ags-card-link:focus-visible .ags-card-overlay,
.ags-card:focus-within .ags-card-overlay {
	opacity: 1;
	transform: translateY(0);
}

.ags-card-title {
	font-family: var(--ags-title-font);
	font-size: 1.35em;
	font-weight: 500;
	line-height: 1.15;
	color: #fff;
}

.ags-card-meta {
	font-family: var(--ags-font-family);
	font-size: .85em;
	color: rgba(255, 255, 255, .72);
}

/* Filtering animation states */
.ags-card.is-hiding {
	opacity: 0;
	transform: scale(.96);
	transition: opacity .25s ease, transform .25s ease;
}

.ags-card.is-hidden {
	display: none;
}

.ags-empty-front {
	text-align: center;
	color: var(--ags-muted, #9a9aa2);
	padding: 40px;
}

/* ---------- Lightbox ---------- */
.ags-lb {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	background: rgba(6, 6, 8, .96);
	opacity: 0;
	visibility: hidden;
	transition: opacity .25s ease, visibility .25s ease;
	padding: 32px;
}

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

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

.ags-lb-img {
	max-width: 92vw;
	max-height: 74vh;
	border-radius: 10px;
	box-shadow: 0 24px 70px rgba(0, 0, 0, .6);
}

.ags-lb-title {
	font-family: var(--ags-lb-title-font, "EB Garamond", Georgia, serif);
	color: #fff;
	font-size: 32px;
	font-weight: 500;
	letter-spacing: .01em;
	margin: 24px 0 8px;
	text-align: center;
}

.ags-lb-meta {
	color: rgba(255, 255, 255, .62);
	font-size: 15px;
	letter-spacing: .02em;
	text-align: center;
}

.ags-lb-btn {
	position: absolute;
	appearance: none;
	background: transparent;
	border: 1px solid rgba(255, 255, 255, .28);
	color: #fff;
	width: 52px;
	height: 52px;
	border-radius: 50%;
	font-size: 24px;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background-color .2s ease, border-color .2s ease;
}

.ags-lb-btn:hover,
.ags-lb-btn:focus-visible {
	background: rgba(255, 255, 255, .12);
	border-color: rgba(255, 255, 255, .6);
	outline: none;
}

.ags-lb-prev { left: clamp(8px, 3vw, 40px); top: 50%; transform: translateY(-50%); }
.ags-lb-next { right: clamp(8px, 3vw, 40px); top: 50%; transform: translateY(-50%); }
.ags-lb-close { top: 28px; right: clamp(8px, 3vw, 40px); }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
	.ags-grid--grid { grid-template-columns: repeat(var(--ags-cols-tablet), minmax(0, 1fr)); }
	.ags-grid--masonry { column-count: var(--ags-cols-tablet); }
}

@media (max-width: 600px) {
	.ags-grid--grid { grid-template-columns: repeat(var(--ags-cols-mobile), minmax(0, 1fr)); }
	.ags-grid--masonry { column-count: var(--ags-cols-mobile); }
	.ags-card-overlay { opacity: 1; transform: none; }
	.ags-lb-title { font-size: 24px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
	.ags-card-img,
	.ags-card-overlay,
	.ags-filter,
	.ags-lb,
	.ags-card.is-hiding {
		transition: none;
	}
}
