/**
 * قسم خدمات الجمعية في ثيم هدي: «بطاقات العطاء» (template-parts/home/home-services.php).
 */

/* ==========================================================================
   1) الشريط المتحرك: أربع بطاقات ظاهرة، وإزاحة علوية تتسع لارتفاع البطاقة عند المرور
   ========================================================================== */

.hd-services__rail {
	--hd-rail-cols: 4;
	--hd-rail-gap: 22px;
}

.hd-services__track {
	padding-top: 12px;
}

.hd-services__item {
	display: flex;
}

/* ==========================================================================
   2) البطاقة: ورقة دافئة بزوايا لينة، وخط ذهبي ينمو في أعلاها عند المرور
   ========================================================================== */

.hd-services__card {
	position: relative;
	isolation: isolate;
	display: flex;
	flex-direction: column;
	align-items: center;
	width: 100%;
	padding: 24px 20px 22px;
	overflow: hidden;
	border: 1px solid rgba(var(--hd-gold-rgb), 0.18);
	border-radius: 22px;
	background: var(--hd-page);
	box-shadow: var(--hd-shadow);
	text-align: center;
	transition: transform 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
}

/* الخط الذهبي في الأعلى: ينمو من البداية (يمين) */
.hd-services__card::before {
	content: '';
	position: absolute;
	top: 0;
	right: 0;
	left: 0;
	height: 3px;
	background: var(--hd-gold-grad);
	transform: scaleX(0);
	transform-origin: right center;
	transition: transform 0.45s ease;
}

.hd-services__card:hover,
.hd-services__card:focus-within {
	border-color: rgba(var(--hd-gold-rgb), 0.38);
	box-shadow: var(--hd-shadow-hover);
	transform: translateY(-6px);
}

.hd-services__card:hover::before,
.hd-services__card:focus-within::before {
	transform: scaleX(1);
}

/* ==========================================================================
   3) الأيقونة: دائرة بحلقة بالتدرّج الذهبي، وتحتها جناحا الكتاب
   ========================================================================== */

.hd-services__badge {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	margin-bottom: 10px;
}

.hd-services__icon {
	position: relative;
	z-index: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 64px;
	height: 64px;
	border: 2px solid transparent;
	border-radius: 50%;
	background:
		linear-gradient(var(--hd-paper), var(--hd-paper)) padding-box,
		var(--hd-gold-grad) border-box;
	color: var(--theme-primary);
	box-shadow: 0 10px 22px -14px rgba(var(--hd-gold-rgb), 0.9);
	transition: background 0.35s ease, color 0.35s ease, transform 0.35s ease;
}

.hd-services__mask {
	display: block;
	width: 30px;
	height: 30px;
	background: currentColor;
	-webkit-mask-position: center;
	mask-position: center;
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	-webkit-mask-size: contain;
	mask-size: contain;
}

.hd-services__svg {
	width: 32px;
	height: 32px;
}

/* جناحا الكتاب: قوس ذهبي خافت يحتضن الدائرة من أسفلها */
.hd-services__wings {
	width: 104px;
	height: 30px;
	margin-top: -12px;
	background: var(--hd-gold-grad);
	opacity: 0.35;
	-webkit-mask: var(--hd-wings) center / contain no-repeat;
	mask: var(--hd-wings) center / contain no-repeat;
	transition: opacity 0.35s ease;
}

.hd-services__card:hover .hd-services__icon,
.hd-services__card:focus-within .hd-services__icon {
	background:
		linear-gradient(var(--theme-primary), var(--hd-ink-soft)) padding-box,
		var(--hd-gold-grad) border-box;
	color: #ffffff;
	transform: translateY(-2px);
}

.hd-services__card:hover .hd-services__wings,
.hd-services__card:focus-within .hd-services__wings {
	opacity: 1;
}

/* ==========================================================================
   4) النص: الاسم بالأخضر، والوصف سطران، و«المزيد» في أسفل البطاقة
   ========================================================================== */

.hd-services__name {
	margin: 0 0 6px;
	color: var(--hd-ink);
	font-family: var(--hd-display);
	font-size: 1.08rem;
	font-weight: 800;
	line-height: 1.5;
}

.hd-services__desc {
	display: -webkit-box;
	margin: 0;
	overflow: hidden;
	color: var(--theme-text-light, #5b6b60);
	font-size: 0.9rem;
	line-height: 1.8;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	line-clamp: 2;
}

.hd-services__more {
	margin-top: auto;
	padding-top: 12px;
}

/* البطاقة كلها رابط: الرابط يمتد عليها */
.hd-services__more::after {
	content: '';
	position: absolute;
	inset: 0;
	z-index: 2;
	border-radius: inherit;
}

.hd-services__more:focus-visible {
	outline: none;
}

.hd-services__card:has(.hd-services__more:focus-visible) {
	outline: 2px solid var(--hd-gold);
	outline-offset: 3px;
}

/* ==========================================================================
   5) الشاشات: عمودان وجزء على اللوحي، وبطاقة وجزء على الجوال
   ========================================================================== */

@media (max-width: 1024px) {
	.hd-services__rail {
		--hd-rail-cols: 2.4;
		--hd-rail-gap: 18px;
	}
}

@media (max-width: 640px) {
	.hd-services__rail {
		--hd-rail-cols: 1.3;
		--hd-rail-gap: 14px;
	}

	.hd-services__card {
		padding: 22px 18px 20px;
		border-radius: 18px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.hd-services__card,
	.hd-services__card::before,
	.hd-services__icon,
	.hd-services__wings {
		transition: none;
	}

	.hd-services__card:hover,
	.hd-services__card:focus-within,
	.hd-services__card:hover .hd-services__icon,
	.hd-services__card:focus-within .hd-services__icon {
		transform: none;
	}
}
