.epcg-gallery {
	--epcg-main-bg: #3d3d3d;
	--epcg-caption-bg: #000000;
	--epcg-caption-color: #ffffff;
	--epcg-thumb-active-border: #4caf50;
	--epcg-arrow-bg: #000000;
	--epcg-arrow-color: #ffffff;
	--epcg-pagination-bg: #b0b0b0;
	--epcg-pagination-color: #ffffff;
	--epcg-pagination-active-bg: #5a5a5a;
	--epcg-thumb-gap: 4px;

	max-width: 100%;
	margin: 0 auto;
}

.epcg-gallery__main {
	position: relative;
	background-color: var(--epcg-main-bg);
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	box-sizing: border-box;
}

.epcg-gallery__main-stage {
	position: relative;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 1 1 auto;
	width: calc(100% - 72px);
	max-width: 100%;
	height: 100%;
	min-width: 0;
	padding: 8px 4px;
	box-sizing: border-box;
}

.epcg-gallery__main--no-arrows .epcg-gallery__main-stage {
	width: 100%;
	padding-left: 8px;
	padding-right: 8px;
}

.epcg-gallery__main-trigger {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	max-width: 100%;
	max-height: 100%;
	padding: 0;
	border: none;
	background: transparent;
	cursor: zoom-in;
}

.epcg-gallery__main-trigger:focus-visible {
	outline: 2px solid var(--epcg-arrow-color);
	outline-offset: 4px;
}

.epcg-gallery__main-image {
	display: block;
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	object-position: center;
}

.epcg-lightbox {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	box-sizing: border-box;
}

.epcg-lightbox[hidden] {
	display: none !important;
}

.epcg-lightbox__backdrop {
	position: absolute;
	inset: 0;
	background-color: rgba(0, 0, 0, 0.92);
	cursor: pointer;
}

.epcg-lightbox__dialog {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	width: 100%;
	max-width: 100%;
	max-height: 100%;
	margin: 0;
	pointer-events: none;
}

.epcg-lightbox__image-wrap {
	display: flex;
	align-items: center;
	justify-content: center;
	max-width: min(96vw, 1600px);
	max-height: calc(100vh - 120px);
	pointer-events: auto;
}

.epcg-lightbox__image {
	display: block;
	max-width: 100%;
	max-height: calc(100vh - 120px);
	width: auto;
	height: auto;
	object-fit: contain;
	object-position: center;
	box-shadow: 0 8px 40px rgba(0, 0, 0, 0.45);
}

.epcg-lightbox__caption {
	margin: 16px 0 0;
	max-width: min(96vw, 900px);
	color: #ffffff;
	font-size: 15px;
	line-height: 1.5;
	text-align: center;
	pointer-events: auto;
}

.epcg-lightbox__close {
	position: absolute;
	top: 16px;
	right: 16px;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: none;
	border-radius: 4px;
	background-color: rgba(0, 0, 0, 0.65);
	color: #ffffff;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.epcg-lightbox__close:hover,
.epcg-lightbox__close:focus {
	background-color: rgba(0, 0, 0, 0.85);
	outline: 2px solid #ffffff;
	outline-offset: 2px;
}

body.epcg-lightbox-open {
	overflow: hidden;
}

.epcg-gallery__arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: none;
	background-color: var(--epcg-arrow-bg);
	color: var(--epcg-arrow-color);
	cursor: pointer;
	transition: opacity 0.2s ease;
}

.epcg-gallery__arrow:hover,
.epcg-gallery__arrow:focus {
	opacity: 0.85;
	outline: 2px solid var(--epcg-arrow-color);
	outline-offset: 2px;
}

.epcg-gallery__arrow:disabled {
	opacity: 0.35;
	cursor: not-allowed;
}

.epcg-gallery__arrow--prev {
	left: 0;
}

.epcg-gallery__arrow--next {
	right: 0;
}

.epcg-gallery__arrow span {
	font-size: 22px;
	line-height: 1;
}

.epcg-gallery__caption {
	background-color: var(--epcg-caption-bg);
	color: var(--epcg-caption-color);
	padding: 12px 16px;
	text-align: center;
	font-size: 15px;
	line-height: 1.5;
	min-height: 1.5em;
}

.epcg-gallery__caption:empty::before {
	content: '\00a0';
}

.epcg-gallery__thumbs {
	display: flex;
	flex-wrap: nowrap;
	gap: var(--epcg-thumb-gap);
	margin-top: var(--epcg-thumb-gap);
}

.epcg-gallery__thumb {
	flex: 1 1 0;
	min-width: 0;
	padding: 0;
	border: 3px solid transparent;
	background: none;
	cursor: pointer;
	overflow: hidden;
	transition: border-color 0.2s ease;
}

.epcg-gallery__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	aspect-ratio: 4 / 3;
}

.epcg-gallery__thumb.is-active {
	border-color: var(--epcg-thumb-active-border);
}

.epcg-gallery__thumb:hover:not(.is-active) {
	border-color: rgba(255, 255, 255, 0.35);
}

.epcg-gallery__pagination {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 6px;
	margin-top: 16px;
}

.epcg-gallery__page-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 32px;
	height: 32px;
	padding: 0 8px;
	border: none;
	border-radius: 4px;
	background-color: var(--epcg-pagination-bg);
	color: var(--epcg-pagination-color);
	font-size: 14px;
	font-weight: 600;
	line-height: 1;
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.epcg-gallery__page-btn:hover:not(:disabled),
.epcg-gallery__page-btn:focus:not(:disabled) {
	background-color: var(--epcg-pagination-active-bg);
	outline: none;
}

.epcg-gallery__page-btn.is-active {
	background-color: var(--epcg-pagination-active-bg);
	cursor: default;
}

.epcg-gallery__page-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.epcg-gallery__ellipsis {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 24px;
	height: 32px;
	color: var(--epcg-pagination-color);
	font-size: 14px;
	font-weight: 600;
	user-select: none;
}

@media (max-width: 767px) {
	.epcg-gallery__arrow {
		width: 30px;
		height: 30px;
	}

	.epcg-gallery__caption {
		font-size: 13px;
		padding: 10px 12px;
	}

	.epcg-gallery__thumbs {
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: thin;
	}

	.epcg-gallery__thumb {
		flex: 0 0 28%;
	}
}
