/**
 * قسم آخر الأخبار في ثيم تنمية الشمالية (template-parts/home/home-news.php): «فسيفساء الأخبار».
 *
 * لوحة من أربع بلاطات متلاصقة بفواصل ضيقة كمربعات الشعار: الأحدث كبيرة (عمودان وصفّان)، والثاني عريضة،
 * والثالث والرابع صغيرتان. الصورة تملأ البلاطة، وعليها من الأسفل تدرّج بالأساسي العميق يحمل التاريخ والعنوان.
 * عند المرور تقترب الصورة قليلاً ويرتفع خط ذهبي قصير فوق العنوان. البلاطة بلا صورة بتدرّج الرمز.
 */

.sh-news__mosaic {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	grid-template-rows: 250px 250px;
	gap: 14px;
}

.sh-news__tile--1 {
	grid-column: 1 / 3;
	grid-row: 1 / 3;
}

.sh-news__tile--2 {
	grid-column: 3 / 5;
}

/* أقل من أربعة أخبار: تمتد البلاطات لتملأ اللوحة */
.sh-news__mosaic--1 {
	grid-template-columns: minmax(0, 1fr);
	grid-template-rows: 440px;
}

.sh-news__mosaic--1 .sh-news__tile--1 {
	grid-column: auto;
	grid-row: auto;
}

.sh-news__mosaic--2 .sh-news__tile--2 {
	grid-row: 1 / 3;
}

.sh-news__mosaic--3 .sh-news__tile--3 {
	grid-column: 3 / 5;
}

/* ==========================================================================
   البلاطة
   ========================================================================== */

.sh-news__tile {
	position: relative;
	isolation: isolate;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	border-radius: var(--sh-radius-lg);
	background: var(--sh-grad-deep);
	box-shadow: var(--sh-shadow);
	transition: box-shadow 0.35s ease, transform 0.35s var(--sh-ease);
}

.sh-news__tile:hover,
.sh-news__tile:focus-within {
	box-shadow: var(--sh-shadow-hover);
	transform: translateY(-3px);
}

.sh-news__media {
	position: absolute;
	inset: 0;
	z-index: -2;
}

.sh-news__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.7s var(--sh-ease);
}

.sh-news__tile:hover .sh-news__media img,
.sh-news__tile:focus-within .sh-news__media img {
	transform: scale(1.05);
}

/* تدرّج داكن من الأسفل يحمل النص */
.sh-news__tile::before {
	content: '';
	position: absolute;
	inset: 0;
	z-index: -1;
	background: linear-gradient(0deg, rgba(7, 26, 36, 0.92) 0%, rgba(7, 26, 36, 0.55) 42%, rgba(7, 26, 36, 0) 75%);
	transition: opacity 0.35s ease;
}

/* الخبر بلا صورة: تدرّج الرمز بلا التعتيم الداكن، ورمز الشعار خافتاً في الزاوية العليا */
.sh-news__tile:has(.sh-news__placeholder)::before {
	opacity: 0.45;
}

.sh-news__tile--even:has(.sh-news__placeholder) {
	background: linear-gradient(150deg, var(--sh-mint-deep), var(--theme-primary));
}

.sh-news__placeholder {
	position: absolute;
	top: -12%;
	inset-inline-end: -10%;
	width: 62%;
	aspect-ratio: 1;
	opacity: 0.14;
}

.sh-news__placeholder svg {
	width: 100%;
	height: 100%;
}

.sh-news__body {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 8px;
	padding: 22px 24px 24px;
	color: #ffffff;
}

/* خط ذهبي قصير فوق النص يمتد عند المرور */
.sh-news__body::before {
	content: '';
	width: 28px;
	height: 4px;
	margin-bottom: 4px;
	border-radius: 2px;
	background: var(--theme-secondary);
	transition: width 0.4s var(--sh-ease);
}

.sh-news__tile:hover .sh-news__body::before,
.sh-news__tile:focus-within .sh-news__body::before {
	width: 60px;
}

.sh-news__tag {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 4px 11px;
	border-radius: var(--sh-radius-sm);
	background: rgba(255, 255, 255, 0.14);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	font-size: 0.8rem;
	font-weight: 700;
}

.sh-news__tag svg {
	width: 14px;
	height: 14px;
	color: var(--theme-secondary);
}

.sh-news__date {
	color: rgba(255, 255, 255, 0.8);
	font-size: 0.85rem;
	font-weight: 600;
}

.sh-news__title {
	margin: 0;
	color: #ffffff;
	font-size: 1.12rem;
	font-weight: 800;
	line-height: 1.55;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.sh-news__tile--1 .sh-news__title {
	font-size: clamp(1.3rem, 1rem + 0.8vw, 1.7rem);
	line-height: 1.45;
	-webkit-line-clamp: 3;
}

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

/* الرابط يغطي البلاطة كلها */
.sh-news__link::after {
	content: '';
	position: absolute;
	inset: 0;
	z-index: 1;
}

.sh-news__tile:has(.sh-news__link:focus-visible) {
	outline: 3px solid var(--theme-secondary);
	outline-offset: 3px;
}

.sh-news__link:focus-visible {
	outline: none;
}

.sh-news__excerpt {
	max-width: 560px;
	margin: 0;
	color: rgba(255, 255, 255, 0.82);
	font-size: 0.95rem;
	line-height: 1.8;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.sh-news__more {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin-top: 6px;
	color: var(--theme-secondary);
	font-size: 0.92rem;
	font-weight: 800;
}

.sh-news__more svg {
	transition: transform 0.3s var(--sh-ease);
}

.sh-news__tile:hover .sh-news__more svg {
	transform: translateX(-4px);
}

/* ==========================================================================
   الشاشات المتوسطة والجوال
   ========================================================================== */

@media (max-width: 991px) {
	.sh-news__mosaic,
	.sh-news__mosaic--2,
	.sh-news__mosaic--3 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		grid-template-rows: 380px repeat(2, 220px);
	}

	.sh-news__tile--1 {
		grid-column: 1 / 3;
		grid-row: auto;
	}

	.sh-news__tile--2 {
		grid-column: 1 / 3;
	}

	.sh-news__mosaic--2 .sh-news__tile--2 {
		grid-row: auto;
	}

	.sh-news__mosaic--3 .sh-news__tile--3 {
		grid-column: 1 / 3;
	}
}

@media (max-width: 640px) {
	.sh-news__mosaic,
	.sh-news__mosaic--2,
	.sh-news__mosaic--3 {
		grid-template-columns: minmax(0, 1fr);
		grid-template-rows: none;
		grid-auto-rows: minmax(210px, auto);
		gap: 12px;
	}

	.sh-news__mosaic > .sh-news__tile {
		grid-column: auto;
		grid-row: auto;
	}

	.sh-news__mosaic > .sh-news__tile--1 {
		min-height: 340px;
	}

	.sh-news__body {
		padding: 18px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.sh-news__tile,
	.sh-news__media img,
	.sh-news__body::before,
	.sh-news__more svg {
		transition: none;
	}
}
