.rcesd-gallery {
	--rcesd-gallery-gap: 16px;
	--rcesd-gallery-visible: 4;
	direction: rtl;
	background: #f4f7f5;
	border-radius: 28px;
	padding: 28px 28px 22px;
	font-family: "Yekan Bakh", Tahoma, sans-serif;
	color: #1c1c1c;
	box-sizing: border-box;
}

.rcesd-gallery__head {
	margin-bottom: 18px;
	text-align: right;
}

.rcesd-gallery__title {
	margin: 0 0 6px;
	font-size: 24px;
	font-weight: 800;
	line-height: 1.45;
}

.rcesd-gallery__subtitle {
	margin: 0;
	color: #8a938c;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.7;
}

.rcesd-gallery__stage {
	position: relative;
	display: flex;
	align-items: center;
	gap: 10px;
	direction: ltr; /* دکمه قبلی سمت چپ، بعدی سمت راست */
}

.rcesd-gallery__viewport {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	direction: rtl;
}

.rcesd-gallery__track {
	display: flex;
	gap: var(--rcesd-gallery-gap);
	transition: transform 0.4s ease;
	will-change: transform;
}

.rcesd-gallery__item {
	flex: 0 0 calc((100% - (var(--rcesd-gallery-visible) - 1) * var(--rcesd-gallery-gap)) / var(--rcesd-gallery-visible));
	min-width: 0;
}

.rcesd-gallery__card {
	position: relative;
	display: block;
	width: 100%;
	padding: 0;
	border: 0;
	overflow: hidden;
	border-radius: 22px;
	background: #dfe8e2;
	aspect-ratio: 4 / 3;
	cursor: pointer;
	text-align: right;
}

.rcesd-gallery__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.35s ease;
}

.rcesd-gallery__img--empty {
	background: linear-gradient(135deg, #d7eadc, #b9d4c4);
}

.rcesd-gallery__overlay {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: flex-end;
	padding: 16px;
	background: linear-gradient(to top, rgba(7, 40, 24, 0.78) 0%, rgba(7, 40, 24, 0.2) 48%, transparent 72%);
	opacity: 0;
	transition: opacity 0.25s ease;
}

.rcesd-gallery__caption {
	color: #fff;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.6;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.rcesd-gallery__card:hover .rcesd-gallery__overlay,
.rcesd-gallery__card:focus-visible .rcesd-gallery__overlay {
	opacity: 1;
}

.rcesd-gallery__card:hover .rcesd-gallery__img,
.rcesd-gallery__card:focus-visible .rcesd-gallery__img {
	transform: scale(1.05);
}

.rcesd-gallery__nav {
	flex: none;
	width: 44px;
	height: 44px;
	border: 0;
	border-radius: 50%;
	display: grid;
	place-items: center;
	cursor: pointer;
	box-shadow: 0 8px 20px rgba(16, 40, 24, 0.12);
	transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.rcesd-gallery__nav--prev {
	background: #1b8f46;
	color: #fff;
}

.rcesd-gallery__nav--next {
	background: #fff;
	color: #1c1c1c;
}

.rcesd-gallery__nav:hover {
	transform: scale(1.05);
}

.rcesd-gallery__nav:disabled {
	opacity: 0.35;
	cursor: default;
	transform: none;
}

.rcesd-gallery__dots {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 7px;
	margin-top: 16px;
	direction: ltr;
}

.rcesd-gallery__dot {
	width: 8px;
	height: 8px;
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: #c9d4cc;
	cursor: pointer;
}

.rcesd-gallery__dot.is-active {
	width: 22px;
	background: #1b8f46;
}

.rcesd-gallery__empty {
	margin: 8px 0 0;
	color: #6b7280;
}

/* پاپ‌آپ اسلایدر */
.rcesd-gallery-lightbox {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 24px;
	background: rgba(8, 20, 14, 0.86);
	direction: rtl;
	font-family: "Yekan Bakh", Tahoma, sans-serif;
}

.rcesd-gallery-lightbox.is-open {
	display: flex;
}

.rcesd-gallery-lightbox__dialog {
	position: relative;
	width: min(960px, 100%);
	max-height: calc(100vh - 48px);
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.rcesd-gallery-lightbox__title {
	margin: 0;
	color: #fff;
	font-size: 18px;
	font-weight: 700;
	line-height: 1.5;
	text-align: right;
}

.rcesd-gallery-lightbox__stage {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 240px;
}

.rcesd-gallery-lightbox__img {
	display: block;
	max-width: 100%;
	max-height: min(72vh, 720px);
	width: auto;
	height: auto;
	margin: 0 auto;
	border-radius: 16px;
	object-fit: contain;
	background: #111;
}

.rcesd-gallery-lightbox__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 46px;
	height: 46px;
	border: 0;
	border-radius: 50%;
	display: grid;
	place-items: center;
	cursor: pointer;
	box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.rcesd-gallery-lightbox__nav--prev {
	left: 8px;
	background: #1b8f46;
	color: #fff;
}

.rcesd-gallery-lightbox__nav--next {
	right: 8px;
	background: #fff;
	color: #1c1c1c;
}

.rcesd-gallery-lightbox__close {
	position: absolute;
	top: -6px;
	left: 0;
	width: 40px;
	height: 40px;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.14);
	color: #fff;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
}

.rcesd-gallery-lightbox__counter {
	color: rgba(255, 255, 255, 0.8);
	font-size: 13px;
	text-align: center;
}

body.rcesd-gallery-lock {
	overflow: hidden;
}

@media (max-width: 980px) {
	.rcesd-gallery {
		--rcesd-gallery-visible: 2;
		padding: 20px 16px 16px;
	}

	.rcesd-gallery__nav {
		width: 38px;
		height: 38px;
	}
}

@media (max-width: 640px) {
	.rcesd-gallery {
		--rcesd-gallery-visible: 1;
		border-radius: 22px;
	}

	.rcesd-gallery__title {
		font-size: 20px;
	}

	.rcesd-gallery__overlay {
		opacity: 1;
	}

	.rcesd-gallery-lightbox__nav--prev {
		left: 0;
	}

	.rcesd-gallery-lightbox__nav--next {
		right: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.rcesd-gallery__track,
	.rcesd-gallery__nav,
	.rcesd-gallery__img,
	.rcesd-gallery__overlay {
		transition: none;
	}
}
