/*
Theme Name: Ultra News - تصميم إخباري
Description: قالب فرعي بتصميم إخباري حديث متوافق مع الموبايل (شريط أقسام، عاجل، خبر رئيسي، آخر الأخبار، صفحة مقال، وضع ليلي)
Template: ultranews
Version: 1.3.1
Text Domain: ultranews-news
*/

:root { --af-red: #b91c1c; --af-red-dark: #961616; --af-bg: #fafafa; --af-card: #fff; --af-text: #18181b; --af-muted: #71717a; --af-line: #e4e4e7; --af-soft: #f4f4f5; --af-radius: 16px; }
html.af-dark { --af-bg: #0f0f11; --af-card: #19191c; --af-text: #ececee; --af-muted: #a1a1aa; --af-line: #2c2c31; --af-soft: #232327; }

body.af-body { margin: 0; background: var(--af-bg); color: var(--af-text); font-family: var(--site-font); font-size: 16px; line-height: 1.6; overflow-x: clip; }
.af-body #site { overflow: visible; }
.af-body #site a:not(.btn) { color: inherit; text-decoration: none; word-break: normal; }
.af-body #site a:hover { color: var(--af-red); }
.af-body h1, .af-body h2, .af-body h3 { font-weight: 700; margin: 0; }
.af-wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; box-sizing: border-box; }
.af-body #site-main { min-height: 60vh; overflow: visible; padding-bottom: 32px; }

/* ===== الهيدر ===== */
.af-head { background: var(--af-head-bg, var(--af-card)); color: var(--af-head-text, var(--af-text)); }
.af-head .af-wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; padding-bottom: 14px; }
.af-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.af-mark { flex: 0 0 52px; width: 52px; height: 52px; border-radius: 14px; background: var(--af-red); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 700; }
.af-body #site .af-brand:hover { color: inherit; }
.af-brand-name { display: block; font-size: 24px; font-weight: 700; line-height: 1.3; }
.af-brand-desc { display: block; font-size: 13px; color: var(--af-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.af-brand img.af-logo { max-height: 56px; width: auto; }
.af-actions { display: flex; gap: 4px; flex-shrink: 0; }
.af-body .af-actions a, .af-body .af-actions button { width: 42px; height: 42px; border: 0; background: transparent; color: var(--af-head-text, var(--af-text)); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 20px; cursor: pointer; margin: 0; padding: 0; }
.af-actions a:hover, .af-actions button:hover { background: var(--af-soft); }

/* ===== شريط الأقسام ===== */
.af-nav { position: sticky; top: var(--wp-admin--admin-bar--height, 0px); z-index: 95; background: var(--af-nav-bg, var(--af-red)); box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.af-nav .af-wrap { padding: 0; }
.af-nav ul { display: flex; list-style: none; margin: 0; padding: 0; overflow-x: auto; scrollbar-width: none; }
.af-nav ul::-webkit-scrollbar { display: none; }
.af-nav li { flex: 0 0 auto; }
.af-body #site .af-nav a { display: block; position: relative; padding: 14px 20px; color: var(--af-nav-text, #fff); font-weight: 600; white-space: nowrap; }
.af-body #site .af-nav a:hover, .af-body #site .af-nav .current-menu-item > a, .af-body #site .af-nav .current-post-ancestor > a, .af-body #site .af-nav .current-category-ancestor > a { background: var(--af-nav-hover, var(--af-red-dark)); color: var(--af-nav-text, #fff); }
.af-nav .current-menu-item > a::after { content: ""; position: absolute; bottom: 0; right: 20px; left: 20px; height: 4px; background: #fff; border-radius: 4px 4px 0 0; }
.af-nav .sub-menu { display: none; }

/* ===== شريط عاجل ===== */
.af-ticker { background: var(--af-card); border-bottom: 1px solid var(--af-line); }
.af-ticker .af-wrap { display: flex; align-items: center; gap: 12px; padding-top: 9px; padding-bottom: 9px; }
.af-ticker-label { flex-shrink: 0; display: flex; align-items: center; gap: 8px; background: var(--af-ticker, #18181b); color: #fff; border-radius: 30px; padding: 3px 14px; font-size: 14px; font-weight: 600; }
.af-ticker-label::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--af-red); animation: af-blink 1.2s infinite; }
@keyframes af-blink { 50% { opacity: .35; } }
.af-ticker-view { flex: 1; overflow: hidden; white-space: nowrap; direction: ltr; }
.af-ticker-track { display: inline-flex; animation: af-marquee var(--af-speed, 40s) linear infinite; }
.af-ticker-view:hover .af-ticker-track { animation-play-state: paused; }
.af-ticker-group { display: flex; flex-direction: row-reverse; }
.af-ticker-group a { direction: rtl; padding: 0 28px; font-size: 15px; font-weight: 500; }
@keyframes af-marquee { from { transform: translateX(-50%); } to { transform: translateX(0); } }
@media (prefers-reduced-motion: reduce) { .af-ticker-track, .af-ticker-label::before { animation: none; } .af-ticker-view { overflow-x: auto; } }

/* ===== الرئيسية ===== */
.af-grid-top { display: grid; gap: 24px; margin-top: 28px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 992px) { .af-grid-top { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; } }
.af-hero { position: relative; display: block; border-radius: var(--af-radius); overflow: hidden; background: #27272a; aspect-ratio: 16 / 10; }
.af-hero img { position: absolute; inset: 0; width: 100%; height: 100% !important; object-fit: cover; }
.af-hero-body { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start; gap: 10px; padding: 20px; background: linear-gradient(to top, rgba(0,0,0,.9) 0%, rgba(0,0,0,.45) 55%, rgba(0,0,0,.05) 100%); color: #fff; }
.af-hero-title { font-size: clamp(21px, 4.6vw, 34px); font-weight: 700; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.af-hero .af-meta { color: #e4e4e7; }
.af-badge { display: inline-block; background: var(--cat, #15803d); color: #fff; border-radius: 30px; padding: 1px 14px; font-size: 13px; font-weight: 600; }
.af-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; color: var(--af-muted); font-size: 13px; }
.af-meta > span + span::before { content: "•"; margin-inline-end: 10px; }

.af-box { background: var(--af-card); border: 1px solid var(--af-line); border-radius: var(--af-radius); padding: 18px; }
.af-box-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.af-box-head h2 { display: flex; align-items: center; gap: 10px; font-size: 21px; }
.af-dot { width: 12px; height: 12px; border-radius: 50%; background: #dc2626; box-shadow: 0 0 0 5px rgba(220,38,38,.12); }
.af-body #site .af-more { color: var(--af-muted); font-size: 14px; }
.af-timeline { list-style: none; margin: 0; padding: 0; }
.af-timeline li { position: relative; padding-inline-start: 18px; margin-bottom: 18px; border-inline-start: 2px solid var(--af-line); margin-inline-start: 5px; }
.af-timeline li:last-child { margin-bottom: 0; }
.af-timeline li::before { content: ""; position: absolute; top: 2px; right: -6px; width: 10px; height: 10px; border-radius: 50%; background: var(--af-red); }
.af-timeline .af-time { display: block; color: var(--af-red); font-size: 13px; font-weight: 700; }
.af-timeline a { display: block; font-weight: 600; line-height: 1.7; }

.af-section { margin-top: 36px; }
.af-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.af-title h1, .af-title h2 { font-size: 22px; border-inline-start: 5px solid var(--cat, var(--af-red)); padding-inline-start: 10px; line-height: 1.3; }
.af-cards { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.af-card { display: flex; flex-direction: column; background: var(--af-card); border: 1px solid var(--af-line); border-radius: var(--af-radius); overflow: hidden; }
.af-card-img { display: block; aspect-ratio: 16 / 10; background: var(--af-soft); }
.af-card-img img { width: 100%; height: 100% !important; object-fit: cover; }
.af-card-body { display: flex; flex-direction: column; gap: 8px; padding: 18px; flex: 1; }
.af-body #site a.af-cat { color: var(--cat, #15803d); font-size: 14px; font-weight: 700; align-self: flex-start; }
.af-card h3 { font-size: 18px; line-height: 1.6; flex: 1; }

.af-most { list-style: none; margin: 0; padding: 0; counter-reset: af; }
.af-most li { counter-increment: af; display: flex; gap: 14px; padding: 14px 0; border-top: 1px solid var(--af-line); }
.af-most li:first-child { border-top: 0; padding-top: 0; }
.af-most li::before { content: counter(af); font-size: 28px; font-weight: 700; color: var(--af-red); line-height: 1.2; min-width: 24px; }
.af-most h3 { font-size: 16px; line-height: 1.6; margin-bottom: 4px; }

.af-pagination { margin-top: 28px; }
.af-pagination .nav-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.af-pagination .page-numbers { min-width: 42px; padding: 8px 12px; text-align: center; background: var(--af-card); border: 1px solid var(--af-line); border-radius: 10px; }
.af-body #site .af-pagination .page-numbers.current { background: var(--af-red); border-color: var(--af-red); color: #fff; }
.af-pagination .screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ===== صفحة المقال ===== */
.af-body #site .af-single { margin-top: 22px; }
.af-crumbs { display: flex; flex-wrap: wrap; gap: 8px; color: var(--af-muted); font-size: 14px; margin-bottom: 16px; }
.af-crumbs a::after { content: "‹"; margin-inline-start: 8px; }
/* الحاويات الأصلية للقالب (محتفظين بها علشان إعلانات وسط المقال) */
.af-single .primary-content, .af-body.design-normal .af-single .primary-content { background: transparent; }
.af-single .primary-content > .container { max-width: none; padding: 0 !important; margin: 0; }
.af-single .primary-content-inner { display: block; }
.af-single .primary-content-inner-3 > *, .af-single .entry-content > * { max-width: 100%; }
.af-single h1 { font-size: clamp(25px, 4.5vw, 36px) !important; line-height: 1.6; margin-bottom: 16px; }
.af-lead { color: var(--af-muted); font-size: 19px; line-height: 2; margin: 0 0 20px; }
.af-byline { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px; border-top: 1px solid var(--af-line); border-bottom: 1px solid var(--af-line); padding: 14px 0; margin-bottom: 24px; color: var(--af-muted); font-size: 14px; }
.af-byline strong { color: var(--af-text); font-size: 15px; }
.af-single .entry-image { margin: 0 0 24px; }
.af-single .entry-image-inner { border-radius: var(--af-radius); margin: 0; }
.af-single .entry-caption { background: var(--af-soft); color: var(--af-muted); }
.af-single .entry-content { font-size: 18px; line-height: 2.1; }
.af-single .entry-content > * { margin-bottom: 22px; }
.af-body #site .af-single .entry-content a:not(.btn) { color: var(--af-red); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--af-red) 35%, transparent); text-underline-offset: 7px; }
.af-body #site .af-single .entry-content h2:not(.unstyled), .af-body #site .af-single .entry-content h3:not(.unstyled), .af-body #site .af-single .entry-content h4:not(.unstyled) { margin: 32px 0 18px; padding: 12px 18px; background: color-mix(in srgb, var(--af-red) 6%, transparent); border: 1px solid color-mix(in srgb, var(--af-red) 18%, transparent); border-inline-start: 4px solid var(--af-red); border-radius: 12px; font-size: 22px; line-height: 1.6; }
.af-body #site .af-single .entry-content h3:not(.unstyled) { font-size: 20px; }
.af-body #site .af-single .entry-content h4:not(.unstyled) { font-size: 18px; }
html.af-dark .af-body #site .af-single .entry-content h2:not(.unstyled), html.af-dark .af-body #site .af-single .entry-content h3:not(.unstyled), html.af-dark .af-body #site .af-single .entry-content h4:not(.unstyled) { background: rgba(248,113,113,.1); border-color: rgba(248,113,113,.25); border-inline-start-color: #f87171; }
.af-single .entry-content blockquote { background: var(--af-soft); border-inline-start: 4px solid var(--af-red); border-radius: var(--af-radius); padding: 18px 20px; }
.af-readalso { background: var(--af-soft); border-inline-start: 4px solid var(--af-red); border-radius: 14px; padding: 14px 18px; line-height: 1.9; }
.af-readalso strong { margin-inline-end: 6px; }
.af-body #site .af-single .entry-content .af-readalso a { text-decoration: none; }
.af-pages { display: flex; gap: 8px; margin: 16px 0; }
.af-tags { display: flex; flex-wrap: wrap; gap: 10px; padding: 8px 0 20px; border-bottom: 1px solid var(--af-line); }
.af-tags a { background: var(--af-soft); border-radius: 30px; padding: 7px 16px; font-size: 14px; font-weight: 500; }

.af-below { display: flex; flex-direction: column; gap: 32px; margin-top: 16px; }
.af-credit { margin-top: 8px; direction: ltr; }
.af-body .comments { background: transparent !important; }
.af-body .comments .container { padding: 0 16px; max-width: 1200px; }
.af-body .comments .glob-container { background: var(--af-card); color: var(--af-text); border-radius: var(--af-radius); }
.af-body.af-body .comments-list .comment-body { background: var(--af-soft); border-color: var(--af-line); }

/* ===== الفوتر: كحلي متدرج لامع ===== */
.af-foot { --af-foot-1: #1e3a8a; --af-foot-2: #10286b; --af-foot-3: #081a45; --af-foot-text: #cbd5e1; --af-foot-title: #fff; position: relative; overflow: hidden; background: linear-gradient(180deg, var(--af-foot-1) 0%, var(--af-foot-2) 55%, var(--af-foot-3) 100%); color: var(--af-foot-text); padding: 40px 0 20px; border-top: 1px solid rgba(255,255,255,.22); box-shadow: inset 0 1px 0 rgba(255,255,255,.3), inset 0 -40px 60px rgba(0,0,0,.18); }
.af-foot.af-gloss::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 55%; background: linear-gradient(180deg, rgba(255,255,255,.17) 0%, rgba(255,255,255,.05) 55%, rgba(255,255,255,0) 100%); pointer-events: none; }
.af-foot.af-gloss::after { content: ""; position: absolute; top: -60%; left: -10%; width: 60%; height: 120%; background: linear-gradient(115deg, rgba(255,255,255,0) 40%, rgba(255,255,255,.07) 50%, rgba(255,255,255,0) 60%); pointer-events: none; }
.af-foot > .af-wrap { position: relative; z-index: 1; }
.af-body #site .af-foot a { color: var(--af-foot-text); }
.af-body #site .af-foot a:hover { color: #fff; }
.af-foot-grid { display: grid; gap: 28px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.af-foot-about { grid-column: 1 / -1; }
@media (min-width: 768px) { .af-foot-about { grid-column: auto; } }
.af-foot h2 { color: var(--af-foot-title); font-size: 18px; margin-bottom: 12px; }
.af-foot p { margin: 0; color: var(--af-foot-text); opacity: .85; }
.af-foot ul { list-style: none; margin: 0; padding: 0; }
.af-foot li { margin-bottom: 8px; }
.af-foot .sub-menu { display: none; }
.af-foot .social-links { justify-content: flex-start; }
.af-foot-copy { border-top: 1px solid rgba(255,255,255,.18); margin-top: 24px; padding-top: 16px; text-align: center; font-size: 13px; color: var(--af-foot-text); }
.af-body #search-overlay { border-bottom: 3px solid var(--af-red); background: var(--af-card); color: var(--af-text); }
.af-body #scroll-top { background: var(--af-card); color: var(--af-text); }
.af-body img { max-width: 100%; }

/* وضوح الأحمر في الوضع الليلي */
html.af-dark .af-body #site .af-single .entry-content a:not(.btn), html.af-dark .af-body #site .af-timeline .af-time, html.af-dark .af-body #site a:hover { color: #f87171; }
html.af-dark .af-timeline .af-time { color: #f87171; }
html.af-dark .af-body #site .af-nav a:hover { color: #fff; }

/* المقال بعرض الصفحة كله (القالب الأب بيحصره في 800px) */
.af-body #site .af-single .primary-content-inner-3 > *:not(.ad), .af-body #site .af-single .primary-content-inner-4 > *:not(.ad), .af-body #site .comments-inner-2 { max-width: 100% !important; }
.af-body #site .af-single .primary-content-inner-4 > p, .af-body #site .af-single .primary-content-inner-4 > div:not(.ad) { margin-left: 0; margin-right: 0; }
.af-body .comments .container { max-width: 1200px; }
.af-body .btn-primary { --bs-btn-bg: var(--af-red); --bs-btn-border-color: var(--af-red); --bs-btn-hover-bg: var(--af-red-dark); --bs-btn-active-bg: var(--af-red-dark); }

/* ===== بوكس المشاركة وبوكس الكاتب ===== */
.af-panel { background: var(--af-card); border: 1px solid var(--af-line); border-radius: 18px; box-shadow: 0 4px 18px rgba(0,0,0,.05); margin: 22px 0; }
.af-share { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 16px 18px; }
.af-share-title { color: var(--af-red); font-weight: 700; font-size: 17px; margin-inline-end: 6px; }
.af-body #site .af-share a, .af-share button { display: inline-flex; align-items: center; gap: 8px; border: 1px solid transparent; border-radius: 30px; padding: 7px 18px; color: #fff; font-family: inherit; font-size: 14px; font-weight: 700; line-height: 1.5; cursor: pointer; }
.af-body #site .af-share a:hover { color: #fff; filter: brightness(1.1); }
.af-body #site .af-share a.af-s-whatsapp { background: #25d366; }
.af-body #site .af-share a.af-s-twitter-x { background: #111827; }
.af-body #site .af-share a.af-s-facebook { background: #1877f2; }
.af-body #site .af-share a.af-s-telegram { background: #229ed9; }
.af-share button { background: var(--af-card); color: var(--af-red); border-color: var(--af-line); }

.af-author { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; padding: 26px 22px; border-top: 4px solid var(--af-red); }
.af-avatar { flex-shrink: 0; width: 78px; height: 78px; border-radius: 50%; border: 3px solid var(--af-red); overflow: hidden; }
.af-avatar img { width: 100%; height: 100% !important; object-fit: cover; }
.af-author-info { flex: 1 1 220px; min-width: 0; }
.af-author-label { display: block; color: var(--af-red); font-size: 13px; font-weight: 700; }
.af-author h2, .af-author h1 { font-size: 22px !important; margin: 2px 0 6px; }
.af-body #site .af-author h2 a { color: var(--af-red); }
.af-author p { color: var(--af-muted); margin: 0; font-size: 15px; line-height: 1.9; }
.af-body #site a.af-author-all { background: var(--af-red); color: #fff; border-radius: 30px; padding: 9px 22px; font-weight: 700; font-size: 14px; }
.af-body #site a.af-author-all:hover { background: var(--af-red-dark); color: #fff; }
@media (max-width: 575px) { .af-author { flex-direction: column; text-align: center; } .af-author-info { flex-basis: auto; } }

/* ===== صفحة الكاتب ===== */
.af-author-count { display: inline-flex; flex-direction: column; align-items: center; background: var(--af-soft); border-radius: 14px; padding: 8px 22px; color: var(--af-muted); font-size: 13px; }
.af-author-count strong { color: var(--af-red); font-size: 24px; line-height: 1.3; }
.af-body #site .af-author-links { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; color: var(--af-red); font-size: 14px; font-weight: 700; }
.af-list { display: flex; flex-direction: column; gap: 14px; }
.af-row { display: flex; gap: 16px; background: var(--af-card); border: 1px solid var(--af-line); border-radius: var(--af-radius); padding: 12px; }
.af-row-img { flex: 0 0 220px; aspect-ratio: 16 / 10; align-self: center; border-radius: 12px; overflow: hidden; background: var(--af-soft); }
.af-row-img img { width: 100%; height: 100% !important; object-fit: cover; }
.af-row-body { display: flex; flex-direction: column; justify-content: center; gap: 6px; min-width: 0; }
.af-row h3 { font-size: 19px; line-height: 1.6; }
@media (max-width: 575px) { .af-row { gap: 12px; padding: 10px; } .af-row-img { flex-basis: 110px; } .af-row h3 { font-size: 15px; } }

/* ===== الإعلانات ===== */
.af-ad { clear: both; display: block; max-width: 100%; margin: 20px auto; text-align: center; overflow: hidden; box-sizing: border-box; }
.af-ad-header, .af-ad-home, .af-ad-footer, .af-ad-archive { max-width: 1200px; padding: 0 16px; }
.af-ad-label { display: block; color: var(--af-muted); font-size: 11px; line-height: 1.6; margin-bottom: 4px; }
@media (max-width: 767px) { .af-ad-d { display: none; } }
@media (min-width: 768px) { .af-ad-m { display: none; } }
.af-ad-sticky { position: fixed; z-index: 99; bottom: 0; inset-inline: 0; margin: 0; padding: 6px 8px; max-width: none; background: var(--af-card); border-top: 1px solid var(--af-line); overflow: visible; }
.af-ad-sticky .af-ad-close { position: absolute; top: -28px; inset-inline-end: 8px; width: 28px; height: 28px; border: 1px solid var(--af-line); border-bottom: 0; border-radius: 8px 8px 0 0; background: var(--af-card); color: var(--af-text); cursor: pointer; line-height: 1; padding: 0; }
@media (min-width: 768px) { .af-ad-sticky { display: none; } }

/* ===== زر أخبار أقدم ===== */
.af-older { text-align: center; margin: 28px 0 8px; }
.af-body #site a.af-btn { display: inline-block; background: var(--af-red); color: #fff; border-radius: 30px; padding: 10px 28px; font-weight: 700; }
.af-body #site a.af-btn:hover { background: var(--af-red-dark); color: #fff; }


/* ===== تثبيت عرض صفحة المقال على الموبايل ومنع الانزلاق الأفقي ===== */
@media (max-width: 767px) {
  html,
  body.af-body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden !important;
  }

  .af-body #site,
  .af-body #site-main,
  .af-body .entry-outer-container,
  .af-body .af-single,
  .af-body .af-single .af-column,
  .af-body .af-single .primary-content,
  .af-body .af-single .primary-content > .container,
  .af-body .af-single .primary-content-inner,
  .af-body .af-single .primary-content-inner-2,
  .af-body .af-single .primary-content-inner-3,
  .af-body .af-single .primary-content-inner-4,
  .af-body .af-single .entry-content,
  .af-body .af-single .af-below,
  .af-body .comments {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .af-body .af-single,
  .af-body .af-single .primary-content,
  .af-body .af-single .primary-content-inner-3,
  .af-body .af-single .primary-content-inner-4 {
    margin-inline: auto;
  }

  .af-body .af-single img,
  .af-body .af-single video,
  .af-body .af-single iframe,
  .af-body .af-single embed,
  .af-body .af-single object,
  .af-body .af-single figure {
    max-width: 100% !important;
    box-sizing: border-box;
  }

  .af-body .af-single .entry-content,
  .af-body .af-single .entry-content p,
  .af-body .af-single .entry-content li,
  .af-body .af-single .entry-content a,
  .af-body .af-single .af-crumbs,
  .af-body .af-single .af-byline,
  .af-body .af-single .af-tags {
    min-width: 0;
    overflow-wrap: anywhere;
    word-wrap: break-word;
  }

  .af-body .af-single .entry-content table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .af-body .af-single .entry-content pre,
  .af-body .af-single .entry-content code {
    max-width: 100%;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    box-sizing: border-box;
  }

  .af-body .af-single .entry-content .wp-block-embed,
  .af-body .af-single .entry-content .wp-block-video,
  .af-body .af-single .entry-content .wp-block-table,
  .af-body .af-single .entry-content .wp-block-image {
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }
}


/* ===== تحسين تخطيط الديسكتوب وتوسيط إعلانات المقال ===== */
@media (min-width: 992px) {
  .af-body #site-main > .af-wrap,
  .af-body #site-main > .af-single {
    width: 100%;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
  }

  .af-body #site-main .af-grid-top {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
    align-items: start;
    width: 100%;
  }

  .af-body #site-main .af-single {
    display: block;
    box-sizing: border-box;
  }

  .af-body #site-main .af-single > .af-column,
  .af-body #site-main .af-single .primary-content,
  .af-body #site-main .af-single .primary-content > .container,
  .af-body #site-main .af-single .primary-content-inner,
  .af-body #site-main .af-single .primary-content-inner-2,
  .af-body #site-main .af-single .primary-content-inner-3,
  .af-body #site-main .af-single .primary-content-inner-4 {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }
}

/* بعض إضافات الإعلانات تستخدم .ad أو .ads وليس .af-ad */
.af-body #site-main .af-single .af-ad,
.af-body #site-main .af-single .entry-content .ad,
.af-body #site-main .af-single .entry-content .ads,
.af-body #site-main .af-single .entry-content [id*="google_ads"],
.af-body #site-main .af-single .primary-content-inner-3 > .ad,
.af-body #site-main .af-single .primary-content-inner-4 > .ad {
  display: block;
  float: none !important;
  clear: both;
  width: fit-content;
  max-width: 100%;
  margin: 20px auto !important;
  text-align: center !important;
  box-sizing: border-box;
}

.af-body #site-main .af-single .af-ad > *,
.af-body #site-main .af-single .entry-content .ad > *,
.af-body #site-main .af-single .entry-content .ads > * {
  margin-left: auto !important;
  margin-right: auto !important;
}


/* ===== إصلاح المساحة الفارغة وانحراف المحتوى في الديسكتوب =====
   إلغاء أعمدة/هوامش القالب الأب التي تحجز مكاناً جانبياً بدون محتوى.
*/
@media (min-width: 768px) {
  .af-body #site-main {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  /* غلاف المقال في القالب الأب كان يترك مساحة لعمود جانبي */
  .af-body #site-main .entry-outer-container {
    display: block !important;
    float: none !important;
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
  }

  .af-body #site-main article.af-single,
  .af-body #site-main .af-wrap {
    float: none !important;
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    max-width: 1200px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
  }

  .af-body #site-main article.af-single {
    display: block !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  .af-body #site-main article.af-single > .af-column {
    display: block !important;
    float: none !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
  }

  .af-body #site-main article.af-single .primary-content,
  .af-body #site-main article.af-single .primary-content > .container,
  .af-body #site-main article.af-single .primary-content-inner,
  .af-body #site-main article.af-single .primary-content-inner-2,
  .af-body #site-main article.af-single .primary-content-inner-3,
  .af-body #site-main article.af-single .primary-content-inner-4,
  .af-body #site-main article.af-single .entry-content {
    float: none !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
  }

  .af-body #site-main article.af-single .primary-content > .container {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  .af-body #site-main article.af-single .af-below {
    width: 100% !important;
    max-width: 100% !important;
    clear: both !important;
  }

  /* الصفحة الرئيسية: المحتوى يأخذ عرض الحاوية ويتمركز */
  .af-body #site-main > .af-wrap {
    display: block !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  .af-body #site-main .af-grid-top {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr) !important;
  }
}

/* توسيط الإعلان حتى لو كان كود الإعلان نفسه يفرض float أو محاذاة */
.af-body #site-main article.af-single .af-ad,
.af-body #site-main article.af-single .entry-content .ad,
.af-body #site-main article.af-single .entry-content .ads,
.af-body #site-main article.af-single .entry-content [id*="google_ads"],
.af-body #site-main article.af-single .entry-content ins.adsbygoogle {
  display: block !important;
  float: none !important;
  clear: both !important;
  position: relative !important;
  left: auto !important;
  right: auto !important;
  inset-inline: auto !important;
  margin: 22px auto !important;
  text-align: center !important;
}

.af-body #site-main article.af-single .af-ad iframe,
.af-body #site-main article.af-single .entry-content .ad iframe,
.af-body #site-main article.af-single .entry-content .ads iframe,
.af-body #site-main article.af-single .entry-content ins.adsbygoogle {
  display: block !important;
  margin-left: auto !important;
  margin-right: auto !important;
}


/* ===== علاج السبب الظاهر بالصورة: الموقع محصور في ثلثي الشاشة =====
   القالب الأب يقيّد غلاف الموقع بعرض عمود ويترك العمود الآخر فارغاً.
   نعيد الغلاف الرئيسي وكل أقسام الهيدر والمحتوى إلى عرض الشاشة كاملاً.
*/
html,
body.af-body {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow-x: hidden !important;
}

body.af-body > #site,
.af-body #site {
  display: block !important;
  float: none !important;
  position: relative !important;
  inset: auto !important;
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  transform: none !important;
  box-sizing: border-box !important;
}

/* لا تسمح لقالب الأب بتطبيق تخطيط عمودين على أغلفة القالب الفرعي */
.af-body #site > .af-head,
.af-body #site > .af-nav,
.af-body #site > .af-ticker,
.af-body #site > .af-ad,
.af-body #site > #site-main,
.af-body #site > .af-foot,
.af-body #site #site-main,
.af-body #site .entry-outer-container {
  display: block !important;
  float: none !important;
  position: relative;
  inset: auto !important;
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  box-sizing: border-box !important;
}

/* أغلفة المحتوى فقط هي التي تبقى محددة العرض ومتمركزة */
.af-body #site .af-wrap {
  width: 100% !important;
  max-width: 1200px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  box-sizing: border-box !important;
}

.af-body #site .af-head .af-wrap,
.af-body #site .af-nav .af-wrap,
.af-body #site .af-ticker .af-wrap {
  width: 100% !important;
  max-width: 1200px !important;
}

/* منع أي عمود جانبي فارغ من تقليص المقال أو الرئيسية */
.af-body #site-main > .af-wrap,
.af-body #site-main > article.af-single,
.af-body #site-main .af-grid-top,
.af-body #site-main .af-single > .af-column,
.af-body #site-main .af-single .af-below {
  float: none !important;
  width: 100% !important;
  max-width: 1200px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  box-sizing: border-box !important;
}

@media (max-width: 767px) {
  .af-body #site .af-wrap,
  .af-body #site-main > .af-wrap,
  .af-body #site-main > article.af-single {
    max-width: 100% !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
  .af-body #site-main .af-grid-top {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}
