.asg-gallery-wrapper {
	--asg-gallery-columns: 3;
	--asg-gallery-gap: 20px;
	position: relative;
}

.asg-gallery-grid {
	display: grid;
	grid-template-columns: repeat(var(--asg-gallery-columns), 1fr);
	gap: var(--asg-gallery-gap);
}

.asg-gallery-item {
	overflow: hidden;
}

.asg-gallery-rounded .asg-gallery-item {
	border-radius: 10px;
}

.asg-gallery-link {
	display: block;
	position: relative;
	text-decoration: none;
	color: inherit;
}

.asg-gallery-media {
	display: block;
	overflow: hidden;
	background: #f2ede4;
}

.asg-gallery-img {
	display: block;
	width: 100%;
	height: auto;
	max-width: 100%;
}

/* ---- Shapes: fixed aspect ratio so every image in the grid lines up
   evenly, regardless of the source photo's original dimensions ---- */
.asg-gallery-shape-square .asg-gallery-media { aspect-ratio: 1 / 1; }
.asg-gallery-shape-portrait .asg-gallery-media { aspect-ratio: 3 / 4; }
.asg-gallery-shape-landscape .asg-gallery-media { aspect-ratio: 4 / 3; }
.asg-gallery-shape-wide .asg-gallery-media { aspect-ratio: 16 / 9; }

.asg-gallery-shape-square .asg-gallery-img,
.asg-gallery-shape-portrait .asg-gallery-img,
.asg-gallery-shape-landscape .asg-gallery-img,
.asg-gallery-shape-wide .asg-gallery-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.asg-gallery-fit-contain .asg-gallery-img {
	object-fit: contain;
	background: #f2ede4;
}

.asg-gallery-shape-original .asg-gallery-img {
	height: auto;
}

/* ---- Hover effects ---- */
.asg-gallery-hover-zoom .asg-gallery-img {
	transition: transform .4s ease;
}
.asg-gallery-hover-zoom .asg-gallery-item:hover .asg-gallery-img {
	transform: scale(1.06);
}

.asg-gallery-hover-fade .asg-gallery-media {
	position: relative;
}
.asg-gallery-hover-fade .asg-gallery-media::after {
	content: '';
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0);
	transition: background .3s ease;
}
.asg-gallery-hover-fade .asg-gallery-item:hover .asg-gallery-media::after {
	background: rgba(0, 0, 0, .15);
}

.asg-gallery-caption {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 12px 14px;
	background: linear-gradient(to top, rgba(0, 0, 0, .65), transparent);
	color: #fff;
	font-size: 13px;
	opacity: 0;
	transform: translateY(6px);
	transition: opacity .25s ease, transform .25s ease;
}
.asg-gallery-item:hover .asg-gallery-caption {
	opacity: 1;
	transform: translateY(0);
}

.asg-gallery-empty {
	grid-column: 1 / -1;
	text-align: center;
	padding: 40px 0;
	color: #777;
}

/* ---- Pagination ---- */
.asg-gallery-pagination-wrap {
	display: flex;
	justify-content: center;
	margin-top: 30px;
}

.asg-gallery-load-more {
	padding: 11px 30px;
	border: none;
	border-radius: 999px;
	background: var(--asg-maroon, #70151b);
	color: #fff;
	font-size: 14px;
	cursor: pointer;
	transition: background .2s ease;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
}
.asg-gallery-load-more:hover {
	background: var(--asg-maroon-dark, #4d1010);
}

.asg-gallery-numbers-pagination {
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
	justify-content: center;
}
.asg-gallery-numbers-pagination button {
	min-width: 34px;
	height: 34px;
	padding: 0 8px;
	border: 1px solid var(--asg-border, #e5d9cf);
	background: #fff;
	border-radius: 6px;
	cursor: pointer;
	font-size: 13px;
}
.asg-gallery-numbers-pagination button.active {
	background: var(--asg-maroon, #70151b);
	border-color: var(--asg-maroon, #70151b);
	color: #fff;
}
.asg-gallery-numbers-pagination button:disabled {
	opacity: .4;
	cursor: not-allowed;
}

.asg-gallery-infinite-sentinel {
	height: 1px;
	width: 100%;
}

.asg-gallery-infinite-loading {
	text-align: center;
	padding: 20px 0;
	color: #777;
	font-size: 13px;
}

.asg-gallery-error-msg {
	text-align: center;
	color: #b32d2e;
	font-size: 13px;
	margin-top: 10px;
}

/* ---- Spinner: a real element (not a CSS pseudo-element), so it always
   renders even if a caching/minify/optimizer plugin mangles ::before /
   ::after rules. Used inline (loading text, buttons) and, larger, inside
   the grid overlay below. Shares the .asg-spinner class name with the
   Shop Grid widget's stylesheet - identical rules, safe to duplicate. ---- */
.asg-spinner {
	display: inline-block;
	vertical-align: middle;
	width: 18px;
	height: 18px;
	margin-right: 8px;
	border: 2.5px solid rgba(112, 21, 27, 0.2);
	border-top-color: var(--asg-maroon, #70151b);
	border-radius: 50%;
	animation: asg-spin 0.7s linear infinite;
}

/* White spinner on the solid maroon Load More button. */
.asg-gallery-load-more .asg-spinner {
	border-color: rgba(255, 255, 255, 0.35);
	border-top-color: #fff;
	margin-right: 0;
}

.asg-btn-spinner {
	display: none;
}

.asg-gallery-loading .asg-gallery-load-more .asg-btn-text {
	display: none;
}

.asg-gallery-loading .asg-gallery-load-more .asg-btn-spinner {
	display: inline-block;
}

/* Grid dims slightly while a fetch is in flight - the spinner shown
   next to "Loading more..." / on the Load More button is the loading
   indicator; this just signals the current items are stale. */
.asg-gallery-grid {
	min-height: 80px;
}

.asg-gallery-loading .asg-gallery-grid {
	opacity: .6;
	pointer-events: none;
}

@keyframes asg-spin {
	to {
		transform: rotate(360deg);
	}
}


/* ---- Lightbox ---- */
.asg-gallery-lightbox {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, .9);
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 40px;
}
.asg-gallery-lightbox img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	box-shadow: 0 10px 40px rgba(0, 0, 0, .5);
}
.asg-gallery-lightbox-close {
	position: absolute;
	top: 20px;
	right: 28px;
	background: none;
	border: none;
	color: #fff;
	font-size: 32px;
	cursor: pointer;
	line-height: 1;
}
body.asg-gallery-lightbox-open {
	overflow: hidden;
}

/* ---- Small phones (320-400px) ----
   Whatever mobile column count is set, more than two on a 288px screen
   makes each image too small to read. */

@media (max-width: 400px) {
	.asg-gallery-grid {
		--asg-gallery-columns: 1;
		gap: 10px;
	}

	.asg-gallery-load-more {
		width: 100%;
	}

	.asg-gallery-lightbox-close {
		top: 8px;
		right: 8px;
	}
}
