/*
Theme Name: Sada9 Agency
Theme URI: https://al9nwes.com
Author: Atheer Al-Obaidy
Description: قالب وكالة أنباء احترافي بتصميم أبيض/أحمر، يدعم العربية RTL بالكامل مع تحسين محركات البحث وبيانات منظمة للأخبار.
Version: 1.0.4
Requires at least: 6.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: sada9
Tags: news, magazine, rtl-language-support, custom-logo, translation-ready
*/

/* ============ المتغيرات ============ */
:root{
  --red:#c8102e;
  --red-dark:#9c0c23;
  --ink:#111418;
  --ink-2:#2b3138;
  --muted:#6a7280;
  --line:#e3e6ea;
  --line-strong:#c9ced5;
  --bg:#ffffff;
  --bg-soft:#f6f7f9;
  --bg-dark:#0f1318;
  --max:1280px;
  --radius:3px;
  --font: "IBM Plex Sans Arabic","Noto Kufi Arabic","Segoe UI",Tahoma,sans-serif;
}

/* ============ أساسيات ============ */
*,*::before,*::after{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{
  margin:0;background:var(--bg);color:var(--ink);
  font-family:var(--font);font-size:16px;line-height:1.75;
  font-weight:400;-webkit-font-smoothing:antialiased;
}
img{max-width:100%;height:auto;display:block}
a{color:inherit;text-decoration:none}
a:hover{color:var(--red)}
h1,h2,h3,h4,h5{margin:0;font-weight:700;line-height:1.35;letter-spacing:-.01em}
p{margin:0 0 1.1em}
.wrap{max-width:var(--max);margin:0 auto;padding:0 20px}
.screen-reader-text{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(1px,1px,1px,1px);white-space:nowrap}
.skip-link{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(1px,1px,1px,1px);background:var(--red);color:#fff;padding:0;z-index:999}
.skip-link:focus{width:auto;height:auto;clip:auto;right:10px;top:10px;padding:10px 16px}

/* ============ الشريط العلوي ============ */
.topbar{background:var(--bg-dark);color:#cfd5dc;font-size:13px;border-bottom:3px solid var(--red)}
.topbar .wrap{display:flex;align-items:center;justify-content:space-between;height:38px;gap:16px}
.topbar a{color:#cfd5dc}
.topbar a:hover{color:#fff}
.topbar-date{display:flex;align-items:center;gap:8px;white-space:nowrap}
.topbar-links{display:flex;gap:18px;align-items:center}
.topbar-social{display:flex;gap:12px;align-items:center}
.topbar-social svg{width:15px;height:15px;fill:currentColor;display:block}

/* ============ الهيدر ============ */
.site-header{background:#fff;border-bottom:1px solid var(--line)}
.header-main{display:flex;align-items:center;justify-content:space-between;gap:24px;padding:18px 0}
.site-branding{display:flex;align-items:center;gap:14px;min-width:0}
.site-branding img,.custom-logo{max-height:68px;width:auto}
.site-title{font-size:30px;font-weight:800;letter-spacing:-.02em}
.site-title a:hover{color:var(--ink)}
.site-desc{font-size:13px;color:var(--muted);margin-top:2px}
.header-ad{flex:1;max-width:520px;text-align:left}
.header-tools{display:flex;align-items:center;gap:10px}
.btn-search,.btn-menu{
  background:none;border:1px solid var(--line-strong);width:40px;height:40px;
  border-radius:var(--radius);cursor:pointer;display:flex;align-items:center;justify-content:center;color:var(--ink);
}
.btn-search:hover,.btn-menu:hover{border-color:var(--red);color:var(--red)}
.btn-search svg,.btn-menu svg{width:18px;height:18px;fill:currentColor}
.btn-menu{display:none}

/* ============ القائمة ============ */
.nav-bar{background:#fff;border-bottom:3px solid var(--ink);position:sticky;top:0;z-index:50}
.admin-bar .nav-bar{top:32px}
.nav-bar .wrap{display:flex;align-items:center;gap:6px}
.main-nav ul{list-style:none;margin:0;padding:0;display:flex;flex-wrap:wrap}
.main-nav li{position:relative}
.main-nav > ul > li > a{
  display:block;padding:14px 16px;font-weight:700;font-size:16px;
  border-bottom:3px solid transparent;margin-bottom:-3px;transition:.15s;
}
.main-nav > ul > li > a:hover,
.main-nav > ul > li.current-menu-item > a,
.main-nav > ul > li.current-cat > a{color:var(--red);border-bottom-color:var(--red)}
.main-nav ul ul{
  display:none;position:absolute;top:100%;right:0;background:#fff;min-width:200px;
  border:1px solid var(--line);box-shadow:0 10px 30px rgba(0,0,0,.09);z-index:60;flex-direction:column;
}
.main-nav li:hover > ul{display:flex}
.main-nav ul ul a{display:block;padding:10px 16px;font-size:15px;border-bottom:1px solid var(--line)}
.nav-live{margin-right:auto;display:flex;align-items:center;gap:7px;font-weight:700;font-size:14px;color:var(--red)}
.nav-live .dot{width:9px;height:9px;border-radius:50%;background:var(--red);animation:pulse 1.6s infinite}
@keyframes pulse{0%{opacity:1;transform:scale(1)}50%{opacity:.35;transform:scale(.75)}100%{opacity:1;transform:scale(1)}}

/* ============ شريط عاجل ============ */
.breaking{background:var(--bg-soft);border-bottom:1px solid var(--line)}
.breaking .wrap{display:flex;align-items:center;gap:0;height:46px;overflow:hidden}
.breaking-label{
  background:var(--red);color:#fff;font-weight:800;font-size:14px;padding:0 16px;height:46px;
  display:flex;align-items:center;gap:8px;white-space:nowrap;flex-shrink:0;position:relative;
}
.breaking-label::after{content:"";position:absolute;left:-10px;top:0;border-right:10px solid var(--red);border-top:23px solid transparent;border-bottom:23px solid transparent}
.breaking-track{flex:1;overflow:hidden;position:relative;height:46px;margin-right:18px}
.breaking-list{display:flex;align-items:center;gap:42px;position:absolute;white-space:nowrap;height:46px;animation:ticker 48s linear infinite}
.breaking-track:hover .breaking-list{animation-play-state:paused}
.breaking-list a{font-size:15px;font-weight:600;display:inline-flex;align-items:center;gap:9px}
.breaking-list a::before{content:"";width:6px;height:6px;background:var(--red);border-radius:50%;flex-shrink:0}
@keyframes ticker{0%{transform:translateX(100%)}100%{transform:translateX(-100%)}}

/* ============ شبكة عامة ============ */
.section{padding:34px 0}
.section-head{display:flex;align-items:center;gap:14px;margin-bottom:20px;border-bottom:2px solid var(--line);padding-bottom:0}
.section-title{font-size:21px;font-weight:800;position:relative;padding:0 0 10px;margin-bottom:-2px;border-bottom:3px solid var(--red)}
.section-more{margin-right:auto;font-size:14px;font-weight:700;color:var(--muted);padding-bottom:10px}
.section-more:hover{color:var(--red)}

/* بطاقات */
.card{display:flex;flex-direction:column;background:#fff}
.card-media{position:relative;overflow:hidden;background:var(--bg-soft);aspect-ratio:16/9}
.card-media img{width:100%;height:100%;object-fit:cover;transition:transform .5s ease}
.card:hover .card-media img{transform:scale(1.045)}
.cat-badge{
  position:absolute;top:0;right:0;background:var(--red);color:#fff;font-size:12px;font-weight:700;
  padding:5px 11px;letter-spacing:.01em;
}
.cat-badge:hover{background:var(--red-dark);color:#fff}
.card-body{padding:12px 0 0}
.card-title{font-size:18px;font-weight:700;line-height:1.5}
.card-excerpt{font-size:14.5px;color:var(--ink-2);margin-top:7px;line-height:1.8}
.meta{display:flex;align-items:center;gap:12px;font-size:12.5px;color:var(--muted);margin-top:9px;flex-wrap:wrap}
.meta svg{width:13px;height:13px;fill:currentColor;vertical-align:-2px;margin-left:4px}

/* ============ الواجهة: اللِيد ============ */
.lead-grid{display:grid;grid-template-columns:1.55fr 1fr;gap:26px;align-items:start}
.lead-main .card-media{aspect-ratio:16/9}
.lead-main .card-title{font-size:34px;font-weight:800;line-height:1.35;margin-top:14px}
.lead-main .card-excerpt{font-size:16.5px}
.lead-side{display:flex;flex-direction:column;gap:16px}
.lead-side .mini{display:grid;grid-template-columns:104px 1fr;gap:13px;padding-bottom:16px;border-bottom:1px solid var(--line)}
.lead-side .mini:last-child{border-bottom:0;padding-bottom:0}
.lead-side .mini .card-media{aspect-ratio:1/1}
.lead-side .mini .card-title{font-size:16px;line-height:1.55}
.lead-side .mini .card-body{padding:0}

/* صف 4 بطاقات */
.grid-4{display:grid;grid-template-columns:repeat(4,1fr);gap:24px}
.grid-3{display:grid;grid-template-columns:repeat(3,1fr);gap:24px}
.grid-2{display:grid;grid-template-columns:repeat(2,1fr);gap:28px}

/* قسم التصنيف: مقال رئيسي + قائمة */
.cat-block{display:grid;grid-template-columns:1fr 1fr;gap:26px}
.cat-list{display:flex;flex-direction:column;gap:14px}
.cat-list .mini{display:grid;grid-template-columns:96px 1fr;gap:12px;border-bottom:1px solid var(--line);padding-bottom:14px}
.cat-list .mini:last-child{border-bottom:0;padding-bottom:0}
.cat-list .mini .card-media{aspect-ratio:4/3}
.cat-list .mini .card-title{font-size:15.5px;line-height:1.55}

/* الأحدث + الشريط الجانبي */
.layout{display:grid;grid-template-columns:1fr 330px;gap:40px;align-items:start}
.sidebar{position:sticky;top:90px}
.widget{margin-bottom:28px;border:1px solid var(--line);padding:18px}
.widget-title{font-size:16px;font-weight:800;border-bottom:2px solid var(--red);padding-bottom:9px;margin-bottom:14px}
.rank-list{list-style:none;margin:0;padding:0;counter-reset:r}
.rank-list li{counter-increment:r;display:grid;grid-template-columns:34px 1fr;gap:12px;padding:12px 0;border-bottom:1px solid var(--line)}
.rank-list li:last-child{border-bottom:0;padding-bottom:0}
.rank-list li::before{content:counter(r);font-size:22px;font-weight:800;color:var(--line-strong);line-height:1.2}
.rank-list a{font-size:15px;font-weight:600;line-height:1.6}
.widget ul{list-style:none;margin:0;padding:0}
.widget ul li{padding:8px 0;border-bottom:1px solid var(--line);font-size:15px}
.widget ul li:last-child{border-bottom:0}

/* ============ صفحة الخبر ============ */
.article-head{max-width:860px;margin:0 auto;padding:30px 0 0}
.crumbs{font-size:13px;color:var(--muted);margin-bottom:14px}
.crumbs a:hover{color:var(--red)}
.crumbs span{margin:0 6px}
.article-cat{display:inline-block;background:var(--red);color:#fff;font-size:13px;font-weight:700;padding:5px 12px;margin-bottom:14px}
.article-title{font-size:40px;font-weight:800;line-height:1.3;margin-bottom:14px}
.article-lede{font-size:19px;color:var(--ink-2);line-height:1.85;margin-bottom:18px;font-weight:500}
.article-meta{display:flex;align-items:center;gap:16px;flex-wrap:wrap;font-size:14px;color:var(--muted);
  border-top:1px solid var(--line);border-bottom:1px solid var(--line);padding:12px 0;margin-bottom:24px}
.article-meta strong{color:var(--ink);font-weight:700}
.share{display:flex;gap:8px;margin-right:auto}
.share a{width:34px;height:34px;border:1px solid var(--line-strong);display:flex;align-items:center;justify-content:center;border-radius:var(--radius);color:var(--ink-2)}
.share a:hover{background:var(--red);border-color:var(--red);color:#fff}
.share svg{width:15px;height:15px;fill:currentColor}
.article-figure{margin:0 0 26px}
.article-figure img{width:100%}
.article-figure figcaption{font-size:13px;color:var(--muted);padding:9px 2px;border-bottom:1px solid var(--line)}
.article-body{max-width:860px;margin:0 auto;font-size:18px;line-height:2.05;color:var(--ink-2)}
.article-body p{margin:0 0 1.25em}
.article-body h2{font-size:25px;color:var(--ink);margin:1.5em 0 .6em}
.article-body h3{font-size:21px;color:var(--ink);margin:1.4em 0 .5em}
.article-body img{margin:1.4em 0}
.article-body a{color:var(--red);text-decoration:underline;text-underline-offset:3px}
.article-body blockquote{
  margin:1.6em 0;padding:4px 22px;border-right:4px solid var(--red);
  font-size:21px;font-weight:600;color:var(--ink);line-height:1.8;
}
.article-body ul,.article-body ol{padding-right:22px;margin:0 0 1.3em}
.article-body li{margin-bottom:.5em}
.article-tags{max-width:860px;margin:30px auto 0;display:flex;gap:8px;flex-wrap:wrap;align-items:center}
.article-tags a{font-size:13px;background:var(--bg-soft);border:1px solid var(--line);padding:5px 12px;color:var(--ink-2)}
.article-tags a:hover{background:var(--red);border-color:var(--red);color:#fff}
.article-source{max-width:860px;margin:22px auto 0;font-size:14px;color:var(--muted);background:var(--bg-soft);border-right:3px solid var(--line-strong);padding:12px 16px}

/* ============ الأرشيف ============ */
.page-head{border-bottom:3px solid var(--ink);padding-bottom:14px;margin-bottom:28px}
.page-head h1{font-size:30px;font-weight:800}
.page-head .count{font-size:14px;color:var(--muted);margin-top:6px}
.list-row{display:grid;grid-template-columns:300px 1fr;gap:22px;padding:22px 0;border-bottom:1px solid var(--line)}
.list-row .card-media{aspect-ratio:16/10}
.list-row .card-title{font-size:22px}
.pagination{display:flex;gap:7px;justify-content:center;margin:34px 0;flex-wrap:wrap}
.pagination .page-numbers{
  min-width:42px;height:42px;display:flex;align-items:center;justify-content:center;padding:0 12px;
  border:1px solid var(--line-strong);font-weight:700;font-size:15px;
}
.pagination .current,.pagination .page-numbers:hover{background:var(--red);border-color:var(--red);color:#fff}

/* ============ الفوتر ============ */
.site-footer{background:var(--bg-dark);color:#aeb6bf;margin-top:40px;font-size:14.5px}
.footer-top{border-top:4px solid var(--red);padding:42px 0 30px}
.footer-grid{display:grid;grid-template-columns:1.6fr 1fr 1fr 1.2fr;gap:34px}
.footer-logo img{max-height:70px;width:auto;margin-bottom:14px;background:#fff;padding:6px 10px;border-radius:2px}
.footer-about{line-height:1.9;font-size:14.5px}
.footer-col h4{color:#fff;font-size:16px;margin-bottom:14px;font-weight:700;position:relative;padding-bottom:9px}
.footer-col h4::after{content:"";position:absolute;bottom:0;right:0;width:34px;height:2px;background:var(--red)}
.footer-col ul{list-style:none;margin:0;padding:0}
.footer-col li{padding:6px 0}
.footer-col a:hover{color:#fff}
.footer-social{display:flex;gap:10px;margin-top:16px}
.footer-social a{width:36px;height:36px;border:1px solid #2c333c;display:flex;align-items:center;justify-content:center;color:#aeb6bf}
.footer-social a:hover{background:var(--red);border-color:var(--red);color:#fff}
.footer-social svg{width:16px;height:16px;fill:currentColor}
.footer-bottom{border-top:1px solid #222931;padding:16px 0;font-size:13.5px}
.footer-bottom .wrap{display:flex;justify-content:space-between;gap:16px;flex-wrap:wrap}

/* البحث */
.search-panel{display:none;background:#fff;border-bottom:1px solid var(--line);padding:20px 0}
.search-panel.open{display:block}
.search-form{display:flex;max-width:620px;margin:0 auto}
.search-form input[type=search]{
  flex:1;padding:13px 16px;border:1px solid var(--line-strong);font-family:var(--font);font-size:16px;outline:none;
}
.search-form input[type=search]:focus{border-color:var(--red)}
.search-form button{background:var(--red);color:#fff;border:0;padding:0 26px;font-weight:700;cursor:pointer;font-family:var(--font);font-size:15px}
.search-form button:hover{background:var(--red-dark)}

/* 404 وصفحات */
.page-content{max-width:860px;margin:0 auto;font-size:17px;line-height:2}
.notfound{text-align:center;padding:70px 0}
.notfound h1{font-size:84px;color:var(--red);font-weight:800;line-height:1}

/* ============ استجابة ============ */
@media (max-width:1024px){
  .lead-grid{grid-template-columns:1fr}
  .layout{grid-template-columns:1fr}
  .sidebar{position:static}
  .grid-4{grid-template-columns:repeat(2,1fr)}
  .lead-main .card-title{font-size:28px}
  .header-ad{display:none}
}
@media (max-width:860px){
  .cat-block{grid-template-columns:1fr}
  .grid-3{grid-template-columns:repeat(2,1fr)}
  .article-title{font-size:29px}
  .article-body{font-size:17px}
  .footer-grid{grid-template-columns:1fr 1fr}
  .list-row{grid-template-columns:150px 1fr;gap:14px}
  .list-row .card-title{font-size:17px}
  .list-row .card-excerpt{display:none}
}
@media (max-width:600px){
  .grid-4,.grid-3,.grid-2{grid-template-columns:1fr}
  .btn-menu{display:flex}
  .main-nav{display:none;position:absolute;top:100%;right:0;left:0;background:#fff;border-bottom:3px solid var(--red);box-shadow:0 14px 28px rgba(0,0,0,.12)}
  .main-nav.open{display:block}
  .main-nav ul{flex-direction:column}
  .main-nav > ul > li > a{padding:13px 20px;border-bottom:1px solid var(--line);margin:0}
  .main-nav ul ul{position:static;border:0;background:var(--bg-soft)}
  .nav-bar .wrap{position:relative;justify-content:space-between}
  .nav-live{margin:0}
  .topbar-links{display:none}
  .site-branding img,.custom-logo{max-height:52px}
  .lead-main .card-title{font-size:24px}
  .article-title{font-size:25px}
  .article-lede{font-size:17px}
  .footer-grid{grid-template-columns:1fr}
  .breaking-label{font-size:13px;padding:0 12px}
}

/* ---- ضبط الشعار والمَسْطَرة (أولوية أعلى من إضافات قديمة) ---- */
.site-branding .custom-logo,
.site-header .custom-logo,
body.wp-custom-logo .site-branding img.custom-logo{
  max-height:66px !important;width:auto !important;height:auto !important;border-radius:0 !important;
}
.custom-logo-link{display:block;line-height:0}
.brand-text .site-title{font-size:26px;font-weight:800;line-height:1.2}
.brand-text .site-desc{font-size:13.5px;color:var(--muted);margin-top:3px}
.header-main{padding:14px 0}
@media (max-width:600px){
  .brand-text .site-title{font-size:19px}
  .brand-text .site-desc{display:none}
  .site-branding .custom-logo{max-height:46px !important}
}

/* ---- إصلاحات ---- */
.search-form input[type=search]{min-width:0}
.widget .search-form{flex-wrap:nowrap}
.widget .search-form button{padding:0 16px}
.sidebar .widget img{height:auto}
.article-body{text-align:start}
