/**
 * blog.css — تخطيط المجلة: الأرشيف، البطاقات، وتجربة قراءة المقال.
 */

/* == شريط التصنيفات ======================================== */
.mag-filters { border-bottom: 1px solid var(--line); background: #fff; }
.mag-filters .container {
	display: flex; gap: 8px; padding-block: 14px;
	overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none;
}
.mag-filters .container::-webkit-scrollbar { display: none; }
.mag-chip {
	flex: 0 0 auto; padding: 8px 16px; border-radius: 999px;
	border: 1px solid var(--line); color: var(--navy); font-weight: 600; font-size: .9rem;
	white-space: nowrap; min-height: 38px; display: inline-flex; align-items: center;
	transition: background var(--speed), color var(--speed), border-color var(--speed);
}
.mag-chip:hover { border-color: var(--blue); color: var(--blue); text-decoration: none; }
.mag-chip.is-active { background: var(--btn-main); border-color: var(--btn-main); color: #fff; }
.mag-chip.is-active:hover { background: var(--gold); border-color: var(--gold); color: #fff; }
.mag-chip:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* == الغلاف العام ========================================== */
.mag-wrap { padding-block: 44px 64px; }
.mag-sec-title {
	font-size: clamp(20px, 2.4vw, 26px); margin: 54px 0 24px; position: relative;
	padding-inline-start: 14px;
}
.mag-sec-title::before {
	content: ""; position: absolute; inset-inline-start: 0; top: .18em; bottom: .18em;
	width: 4px; border-radius: 3px; background: linear-gradient(var(--blue), var(--gold));
}

/* == البطاقة الأساسية ====================================== */
.mag-card { display: flex; flex-direction: column; min-width: 0; }
.mag-thumb {
	position: relative; display: block; overflow: hidden; border-radius: var(--radius);
	background: var(--bg-soft); line-height: 0;
}
.mag-thumb img {
	width: 100%; height: 100%; object-fit: cover; display: block;
	transition: transform .45s ease;
}
.mag-card:hover .mag-thumb img { transform: scale(1.04); }
.mag-noimg {
	display: flex; align-items: center; justify-content: center; height: 100%;
	color: var(--light-blue); background: linear-gradient(135deg, rgba(17,117,188,.10), rgba(107,182,216,.20));
}
.mag-cat {
	position: absolute; inset-inline-start: 12px; top: 12px; z-index: 2;
	background: rgba(255, 255, 255, .94); color: var(--navy);
	font-size: .74rem; font-weight: 700; padding: 5px 11px; border-radius: 999px;
	box-shadow: 0 2px 10px rgba(11, 37, 64, .12); line-height: 1.4;
}
.mag-body { padding-top: 14px; display: flex; flex-direction: column; flex: 1; }
.mag-title { font-size: 1.08rem; line-height: 1.6; margin: 0 0 9px; font-weight: 700; }
.mag-title a { color: var(--navy); }
.mag-title a:hover { color: var(--blue); text-decoration: none; }
.mag-excerpt {
	font-size: .93rem; color: var(--muted); line-height: 1.85; margin: 0 0 14px; flex: 1;
	display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.mag-meta {
	display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
	font-size: .82rem; color: var(--muted); margin-top: auto;
}
.mag-meta .dot { opacity: .55; }
.mag-more {
	display: inline-flex; align-items: center; gap: 6px; margin-top: 12px;
	font-weight: 700; font-size: .9rem; color: var(--blue);
}
.mag-more svg { transition: transform var(--speed); }
.mag-card:hover .mag-more svg { transform: translateX(var(--arrow-shift, 3px)); }
[dir="rtl"] .mag-more { --arrow-shift: -3px; }
[dir="rtl"] .mag-more svg { transform: scaleX(-1); }
[dir="rtl"] .mag-card:hover .mag-more svg { transform: scaleX(-1) translateX(3px); }

/* == الصف الرئيسي: مقال كبير + مقالان جانبيان ============== */
.mag-lead-row { display: grid; grid-template-columns: 1.35fr 1fr; gap: 34px; align-items: start; }
.mag-side { display: flex; flex-direction: column; gap: 26px; }

.mag-v-lead .mag-thumb { aspect-ratio: 16 / 10; }
.mag-v-lead .mag-title { font-size: clamp(1.4rem, 2.5vw, 1.95rem); line-height: 1.4; margin-top: 4px; }
.mag-v-lead .mag-excerpt { font-size: 1.02rem; }
.mag-v-lead .mag-body { padding-top: 18px; }

.mag-v-wide { display: grid; grid-template-columns: 150px 1fr; gap: 16px; align-items: start; }
.mag-v-wide .mag-thumb { aspect-ratio: 4 / 3; }
.mag-v-wide .mag-body { padding-top: 0; }
.mag-v-wide .mag-title { font-size: 1rem; }
.mag-v-wide .mag-excerpt { display: none; }
.mag-v-wide .mag-cat { inset-inline-start: 8px; top: 8px; font-size: .68rem; padding: 4px 9px; }

/* == الشبكة ================================================ */
.mag-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px 28px; }
.mag-grid .mag-thumb { aspect-ratio: 3 / 2; }

@media (max-width: 1000px) {
	.mag-lead-row { grid-template-columns: 1fr; gap: 30px; }
	.mag-side { flex-direction: row; gap: 20px; }
	.mag-side .mag-v-wide { flex: 1 1 0; }
	.mag-grid { grid-template-columns: repeat(2, 1fr); gap: 28px 22px; }
}
@media (max-width: 640px) {
	.mag-side { flex-direction: column; }
	.mag-grid { grid-template-columns: 1fr; gap: 26px; }
	.mag-wrap { padding-block: 30px 44px; }
}

/* == شريط تقدم القراءة ===================================== */
.read-progress {
	position: sticky; top: 0; z-index: 45; height: 3px; background: transparent;
	margin-bottom: -3px;
}
.read-progress span {
	display: block; height: 100%; width: 0;
	background: linear-gradient(90deg, var(--blue), var(--gold));
	transition: width .1s linear;
}

/* == المقال المفرد ========================================= */
.single-article { background: #fff; }
.article-head { padding-block: 44px 24px; text-align: center; }
.article-head .container { max-width: 820px; }
.article-cat {
	display: inline-block; font-size: .8rem; font-weight: 700; letter-spacing: .04em;
	color: var(--gold-d); background: rgba(181, 142, 75, .12);
	padding: 6px 14px; border-radius: 999px; margin-bottom: 16px;
}
.article-cat:hover { text-decoration: none; background: rgba(181, 142, 75, .2); }
.article-head h1 { font-size: clamp(1.7rem, 3.6vw, 2.6rem); line-height: 1.35; margin: 0 0 14px; }
.article-standfirst {
	font-size: 1.1rem; line-height: 1.9; color: var(--muted);
	max-width: 700px; margin: 0 auto 20px;
}
.article-meta {
	display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap;
	font-size: .88rem; color: var(--muted);
	padding-block: 14px; border-block: 1px solid var(--line);
}
.article-meta .am-brand { display: inline-flex; align-items: center; gap: 8px; color: var(--navy); }
.article-meta .am-brand img { height: 24px; width: auto; }
.article-meta .dot, .article-meta .am-sep { opacity: .5; }
.article-head .crumbs { color: var(--muted); margin-top: 14px; font-size: .84rem; }
.article-head .crumbs a { color: var(--muted); }
.article-head .crumbs a:hover { color: var(--blue); }

.article-hero { margin: 0 0 6px; }
.article-hero .container { max-width: 1000px; }
.article-hero img {
	width: 100%; height: auto; max-height: 520px; object-fit: cover;
	border-radius: var(--radius-lg); box-shadow: var(--shadow); display: block;
}

/* تخطيط المقال: نص + عمود جانبي لاصق */
.article-layout {
	display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 48px;
	max-width: 1080px; padding-block: 44px 56px; align-items: start;
}
.article-layout .entry-content { max-width: 72ch; font-size: 1.09rem; line-height: 2; }
.article-layout .entry-content > *:first-child { margin-top: 0; }
.entry-content h2 {
	font-size: clamp(1.3rem, 2.2vw, 1.6rem); margin: 1.8em 0 .6em; position: relative;
	padding-inline-start: 14px;
}
.entry-content h2::before {
	content: ""; position: absolute; inset-inline-start: 0; top: .15em; bottom: .15em;
	width: 4px; border-radius: 3px; background: var(--blue);
}
.entry-content h3 { font-size: 1.18rem; margin: 1.5em 0 .5em; color: var(--navy); }
.entry-content p { margin-bottom: 1.15em; }
.entry-content ul, .entry-content ol { margin: 0 0 1.3em; padding-inline-start: 1.3em; }
.entry-content li { margin-bottom: .55em; }
.entry-content img { border-radius: var(--radius); box-shadow: var(--shadow); height: auto; }
.entry-content figure { margin: 1.8em 0; }
.entry-content figcaption { font-size: .85rem; color: var(--muted); text-align: center; margin-top: 8px; }
.entry-content blockquote {
	margin: 1.8em 0; padding: 22px 26px; border: none;
	background: linear-gradient(180deg, rgba(17, 117, 188, .06), rgba(17, 117, 188, .02));
	border-inline-start: 4px solid var(--blue); border-radius: 0 var(--radius) var(--radius) 0;
	font-size: 1.06rem; color: var(--navy);
}
[dir="rtl"] .entry-content blockquote { border-radius: var(--radius) 0 0 var(--radius); }
.entry-content blockquote p:last-child { margin-bottom: 0; }
.entry-content a:not(.btn) { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }
/* الأزرار داخل المقال تحتفظ بألوانها ولا ترث تنسيق الروابط */
.entry-content a.btn, .article-cta a.btn {
	color: #fff !important; text-decoration: none !important;
	display: inline-flex; align-items: center; justify-content: center;
}
.entry-content a.btn:hover, .article-cta a.btn:hover { color: #fff !important; text-decoration: none !important; }
.entry-content a.btn-ghost, .article-cta a.btn-ghost { color: var(--blue) !important; }
.entry-content hr { border: none; border-top: 1px solid var(--line); margin: 2.4em 0; }

/* العمود الجانبي */
.article-aside { position: sticky; top: 96px; display: flex; flex-direction: column; gap: 18px; }
.aside-card {
	background: linear-gradient(160deg, rgba(17, 117, 188, .07), rgba(107, 182, 216, .10));
	border: 1px solid rgba(17, 117, 188, .16); border-radius: var(--radius-lg); padding: 24px;
}
.aside-card h4 { margin: 0 0 8px; color: var(--navy); font-size: 1.05rem; }
.aside-card p { margin: 0 0 16px; font-size: .92rem; color: var(--muted); line-height: 1.8; }
.aside-card .btn { width: 100%; }
.aside-share { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.share-label { font-size: .85rem; font-weight: 700; color: var(--navy); margin-inline-end: 2px; }
.share-btn {
	width: 40px; height: 40px; min-height: 40px; border-radius: 50%;
	display: inline-flex; align-items: center; justify-content: center;
	border: 1px solid var(--line); background: #fff; color: var(--navy); cursor: pointer;
	transition: background var(--speed), color var(--speed), border-color var(--speed);
}
.share-btn:hover { background: var(--blue); border-color: var(--blue); color: #fff; text-decoration: none; }
.share-btn.is-copied { background: var(--gold); border-color: var(--gold); color: #fff; }

@media (max-width: 980px) {
	.article-layout { grid-template-columns: 1fr; gap: 34px; }
	.article-aside { position: static; flex-direction: column; }
	.aside-card { max-width: 520px; }
}
@media (max-width: 640px) {
	.article-head { padding-block: 30px 18px; }
	.article-layout { padding-block: 30px 40px; }
	.article-layout .entry-content { font-size: 1.03rem; line-height: 1.95; }
	.article-hero img { max-height: 300px; }
}

/* الترقيم */
.pagination-wrap { margin-top: 46px; }
.pagination-wrap .nav-links { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.pagination-wrap .page-numbers {
	min-width: 44px; min-height: 44px; padding: 0 12px; border-radius: 10px;
	display: inline-flex; align-items: center; justify-content: center;
	border: 1px solid var(--line); color: var(--navy); font-weight: 700;
}
.pagination-wrap .page-numbers:hover { border-color: var(--blue); color: var(--blue); text-decoration: none; }
.pagination-wrap .page-numbers.current { background: var(--btn-main); border-color: var(--btn-main); color: #fff; }
