.eaig-widget,
.eaig-gallery-wrap {
	width: 100%;
	min-width: 0;
	box-sizing: border-box;
}

.eaig-gallery-wrap {
	position: relative;
}

.eaig-gallery,
.eaig-gallery * {
	box-sizing: border-box;
}

.eaig-gallery {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	column-gap: 18px;
	row-gap: 18px;
	width: 100%;
	align-items: start;
}

.eaig-gallery--masonry {
	grid-auto-rows: 8px;
	align-items: start;
}

.eaig-item {
	position: relative;
	min-width: 0;
	width: 100%;
	margin: 0;
	padding: 0;
}

.eaig-image-link {
	display: block;
	width: 100%;
	color: inherit;
	text-decoration: none;
	outline-offset: 3px;
}

.eaig-image-frame {
	position: relative;
	display: block;
	width: 100%;
	height: auto;
	overflow: hidden;
	background-color: #f4f4f4;
	border-radius: 0;
}

.eaig-image-frame img.eaig-image {
	display: block;
	width: 100%;
	max-width: 100%;
	height: auto;
	margin: 0;
	object-fit: contain;
	object-position: center center;
	transition: transform .35s ease, filter .35s ease;
}

/* Equal-height frame mode: Contain is the default so the whole image remains visible. */
.eaig-gallery--fixed .eaig-image-frame {
	height: 240px;
}

.eaig-gallery--fixed .eaig-image-frame img.eaig-image {
	width: 100%;
	height: 100%;
}

/* Aspect-ratio mode uses a stable frame while object-fit controls cropping. */
.eaig-gallery--ratio .eaig-image-frame {
	height: auto;
	aspect-ratio: 4 / 3;
}

.eaig-gallery--ratio .eaig-image-frame img.eaig-image {
	width: 100%;
	height: 100%;
}

.eaig-ratio-1-1 { aspect-ratio: 1 / 1; }
.eaig-ratio-4-3 { aspect-ratio: 4 / 3; }
.eaig-ratio-3-2 { aspect-ratio: 3 / 2; }
.eaig-ratio-16-9 { aspect-ratio: 16 / 9; }
.eaig-ratio-3-4 { aspect-ratio: 3 / 4; }
.eaig-ratio-2-3 { aspect-ratio: 2 / 3; }
.eaig-ratio-9-16 { aspect-ratio: 9 / 16; }

.eaig-gallery--ratio .eaig-image-frame.eaig-ratio-1-1 { aspect-ratio: 1 / 1; }
.eaig-gallery--ratio .eaig-image-frame.eaig-ratio-4-3 { aspect-ratio: 4 / 3; }
.eaig-gallery--ratio .eaig-image-frame.eaig-ratio-3-2 { aspect-ratio: 3 / 2; }
.eaig-gallery--ratio .eaig-image-frame.eaig-ratio-16-9 { aspect-ratio: 16 / 9; }
.eaig-gallery--ratio .eaig-image-frame.eaig-ratio-3-4 { aspect-ratio: 3 / 4; }
.eaig-gallery--ratio .eaig-image-frame.eaig-ratio-2-3 { aspect-ratio: 2 / 3; }
.eaig-gallery--ratio .eaig-image-frame.eaig-ratio-9-16 { aspect-ratio: 9 / 16; }

.eaig-caption {
	display: block;
	margin: 0;
	padding: 0;
	color: inherit;
	font-size: 14px;
	line-height: 1.5;
	overflow-wrap: anywhere;
}

.eaig-item--caption-below .eaig-caption {
	margin-top: 10px;
}

.eaig-item--caption-overlay .eaig-image-link {
	position: relative;
	overflow: hidden;
}

.eaig-item--caption-overlay .eaig-caption {
	position: absolute;
	z-index: 2;
	right: 0;
	bottom: 0;
	left: 0;
	margin: 0;
	padding: 12px 14px;
	color: #fff;
	background: rgba(0, 0, 0, .58);
}

.eaig-gallery--hover-zoom .eaig-item:hover .eaig-image,
.eaig-gallery--hover-zoom .eaig-item:focus-within .eaig-image {
	transform: scale(1.06);
}

.eaig-gallery--hover-lift .eaig-item {
	transition: transform .25s ease;
}

.eaig-gallery--hover-lift .eaig-item:hover,
.eaig-gallery--hover-lift .eaig-item:focus-within {
	transform: translateY(-5px);
}

.eaig-gallery--hover-gray .eaig-image {
	filter: grayscale(1);
}

.eaig-gallery--hover-gray .eaig-item:hover .eaig-image,
.eaig-gallery--hover-gray .eaig-item:focus-within .eaig-image {
	filter: grayscale(0);
}

.eaig-empty-state {
	padding: 24px;
	border: 1px dashed #bbb;
	border-radius: 4px;
	color: #666;
	text-align: center;
}

/* Lightbox is created by the frontend script only when a visitor opens an image. */
.eaig-lightbox {
	position: fixed;
	z-index: 999999;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 48px;
	background: rgba(0, 0, 0, .92);
}

.eaig-lightbox[hidden] {
	display: none !important;
}

.eaig-lightbox img {
	display: block;
	max-width: 100%;
	max-height: calc(100vh - 96px);
	width: auto;
	height: auto;
	object-fit: contain;
	box-shadow: 0 12px 50px rgba(0, 0, 0, .35);
}

.eaig-lightbox-close {
	position: absolute;
	top: 14px;
	right: 20px;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .14);
	color: #fff;
	font: 32px/1 Arial, sans-serif;
	cursor: pointer;
}

.eaig-lightbox-close:hover,
.eaig-lightbox-close:focus {
	background: rgba(255, 255, 255, .25);
	color: #fff;
}

@media (max-width: 767px) {
	.eaig-lightbox {
		padding: 20px;
	}
	.eaig-lightbox img {
		max-height: calc(100vh - 40px);
	}
}
