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

/* ==========================================================================
   الشبكة
   ========================================================================== */

.tn-news__grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 28px;
	margin: 0;
	padding: 0;
	list-style: none;
}

/* خبر أو خبران: بطاقات أعرض في الوسط */
.tn-news__grid--1 {
	grid-template-columns: minmax(0, 420px);
	justify-content: center;
}

.tn-news__grid--2 {
	grid-template-columns: repeat(2, minmax(0, 420px));
	justify-content: center;
}

.tn-news__cell {
	display: flex;
	min-width: 0;
	margin: 0;
}

/* ==========================================================================
   البطاقة: بيضاء، والصورة داخلها بهامش وزوايا ورقة
   ========================================================================== */

.tn-news__card {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	padding: 12px 12px 22px;
	border: 1px solid var(--tn-line);
	border-radius: var(--tn-radius-lg);
	background: var(--tn-card);
	box-shadow: var(--tn-shadow);
	transition: transform 0.35s var(--tn-ease), box-shadow 0.35s ease, border-color 0.35s ease;
}

.tn-news__card:hover,
.tn-news__card:focus-within {
	border-color: var(--tn-line-strong);
	box-shadow: var(--tn-shadow-hover);
	transform: translateY(-6px);
}

.tn-news__media {
	position: relative;
	margin-bottom: 30px;
}

.tn-news__frame {
	position: relative;
	display: block;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	border-radius: var(--tn-radius-leaf);
	background: var(--tn-sand);
}

.tn-news__frame img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.7s var(--tn-ease);
}

.tn-news__card:hover .tn-news__frame img {
	transform: scale(1.05);
}

/* شارة التاريخ: ورقة خضراء تتدلّى من حافة الصورة في البداية (يمين) */
.tn-news__date {
	position: absolute;
	bottom: -18px;
	inset-inline-start: 18px;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	min-height: 38px;
	padding: 6px 18px;
	border: 3px solid var(--tn-card);
	border-radius: 20px 4px 20px 4px;
	background: var(--tn-leaf-deep);
	color: #ffffff;
	font-size: 0.82rem;
	font-weight: 700;
	line-height: 1.4;
	white-space: nowrap;
	box-shadow: 0 10px 20px -12px rgba(var(--theme-primary-rgb), 0.6);
}

/* خبر بلا صورة: لوحة خضراء فاتحة فيها الغرسة */
.tn-news__placeholder {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background:
		radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.6) 0, transparent 60%),
		linear-gradient(160deg, var(--tn-sand) 0%, var(--tn-sand-deep) 100%);
	color: rgba(var(--theme-secondary-rgb), 0.75);
}

.tn-news__placeholder svg {
	width: 26%;
	max-width: 84px;
	height: auto;
}

/* ==========================================================================
   نص البطاقة
   ========================================================================== */

.tn-news__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	align-items: flex-start;
	gap: 10px;
	padding: 0 10px;
}

.tn-news__tag {
	font-size: 0.76rem;
}

.tn-news__title {
	margin: 0;
	color: var(--tn-ink);
	font-size: 1.08rem;
	font-weight: 800;
	line-height: 1.6;
}

.tn-news__title a {
	color: inherit;
	text-decoration: none;
	transition: color 0.25s ease;
}

/* رابط العنوان يغطي البطاقة كلها */
.tn-news__title a::after {
	content: '';
	position: absolute;
	inset: 0;
	z-index: 3;
	border-radius: var(--tn-radius-lg);
}

.tn-news__card:hover .tn-news__title a {
	color: var(--theme-primary);
}

.tn-news__title a:focus-visible {
	outline: none;
}

.tn-news__title a:focus-visible::after {
	outline: 2px solid var(--theme-secondary);
	outline-offset: 3px;
}

.tn-news__excerpt {
	display: -webkit-box;
	overflow: hidden;
	margin: 0;
	color: var(--theme-text-light);
	font-size: 0.9rem;
	line-height: 1.8;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
}

.tn-news__more {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin-top: auto;
	padding-top: 6px;
	color: var(--tn-leaf-deep);
	font-size: 0.88rem;
	font-weight: 700;
}

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

.tn-news__card:hover .tn-news__more svg {
	transform: translateX(-4px);
}

/* ==========================================================================
   شريط «عناوين أخرى»
   ========================================================================== */

.tn-news__strip {
	display: flex;
	align-items: center;
	gap: 14px 22px;
	margin-top: 36px;
	padding: 10px;
	border: 1px solid var(--tn-line);
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.8);
}

.tn-news__strip--link-only {
	justify-content: center;
	border: 0;
	background: none;
}

.tn-news__strip-label {
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 7px 14px;
	border-radius: 999px;
	background: rgba(var(--theme-secondary-rgb), 0.12);
	color: var(--tn-leaf-deep);
	font-size: 0.82rem;
	font-weight: 800;
}

.tn-news__strip-label svg {
	width: 16px;
	height: 16px;
}

.tn-news__headlines {
	display: flex;
	flex: 1;
	min-width: 0;
	margin: 0;
	padding: 0;
	list-style: none;
}

.tn-news__headline {
	flex: 1 1 0;
	min-width: 0;
	margin: 0;
}

/* فاصل رفيع بين العناوين */
.tn-news__headline + .tn-news__headline {
	border-inline-start: 1px solid var(--tn-line-strong);
}

.tn-news__headline a {
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding: 2px 16px;
	color: inherit;
	text-decoration: none;
}

.tn-news__headline-date {
	color: var(--tn-leaf-deep);
	font-size: 0.74rem;
	font-weight: 700;
}

.tn-news__headline-title {
	overflow: hidden;
	color: var(--tn-ink);
	font-size: 0.9rem;
	font-weight: 700;
	line-height: 1.6;
	white-space: nowrap;
	text-overflow: ellipsis;
	transition: color 0.25s ease;
}

.tn-news__headline a:hover .tn-news__headline-title,
.tn-news__headline a:focus-visible .tn-news__headline-title {
	color: var(--theme-primary);
	text-decoration: underline;
	text-decoration-color: var(--theme-secondary);
	text-underline-offset: 4px;
}

.tn-news__all {
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 9px 18px;
	border-radius: 999px;
	background: var(--theme-primary);
	color: #ffffff;
	font-size: 0.86rem;
	font-weight: 700;
	text-decoration: none;
	transition: background-color 0.25s ease;
}

.tn-news__all:hover,
.tn-news__all:focus-visible {
	background: var(--tn-leaf-deep);
	color: #ffffff;
}

/* ==========================================================================
   الشاشات الأصغر
   ========================================================================== */

@media (max-width: 1024px) {
	.tn-news__grid,
	.tn-news__grid--2 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 22px;
	}

	/* البطاقة الثالثة بعرض الصف: صورتها في البداية والنص بجانبها */
	.tn-news__grid--3 .tn-news__cell:nth-child(3) {
		grid-column: 1 / -1;
	}

	.tn-news__grid--3 .tn-news__cell:nth-child(3) .tn-news__card {
		display: grid;
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
		align-items: center;
		gap: 0 22px;
		padding-bottom: 12px;
	}

	.tn-news__grid--3 .tn-news__cell:nth-child(3) .tn-news__media {
		margin-bottom: 0;
	}

	/* الصورة بجانب النص هنا، فتجلس شارة التاريخ داخل حافتها السفلية */
	.tn-news__grid--3 .tn-news__cell:nth-child(3) .tn-news__date {
		bottom: 12px;
	}

	.tn-news__grid--3 .tn-news__cell:nth-child(3) .tn-news__body {
		padding: 10px 0;
	}

	.tn-news__strip {
		flex-wrap: wrap;
		border-radius: var(--tn-radius-lg);
	}

	.tn-news__headlines {
		flex-basis: 100%;
		order: 2;
		flex-direction: column;
		gap: 4px;
	}

	.tn-news__headline + .tn-news__headline {
		padding-top: 6px;
		border-inline-start: 0;
		border-top: 1px solid var(--tn-line);
	}

	.tn-news__headline a {
		flex-direction: row;
		align-items: baseline;
		gap: 12px;
		padding: 4px 6px;
	}

	.tn-news__headline-date {
		flex-shrink: 0;
	}

	.tn-news__all {
		margin-inline-start: auto;
	}
}

@media (max-width: 640px) {
	.tn-news__grid,
	.tn-news__grid--1,
	.tn-news__grid--2 {
		grid-template-columns: minmax(0, 1fr);
	}

	.tn-news__grid--3 .tn-news__cell:nth-child(3) .tn-news__card {
		display: flex;
		align-items: stretch;
		padding-bottom: 22px;
	}

	.tn-news__grid--3 .tn-news__cell:nth-child(3) .tn-news__media {
		margin-bottom: 30px;
	}

	.tn-news__grid--3 .tn-news__cell:nth-child(3) .tn-news__date {
		bottom: -18px;
	}

	.tn-news__grid--3 .tn-news__cell:nth-child(3) .tn-news__body {
		padding: 0 10px;
	}

	.tn-news__frame {
		aspect-ratio: 16 / 10;
	}

	.tn-news__headline a {
		flex-direction: column;
		gap: 2px;
	}

	.tn-news__headline-title {
		white-space: normal;
	}

	.tn-news__all {
		margin-inline: auto;
	}
}

@media (prefers-reduced-motion: reduce) {
	.tn-news__card,
	.tn-news__frame img,
	.tn-news__more svg {
		transition: none;
	}

	.tn-news__card:hover,
	.tn-news__card:focus-within {
		transform: none;
	}
}
