/* Component sizing stays contained within its Elementor column. */
.ceig-gallery,
.ceig-gallery * {
	box-sizing: border-box;
}

.ceig-gallery {
	display: block;
	width: 100%;
	max-width: 100%;
	min-width: 0;
}

/* The aspect ratio controls height naturally as the available width changes. */
.ceig-main-image-wrap {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	max-width: 100%;
	height: auto;
	aspect-ratio: 4 / 3;
	min-width: 0;
	overflow: hidden;
	margin-inline: auto;
	background: #f4f0ec;
	border-radius: 8px;
}

.ceig-main-image {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	max-width: 100%;
	margin: 0;
	object-fit: contain;
	object-position: center;
}

/* Per-image label overlay, updated whenever the active image changes. */
.ceig-image-label {
	position: absolute;
	right: clamp(10px, 2vw, 18px);
	bottom: clamp(10px, 2vw, 18px);
	z-index: 1;
	max-width: calc(100% - 32px);
	padding: 7px 12px;
	border-radius: 4px;
	background: rgba(0, 0, 0, 0.68);
	color: #fff;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.35;
	text-align: right;
	overflow-wrap: anywhere;
	pointer-events: none;
}

.ceig-image-label[hidden] {
	display: none !important;
}

/* Main image navigation arrows */
.ceig-arrow {
	position: absolute;
	z-index: 2;
	top: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	width: clamp(30px, 4vw, 42px);
	height: clamp(30px, 4vw, 42px);
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.92);
	color: #222;
	font-size: clamp(13px, 1.6vw, 17px);
	line-height: 1;
	cursor: pointer;
	transform: translateY(-50%);
	transition: background-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.10);
}

.ceig-arrow:hover,
.ceig-arrow:focus-visible {
	background: #222;
	color: #fff;
}

.ceig-arrow:focus-visible,
.ceig-thumbnail-button:focus-visible {
	outline: 2px solid #9b7848;
	outline-offset: 3px;
}

.ceig-arrow-prev {
	left: clamp(6px, 1.5vw, 14px);
}

.ceig-arrow-next {
	right: clamp(6px, 1.5vw, 14px);
}

/* The viewport scrolls only when the thumbnail track exceeds its width. */
.ceig-thumbnails-viewport {
	display: block;
	width: 100%;
	max-width: 100%;
	min-width: 0;
	margin-top: clamp(8px, 1.2vw, 12px);
	overflow-x: auto;
	overflow-y: hidden;
	scroll-behavior: smooth;
	scrollbar-width: thin;
	-webkit-overflow-scrolling: touch;
}

.ceig-thumbnails {
	display: flex;
	align-items: stretch;
	justify-content: center;
	gap: clamp(6px, 1vw, 10px);
	width: max-content;
	min-width: 100%;
	box-sizing: border-box;
	margin: 0 auto;
	padding: 2px 1px 6px;
}

.ceig-thumbnail-button {
	position: relative;
	display: block;
	flex: 0 0 clamp(52px, 8vw, 82px);
	width: clamp(52px, 8vw, 82px);
	min-width: 0;
	aspect-ratio: 1 / 1;
	margin: 0;
	padding: 0;
	overflow: hidden;
	border: 1px solid #dedbd7;
	border-radius: 4px;
	background: #f4f0ec;
	cursor: pointer;
	opacity: 0.78;
	transition: border-color 0.2s ease, opacity 0.2s ease;
}

.ceig-thumbnail-button img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	object-fit: cover;
	object-position: center;
}

.ceig-thumbnail-button:hover,
.ceig-thumbnail-button.is-active {
	border: 2px solid #9b7848;
	opacity: 1;
}

.ceig-thumbnail-button.is-active {
	cursor: default;
}

.ceig-editor-notice {
	padding: 14px;
	border: 1px dashed #aaa;
	color: #555;
}

/* Compact touch targets and thumbnail sizing on narrow screens. */
@media (max-width: 767px) {
	.ceig-thumbnail-button {
		flex-basis: clamp(48px, 15vw, 66px);
		width: clamp(48px, 15vw, 66px);
	}

	.ceig-thumbnails {
		gap: 7px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ceig-thumbnails-viewport,
	.ceig-arrow,
	.ceig-thumbnail-button {
		scroll-behavior: auto;
		transition: none;
	}
}
