/* Caption Gallery — front end.
   Override any of these variables in Bricks (Settings > Custom CSS) to restyle every gallery. */
.cg-gallery {
	--cg-gap: 13px;
	--cg-caption-bg: rgba(170, 186, 160, 0.6);
	--cg-caption-color: #1d2119;
	--cg-caption-size: 1.3rem;
	--cg-ratio: 465 / 430;
	display: grid !important;
	width: 100%;
	box-sizing: border-box;
	grid-template-columns: repeat(var(--cg-columns, 4), minmax(0, 1fr));
	gap: var(--cg-gap);
	align-items: start;
}
.cg-item {
	margin: 0;
	padding: 0;
	display: block;
}
.cg-media {
	display: block;
	width: 100%;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 0;
	cursor: zoom-in;
	aspect-ratio: var(--cg-ratio);
	overflow: hidden;
	background: #d7dccf;
}
.cg-media .cg-img {
	margin: 0;
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform .3s ease;
}
.cg-open:hover .cg-img { transform: scale(1.03); }
.cg-open:focus-visible { outline: 3px solid #2f6fd6; outline-offset: 2px; }
.cg-caption {
	background: var(--cg-caption-bg);
	color: var(--cg-caption-color);
	margin: 0;
	padding: 14px 16px;
	font-size: var(--cg-caption-size);
	line-height: 1.75;
}
/* Let the Bricks Shortcode element stretch to its container's full width */
.brxe-shortcode:has(> .cg-gallery) { width: 100%; }
.cg-gallery > .cg-item { min-width: 0; }
/* Tablet (matches Bricks' tablet breakpoint) */
@media (max-width: 991px) {
	.cg-gallery { grid-template-columns: repeat(var(--cg-columns-tablet, 2), minmax(0, 1fr)); }
}
/* Mobile (matches Bricks' mobile landscape breakpoint) */
@media (max-width: 767px) {
	.cg-gallery { grid-template-columns: repeat(var(--cg-columns-mobile, 1), minmax(0, 1fr)); }
}

/* Full-screen viewer: 90% black, image left (75%), content right (25%) */
.cg-lightbox {
	--cg-lb-title-size: 1.5rem;
	--cg-lb-text-size: 1.5rem;
	position: fixed;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	background: rgba(0, 0, 0, 0.9);
	color: #fff;
	overflow: hidden;
}
.cg-lightbox::backdrop { background: transparent; }
.cg-lightbox[open] { display: flex; }
.cg-lb-stage {
	flex: 1;
	min-height: 0;
	display: grid;
	grid-template-columns: minmax(0, 3fr) minmax(0, 1fr);
	align-items: center;
	gap: 40px;
	padding: 80px 88px 56px;
	box-sizing: border-box;
}
.cg-lb-img {
	display: block;
	width: 100%;
	height: calc(100vh - 136px);
	object-fit: contain;
	object-position: right center;
}
.cg-lb-content {
	max-height: calc(100vh - 136px);
	overflow-y: auto;
	padding-right: 8px;
}
.cg-lb-title {
	margin: 0 0 12px;
	font-size: var(--cg-lb-title-size);
	line-height: 2.2rem;
	font-weight: 700;
	color: #fff;
	overflow-wrap: anywhere;
}
.cg-lb-desc {
	margin: 0;
	font-size: var(--cg-lb-text-size);
	line-height: 2.2rem;
	white-space: pre-line;
	color: rgba(255, 255, 255, 0.9);
}
.cg-lb-desc:empty { display: none; }
.cg-lb-btn {
	position: absolute;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
	cursor: pointer;
}
.cg-lb-btn:hover { background: rgba(255, 255, 255, 0.25); }
.cg-lb-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.cg-lb-close { top: 16px; right: 16px; }
.cg-lb-prev { left: 24px; top: 50%; transform: translateY(-50%); }
.cg-lb-next { right: 24px; top: 50%; transform: translateY(-50%); }
.cg-lb-count {
	position: absolute;
	top: 28px;
	left: 24px;
	font-size: 14px;
	color: rgba(255, 255, 255, 0.7);
}
/* Tablet and phone: image on top, content below */
@media (max-width: 991px) {
	.cg-lightbox { overflow-y: auto; }
	.cg-lb-stage {
		grid-template-columns: minmax(0, 1fr);
		align-content: start;
		gap: 24px;
		padding: 72px 24px 96px;
	}
	.cg-lb-img { height: auto; max-height: 55vh; object-position: center; }
	.cg-lb-content { max-height: none; overflow: visible; padding-right: 0; }
	.cg-lb-prev, .cg-lb-next { position: fixed; top: auto; bottom: 20px; transform: none; }
}
body.cg-lb-lock { overflow: hidden; }
