/*
 * ---------------------------------------------------------------------------
 * الملف:      assets/css/blog.css
 * الوظيفة:    تصميم المدونتين فقط (يُحمَّل بعد core.css في صفحات المدونة):
 *             1. أعمدة الشبكة وبطاقة المقال   2. المقال: الرأس، الكاتب، الصورة
 *             3. المصادر، المنتج المرتبط، المشاركة، «اقرأ أيضاً»   4. صفحة الكاتب
 *             الشبكة الأساسية والمسار وأرقام الصفحات و404 في core.css (مشتركة مع المتجر).
 * ---------------------------------------------------------------------------
 */

/* 1. Grid columns and article cards ------------------------------------------------- */

@media (min-width: 600px) {
	.grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (min-width: 1024px) {
	.grid {
		grid-template-columns: repeat(3, 1fr);
	}

	.grid.grid--two {
		grid-template-columns: repeat(2, 1fr);
	}
}

.card {
	position: relative;
	display: flex;
	flex-direction: column;
	background: #fff;
	border: 1px solid var(--c-line);
	border-radius: var(--radius);
	overflow: hidden;
	transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover {
	box-shadow: 0 8px 24px rgba(14, 14, 18, 0.08);
	transform: translateY(-2px);
}

.card__media .thumb {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	object-fit: cover;
}

.card__body {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 14px 16px 16px;
}

.card__title {
	margin: 0;
	font-size: 1.05rem;
	line-height: 1.55;
}

.card__media {
	display: block;
}

/* The line clamp sits on the inner text, not on the link: a clamped link
   (overflow hidden) stops its full-card ::after from taking taps in Safari. */
.card__link {
	color: var(--c-text);
	text-decoration: none;
}

.card__text {
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* The whole card opens the article; the category link stays separate. */
.card__link::after {
	content: "";
	position: absolute;
	inset: 0;
}

.card:hover .card__link,
.card__link:focus-visible {
	color: var(--accent);
}

.card__meta {
	margin: 0;
	color: var(--c-muted);
	font-size: 0.82rem;
}

/* 2. Article ------------------------------------------------------------------------------ */

.reading {
	width: min(100% - 32px, var(--reading));
	margin-inline: auto;
}

.article__header {
	padding-top: 24px;
}

.article__header .badge {
	margin-bottom: 10px;
}

.article__title {
	margin: 0 0 14px;
	font-size: clamp(1.6rem, 1.15rem + 1.9vw, 2.3rem);
	line-height: 1.45;
}

html[lang="en"] .article__title {
	line-height: 1.25;
	letter-spacing: -0.01em;
}

.author-line {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 12px;
	margin-bottom: 20px;
	color: var(--c-muted);
	font-size: 0.85rem;
}

.author-line__avatar {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	object-fit: cover;
}

.author-line__name a {
	color: var(--c-text);
	font-weight: 600;
	text-decoration: none;
}

.author-line__name a:hover {
	color: var(--accent);
}

.author-line__date::before,
.author-line__updated::before {
	content: "·";
	margin-inline-end: 12px;
}

.article__image {
	width: min(100%, 960px);
	margin: 0 auto 8px;
}

.article__image .thumb {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	object-fit: cover;
}

@media (min-width: 1024px) {
	.article__image .thumb {
		border-radius: var(--radius);
	}
}

.article__image figcaption {
	padding: 6px 16px 0;
	color: var(--c-muted);
	font-size: 0.82rem;
	text-align: center;
}

.article__content {
	padding-top: 16px;
}

.page-links {
	margin-top: 24px;
	font-weight: 700;
}

/* 3. Sources, product box, share, related ------------------------------------------------------ */

.sources {
	margin-top: 32px;
	padding-top: 16px;
	border-top: 1px solid var(--c-line);
	font-size: 0.9rem;
}

.sources__title,
.share__title {
	margin-bottom: 8px;
	font-size: 1rem;
}

.sources__list {
	margin: 0;
	padding-inline-start: 1.3em;
	color: var(--c-muted);
}

.sources__list cite {
	color: var(--c-text);
	font-style: normal;
	font-weight: 600;
}

.sources__list a cite {
	color: var(--accent);
}

.product-box {
	margin-top: 32px;
	padding: 16px;
	background: var(--c-ivory);
	border: 1px solid var(--c-line);
	border-radius: var(--radius);
}

.product-box__label {
	margin: 0 0 10px;
	color: var(--accent);
	font-size: 0.85rem;
	font-weight: 700;
}

.product-box__inner {
	display: grid;
	grid-template-columns: 96px 1fr;
	gap: 16px;
	align-items: start;
}

.product-box__media img,
.product-box__media .thumb {
	display: block;
	width: 96px;
	height: 96px;
	object-fit: cover;
	border-radius: 10px;
	background: #fff;
}

.product-box__name {
	margin: 0 0 4px;
	font-weight: 700;
	line-height: 1.5;
}

.product-box__name a {
	color: var(--c-text);
	text-decoration: none;
}

.product-box__intro {
	margin: 0 0 10px;
	color: var(--c-muted);
	font-size: 0.9rem;
	line-height: 1.7;
}

.share {
	margin-top: 32px;
}

.share__list {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.share__item {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 44px;
	padding-inline: 8px 14px;
	background: #fff;
	border: 1px solid var(--c-line);
	border-radius: 999px;
	color: var(--c-text);
	font-size: 0.9rem;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
}

.share__item:hover {
	border-color: var(--accent);
	color: var(--accent);
}

/* The icon (or letter) of the network inside a share button. */
.share__mark.network-mark {
	width: 28px;
	height: 28px;
	background: var(--c-ivory);
	color: var(--c-text);
}

.share__mark.network-mark.has-icon {
	background: none;
}

.share__mark img {
	width: 28px;
	height: 28px;
}

.share__mark .icon {
	width: 16px;
	height: 16px;
}

.related {
	margin-top: 48px;
}

/* 4. Writer page ---------------------------------------------------------------------- */

.author-hero {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
	margin-bottom: 32px;
	padding: 24px 20px;
	background: var(--c-ivory);
	border: 1px solid var(--c-line);
	border-radius: var(--radius);
	text-align: center;
}

@media (min-width: 768px) {
	.author-hero {
		flex-direction: row;
		align-items: flex-start;
		gap: 24px;
		padding: 28px 32px;
		text-align: start;
	}
}

.author-hero__avatar {
	flex: none;
	width: 96px;
	height: 96px;
	border: 3px solid var(--accent);
	border-radius: 50%;
	object-fit: cover;
}

.author-hero__label {
	margin: 0;
	color: var(--accent);
	font-size: 0.85rem;
	font-weight: 700;
}

.author-hero__name {
	margin: 2px 0 8px;
	font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem);
	line-height: 1.4;
}

.author-hero__bio {
	max-width: var(--reading);
	margin: 0;
	font-size: var(--fs-body);
	line-height: var(--lh-body);
}

/* "Also writes in English (12 articles)": link to the writer's other page. */
.author-hero__other {
	margin: 12px 0 0;
}

.author-hero__other a {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 40px;
	padding: 6px 16px;
	border: 1px solid var(--accent-line);
	border-radius: 999px;
	color: var(--c-text);
	font-size: 0.92rem;
	font-weight: 700;
	text-decoration: none;
}

.author-hero__other a:hover {
	background: var(--accent-fill-flat);
	color: var(--on-accent-fill);
}

.author-hero__arrow {
	width: 16px;
	height: 16px;
}

[dir="rtl"] .author-hero__arrow {
	transform: scaleX(-1);
}
