/**
 * أنماط سلايدر البطاقات المقلوبة المشترك بين أقسام الرئيسية (الأخبار، المشاريع، الفعاليات، فرص التطوع، الوظائف).
 *
 * يُحمَّل في الصفحة الرئيسية فقط عند تفعيل أحد هذه الأقسام (انظر association_child_enqueue_block_assets في functions.php).
 */

/* ==========================================================================
   عنوان بلونين، وبطاقة تنقلب عند مرور الماوس ليظهر خلفها زر التفاصيل
   القالب: template-parts/home/card-slider.php
   السكربت: assets/js/blocks/card-slider.js
   الحركة والتوقيت منسوخان حرفياً من تأثير «Effect 4» في الموقع المرجعي (JetElements Animated Box).
   ========================================================================== */

.child-cards-section {
	--child-cards-accent: var(--theme-secondary, #ca9c5e);
	--child-cards-accent-rgb: var(--theme-secondary-rgb, 202, 156, 94);
	--child-cards-dark: var(--theme-primary, #1a4261);
	--child-cards-dark-rgb: var(--theme-primary-rgb, 26, 66, 97);

	position: relative;
	overflow: hidden;
	isolation: isolate;
}

/* خطوط منحنية خفيفة خلف القسم كله */
.child-cards-waves {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	z-index: -2;
	pointer-events: none;
}

.child-cards-waves path {
	fill: none;
	stroke: rgba(var(--child-cards-dark-rgb), 0.06);
	stroke-width: 1;
}

/*
 * نقش السلايدر الذهبي (الزخرفة الافتراضية، pattern = islamic): بلاطة متكررة بلا فواصل
 * (assets/images/islamic-pattern-tile.png، دورة واحدة من islamic-patrn.png) تُستخدم قناعاً فوق اللون الثانوي.
 * الغلاف الخارجي يذيب النقش في أعلى القسم وأسفله، فيبدأ القسم وينتهي بالأبيض وينتقل بنعومة إلى ما قبله وبعده.
 */
.child-cards-islamic {
	position: absolute;
	inset: 0;
	z-index: -2;
	pointer-events: none;
	-webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 28%, #000 72%, transparent 100%);
	mask-image: linear-gradient(to bottom, transparent 0%, #000 28%, #000 72%, transparent 100%);
}

.child-cards-islamic__lines {
	display: block;
	width: 100%;
	height: 100%;
	background: var(--child-cards-accent);
	opacity: 0.32;
	-webkit-mask: url('../../images/islamic-pattern-tile.png') center top / 390px 225px repeat;
	mask: url('../../images/islamic-pattern-tile.png') center top / 390px 225px repeat;
}

/*
 * النقش الهندسي الإسلامي (الزخرفة الافتراضية، والخطوط المنحنية أعلاه حين pattern = waves): خطوط رفيعة خافتة بلون الثيم،
 * تظهر على أطراف القسم وتتلاشى نحو الوسط حيث البطاقات، فتؤطّر المحتوى ولا تنافسه.
 */
.child-cards-pattern {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	z-index: -2;
	pointer-events: none;
	-webkit-mask-image: radial-gradient(ellipse 70% 65% at 50% 55%, transparent 25%, #000 95%);
	mask-image: radial-gradient(ellipse 70% 65% at 50% 55%, transparent 25%, #000 95%);
}

.child-cards-pattern path {
	fill: none;
	stroke: rgba(var(--child-cards-dark-rgb), 0.17);
	stroke-width: 1.1;
	stroke-linejoin: round;
	stroke-linecap: round;
}

/* الأيقونتان الزخرفيتان الصغيرتان أعلى القسم */
.child-cards-shape {
	position: absolute;
	z-index: 1;
	color: var(--child-cards-accent);
	pointer-events: none;
}

.child-cards-shape--spark {
	top: 6%;
	inset-inline-start: clamp(16px, 4vw, 60px);
}

.child-cards-shape--triangle {
	top: 14%;
	inset-inline-end: clamp(40px, 10vw, 140px);
	width: 0;
	height: 0;
	border-inline: 9px solid transparent;
	border-bottom: 16px solid var(--child-cards-accent);
}

.child-cards-section .section-header {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	justify-content: flex-start;
	margin-bottom: clamp(28px, 4vw, 46px);
	text-align: start;
}

.child-cards-title {
	position: relative;
	z-index: 1;
	margin: 0;
	color: var(--theme-heading, #111827);
	font-size: clamp(1.4rem, 1.1rem + 1.2vw, 1.9rem);
	font-weight: 800;
}

.child-cards-title::after {
	content: '';
	display: block;
	width: 60px;
	height: 6px;
	margin-top: 10px;
	border-radius: 999px;
	background: var(--child-cards-accent, #ff9640);
}

.child-cards-title__accent {
	color: var(--child-cards-accent);
}

/* حاوية السلايدر والأسهم */
html body .child-cards-slider {
	position: relative;
	padding: 0 clamp(35px, 4vw, 55px) !important;
	background: transparent !important;
	background-color: transparent !important;
	box-shadow: none !important;
	border: none !important;
	overflow: visible !important;
}

html body .child-cards-swiper {
	position: relative;
	padding: 15px 4px 40px !important;
	overflow: hidden !important;
	background: transparent !important;
	background-color: transparent !important;
	box-shadow: none !important;
	border: none !important;
}

html body .child-cards-swiper .swiper-wrapper {
	position: relative;
	align-items: stretch !important;
	height: auto !important;
	background: transparent !important;
	background-color: transparent !important;
	box-shadow: none !important;
	border: none !important;
}

html body .child-cards-swiper .swiper-slide {
	position: relative;
	height: auto !important;
	background: transparent !important;
	background-color: transparent !important;
	box-shadow: none !important;
	border: none !important;
}

html body .child-cards-card,
html body .child-cards-card__flip {
	background: transparent !important;
	background-color: transparent !important;
	box-shadow: none !important;
	border: none !important;
}

.child-cards-nav {
	position: absolute;
	top: 50%;
	z-index: 5;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	margin-top: -20px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #fff;
	color: var(--child-cards-accent);
	box-shadow: 0 4px 16px rgba(15, 23, 42, 0.12);
	cursor: pointer;
	transition: background-color 0.25s ease, color 0.25s ease;
}

.child-cards-nav:hover,
.child-cards-nav:focus-visible {
	background: var(--child-cards-accent);
	color: #fff;
}

html body .child-cards-nav--prev {
	right: 0 !important;
	left: auto !important;
}

html body .child-cards-nav--next {
	left: 0 !important;
	right: auto !important;
}

.child-cards-nav.swiper-button-disabled {
	opacity: 0.4;
	cursor: default;
}

.child-cards-card {
	--child-cards-h: 440px;
	/* ارتفاع البطاقة، لازم أن يكون ثابتاً لأن الوجه والظهر فوق بعضهما */
	--child-cards-back: var(--theme-primary, #1a4261);
	/* خلفية الوجه الخلفي وزره */
	--child-cards-back-rgb: var(--theme-primary-rgb, 26, 66, 97);

	position: relative;
	height: var(--child-cards-h);
	perspective: 1200px;
}

.child-cards-card__flip {
	position: relative;
	width: 100%;
	height: 100%;
}

.child-cards-card__front,
.child-cards-card__back {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border-radius: 24px;
	backface-visibility: hidden;
	overflow: hidden;
}

/* الوجه الأمامي: الصورة كاملة العرض وبحجم أضخم يلغي أي فراغ أبيض في الأسفل */
html body .child-cards-card__front {
	z-index: 2;
	display: flex;
	flex-direction: column;
	background: #ffffff !important;
	border: 1px solid #e2e8f0 !important;
	border-radius: 24px !important;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03) !important;
	transform: rotateY(0deg) translateX(0) scale(1);
	transition: transform 0.7s cubic-bezier(0.11, 0.6, 0.24, 0.89);
}

.child-cards-card__media {
	position: relative;
	margin: 0;
	border-radius: 24px 24px 0 0;
	overflow: hidden;
	height: 260px;
	aspect-ratio: 380 / 260;
	background: var(--theme-bg-light, #f1f5f9);
}

.child-cards-card__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.child-cards-card__img--placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--theme-text-muted, #9ca3af);
}

.child-cards-card__badge {
	position: absolute;
	top: 14px;
	inset-inline-end: 14px;
	padding: 5px 14px;
	border-radius: 10px;
	background: var(--child-cards-accent, #ff9640);
	color: #ffffff;
	font-size: 0.82rem;
	font-weight: 700;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.child-cards-card__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	padding: 14px 18px 16px;
	min-height: 0;
	text-align: right;
}

/* سطر المعلومات الصغيرة فوق العنوان (التاريخ، الموقع، الميزانية...) في سطر واحد، والنص الطويل يُقصّ بنقاط */
.child-cards-card__meta {
	display: flex;
	justify-content: flex-end;
	gap: 14px;
	min-width: 0;
	margin-bottom: 8px;
	overflow: hidden;
}

.child-cards-card__date {
	display: inline-flex;
	align-items: center;
	justify-content: flex-end;
	gap: 6px;
	flex-shrink: 0;
	max-width: 100%;
	min-width: 0;
	color: #94a3b8;
	font-size: 0.88rem;
	white-space: nowrap;
}

/* المعلومة الأخيرة (غالباً الموقع) هي التي تنكمش إن ضاق السطر */
.child-cards-card__date:last-child {
	flex-shrink: 1;
}

.child-cards-card__date svg {
	flex-shrink: 0;
}

.child-cards-card__date-text {
	overflow: hidden;
	text-overflow: ellipsis;
}

.child-cards-card__title {
	display: -webkit-box;
	margin: 0 0 10px;
	overflow: hidden;
	color: #0f172a;
	font-size: 1.15rem;
	font-weight: 800;
	line-height: 1.45;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	-webkit-box-orient: vertical;
}

.child-cards-card__title a {
	color: inherit;
	text-decoration: none;
}

.child-cards-card__title a:hover {
	color: var(--child-cards-accent, #ff9640);
}

.child-cards-card__excerpt {
	display: -webkit-box;
	margin: 0;
	overflow: hidden;
	color: #94a3b8;
	font-size: 0.92rem;
	line-height: 1.65;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	-webkit-box-orient: vertical;
}

/* الوجه الخلفي: يظهر عند مرور الماوس (تدوير + تصغير، عكس الأمامي) */
.child-cards-card__back {
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--child-cards-back);
	transform: rotateY(-90deg) translateX(-150%) scale(0);
	transition: transform 0.5s cubic-bezier(0.63, 0.07, 0.78, 0.55);
}

/*
 * SVG التموج في الوجه الخلفي لبطاقة الخبر (ممتد بانسيابية كاملة وجذابة)
 */
.child-cards-card__back-waves {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	z-index: 1;
	opacity: 0.85;
}

/* الزر خلف البطاقة: زر زجاجي كبسولي عصري (Glassmorphism Pill) بأيقونة سهم تفاعلية */
.child-cards-card__btn {
	position: relative;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	gap: 12px;
	padding: 10px 22px 10px 14px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.16);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	border: 1.5px solid rgba(255, 255, 255, 0.35);
	color: #ffffff;
	font-size: 1.08rem;
	font-weight: 700;
	text-decoration: none;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
	transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.child-cards-card__btn-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: #ffffff;
	color: var(--child-cards-back, #015366);
	transition: transform 0.3s ease, background-color 0.3s ease, color 0.3s ease;
}

.child-cards-card__btn:hover {
	background: var(--child-cards-accent, #ff9640);
	border-color: var(--child-cards-accent, #ff9640);
	color: #ffffff;
	transform: translateY(-2px);
	box-shadow: none;
}

.child-cards-card__btn:hover .child-cards-card__btn-icon {
	background: #ffffff;
	color: var(--child-cards-accent, #ff9640);
	transform: translateX(-4px);
}

/* أزرار الوجه الخلفي: زر إجراء اختياري (تبرع، تسجيل، تقديم) فوق زر التفاصيل */
.child-cards-card__actions {
	position: relative;
	z-index: 2;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
}

.child-cards-card__btn--solid {
	padding: 12px 30px;
	background: var(--child-cards-accent, #ff9640);
	border-color: var(--child-cards-accent, #ff9640);
}

.child-cards-card__btn--solid:hover {
	background: #ffffff;
	border-color: #ffffff;
	color: var(--child-cards-back, #015366);
}

/* التبديل عند مرور الماوس، أو بالتنقل بلوحة المفاتيح إلى رابط داخل البطاقة */
.child-cards-card:hover .child-cards-card__front,
.child-cards-card:focus-within .child-cards-card__front {
	z-index: 1;
	transform: rotateY(90deg) translateX(150%) scale(0);
	transition: transform 0.5s cubic-bezier(0.63, 0.07, 0.78, 0.55);
}

.child-cards-card:hover .child-cards-card__back,
.child-cards-card:focus-within .child-cards-card__back {
	z-index: 2;
	transform: rotateY(0deg) translateX(0) scale(1);
	transition: transform 0.7s cubic-bezier(0.11, 0.6, 0.24, 0.89);
}

@media (max-width: 860px) {
	.child-cards-card {
		--child-cards-h: 420px;
	}

	/*
	 * الصورة بنسبة عرض البطاقة بدل ارتفاع ثابت 260px: البطاقة ثابتة الارتفاع (الوجهان فوق بعضهما)، فالارتفاع
	 * الثابت للصورة كان يترك للعنوان والنبذة أقل من حاجتهما فيُقصّان في منتصف السطر.
	 */
	.child-cards-card__media {
		height: auto;
		aspect-ratio: 16 / 10;
		flex-shrink: 0;
	}

	/* السهمان على جانبي البطاقة في منتصفها تماماً (الموضع من card-slider.js)، أصغر قليلاً */
	html body .child-cards-nav {
		top: var(--child-nav-top, 50%);
		width: 36px;
		height: 36px;
		margin-top: -18px;
	}

	/* تُخفى الأشكال الزخرفية حتى لا تزاحم العنوان */
	.child-cards-shape--spark,
	.child-cards-shape--triangle {
		display: none;
	}
}

@media (max-width: 480px) {
	.child-cards-card {
		--child-cards-h: 400px;
	}

	.child-cards-card__title {
		font-size: 1rem;
	}
}

/* حركة أهدأ لمن يفعّل «تقليل الحركة»: تلاشٍ بدل الدوران والطيران */
@media (prefers-reduced-motion: reduce) {

	.child-cards-card__front,
	.child-cards-card__back {
		transition: opacity 0.3s ease;
		transform: none !important;
	}

	.child-cards-card__front {
		opacity: 1;
	}

	.child-cards-card__back {
		opacity: 0;
	}

	.child-cards-card:hover .child-cards-card__front,
	.child-cards-card:focus-within .child-cards-card__front {
		z-index: 1;
		opacity: 0;
	}

	.child-cards-card:hover .child-cards-card__back,
	.child-cards-card:focus-within .child-cards-card__back {
		z-index: 2;
		opacity: 1;
	}
}
/* ==========================================================================
   أقسام يبقى سلايدرها وبطاقاتها من الأب بهوية الرئيسية (المكتبة المرئية، الشركاء، الإعلانات، الفروع)
   القوالب: template-parts/home/home-{videos,partners,ads,branches}.php (صنف child-section)
   ========================================================================== */

/* سلايدر لا يتحرك لقلة بطاقاته (الشعارات تتوسط): يُخفى السهمان (يضيف card-slider.js ‎.is-locked) */
.child-cards-slider.is-locked .child-cards-nav {
	display: none;
}

/* الأب يترك مسافة أسفل سلايدر الشركاء لنقاط التنقل، وقد حلّ محلها السهمان */
html body .child-section .partners-swiper {
	padding-bottom: 20px !important;
}

/* ==========================================================================
   مكونات هوية وفاق المشتركة لأقسام: عن الجمعية، والمدير التنفيذي، والرؤية، وقالوا عنا
   ========================================================================== */

/* وصف القسم تحت العنوان (template-parts/home/section-title.php، يُطبع فقط إن كان معبّأً) */
.child-cards-desc {
	max-width: 720px;
	margin: 14px 0 0;
	color: var(--theme-text-light, #64748b);
	font-size: 0.98rem;
	line-height: 1.8;
}

/*
 * إطار القوس الإسلامي (template-parts/home/arch-frame.php): الصورة داخل قوس مدبّب، وخلفها قوس ذهبي مُزاح
 * كإطار. القوس SVG clipPath بوحدات الصندوق فيتمدد بأي مقاس.
 */
.child-arch {
	position: relative;
	width: 100%;
	aspect-ratio: 4 / 5;
}

.child-arch__outline,
.child-arch__img {
	position: absolute;
	inset: 0;
}

.child-arch__outline {
	background: var(--child-cards-accent);
	opacity: 0.85;
	transform: translate(-16px, -16px);
}

.child-arch__img {
	overflow: hidden;
	/* خلفية فاتحة للصور الشفافة (PNG) فيبقى الذهبي إطاراً خلف القوس فقط */
	background: #f7f3ea;
}

.child-arch__img img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* أيقونة ذهبية صغيرة (رمز شعار وفاق في الاقتباسات) */
.child-star {
	display: inline-block;
	flex-shrink: 0;
	color: var(--child-cards-accent);
	line-height: 0;
}

/* كبسولة بيانات بخلفية خضراء فاتحة (الترخيص، الخبرة، البريد...) */
.child-pill {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 9px 16px;
	border: 1px solid rgba(var(--child-cards-dark-rgb), 0.12);
	border-radius: 14px;
	background: rgba(var(--child-cards-dark-rgb), 0.06);
	color: var(--child-cards-dark);
	font-size: 0.9rem;
	font-weight: 700;
	text-decoration: none;
}

.child-pill svg {
	flex-shrink: 0;
	color: var(--child-cards-accent);
}

a.child-pill:hover {
	border-color: var(--child-cards-accent);
}

@media (max-width: 560px) {
	.child-arch__outline {
		transform: translate(-10px, -10px);
	}
}
