/* ─── کارت‌های چسبان — روی هم کامل (viewport pin) ─── */

.home-features-stack {
	--stack-deep: #7a1415;
	--stack-base: #bf1f20;
	--stack-light: #d94546;
	position: relative;
	z-index: 4;
	isolation: isolate;
	background-color: var(--stack-base);
	background-image:
		linear-gradient(180deg, var(--stack-deep) 0%, var(--stack-base) 22%, var(--stack-base) 100%);
	color: #f8fafc;
	/* مهم: overflow نباید clip/hidden باشد؛ pin فیکس GSAP را می‌شکند */
	overflow: visible;
	margin-top: 0;
	padding-top: 0;
	padding-bottom: 0;
}

.home-features-stack::before {
	content: '';
	position: absolute;
	inset: 0;
	z-index: 0;
	background:
		radial-gradient(ellipse 70% 45% at 50% 0%, rgba(255, 255, 255, 0.07), transparent 58%);
	pointer-events: none;
}

.home-features-stack__inner {
	position: relative;
	z-index: 3;
	padding-top: clamp(1rem, 3vh, 2rem);
	padding-bottom: 0.5rem;
}

.home-features-stack__pinned {
	position: relative;
	z-index: 3;
	display: flex;
	flex-direction: column;
	justify-content: center;
	min-height: 100vh;
	min-height: 100dvh;
	box-sizing: border-box;
	padding-block: clamp(1rem, 3vh, 2rem);
}

.home-features-stack__title {
	font-size: clamp(1.25rem, 3.2vw, 2rem);
	line-height: 1.25;
	margin-bottom: 0.75rem;
	color: #fff;
}

.home-features-stack__title-accent {
	color: #fff;
}

.home-features-stack__lead {
	max-width: 42rem;
	color: rgba(255, 255, 255, 0.68);
}

.home-features-stack__track {
	position: relative;
	z-index: 3;
	width: 100%;
	max-width: 100rem;
	margin-inline: auto;
	margin-top: clamp(1.25rem, 3.5vh, 2.5rem);
	padding-inline: clamp(1rem, 4vw, 3rem);
	--stack-top: clamp(3.25rem, 8vh, 4.75rem);
	--card-h: clamp(18rem, 52vh, 26rem);
	--stack-enter-y: clamp(2rem, 6vh, 4rem);
	--stack-gap: clamp(1rem, 2.5vh, 1.75rem);
	--stack-end-gap: clamp(4rem, 12vh, 8rem);
}

.home-features-stack__pin {
	position: relative;
	height: var(--card-h);
	margin-top: 0;
	overflow: hidden;
	border-radius: clamp(1.25rem, 2.5vw, 1.75rem);
}

.home-features-stack-swiper {
	width: 100%;
	overflow: visible;
}

.home-features-stack-pagination {
	display: none;
}

.home-features-stack__card {
	--stack-i: 0;
	position: absolute;
	inset: 0;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: calc(var(--stack-i) + 1);
	display: grid;
	grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.15fr) minmax(0, 1fr);
	gap: clamp(1rem, 2.5vw, 2rem);
	align-items: center;
	width: 100%;
	height: var(--card-h);
	min-height: var(--card-h);
	max-height: var(--card-h);
	padding: clamp(1.25rem, 3vw, 2rem) clamp(1.25rem, 3vw, 2.25rem);
	border-radius: clamp(1.25rem, 2.5vw, 1.75rem);
	background: linear-gradient(145deg, #6b1011 0%, #851618 42%, #6b1011 100%);
	color: #f8fafc;
	box-shadow:
		0 4px 6px rgba(0, 0, 0, 0.18),
		0 24px 48px rgba(74, 10, 11, 0.35);
	border: 1px solid rgba(255, 255, 255, 0.14);
	box-sizing: border-box;
	overflow: hidden;
	transform-origin: center top;
	will-change: transform, opacity;
}

.home-features-stack__card-heading {
	font-size: clamp(1.35rem, 2.8vw, 2.15rem);
	font-weight: 900;
	line-height: 1.15;
	letter-spacing: -0.02em;
}

.home-features-stack__card-text {
	font-size: clamp(0.8125rem, 1.5vw, 0.9375rem);
	line-height: 1.75;
	color: rgba(248, 250, 252, 0.82);
	margin-bottom: clamp(0.875rem, 2vw, 1.25rem);
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	overflow: hidden;
}

.home-features-stack__tags {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.home-features-stack__tag {
	display: inline-flex;
	align-items: center;
	padding: 0.35rem 0.75rem;
	border-radius: 9999px;
	font-size: 0.75rem;
	font-weight: 600;
	line-height: 1.3;
	background: rgba(255, 255, 255, 0.1);
	color: rgba(248, 250, 252, 0.92);
	border: 1px solid rgba(255, 255, 255, 0.12);
	white-space: nowrap;
}

.home-features-stack__card-media {
	position: relative;
	width: 100%;
	height: 100%;
	max-height: calc(var(--card-h) - 2.5rem);
	border-radius: clamp(0.875rem, 1.8vw, 1.25rem);
	overflow: hidden;
	background: linear-gradient(145deg, #851618, #9a1a1b 50%, #6b1011);
}

.home-features-stack__card-media.is-fallback .home-features-stack__card-img {
	display: none;
}

.home-features-stack__card-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.home-features-stack__card-title {
	text-align: start;
}

.home-features-stack__card--title-lottie .home-features-stack__card-title {
	display: flex;
	justify-content: flex-start;
	align-items: center;
	width: 100%;
	min-width: 0;
}

.home-features-stack__card--title-lottie .home-features-stack__card-title-row {
	display: inline-flex;
	flex-direction: row;
	align-items: center;
	gap: clamp(0.35rem, 0.9vw, 0.65rem);
	max-width: 100%;
}

.home-features-stack__card--title-lottie .home-features-stack__card-heading {
	margin: 0;
	flex-shrink: 0;
	order: 1;
	transform: translateY(-0.12em);
}

.home-features-stack__card--title-lottie .home-features-stack__card-lottie {
	position: relative;
	order: 2;
	flex-shrink: 0;
	width: clamp(6.4rem, 12.75vw, 9.75rem);
	height: clamp(6.4rem, 12.75vw, 9.75rem);
	line-height: 0;
}

.home-features-stack__card--title-lottie .home-features-stack__lottie {
	display: block;
	width: 100%;
	height: 100%;
}

.home-features-stack__card--title-lottie .home-features-stack__lottie dotlottie-wc {
	display: block;
	width: 100%;
	height: 100%;
	min-height: 0;
	max-height: none;
}

/* Tablet / موبایل عریض */
@media (max-width: 63.99rem) {
	.home-features-stack__track {
		--card-h: clamp(22rem, 58vh, 32rem);
		--stack-enter-y: clamp(1.5rem, 4.5vh, 3rem);
	}

	.home-features-stack__card {
		grid-template-columns: 1fr;
		grid-template-rows: auto 1fr auto;
		align-content: start;
	}

	.home-features-stack__card-title {
		order: 1;
	}

	.home-features-stack__card--title-lottie .home-features-stack__card-lottie {
		width: clamp(5.65rem, 27vw, 8.25rem);
		height: clamp(5.65rem, 27vw, 8.25rem);
	}

	.home-features-stack__card-body {
		order: 2;
		min-height: 0;
	}

	.home-features-stack__card-media {
		order: 3;
		height: clamp(8.5rem, 20vh, 11.5rem);
		max-height: clamp(8.5rem, 20vh, 11.5rem);
	}
}

/* دسکتاپ: Swiper خاموش — استک اسکرولی مثل قبل */
@media (min-width: 1024px) {
	.home-features-stack-swiper {
		overflow: visible;
		margin: 0;
		padding: 0;
	}

	.home-features-stack-swiper .home-features-stack__pin.swiper-wrapper {
		display: block;
		transform: none !important;
		position: relative;
		height: var(--card-h);
		overflow: hidden;
		border-radius: clamp(1.25rem, 2.5vw, 1.75rem);
	}

	.home-features-stack-swiper .home-features-stack__card.swiper-slide {
		position: absolute;
		inset: 0;
		width: 100% !important;
		height: var(--card-h) !important;
		margin: 0 !important;
		flex-shrink: 1;
	}

	.home-features-stack-pagination {
		display: none !important;
	}
}

/* موبایل: کاروسل افقی مثل قیمت — بدون اسکرول افقی صفحه */
@media (max-width: 1023px) {
	.home-features-stack {
		--stack-bottom-nav: 5.25rem;
		--stack-sticky-top: 4.75rem;
		--stack-header-budget: 7.25rem;
		padding-bottom: 1rem;
		overflow-x: hidden;
		max-width: 100vw;
	}

	.home-features-stack.is-mobile-swiper .home-features-stack__pinned,
	.home-features-stack__pinned {
		min-height: 0;
		height: auto;
		justify-content: flex-start;
		padding-top: 1.15rem;
		padding-bottom: 0.85rem;
		box-sizing: border-box;
		overflow-x: hidden;
		max-width: 100%;
	}

	.home-features-stack__inner {
		padding-top: 0;
		padding-bottom: 0;
		flex-shrink: 0;
		max-width: 100%;
	}

	.home-features-stack__header {
		margin-bottom: 0;
	}

	.home-features-stack__title {
		font-size: clamp(1.05rem, 4.4vw, 1.35rem);
		line-height: 1.4;
		margin-bottom: 0.45rem;
	}

	.home-features-stack__lead {
		font-size: 0.78rem;
		line-height: 1.65;
		margin: 0 0 0.35rem;
		-webkit-line-clamp: 3;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		overflow: hidden;
	}

	.home-features-stack__track {
		margin-top: 1.15rem;
		padding-inline: 0;
		flex: none;
		min-height: 0;
		display: block;
		--card-h: auto;
		width: 100%;
		max-width: 100%;
		overflow: hidden;
	}

	.home-features-stack-swiper {
		overflow: hidden;
		width: 100%;
		max-width: 100%;
		margin-inline: 0;
		padding: 0.35rem 1rem 0.5rem;
		box-sizing: border-box;
	}

	.home-features-stack-swiper .home-features-stack__pin.swiper-wrapper {
		display: flex;
		align-items: stretch;
		height: auto;
		overflow: visible;
		border-radius: 0;
		/* transform را Swiper مدیریت می‌کند — دستی none نگذارید */
	}

	.home-features-stack-swiper .home-features-stack__card.swiper-slide {
		position: relative;
		inset: auto;
		top: auto;
		left: auto;
		right: auto;
		bottom: auto;
		width: min(82vw, 22.5rem);
		height: auto;
		min-height: 0;
		max-height: none;
		margin: 0;
		flex-shrink: 0;
		box-sizing: border-box;
		opacity: 1;
		visibility: visible;
		will-change: transform;
		padding: 0.9rem 1rem 1rem;
		gap: 0.55rem;
		grid-template-columns: 1fr;
		grid-template-rows: auto auto auto;
		box-shadow: 0 4px 12px rgba(0, 0, 0, 0.16);
	}

	.home-features-stack-swiper .home-features-stack__card.swiper-slide:not(.swiper-slide-active) {
		box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
	}

	.home-features-stack-swiper .home-features-stack__card.swiper-slide-active {
		z-index: 2;
		box-shadow:
			0 6px 16px rgba(0, 0, 0, 0.18),
			0 0 0 1px rgba(255, 255, 255, 0.12);
	}

	.home-features-stack__card-heading {
		font-size: clamp(1.1rem, 5vw, 1.35rem);
	}

	.home-features-stack__card-text {
		font-size: 0.78rem;
		line-height: 1.6;
		margin-bottom: 0.45rem;
		-webkit-line-clamp: 3;
	}

	.home-features-stack__tag {
		font-size: 0.66rem;
		padding: 0.26rem 0.55rem;
	}

	.home-features-stack__card-media {
		order: 3;
		height: clamp(10rem, 32vw, 13rem);
		max-height: none;
		min-height: 9.5rem;
		align-self: stretch;
	}

	.home-features-stack__card--title-lottie .home-features-stack__card-lottie {
		width: clamp(4.25rem, 20vw, 6rem);
		height: clamp(4.25rem, 20vw, 6rem);
	}

	.home-features-stack-pagination {
		display: flex;
		justify-content: center;
		align-items: center;
		gap: 0.4rem;
		margin-top: 0.65rem;
		margin-bottom: 0;
		position: static;
	}

	.home-features-stack-pagination .swiper-pagination-bullet {
		width: 0.45rem;
		height: 0.45rem;
		margin: 0 !important;
		background: rgba(255, 255, 255, 0.35);
		opacity: 1;
		border-radius: 999px;
		transition: width 0.25s ease, background 0.25s ease;
	}

	.home-features-stack-pagination .swiper-pagination-bullet-active {
		width: 1.15rem;
		background: #fff;
	}
}

/* گوشی‌های کوتاه */
@media (max-width: 1023px) and (max-height: 700px) {
	.home-features-stack__lead {
		-webkit-line-clamp: 2;
		font-size: 0.72rem;
	}

	.home-features-stack__card-media {
		height: clamp(8.5rem, 22vh, 11rem);
		min-height: 8rem;
		max-height: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.home-features-stack__pinned {
		min-height: 0;
	}

	.home-features-stack__card {
		position: relative;
		inset: auto;
		height: auto;
		min-height: auto;
		max-height: none;
		overflow: visible;
		opacity: 1;
		pointer-events: auto;
		transform: none;
	}

	.home-features-stack__card + .home-features-stack__card {
		margin-top: 1rem;
	}

	.home-features-stack__card-text {
		-webkit-line-clamp: unset;
		display: block;
		overflow: visible;
	}

	.home-features-stack__pin {
		height: auto;
		overflow: visible;
	}
}

/* تم تیره — متن و کارت‌ها */
html[data-theme="dark"] .home-features-stack {
	color: #f1f5f9;
}

html[data-theme="dark"] .home-features-stack__title {
	color: #fffbbd;
}

html[data-theme="dark"] .home-features-stack__title-accent {
	color: #fffbbd;
}

html[data-theme="dark"] .home-features-stack__lead {
	color: rgba(254, 226, 226, 0.78);
}

html[data-theme="dark"] .home-features-stack__card {
	background: linear-gradient(145deg, #4a0d0e 0%, #6b1011 45%, #3d0a0b 100%);
	border-color: rgba(255, 255, 255, 0.1);
	box-shadow:
		0 4px 6px rgba(0, 0, 0, 0.28),
		0 24px 48px rgba(0, 0, 0, 0.4);
}
