.cmgs-wrapper {
	position: relative;
	width: 100%;
}

/* ---- Stage ---- */
.cmgs-stage {
	position: relative;
	width: 100%;
	height: 480px;
	background: #111;
}

.cmgs-slide {
	position: absolute;
	inset: 0;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.5s ease;
	z-index: 1;
}

.cmgs-slide.is-active {
	opacity: 1;
	visibility: visible;
	z-index: 2;
}

.cmgs-media-image {
	width: 100%;
	height: 100%;
	max-width: none;
	display: block;
	object-fit: cover;
	object-position: center center;
}

.cmgs-media-image.cmgs-lightbox-trigger {
	cursor: zoom-in;
}

.cmgs-video-poster {
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	display: block;
}

.cmgs-media-video {
	position: relative;
	width: 100%;
	height: 100%;
	background: #000;
}

/* Play button shown over the poster, before the video has been started */
.cmgs-play-overlay {
	-webkit-appearance: none;
	appearance: none;
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	display: inline-flex;
	align-items: center;
	gap: 14px;
	padding: 8px 28px 8px 8px;
	border-radius: 999px;
	border: 2px solid rgba(245, 233, 218, 0.85);
	background-color: transparent;
	color: #f5e9da;
	cursor: pointer;
	white-space: nowrap;
	z-index: 6;
	transition: background-color 0.2s ease, border-color 0.2s ease;
}

.cmgs-play-overlay:hover {
	background-color: rgba(255, 255, 255, 0.1);
}

.cmgs-play-overlay-icon {
	flex: 0 0 auto;
	width: 46px;
	height: 46px;
	border-radius: 50%;
	background-color: #f2e9dc;
	color: #2b2b2b;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}

.cmgs-play-overlay--custom-icon .cmgs-play-overlay-icon {
	width: auto;
	height: auto;
	background-color: transparent;
	border-radius: 0;
	overflow: visible;
}

.cmgs-play-overlay-label {
	font-size: 14px;
	font-weight: 700;
	letter-spacing: 1px;
	text-transform: uppercase;
	line-height: 1;
}

.cmgs-custom-play-icon-stage {
	display: block;
	width: 46px;
	height: auto;
	max-width: none !important;
	pointer-events: none;
}

/* The actual player is hidden until the user clicks play */
.cmgs-video-embed {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease;
}

.cmgs-slide.is-playing .cmgs-video-embed {
	opacity: 1;
	visibility: visible;
	z-index: 1;
}

.cmgs-slide.is-playing .cmgs-play-overlay,
.cmgs-slide.is-playing .cmgs-video-poster {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}

.cmgs-html5-video {
	width: 100%;
	height: 100%;
	object-fit: contain;
	background: #000;
	display: block;
}

.cmgs-embed-wrap,
.cmgs-embed-wrap iframe {
	width: 100%;
	height: 100%;
	display: block;
	border: none;
}

/* ---- Caption overlay ---- */
.cmgs-caption-overlay {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: flex-end;
	pointer-events: none;
	--cmgs-overlay-strength: 65%;
	background: linear-gradient(0deg, rgba(0,0,0,var(--cmgs-overlay-strength)) 0%, rgba(0,0,0,0) 65%);
	z-index: 3;
}

.cmgs-caption-box {
	padding: 28px 32px;
	max-width: 70%;
	pointer-events: auto;
}

.cmgs-caption-box p {
	margin: 0;
	font-size: 15px;
	color: #f2f2f2;
	line-height: 1.5;
}

/* ---- Thumbnail strip ---- */
.cmgs-thumbs {
	position: relative;
	z-index: 4;
	display: flex;
	align-items: center;
	gap: 14px;
	margin-top: -35px;
	padding: 0 32px;
	overflow-x: auto;
	scrollbar-width: none;
}

.cmgs-thumbs::-webkit-scrollbar {
	display: none;
}

.cmgs-thumb {
	-webkit-appearance: none;
	appearance: none;
	-webkit-tap-highlight-color: transparent;
	box-sizing: border-box;
	flex: 0 0 auto;
	display: block;
	width: 70px;
	height: 70px;
	border-radius: 50%;
	border: 3px solid #fff;
	padding: 6px;
	background: transparent;
	cursor: pointer;
	margin: 0;
	position: relative;
	outline: none;
	box-shadow: none;
	transition: border-color 0.25s ease;
}

.cmgs-thumb:hover,
.cmgs-thumb:focus,
.cmgs-thumb:focus-visible,
.cmgs-thumb:active {
	background: transparent;
	outline: none;
	box-shadow: none;
	color: inherit;
}

.cmgs-thumb.is-active {
	border-color: #e07a3f;
}

.cmgs-thumb-inner {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: inherit;
	overflow: hidden;
	position: relative;
	background-color: #ccc;
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
}

.cmgs-thumb-inner {
	transition: width 0.2s ease, height 0.2s ease, margin 0.2s ease;
}

.cmgs-thumb:hover .cmgs-thumb-inner {
	width: calc(100% + 2px);
	height: calc(100% + 2px);
	margin: -1px;
}

.cmgs-thumb-inner::after {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: inherit;
	background-color: transparent;
	transition: background-color 0.25s ease;
}

.cmgs-thumb.is-active .cmgs-thumb-inner::after {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: inherit;
	background-color: rgba(224, 122, 63, 0.8);
}

.cmgs-play-icon {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	background: rgba(0,0,0,0.35);
	border-radius: inherit;
	z-index: 2;
}

.cmgs-play-icon--custom {
	inset: auto;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: auto;
	height: auto;
	background: transparent;
}

.cmgs-custom-play-icon-thumb {
	display: block;
	width: 22px;
	height: auto;
	max-width: none;
	pointer-events: none;
}

/* ---- Responsive ---- */
@media (max-width: 767px) {
	.cmgs-stage {
		height: 320px;
	}
	.cmgs-caption-box {
		max-width: 90%;
		padding: 18px 18px;
	}
	.cmgs-thumb {
		width: 54px;
		height: 54px;
	}
	.cmgs-thumbs {
		margin-top: -27px;
		padding: 0 16px;
	}
}

/* ---- Lightbox ---- */
body.cmgs-lightbox-open {
	overflow: hidden;
}

.cmgs-lightbox {
	position: fixed;
	inset: 0;
	display: none;
	align-items: center;
	justify-content: center;
	background: var(--cmgs-lb-bg, rgba(0, 0, 0, 0.9));
	z-index: 999999;
	padding: 30px;
	box-sizing: border-box;
}

.cmgs-lightbox.is-open {
	display: flex;
}

.cmgs-lightbox-img {
	display: block;
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.cmgs-lightbox-close {
	-webkit-appearance: none;
	appearance: none;
	position: fixed;
	top: var(--cmgs-lb-close-top, 20px);
	right: var(--cmgs-lb-close-right, 24px);
	width: var(--cmgs-lb-close-size, 44px);
	height: var(--cmgs-lb-close-size, 44px);
	padding: 0;
	border-radius: var(--cmgs-lb-close-radius, 50%);
	border: var(--cmgs-lb-close-border-width, 0) solid var(--cmgs-lb-close-border-color, transparent);
	background: var(--cmgs-lb-close-bg, rgba(255, 255, 255, 0.12));
	color: var(--cmgs-lb-close-color, #fff);
	font-size: var(--cmgs-lb-close-icon-size, 26px);
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.cmgs-lightbox-close:hover {
	background: var(--cmgs-lb-close-bg-hover, rgba(255, 255, 255, 0.25));
	color: var(--cmgs-lb-close-color-hover, var(--cmgs-lb-close-color, #fff));
	border-color: var(--cmgs-lb-close-border-color-hover, var(--cmgs-lb-close-border-color, transparent));
}

.cmgs-lightbox-close .cmgs-lb-close-img {
	display: block;
	width: var(--cmgs-lb-close-icon-size, 26px);
	height: auto;
	max-width: none;
	pointer-events: none;
}

.cmgs-lightbox-close .cmgs-lb-close-lib {
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
	pointer-events: none;
}

.cmgs-lightbox-close .cmgs-lb-close-lib svg {
	width: var(--cmgs-lb-close-icon-size, 26px);
	height: var(--cmgs-lb-close-icon-size, 26px);
	fill: currentColor;
}

/* ---- Video in lightbox ---- */
.cmgs-lightbox-video {
	display: none;
	width: min(1100px, 100%);
	aspect-ratio: 16 / 9;
	max-height: 100%;
}

.cmgs-lightbox.is-video .cmgs-lightbox-img {
	display: none;
}

.cmgs-lightbox.is-video .cmgs-lightbox-video {
	display: block;
}

.cmgs-lightbox-video-el {
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
	background: #000;
}

/* ---- Play button extras ---- */
.cmgs-lib-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
}

.cmgs-lib-icon svg {
	fill: currentColor;
}

.cmgs-play-overlay-label,
.cmgs-play-overlay-icon {
	transition: color 0.2s ease, background-color 0.2s ease;
}

/* ---- Video overlay + thumbnail library icon ---- */
.cmgs-video-overlay {
	position: absolute;
	inset: 0;
	background-color: transparent;
	pointer-events: none;
	z-index: 1;
	transition: background-color 0.25s ease;
}

.cmgs-slide.is-playing .cmgs-video-overlay {
	opacity: 0;
	visibility: hidden;
}

.cmgs-thumb-lib-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
}

.cmgs-thumb-lib-icon svg {
	fill: currentColor;
}
