/**
 * المكونات المشتركة بين أقسام الرئيسية في ثيم تنمية الشمالية: القسم (بلا خلفية) والجزر الداكنة، ورأس القسم
 * (template-parts/home/sh-section-head.php)، والشريط الأفقي بزرّي تنقل
 * (template-parts/home/sh-rail-nav.php وassets/js/blocks/sh-rail.js).
 *
 * يُحمَّل مرة واحدة مع أي قسم مفعّل (association_child_enqueue_block_assets في functions.php).
 */

/* ==========================================================================
   1) القسم: بلا خلفية، فتظهر من خلفه خلفية الصفحة الموحدة (assets/css/backdrop.css وinc في functions.php).
      الأقسام الداكنة «جزر»: لوحة بتدرّج الرمز العميق بزوايا ناعمة داخل حدود الصفحة تطفو فوق الخلفية،
      في ركنها رسم الشعار الخطي الأبيض خافتاً.
      أصناف ‎--white‎ و‎--mist‎ و‎--sand‎ و‎--lattice‎ باقية في القوالب بلا أثر، فلا يلزم تعديلها.
   ========================================================================== */

.sh-section {
	position: relative;
	isolation: isolate;
	padding: 88px 0;
	background: transparent;
}

/* الجزيرة الداكنة */
.sh-section--deep {
	padding: 44px 0;
	color: #ffffff;
}

.sh-section--deep > .container {
	position: relative;
	isolation: isolate;
	overflow: hidden;
	padding: clamp(40px, 5vw, 68px) clamp(22px, 4.5vw, 64px);
	border-radius: 32px;
	background: var(--sh-grad-deep);
	box-shadow: 0 40px 80px -48px rgba(var(--theme-primary-rgb), 0.85);
}

/* رسم الشعار الخطي الأبيض في ركن الجزيرة */
.sh-section--deep > .container::after {
	content: '';
	position: absolute;
	bottom: -120px;
	inset-inline-end: -90px;
	z-index: -1;
	width: 420px;
	height: 420px;
	background: #ffffff;
	opacity: 0.07;
	-webkit-mask: var(--sh-emblem-line) center / contain no-repeat;
	mask: var(--sh-emblem-line) center / contain no-repeat;
	pointer-events: none;
}

/* وهج نعناعي ناعم في الركن المقابل */
.sh-section--deep > .container::before {
	content: '';
	position: absolute;
	top: -30%;
	inset-inline-start: -10%;
	z-index: -1;
	width: 60%;
	height: 90%;
	background: radial-gradient(closest-side, rgba(68, 170, 143, 0.35), transparent);
	pointer-events: none;
}

.sh-section > .container {
	position: relative;
}

@media (max-width: 767px) {
	.sh-section--deep {
		padding: 28px 0;
	}

	.sh-section--deep > .container {
		width: calc(100% - 24px);
		border-radius: 24px;
	}

	.sh-section--deep > .container::after {
		width: 260px;
		height: 260px;
	}
}

/* ==========================================================================
   2) رأس القسم «سطر الكوفي»: جرّة عمودية بتدرّج الرمز في بداية العنوان، و«عرض الكل» بلاطة في الطرف المقابل
   ========================================================================== */

.sh-head {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 20px 40px;
	margin-bottom: 48px;
}

.sh-head__main {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	max-width: 720px;
	padding-inline-start: 26px;
}

/*
 * الجرّة الكوفية: عمود بعرض جرّات الشعار وطرفين مربعين ناعمين، يتدرّج من النعناعي إلى الأساسي كالرمز،
 * ويتبعه في أسفله مربع ذهبي مائل كأحد مربعات الشعار.
 */
.sh-head__stroke {
	position: absolute;
	top: 6px;
	bottom: 20px;
	inset-inline-start: 0;
	width: 7px;
	border-radius: 3px;
	background: linear-gradient(180deg, var(--sh-mint), var(--theme-primary));
}

.sh-head__stroke::after {
	content: '';
	position: absolute;
	bottom: -15px;
	left: 50%;
	width: 8px;
	height: 8px;
	margin-left: -4px;
	border-radius: 2px;
	background: var(--theme-secondary);
	transform: rotate(45deg);
}

/* شارة فوق العنوان: ورقتا الشعار الذهبيتان ونص بلون الحبر */
.sh-head__eyebrow {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	margin-bottom: 10px;
	padding: 4px 12px 4px 10px;
	border-radius: var(--sh-radius-sm);
	background: var(--sh-gold-soft);
	color: var(--sh-ink);
	font-size: 0.82rem;
	font-weight: 800;
	letter-spacing: 0;
}

.sh-head__eyebrow-icon {
	width: 15px;
	height: 15px;
	color: var(--theme-secondary);
}

.sh-head__title {
	margin: 0;
	color: var(--sh-ink);
	font-size: clamp(1.6rem, 1.15rem + 1.35vw, 2.4rem);
	font-weight: 800;
	line-height: 1.3;
}

.sh-head__desc {
	margin: 10px 0 0;
	color: var(--theme-text-light);
	font-size: 1.02rem;
	line-height: 1.85;
}

/* بلا وصف: الجرّة بطول العنوان */
.sh-head__title:last-child {
	padding-bottom: 14px;
}

/* «عرض الكل»: بلاطة بحد رفيع، وسهمها في معيّن يمتلئ بتدرّج الرمز عند المرور */
.sh-head__all {
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 18px;
	padding: 8px 10px 8px 18px;
	border: 1.5px solid var(--sh-line-strong);
	border-radius: var(--sh-radius);
	background: #ffffff;
	color: var(--theme-primary);
	font-size: 0.93rem;
	font-weight: 800;
	text-decoration: none;
	transition: color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.sh-head__all-icon {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
}

.sh-head__all-icon::before {
	content: '';
	position: absolute;
	inset: 4px;
	border-radius: 5px;
	background: rgba(var(--theme-primary-rgb), 0.1);
	transform: rotate(45deg);
	transition: background 0.3s ease, transform 0.4s var(--sh-ease);
}

.sh-head__all-icon svg {
	position: relative;
	transition: transform 0.3s var(--sh-ease), color 0.3s ease;
}

.sh-head__all:hover,
.sh-head__all:focus-visible {
	border-color: var(--theme-primary);
	color: var(--theme-primary);
	box-shadow: var(--sh-shadow);
}

.sh-head__all:hover .sh-head__all-icon::before,
.sh-head__all:focus-visible .sh-head__all-icon::before {
	background: var(--sh-grad);
	transform: rotate(135deg);
}

.sh-head__all:hover .sh-head__all-icon svg,
.sh-head__all:focus-visible .sh-head__all-icon svg {
	color: #ffffff;
	transform: translateX(-2px);
}

/* في الوسط: الجرّة أفقية فوق العنوان، ومربعها الذهبي في طرفها */
.sh-head--center {
	justify-content: center;
	text-align: center;
}

.sh-head--center .sh-head__main {
	align-items: center;
	padding-inline-start: 0;
	padding-top: 26px;
}

.sh-head--center .sh-head__stroke {
	top: 0;
	bottom: auto;
	inset-inline-start: 50%;
	width: 54px;
	height: 7px;
	transform: translateX(50%);
	background: linear-gradient(to left, var(--sh-mint), var(--theme-primary));
}

.sh-head--center .sh-head__stroke::after {
	top: 50%;
	bottom: auto;
	left: -17px;
	margin: -4px 0 0;
}

.sh-head--center .sh-head__title:last-child {
	padding-bottom: 0;
}

/* فوق الخلفية الداكنة: الجرّة من النعناعي إلى الأبيض */
.sh-head--light .sh-head__stroke {
	background: linear-gradient(180deg, var(--sh-mint), #ffffff);
}

.sh-head--light.sh-head--center .sh-head__stroke {
	background: linear-gradient(to left, var(--sh-mint), #ffffff);
}

.sh-head--light .sh-head__title {
	color: #ffffff;
}

.sh-head--light .sh-head__desc {
	color: rgba(255, 255, 255, 0.8);
}

.sh-head--light .sh-head__all {
	border-color: rgba(255, 255, 255, 0.35);
	background: rgba(255, 255, 255, 0.06);
	color: #ffffff;
}

.sh-head--light .sh-head__all-icon::before {
	background: rgba(255, 255, 255, 0.16);
}

.sh-head--light .sh-head__all:hover,
.sh-head--light .sh-head__all:focus-visible {
	border-color: var(--theme-secondary);
	color: #ffffff;
}

.sh-head--light .sh-head__all:hover .sh-head__all-icon::before,
.sh-head--light .sh-head__all:focus-visible .sh-head__all-icon::before {
	background: var(--theme-secondary);
}

.sh-head--light .sh-head__all:hover .sh-head__all-icon svg,
.sh-head--light .sh-head__all:focus-visible .sh-head__all-icon svg {
	color: var(--sh-deep);
}

@media (max-width: 767px) {
	.sh-head {
		margin-bottom: 32px;
	}

	.sh-head__main {
		padding-inline-start: 20px;
	}

	.sh-head__stroke {
		width: 6px;
	}

	.sh-head__all {
		margin-bottom: 0;
	}
}

/* ==========================================================================
   3) الشريط الأفقي: بطاقات تتمرر، وزرّا تنقل متلاصقان أسفله
   ========================================================================== */

.sh-rail {
	--sh-rail-cols: 4;
	--sh-rail-gap: 24px;
	position: relative;
}

.sh-rail__track {
	display: grid;
	grid-auto-columns: calc((100% - (var(--sh-rail-cols) - 1) * var(--sh-rail-gap)) / var(--sh-rail-cols));
	grid-auto-flow: column;
	gap: var(--sh-rail-gap);
	overflow-x: auto;
	padding: 6px 2px 22px;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
}

.sh-rail__track::-webkit-scrollbar {
	display: none;
}

.sh-rail__track > * {
	scroll-snap-align: start;
}

.sh-rail__nav {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	margin-top: 6px;
}

.sh-rail__nav[hidden] {
	display: none;
}

.sh-rail__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 46px;
	height: 46px;
	padding: 0;
	border: 1.5px solid var(--sh-line-strong);
	border-radius: var(--sh-radius);
	background: #ffffff;
	color: var(--theme-primary);
	cursor: pointer;
	transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease, opacity 0.25s ease;
}

.sh-rail__btn:hover,
.sh-rail__btn:focus-visible {
	position: relative;
	z-index: 1;
	border-color: var(--theme-primary);
	background: var(--theme-primary);
	color: #ffffff;
}

.sh-rail__btn[disabled] {
	opacity: 0.4;
	cursor: default;
	pointer-events: none;
}

/* الشريط فوق خلفية داكنة */
.sh-section--deep .sh-rail__btn {
	border-color: rgba(255, 255, 255, 0.3);
	background: transparent;
	color: #ffffff;
}

.sh-section--deep .sh-rail__btn:hover,
.sh-section--deep .sh-rail__btn:focus-visible {
	border-color: var(--theme-secondary);
	background: var(--theme-secondary);
	color: var(--sh-deep);
}

@media (max-width: 1024px) {
	.sh-rail {
		--sh-rail-cols: 2.4;
	}
}

@media (max-width: 640px) {
	.sh-section {
		padding: 60px 0;
	}

	.sh-rail {
		--sh-rail-cols: 1.2;
		--sh-rail-gap: 14px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.sh-rail__btn,
	.sh-head__all svg {
		transition: none;
	}
}
