.sce-stacking-cards {
	position: relative;
	width: 100%;
	display: flex;
	flex-direction: column;
	gap: 0;
	--sce-scale-amount: 0.06;
	--sce-opacity-amount: 0.15;
	--sce-tilt-angle: 3deg;
	--sce-image-zoom: 0.15;
}

.sce-card {
	position: -webkit-sticky;
	position: sticky;
	width: 100%;
	box-sizing: border-box;
	overflow: hidden;
	will-change: transform, opacity;
	transform-origin: center top;
}

/* Плавность обеспечивается коротким transition — сам прогресс (--sce-cover / --sce-reveal)
 * уже вычисляется непрерывно в JS на каждый кадр скролла, поэтому transition здесь
 * лишь сглаживает "ступеньки" между кадрами requestAnimationFrame. */
.sce-card {
	transition: transform 0.05s linear, opacity 0.05s linear, filter 0.05s linear;
}

/* ==========================================================
 * Эффект глубины стопки (карточка уменьшается и затемняется,
 * когда её накрывает следующая карточка) — непрерывный, а не бинарный.
 * ========================================================== */
.sce-scale-effect .sce-card {
	transform:
		scale( calc( 1 - var( --sce-cover, 0 ) * var( --sce-scale-amount, 0.06 ) ) )
		translateY( calc( var( --sce-cover, 0 ) * -6px ) );
	opacity: calc( 1 - var( --sce-cover, 0 ) * var( --sce-opacity-amount, 0.15 ) );
	filter: brightness( calc( 1 - var( --sce-cover, 0 ) * 0.1 ) );
}

/* Лёгкий наклон карточек в стопке — вдохновлено эффектом "карточки веером". */
.sce-tilt-effect.sce-scale-effect .sce-card:nth-child(odd) {
	transform:
		scale( calc( 1 - var( --sce-cover, 0 ) * var( --sce-scale-amount, 0.06 ) ) )
		translateY( calc( var( --sce-cover, 0 ) * -6px ) )
		rotate( calc( var( --sce-cover, 0 ) * var( --sce-tilt-angle, 3deg ) * -1 ) );
}

.sce-tilt-effect.sce-scale-effect .sce-card:nth-child(even) {
	transform:
		scale( calc( 1 - var( --sce-cover, 0 ) * var( --sce-scale-amount, 0.06 ) ) )
		translateY( calc( var( --sce-cover, 0 ) * -6px ) )
		rotate( calc( var( --sce-cover, 0 ) * var( --sce-tilt-angle, 3deg ) ) );
}

/* ==========================================================
 * Обычная карточка с картинкой
 * ========================================================== */
.sce-card__media {
	position: absolute;
	inset: 0;
	z-index: 0;
	overflow: hidden;
}

.sce-card__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.05s linear;
}

/* Эффект "раскрытия" изображения: картинка чуть увеличена и плавно
 * уменьшается до нормального масштаба по мере того, как карточка
 * занимает своё место — как во втором референс-видео. */
.sce-image-zoom .sce-card__media img {
	transform: scale( calc( 1 + var( --sce-image-zoom, 0.15 ) * ( 1 - var( --sce-reveal, 1 ) ) ) );
}

.sce-card__inner {
	position: relative;
	z-index: 1;
	width: 100%;
	height: 100%;
	display: flex;
	flex-direction: column;
	justify-content: center;
}

/* Затемняющая подложка и белый текст, если у карточки есть фоновое изображение */
.sce-card__scrim {
	position: absolute;
	inset: 0;
	z-index: 0;
	background: linear-gradient(0deg, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0.15) 55%, rgba(0,0,0,0) 100%);
	pointer-events: none;
}

.sce-card--has-image .sce-card__title,
.sce-card--has-image .sce-card__description {
	color: #fff;
}

/* Карточка с готовой секцией Elementor — контент занимает всё пространство карточки */
.sce-card--template {
	padding: 0 !important;
}

.sce-card__template-content {
	width: 100%;
	height: 100%;
}

.sce-card__template-content--empty {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 100%;
	padding: 20px;
	color: #999;
	font-style: italic;
}

.sce-card__text {
	transform: translate( var( --sce-text-offset-x, 0px ), var( --sce-text-offset-y, 0px ) );
}

.sce-card__title {
	margin: 0 0 12px 0;
}

.sce-card__description {
	margin: 0 0 16px 0;
}

.sce-card__button {
	position: absolute;
	display: inline-block;
	padding: 10px 22px;
	border-radius: 999px;
	text-decoration: none;
	font-weight: 600;
	transition: opacity 0.2s ease;
	transform: translate( var( --sce-button-offset-x, 0px ), var( --sce-button-offset-y, 0px ) );
}

/* Расположение кнопки: крепится к одному из углов карточки и не
 * зависит от заголовка/описания — те могут быть любой высоты. */
.sce-card__button--bottom-left {
	left: var( --sce-button-gap, 24px );
	bottom: var( --sce-button-gap, 24px );
}

.sce-card__button--bottom-right {
	right: var( --sce-button-gap, 24px );
	bottom: var( --sce-button-gap, 24px );
}

.sce-card__button--top-left {
	left: var( --sce-button-gap, 24px );
	top: var( --sce-button-gap, 24px );
}

.sce-card__button--top-right {
	right: var( --sce-button-gap, 24px );
	top: var( --sce-button-gap, 24px );
}

.sce-card__button:hover {
	opacity: 0.85;
}

/* ==========================================================
 * Эффект "раскрытия" текста: заголовок, описание и кнопка плавно
 * появляются снизу вверх по мере того, как карточка становится активной.
 * ========================================================== */
.sce-text-reveal .sce-card__title,
.sce-text-reveal .sce-card__description {
	opacity: var( --sce-reveal, 1 );
	transform: translateY( calc( ( 1 - var( --sce-reveal, 1 ) ) * 24px ) );
	transition: opacity 0.05s linear, transform 0.05s linear;
}

.sce-text-reveal .sce-card__button {
	opacity: var( --sce-reveal, 1 );
	transform:
		translate( var( --sce-button-offset-x, 0px ), var( --sce-button-offset-y, 0px ) )
		translateY( calc( ( 1 - var( --sce-reveal, 1 ) ) * 24px ) );
	transition: opacity 0.05s linear, transform 0.05s linear;
}

.sce-text-reveal .sce-card__description {
	transition-delay: 0.03s;
}

.sce-text-reveal .sce-card__button {
	transition-delay: 0.06s;
}

/* ==========================================================
 * Сплит-макет карточки: текст в одной половине, картинка в другой
 * (как на референсном скриншоте — год/заголовок и текст слева на
 * белом фоне, фотография во всю высоту справа, и наоборот).
 * ========================================================== */
.sce-card--split-layout {
	padding: 0 !important;
}

.sce-card__split {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: stretch;
	width: 100%;
	height: 100%;
}

.sce-card__split--split-left {
	flex-direction: row;
}

.sce-card__split--split-right {
	flex-direction: row-reverse;
}

.sce-card__split-text {
	width: 50%;
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	justify-content: center;
	overflow: auto;
}

.sce-card__split-media {
	width: 50%;
	position: relative;
	overflow: hidden;
	flex-shrink: 0;
}

.sce-card__split-media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* Сплит-карточка не затемняется/не окрашивается в белый принудительно —
 * цвет текста задаётся отдельными контролами стиля, а не унаследован
 * от .sce-card--has-image (это правило только для оверлей-макета). */
.sce-card--split-layout.sce-card--has-image .sce-card__title,
.sce-card--split-layout.sce-card--has-image .sce-card__description {
	color: inherit;
}

@media (max-width: 767px) {
	.sce-card__split {
		flex-direction: column !important;
	}

	.sce-card__split-text,
	.sce-card__split-media {
		width: 100% !important;
	}

	.sce-card__split-media {
		min-height: 220px;
	}
}


@media (max-width: 767px) {
	.sce-disable-mobile .sce-card {
		position: relative !important;
		top: 0 !important;
		margin-bottom: 20px;
		transform: none !important;
		opacity: 1 !important;
		filter: none !important;
	}

	.sce-disable-mobile .sce-card__media img {
		transform: none !important;
	}

	.sce-disable-mobile .sce-card__title,
	.sce-disable-mobile .sce-card__description,
	.sce-disable-mobile .sce-card__button {
		opacity: 1 !important;
		transform: none !important;
	}
}
