/**
 * سلايدر الرئيسية لثيم تنمية العرضية (template-parts/home/home-sliders.php).
 *
 * تكوين منقسم: لوح تركوازي عميق بنقش البذور يغطي جهة البداية (يمين، 46% من العرض) ثابتاً خلف الشرائح،
 * وعليه النص الأبيض. وفي الجهة الأخرى خلفية خضراء فاتحة عليها صورة الشريحة داخل قناع ورقة كبير
 * (180px و24px متناوبة) يتداخل مع حافة اللوح، وشارة غرسة خضراء على ركنها. أسفل اللوح عدّاد «01 / 03»
 * وأشرطة تقدّم وزرّا التنقل، ثم مدرجات العرضية بلون خلفية الصفحة. على الجوال: الصورة أعلى واللوح تحتها.
 */

.tn-hero {
	--tn-hero-h: clamp(580px, calc(100vh - 130px), 740px);
	--tn-hero-sky: 70px;
	--tn-hero-panel: 46%;
	--tn-hero-leaf: 180px 24px 180px 24px;
	position: relative;
	isolation: isolate;
	overflow: hidden;
	background: var(--tn-sand);
	color: var(--tn-ink);
}

/* اللوح التركوازي: ثابت لا يتلاشى مع الشرائح، بنقش البذور ووهج أخضر خافت في أعلاه */
.tn-hero__panel {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	z-index: -1;
	width: var(--tn-hero-panel);
	--tn-grid-color: rgba(255, 255, 255, 0.08);
	background:
		radial-gradient(ellipse 70% 50% at 70% 0%, rgba(var(--theme-secondary-rgb), 0.22), transparent 70%),
		var(--tn-grid),
		linear-gradient(165deg, var(--theme-primary), var(--tn-deep) 70%);
	pointer-events: none;
}

/* حافة اللوح الداخلية: خط أخضر رقيق متقطع كحدّ الحقل */
.tn-hero__panel::after {
	content: '';
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	width: 3px;
	background: linear-gradient(to bottom, transparent, rgba(var(--theme-secondary-rgb), 0.7) 30%, rgba(var(--theme-secondary-rgb), 0.7) 70%, transparent);
}

.tn-hero__slider {
	overflow: hidden;
}

.tn-hero .swiper-slide {
	height: auto;
}

/* الشرائح فوق بعضها قبل تهيئة Swiper: تظهر الأولى فقط */
.tn-hero__slider:not(.swiper-initialized) .swiper-slide:not(:first-child) {
	display: none;
}

/* الشريحة: عمودان، النص في البداية (فوق اللوح) والصورة في الطرف الآخر تتداخل معه */
.tn-hero__slide {
	display: grid;
	grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
	align-items: center;
	gap: 40px;
	min-height: var(--tn-hero-h);
	padding-top: 56px;
	padding-bottom: calc(var(--tn-hero-sky) + 92px);
}

.tn-hero__slide--text {
	grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
}

/* ==========================================================================
   النص فوق اللوح
   ========================================================================== */

.tn-hero__content {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	padding-inline-end: 56px; /* مسافة عن طرف الصورة المتداخل مع اللوح */
	color: #ffffff;
}

.tn-hero__eyebrow {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 18px;
	padding: 6px 14px 6px 16px;
	border-radius: 999px;
	background: rgba(var(--theme-secondary-rgb), 0.2);
	color: color-mix(in srgb, var(--theme-secondary) 18%, #fff);
	font-size: 0.86rem;
	font-weight: 700;
	line-height: 1.5;
}

.tn-hero__eyebrow svg {
	width: 17px;
	height: 17px;
	color: var(--theme-secondary);
}

.tn-hero__title {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin: 0 0 18px;
	color: #ffffff;
	font-size: clamp(2rem, 1.2rem + 2.4vw, 3.3rem);
	font-weight: 800;
	line-height: 1.22;
}

.tn-hero__title-accent {
	color: color-mix(in srgb, var(--theme-secondary) 55%, #fff);
	font-size: 0.56em;
	font-weight: 700;
}

.tn-hero__title-main {
	color: #ffffff;
}

.tn-hero .tn-ornament {
	color: var(--theme-secondary);
}

.tn-hero .tn-ornament .tn-ornament__line {
	width: 56px;
}

.tn-hero__desc {
	max-width: 500px;
	margin: 20px 0 0;
	color: rgba(255, 255, 255, 0.84);
	font-size: 1.04rem;
	line-height: 1.95;
}

.tn-hero__desc p {
	margin: 0;
}

.tn-hero__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin-top: 30px;
}

.tn-hero__btn {
	padding: 14px 28px;
	font-size: 1rem;
}

.tn-hero .tn-btn--light {
	border-color: rgba(255, 255, 255, 0.45);
	background: rgba(255, 255, 255, 0.06);
}

/* ==========================================================================
   الصورة داخل قناع الورقة
   ========================================================================== */

.tn-hero__figure {
	position: relative;
	margin: 0;
	margin-inline-start: -72px; /* تتداخل الصورة مع حافة اللوح */
}

.tn-hero__media {
	position: relative;
	aspect-ratio: 7 / 5.4;
	max-height: calc(var(--tn-hero-h) - var(--tn-hero-sky) - 120px);
	width: 100%;
	overflow: hidden;
	border-radius: var(--tn-hero-leaf);
	background: var(--tn-sand-deep);
	box-shadow: 0 30px 60px -30px rgba(var(--theme-primary-rgb), 0.55);
}

/* خط أبيض داخلي رقيق يحدد الورقة */
.tn-hero__media::after {
	content: '';
	position: absolute;
	inset: 0;
	border: 6px solid rgba(255, 255, 255, 0.9);
	border-radius: inherit;
	pointer-events: none;
}

.tn-hero__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transform: scale(1.08);
	transition: transform 9s ease-out;
}

/* تقترب الصورة ببطء في الشريحة الظاهرة */
.tn-hero .swiper-slide-active .tn-hero__img,
.tn-hero__slider:not(.swiper-initialized) .tn-hero__img {
	transform: scale(1.01);
}

/* شارة الغرسة على الركن السفلي شبه الحاد (بعيداً عن اللوح) */
.tn-hero__badge {
	position: absolute;
	left: -18px;
	bottom: 28px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 92px;
	height: 92px;
	padding: 20px;
	border: 6px solid var(--tn-sand);
	border-radius: 46px 10px 46px 10px;
	background: var(--theme-secondary);
	color: #ffffff;
	box-shadow: 0 18px 30px -16px rgba(var(--theme-secondary-rgb), 0.9);
}

.tn-hero__badge svg {
	width: 100%;
	height: 100%;
}

/* حركة دخول خفيفة للنص في الشريحة الظاهرة */
.tn-hero .swiper-slide-active .tn-hero__content > * {
	animation: tn-hero-rise 0.9s var(--tn-ease) both;
}

.tn-hero .swiper-slide-active .tn-hero__title {
	animation-delay: 0.1s;
}

.tn-hero .swiper-slide-active .tn-hero__desc {
	animation-delay: 0.2s;
}

.tn-hero .swiper-slide-active .tn-hero__actions {
	animation-delay: 0.3s;
}

.tn-hero .swiper-slide-active .tn-hero__badge {
	animation: tn-hero-pop 0.8s 0.35s var(--tn-ease) both;
}

@keyframes tn-hero-rise {
	from {
		opacity: 0;
		transform: translateY(18px);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

@keyframes tn-hero-pop {
	from {
		opacity: 0;
		transform: scale(0.6) rotate(-12deg);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

/* ==========================================================================
   المدرجات والتحكم (العدّاد وأشرطة التقدّم)
   ========================================================================== */

.tn-hero__terraces {
	position: absolute;
	inset: auto 0 -1px;
	z-index: 2;
	width: 100%;
	height: var(--tn-hero-sky);
	color: var(--theme-bg-body, var(--tn-stone));
	pointer-events: none;
}

.tn-hero__controls {
	position: absolute;
	right: 0;
	left: 0;
	bottom: calc(var(--tn-hero-sky) + 22px);
	z-index: 3;
	display: flex;
	align-items: center;
	gap: 22px;
	color: #ffffff;
	pointer-events: none;
}

.tn-hero__controls > * {
	pointer-events: auto;
}

.tn-hero__counter {
	display: inline-flex;
	align-items: baseline;
	gap: 6px;
	font-variant-numeric: tabular-nums;
	direction: ltr;
	line-height: 1;
}

.tn-hero__current {
	font-size: 1.7rem;
	font-weight: 800;
}

.tn-hero__sep,
.tn-hero__total {
	color: rgba(255, 255, 255, 0.6);
	font-size: 0.95rem;
	font-weight: 700;
}

.tn-hero__bars {
	display: flex;
	align-items: center;
	gap: 8px;
}

/* شريط لكل شريحة: مسار أبيض خافت يمتلئ بالأخضر (من اليمين في RTL) */
.tn-hero__bar {
	position: relative;
	display: block;
	width: 54px;
	height: 18px;
	padding: 0;
	border: 0;
	background: transparent;
	cursor: pointer;
}

.tn-hero__bar::before,
.tn-hero__bar-fill {
	content: '';
	position: absolute;
	right: 0;
	left: 0;
	top: 50%;
	height: 4px;
	margin-top: -2px;
	border-radius: 4px;
}

.tn-hero__bar::before {
	background: rgba(255, 255, 255, 0.28);
	transition: background-color 0.25s ease;
}

.tn-hero__bar:hover::before,
.tn-hero__bar:focus-visible::before {
	background: rgba(255, 255, 255, 0.5);
}

.tn-hero__bar-fill {
	background: var(--theme-secondary);
	transform: scaleX(0);
	transform-origin: right;
}

.tn-hero__bar.is-active .tn-hero__bar-fill {
	transform: scaleX(1);
}

/* مع التشغيل التلقائي يملأ السكربت شريط الظاهرة تدريجياً */
.tn-hero.is-timed .tn-hero__bar.is-active .tn-hero__bar-fill {
	transform: scaleX(0);
}

.tn-hero__arrows {
	display: flex;
	gap: 8px;
}

.tn-hero__arrow {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, 0.35);
	border-radius: 14px 4px 14px 4px;
	background: transparent;
	color: #ffffff;
	cursor: pointer;
	transition: background-color 0.25s ease, border-color 0.25s ease;
}

.tn-hero__arrow:hover,
.tn-hero__arrow:focus-visible {
	border-color: var(--theme-secondary);
	background: var(--theme-secondary);
}

/* ==========================================================================
   الشاشات المتوسطة والجوال
   ========================================================================== */

@media (max-width: 1100px) {
	.tn-hero {
		--tn-hero-panel: 48%;
		--tn-hero-leaf: 130px 20px 130px 20px;
	}

	.tn-hero__slide {
		gap: 32px;
	}

	.tn-hero__content {
		padding-inline-end: 36px;
	}

	.tn-hero__figure {
		margin-inline-start: -56px;
	}

	.tn-hero__badge {
		width: 76px;
		height: 76px;
		padding: 16px;
		left: -10px;
	}
}

/* الجوال واللوحي الضيق: الصورة أعلى بقناع الورقة، واللوح التركوازي يبدأ من منتصفها ويحمل النص */
@media (max-width: 860px) {
	.tn-hero {
		--tn-hero-sky: 40px;
		--tn-hero-leaf: 110px 18px 110px 18px;
		--tn-hero-cut: 190px; /* بداية اللوح من أعلى القسم */
	}

	.tn-hero__panel {
		top: var(--tn-hero-cut);
		width: 100%;
	}

	.tn-hero__panel::after {
		top: 0;
		right: 0;
		bottom: auto;
		left: 0;
		width: auto;
		height: 3px;
		background: linear-gradient(to left, transparent, rgba(var(--theme-secondary-rgb), 0.7) 30%, rgba(var(--theme-secondary-rgb), 0.7) 70%, transparent);
	}

	.tn-hero__slide {
		grid-template-columns: minmax(0, 1fr);
		gap: 30px;
		min-height: 0;
		padding-top: 26px;
		padding-bottom: calc(var(--tn-hero-sky) + 84px);
	}

	.tn-hero__content {
		padding-inline-end: 0;
	}

	.tn-hero__figure {
		order: -1;
		width: min(560px, 100%);
		margin: 0 auto;
	}

	.tn-hero__media {
		aspect-ratio: auto;
		height: calc((var(--tn-hero-cut) - 26px) * 2); /* منتصف الصورة على حافة اللوح */
		max-height: none;
	}

	.tn-hero__badge {
		left: -6px;
		bottom: 18px;
		width: 64px;
		height: 64px;
		padding: 13px;
		border-width: 4px;
		border-color: var(--tn-deep);
	}

	/* شريحة بلا صورة: اللوح من الأعلى */
	.tn-hero__slide--text {
		padding-top: calc(var(--tn-hero-cut) + 30px);
	}
}

@media (max-width: 767px) {
	.tn-hero {
		--tn-hero-cut: 150px;
		--tn-hero-leaf: 90px 16px 90px 16px;
	}

	.tn-hero__title {
		font-size: 1.85rem;
	}

	/* الوصف أربعة أسطر على الجوال */
	.tn-hero__desc {
		display: -webkit-box;
		overflow: hidden;
		-webkit-line-clamp: 4;
		-webkit-box-orient: vertical;
		font-size: 0.98rem;
		line-height: 1.85;
	}

	.tn-hero__actions {
		width: 100%;
	}

	.tn-hero__actions .tn-btn {
		flex: 1 1 auto;
		justify-content: center;
	}

	.tn-hero__controls {
		gap: 14px;
		bottom: calc(var(--tn-hero-sky) + 16px);
	}

	.tn-hero__bar {
		width: 34px;
	}

	.tn-hero__arrows {
		margin-inline-start: auto;
	}

	.tn-hero__arrow {
		width: 40px;
		height: 40px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.tn-hero__img,
	.tn-hero__bar::before,
	.tn-hero__arrow {
		transition: none;
	}

	.tn-hero__img {
		transform: none;
	}

	.tn-hero .swiper-slide-active .tn-hero__content > *,
	.tn-hero .swiper-slide-active .tn-hero__badge {
		animation: none;
	}
}
