/**
 * قسم الفروع في ثيم تنمية الشمالية (template-parts/home/home-branches.php): «خريطة الفروع» على تدرّج الرمز العميق.
 *
 * بطاقة الفروع البيضاء في البداية (قائمة بالأسماء ومدنها، والمختار تنفتح تحته بياناته وزر الخريطة)، وخريطة المملكة
 * بخط أبيض ونقش فسيفساء خافت في الطرف الآخر. الفروع المتقاربة تُكبَّر منطقتها في «عدسة» دائرية بإطار أبيض وحلقة ذهبية
 * منقّطة تدور ببطء، يصلها خط منقّط بدائرة المنطقة على الخريطة الكاملة. الدبابيس معيّنات، والمختار ذهبي تنبض حوله حلقة.
 * السلوك في assets/js/blocks/home-branches.js، وبلا سكربت تبقى البيانات كلها مفتوحة.
 */

.sh-branches__layout {
	display: grid;
	grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
	align-items: center;
	gap: 40px;
}

/* ==========================================================================
   بطاقة الفروع
   ========================================================================== */

.sh-branches__panel {
	padding: 10px;
	border: 1px solid var(--sh-line);
	border-radius: var(--sh-radius-lg);
	background: #ffffff;
	box-shadow: var(--sh-shadow);
}

.sh-branches__list {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.sh-branches__item {
	position: relative;
	border-radius: var(--sh-radius);
	transition: background-color 0.3s ease;
}

.sh-branches__item.is-open {
	background: var(--sh-mist);
}

/* جرّة كوفية بتدرّج الرمز على حافة الفرع المختار */
.sh-branches__item.is-open::before {
	content: '';
	position: absolute;
	top: 16px;
	bottom: 16px;
	inset-inline-start: 0;
	width: 4px;
	border-radius: 0 3px 3px 0;
	background: linear-gradient(180deg, var(--sh-mint), var(--theme-primary));
}

.sh-branches__name {
	margin: 0;
	font-size: inherit;
}

.sh-branches__toggle {
	display: flex;
	align-items: center;
	gap: 14px;
	width: 100%;
	padding: 14px 18px;
	border: 0;
	border-radius: var(--sh-radius);
	background: none;
	color: var(--sh-ink);
	font: inherit;
	text-align: start;
	cursor: pointer;
}

.sh-branches__toggle:hover {
	background: var(--sh-mist);
}

.sh-branches__toggle:focus-visible {
	outline: 2px solid var(--sh-mint);
	outline-offset: -2px;
}

/* معيّن صغير يمتلئ بتدرّج الرمز للفرع المختار */
.sh-branches__mark {
	flex-shrink: 0;
	width: 14px;
	height: 14px;
	border: 2px solid var(--sh-line-strong);
	border-radius: 3px;
	transform: rotate(45deg);
	transition: background-color 0.3s ease, border-color 0.3s ease;
}

.sh-branches__item.is-open .sh-branches__mark {
	border-color: transparent;
	background: var(--theme-secondary);
}

.sh-branches__label {
	display: flex;
	flex-direction: column;
	flex: 1;
	min-width: 0;
}

.sh-branches__title {
	font-size: 1.05rem;
	font-weight: 800;
	line-height: 1.5;
}

.sh-branches__city {
	color: var(--theme-text-light);
	font-size: 0.84rem;
	font-weight: 600;
}

.sh-branches__details {
	padding: 0 18px 18px 18px;
	padding-inline-start: 46px;
}

/* بعد تهيئة السكربت: بيانات الفرع المختار وحده */
.sh-branches.is-ready .sh-branches__item:not(.is-open) .sh-branches__details {
	display: none;
}

.sh-branches__rows {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin: 0;
}

.sh-branches__row {
	display: flex;
	align-items: flex-start;
	gap: 10px;
}

.sh-branches__row dt {
	flex-shrink: 0;
	display: inline-flex;
	padding-top: 3px;
	color: var(--sh-mint-deep);
}

.sh-branches__row dd {
	margin: 0;
	color: var(--theme-text-dark);
	font-size: 0.93rem;
	line-height: 1.7;
	overflow-wrap: anywhere;
}

.sh-branches__row a {
	color: inherit;
	text-decoration: none;
}

.sh-branches__row a:hover {
	color: var(--theme-primary);
}

.sh-branches__go {
	margin-top: 16px;
	padding: 9px 16px;
	font-size: 0.88rem;
}

/* ==========================================================================
   الخريطة: المملكة بخط أبيض وتعبئة زجاجية خافتة ونقش فسيفساء، فوق تدرّج الرمز
   ========================================================================== */

.sh-branches__map {
	position: relative;
	width: 100%;
	aspect-ratio: 718 / 602;
}

/* وهج نعناعي ناعم خلف الخريطة */
.sh-branches__map::before {
	content: '';
	position: absolute;
	inset: 4% 6%;
	z-index: -1;
	border-radius: 50%;
	background: radial-gradient(closest-side, rgba(68, 170, 143, 0.35), transparent);
	filter: blur(14px);
}

.sh-branches__land,
.sh-branches__lens-map {
	display: block;
	width: 100%;
	height: 100%;
	overflow: visible;
}

.sh-branches__shape {
	fill: rgba(255, 255, 255, 0.08);
	stroke: rgba(255, 255, 255, 0.55);
	stroke-width: 2;
	stroke-linejoin: round;
	vector-effect: non-scaling-stroke;
}

.sh-branches__texture {
	stroke: none;
}

.sh-branches__tile {
	fill: rgba(255, 255, 255, 0.07);
}

/* العاصمة نقطةً خافتة للاهتداء */
.sh-branches__capital {
	fill: rgba(255, 255, 255, 0.55);
}

.sh-branches__capital-name {
	fill: rgba(255, 255, 255, 0.7);
	font-family: inherit;
	font-size: 15px;
	font-weight: 700;
}

/* الأقواس: منقّطة ذهبية تسري ببطء من الفرع الرئيسي */
.sh-branches__route {
	fill: none;
	stroke: var(--theme-secondary);
	stroke-width: 2.5;
	stroke-linecap: round;
	stroke-dasharray: 2 8;
	vector-effect: non-scaling-stroke;
	animation: sh-branches-route 1.6s linear infinite;
}

@keyframes sh-branches-route {
	to {
		stroke-dashoffset: -20;
	}
}

/* منطقة الفروع على الخريطة الكاملة، وخط يصلها بالعدسة */
.sh-branches__focus {
	fill: rgba(var(--theme-secondary-rgb), 0.12);
	stroke: var(--theme-secondary);
	stroke-width: 2;
	stroke-dasharray: 4 5;
}

.sh-branches__link {
	stroke: rgba(var(--theme-secondary-rgb), 0.8);
	stroke-width: 2;
	stroke-dasharray: 3 6;
	stroke-linecap: round;
}

.sh-branches__dot {
	fill: var(--theme-secondary);
}

/* ==========================================================================
   العدسة: المنطقة مكبّرة في دائرة بإطار أبيض وحلقة ذهبية منقّطة تدور حولها ببطء
   ========================================================================== */

.sh-branches__lens {
	position: absolute;
	top: 38%;
	left: 54%;
	width: 46%;
	aspect-ratio: 1;
	border: 4px solid rgba(255, 255, 255, 0.9);
	border-radius: 50%;
	background:
		radial-gradient(circle at 30% 25%, rgba(68, 170, 143, 0.35), transparent 60%),
		var(--sh-deep);
	box-shadow: 0 30px 60px -24px rgba(0, 0, 0, 0.6), 0 0 0 10px rgba(255, 255, 255, 0.08);
}

.sh-branches__lens::after {
	content: '';
	position: absolute;
	inset: -18px;
	border: 2px dashed rgba(var(--theme-secondary-rgb), 0.7);
	border-radius: 50%;
	animation: sh-branches-spin 40s linear infinite;
	pointer-events: none;
}

@keyframes sh-branches-spin {
	to {
		transform: rotate(360deg);
	}
}

.sh-branches__lens-map {
	border-radius: 50%;
	overflow: hidden;
}

.sh-branches__lens .sh-branches__shape {
	fill: rgba(255, 255, 255, 0.12);
	stroke: rgba(255, 255, 255, 0.75);
}

/* ==========================================================================
   الدبوس: معيّن صغير بتدرّج الرمز في موضع مدينة الفرع
   ========================================================================== */

.sh-branches__pin {
	position: absolute;
	top: var(--y);
	left: var(--x);
	z-index: 1;
	width: 28px;
	height: 28px;
	margin: -14px 0 0 -14px;
	cursor: pointer;
}

.sh-branches__pin::after {
	content: '';
	position: absolute;
	inset: 5px;
	border: 2px solid #ffffff;
	border-radius: 4px;
	background: var(--sh-grad);
	box-shadow: 0 6px 14px -4px rgba(0, 0, 0, 0.5);
	transform: rotate(45deg);
	transition: transform 0.35s var(--sh-ease), background 0.3s ease;
}

.sh-branches__pin:hover::after {
	transform: rotate(45deg) scale(1.2);
}

/* المختار: ذهبي أكبر، وحلقة معيّنة تنبض حوله */
.sh-branches__pin.is-active {
	z-index: 2;
}

.sh-branches__pin.is-active::after {
	background: var(--theme-secondary);
	transform: rotate(45deg) scale(1.35);
}

.sh-branches__pin.is-active::before {
	content: '';
	position: absolute;
	inset: -4px;
	border: 2px solid rgba(var(--theme-secondary-rgb), 0.85);
	border-radius: 7px;
	animation: sh-branches-pulse 2.2s var(--sh-ease) infinite;
}

@keyframes sh-branches-pulse {
	0% {
		opacity: 0.9;
		transform: rotate(45deg) scale(0.6);
	}

	100% {
		opacity: 0;
		transform: rotate(45deg) scale(1.6);
	}
}

/* اسم الفرع بجوار دبوسه: للمختار دائماً، ولغيره عند المرور */
.sh-branches__pin-tip {
	position: absolute;
	top: 50%;
	left: calc(100% + 8px);
	padding: 5px 12px;
	border-radius: var(--sh-radius-sm);
	background: #ffffff;
	color: var(--sh-deep);
	font-size: 0.8rem;
	font-weight: 800;
	white-space: nowrap;
	box-shadow: 0 10px 20px -10px rgba(0, 0, 0, 0.5);
	opacity: 0;
	transform: translate(-4px, -50%);
	transition: opacity 0.3s ease, transform 0.3s ease;
	pointer-events: none;
}

.sh-branches__pin.is-active .sh-branches__pin-tip,
.sh-branches__pin:hover .sh-branches__pin-tip {
	opacity: 1;
	transform: translate(0, -50%);
}

/* ==========================================================================
   بطاقة الفروع فوق التدرّج
   ========================================================================== */


.sh-branches__panel {
	position: relative;
	overflow: hidden;
	border: 0;
	box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.55);
}

.sh-branches__panel::before {
	content: '';
	position: absolute;
	inset: 0 0 auto;
	height: 4px;
	background: linear-gradient(to left, var(--sh-mint), var(--theme-primary) 60%, var(--theme-secondary));
}

/* ==========================================================================
   الشاشات المتوسطة والجوال: الخريطة فوق البطاقة
   ========================================================================== */

@media (max-width: 991px) {
	.sh-branches__layout {
		grid-template-columns: minmax(0, 1fr);
		gap: 30px;
	}

	.sh-branches__map {
		order: -1;
		max-width: 560px;
		margin: 0 auto;
	}
}

@media (max-width: 560px) {
	.sh-branches__details {
		padding-inline-start: 18px;
	}

	.sh-branches__toggle {
		padding: 12px 14px;
	}

	.sh-branches__lens::after {
		inset: -10px;
	}

	/* اسم الفرع تحت دبوسه، فلا يقطعه طرف الشاشة */
	.sh-branches__pin-tip {
		top: calc(100% + 6px);
		left: 50%;
		padding: 3px 9px;
		font-size: 0.72rem;
		transform: translate(-50%, -4px);
	}

	.sh-branches__pin.is-active .sh-branches__pin-tip,
	.sh-branches__pin:hover .sh-branches__pin-tip {
		transform: translate(-50%, 0);
	}

}

@media (prefers-reduced-motion: reduce) {
	.sh-branches__pin::after,
	.sh-branches__pin-tip,
	.sh-branches__item,
	.sh-branches__mark {
		transition: none;
	}

	.sh-branches__pin.is-active::before,
	.sh-branches__route,
	.sh-branches__lens::after {
		animation: none;
	}
}
