/**
 * أنماط قسم السلايدرات في الثيم الابن.
 *
 * يُحمَّل في الصفحة الرئيسية فقط عند تفعيل القسم (انظر association_child_enqueue_block_assets في functions.php).
 */

/* ==========================================================================
   قسم السلايدرات: صورة تملأ الشريحة، وتدرج أبيض من اليمين يحمل النص، ونقش ذهبي في الركن
   القالب: template-parts/home/home-sliders.php
   السكربت: assets/js/blocks/home-sliders.js
   ========================================================================== */

.child-hero {
	/*
	 * الألوان تُقرأ من إعدادات الموقع (اللون الأساسي والثانوي في لوحة التحكم)،
	 * فتتغير تلقائياً بتغييرها هناك. لتثبيت لون معيّن ضع قيمته مكان var(...).
	 */
	--child-hero-accent: var(--theme-secondary, #ca9c5e);
	/* السطر العلوي والزر */
	--child-hero-accent-rgb: var(--theme-secondary-rgb, 202, 156, 94);
	--child-hero-dark: var(--theme-primary, #1a4261);
	/* العنوان */
	--child-hero-dark-rgb: var(--theme-primary-rgb, 26, 66, 97);
	--child-hero-bg: #ffffff;
	/* لون التدرج الذي يحمل النص، وخلفية القسم */
	--child-hero-bg-rgb: 255, 255, 255;
	--child-hero-h: clamp(460px, 72vh, 680px);
	/* ارتفاع الشريحة على الشاشات الواسعة */

	position: relative;
	overflow: hidden;
	background: var(--child-hero-bg);
	isolation: isolate;
}

.child-hero__slider {
	width: 100%;
}

.child-hero__slide {
	position: relative;
	display: flex;
	align-items: center;
	min-height: var(--child-hero-h);
	overflow: hidden;
}

/* الصورة تملأ الشريحة، وتقترب ببطء في الشريحة الظاهرة */
.child-hero__media {
	position: absolute;
	inset: 0;
	z-index: 0;
	overflow: hidden;
	background: rgba(var(--child-hero-dark-rgb), 0.08);
}

.child-hero__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: left center;
	transform: scale(1.08);
	transition: transform 7s ease-out;
}

.child-hero .swiper-slide-active .child-hero__img {
	transform: scale(1);
}

/*
 * التدرج الأبيض: كامل من اليمين حتى ثلث العرض تقريباً ليُقرأ النص بوضوح، ثم يذوب في الصورة.
 * وخط خفيف في الأسفل يدمج الشريحة مع القسم التالي.
 */
.child-hero__veil {
	position: absolute;
	inset: 0;
	z-index: 2;
	pointer-events: none;
	background:
		linear-gradient(to top, rgba(var(--child-hero-bg-rgb), 0.9) 0, rgba(var(--child-hero-bg-rgb), 0) 90px),
		linear-gradient(to left,
			rgba(var(--child-hero-bg-rgb), 1) 0%,
			rgba(var(--child-hero-bg-rgb), 0.97) 28%,
			rgba(var(--child-hero-bg-rgb), 0.82) 38%,
			rgba(var(--child-hero-bg-rgb), 0.35) 50%,
			rgba(var(--child-hero-bg-rgb), 0) 62%);
}

/*
 * النقش الهندسي الإسلامي الذهبي في الركن الأيمن السفلي: خطوط النقش (assets/images/islamic-pattern-mask.png،
 * طبقة شفافة من islamic-patrn.png) تُستخدم قناعاً فوق لون الثيم الثانوي، فيتغير لونها بتغييره.
 * والغلاف الخارجي يُذيب النقش من الركن نحو الداخل.
 */
.child-hero__ornament {
	position: absolute;
	right: 0;
	bottom: 0;
	z-index: 2;
	width: clamp(280px, 34vw, 520px);
	aspect-ratio: 1;
	pointer-events: none;
	-webkit-mask-image: radial-gradient(circle at 100% 100%, #000 0%, rgba(0, 0, 0, 0.8) 40%, transparent 78%);
	mask-image: radial-gradient(circle at 100% 100%, #000 0%, rgba(0, 0, 0, 0.8) 40%, transparent 78%);
}

.child-hero__ornament-lines {
	display: block;
	width: 100%;
	height: 100%;
	background: var(--child-hero-accent);
	opacity: 0.9;
	-webkit-mask: url('../../images/islamic-pattern-mask.png') right bottom / 100% 100% no-repeat;
	mask: url('../../images/islamic-pattern-mask.png') right bottom / 100% 100% no-repeat;
}

/* النص على يمين الشريحة فوق التدرج */
.child-hero__container {
	position: relative;
	z-index: 3;
	width: 100%;
}

.child-hero__content {
	max-width: 540px;
	padding: 40px 0;
	text-align: right;
}

/*
 * حين يأتي قسم الإحصائيات بعد السلايدر ترتفع بطاقته فوق أسفل الشريحة (home-stats.css)،
 * فيُترك تحت النص فراغ بقدر ارتفاعها حتى لا تغطي الزر.
 */
.child-hero:has(+ .child-stats-section) .child-hero__content {
	padding-bottom: calc(clamp(50px, 7vw, 90px) + 40px);
}

.child-hero__eyebrow {
	display: block;
	margin-bottom: 8px;
	color: var(--child-hero-accent);
	font-size: clamp(1.05rem, 0.9rem + 0.55vw, 1.4rem);
	font-weight: 800;
	line-height: 1.4;
}

.child-hero__title {
	margin: 0 0 18px;
	color: var(--child-hero-dark);
	font-size: clamp(2rem, 1.3rem + 2.8vw, 3.6rem);
	font-weight: 800;
	line-height: 1.2;
}

/* الوصف: أسطر متساوية الأطراف. يظهر كاملاً مهما طال، والشريحة تطول معه */
.child-hero__desc {
	margin-bottom: 30px;
	color: #475569;
	font-size: clamp(0.95rem, 0.9rem + 0.2vw, 1.05rem);
	line-height: 1.85;
	text-align: justify;
	text-wrap: pretty;
}

.child-hero__desc p {
	margin: 0;
}

.child-hero__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
}

.child-hero__btn {
	display: inline-flex;
	align-items: center;
	gap: 12px;
	padding: 13px 26px;
	border: 1.5px solid var(--child-hero-accent);
	border-radius: 10px;
	background: var(--child-hero-accent);
	color: #ffffff;
	font-weight: 700;
	text-decoration: none;
	box-shadow: 0 10px 24px rgba(var(--child-hero-accent-rgb), 0.3);
	transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.child-hero__btn svg {
	transition: transform 0.3s ease;
}

.child-hero__btn:hover,
.child-hero__btn:focus-visible {
	border-color: var(--child-hero-dark);
	background: var(--child-hero-dark);
	color: #ffffff;
	transform: translateY(-2px);
	box-shadow: 0 10px 24px rgba(var(--child-hero-dark-rgb), 0.25);
}

.child-hero__btn:hover svg,
.child-hero__btn:focus-visible svg {
	transform: translateX(-4px);
}

.child-hero__btn--ghost {
	border-color: rgba(var(--child-hero-dark-rgb), 0.25);
	background: rgba(var(--child-hero-bg-rgb), 0.7);
	color: var(--child-hero-dark);
	box-shadow: none;
}

/* ظهور النص تدريجياً في الشريحة الظاهرة: الشارة ثم العنوان ثم الوصف ثم الأزرار.
   الإخفاء بعد تهيئة Swiper فقط (swiper-initialized): قبلها، أو إن لم يعمل السكربت، يظهر نص الشريحة الأولى فوراً */
.child-hero__slider.swiper-initialized .child-hero__content > * {
	opacity: 0;
	transform: translateY(18px);
	transition: opacity 0.7s ease, transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.child-hero .swiper-slide-active .child-hero__content > * {
	opacity: 1;
	transform: none;
}

.child-hero .swiper-slide-active .child-hero__content > :nth-child(1) { transition-delay: 0.25s; }
.child-hero .swiper-slide-active .child-hero__content > :nth-child(2) { transition-delay: 0.4s; }
.child-hero .swiper-slide-active .child-hero__content > :nth-child(3) { transition-delay: 0.55s; }
.child-hero .swiper-slide-active .child-hero__content > :nth-child(4) { transition-delay: 0.7s; }

/* الأسهم: دوائر بيضاء على حافتي الشريحة */
.child-hero__nav {
	position: absolute;
	top: 50%;
	z-index: 5;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin-top: -22px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #ffffff;
	color: var(--child-hero-dark);
	box-shadow: 0 6px 18px rgba(15, 23, 42, 0.15);
	cursor: pointer;
	transition: background-color 0.25s ease, color 0.25s ease;
}

.child-hero__nav:hover,
.child-hero__nav:focus-visible {
	background: var(--child-hero-accent);
	color: #ffffff;
}

.child-hero__nav--prev {
	right: clamp(10px, 1.5vw, 24px);
}

.child-hero__nav--next {
	left: clamp(10px, 1.5vw, 24px);
}

@media (prefers-reduced-motion: reduce) {

	.child-hero__img,
	.child-hero__content > * {
		transition: none;
	}

	.child-hero__img {
		transform: none;
	}
}

/*
 * الشاشات الضيقة: الصورة في الأعلى بارتفاع ثابت ويذوب أسفلها في الأبيض، والنص تحتها.
 */
@media (max-width: 860px) {
	.child-hero__slide {
		flex-direction: column;
		align-items: stretch;
		min-height: 0;
	}

	/*
	 * الصورة نفسها تذوب إلى شفاف في أسفلها: ارتفاعها بكسور بكسل، فكان يبقى تحت حافة التدرج الأبيض سطر رفيع
	 * منها يظهر خطاً داكناً في الصور الداكنة (أوضح أثناء تلاشي الشرائح).
	 */
	.child-hero__media {
		position: relative;
		inset: auto;
		height: clamp(220px, 52vw, 360px);
		-webkit-mask-image: linear-gradient(to bottom, #000 60%, transparent 100%);
		mask-image: linear-gradient(to bottom, #000 60%, transparent 100%);
	}

	.child-hero__img {
		object-position: center;
	}

	.child-hero__veil {
		inset: 0 0 auto;
		height: calc(clamp(220px, 52vw, 360px) + 2px);
		background: linear-gradient(to top, rgba(var(--child-hero-bg-rgb), 1) 0, rgba(var(--child-hero-bg-rgb), 0) 45%);
	}

	.child-hero__content,
	.child-hero:has(+ .child-stats-section) .child-hero__content {
		max-width: none;
		margin-top: -12px;
		padding: 0 0 36px;
	}

	.child-hero__nav {
		top: clamp(110px, 26vw, 180px);
		width: 38px;
		height: 38px;
		margin-top: -19px;
	}
}
