/*
Theme Name: JadidTV News
Theme URI: https://jadidtv.com
Author: JadidTV Team
Description: قالب إخباري متكامل لـ JadidTV News
Version: 1.0.0
Text Domain: jadidtv-news
*/

:root {
  --main-brand: #e60000;
  --main-dark: #800000;
  --pink: #ffc0cb;
  --ed: #5b2a86;
  --ink: #1d1d1d;
  --muted: #6b6b6b;
  --line: #e6e6e6;
  --bg: #f6f6f6;
  
  --primary: var(--main-brand);
  --primary-deep: var(--main-dark);
  --red: var(--main-brand);
  --deep: var(--main-dark);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Tajawal", "Cairo", sans-serif;
  background: var(--bg);
  color: var(--ink);
  direction: rtl;
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--main-brand); }

img { max-width: 100%; display: block; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* البراند والشعار */
.brand { background: #fff; text-align: center; padding: 22px 0; }
.brand .name { font-family: "Cairo", sans-serif; font-weight: 900; font-size: 44px; color: var(--main-brand); margin: 0; }
.brand .dom { letter-spacing: .3em; font-size: 12px; color: var(--muted); }
.brand .custom-logo { margin: 0 auto; max-height: 110px; width: auto; }

/* القائمة الرئيسية */
.mainnav { background: var(--main-brand); }
.mainnav .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mainnav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; }
.mainnav li { position: relative; }
.mainnav a { display: block; color: #fff; padding: 13px 14px; font-weight: 700; transition: background 0.3s; }
.mainnav a:hover { background: var(--main-dark); color: #fff; }
.mainnav .sub-menu { display: none; position: absolute; top: 100%; right: 0; min-width: 200px; background: var(--main-dark); z-index: 60; flex-direction: column; }
.mainnav li:hover > .sub-menu, .mainnav li.open > .sub-menu { display: flex; }
.mainnav .menu-item-has-children > a:after { content: " ▾"; }

.search-form input { border: 0; border-radius: 3px; padding: 7px 10px; font-family: inherit; }

/* الشريط العاجل */
.ticker { background: #fff; border-bottom: 1px solid var(--line); }
.ticker .wrap { display: flex; align-items: center; gap: 12px; }
.ticker .lbl { background: var(--main-brand); color: #fff; padding: 10px 16px; font-weight: 800; white-space: nowrap; }
.ticker .time { color: var(--main-brand); font-weight: 700; }

/* التخطيط العلوي والأقسام */
.top { display: grid; grid-template-columns: 1fr 2fr 1fr; gap: 18px; margin: 22px auto; }
.box { background: #fff; border: 1px solid var(--line); }
.box h3 { margin: 0; padding: 10px 14px; background: var(--main-brand); color: #fff; font-size: 17px; }

.briefs { list-style: none; margin: 0; padding: 0; max-height: 470px; overflow-y: auto; }
.briefs li { padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 15px; }
.briefs .time { display: block; color: var(--main-brand); font-size: 12px; font-weight: 700; }

/* السلايدر الرئيسي */
.slider { position: relative; overflow: hidden; min-height: 470px; background: #000; }
.slide { position: absolute; inset: 0; opacity: 0; transition: opacity .6s ease-in-out; }
.slide.on { opacity: 1; }
.slide img { width: 100%; height: 100%; object-fit: cover; }
.slide .cap { position: absolute; bottom: 0; left: 0; right: 0; padding: 60px 20px 56px; background: linear-gradient(transparent, rgba(0,0,0,.85)); color: #fff; font-size: 24px; font-weight: 800; font-family: "Cairo", sans-serif; }
.slide .cap a { color: #fff; }

.dots { position: absolute; bottom: 14px; left: 0; right: 0; display: flex; justify-content: center; gap: 6px; z-index: 5; }
.dots button { width: 30px; height: 30px; border: 0; background: rgba(255,255,255,.8); font-weight: 700; cursor: pointer; font-family: inherit; border-radius: 4px; }
.dots button.on { background: var(--main-brand); color: #fff; }

/* القسم الافتتاحي المختصر */
.editorial h3 { background: var(--ed); }
.editorial .in { padding: 16px; }
.editorial h4 { font-family: "Cairo", sans-serif; font-size: 21px; margin: 0 0 10px; color: var(--ed); }
.editorial p { color: var(--muted); }

/* الأقسام والشبكات */
.sec { margin: 28px auto; }
.sec-title { border-bottom: 3px solid var(--main-brand); margin-bottom: 16px; }
.sec-title span { display: inline-block; background: var(--main-brand); color: #fff; padding: 8px 18px; font-weight: 800; font-size: 18px; }

.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

.card { background: #fff; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.card .th { position: relative; aspect-ratio: 16/10; overflow: hidden; background: #ddd; }
.card .th img { width: 100%; height: 100%; object-fit: cover; }

.play { position: absolute; inset: 0; margin: auto; width: 48px; height: 48px; border-radius: 50%; background: var(--main-brand); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.card h4 { margin: 0; padding: 12px; font-size: 15px; }

.op { padding: 18px; border-top: 4px solid var(--main-brand); background: #fff; }
.op h4 { padding: 0; font-size: 18px; margin-bottom: 10px; }
.op .au { color: var(--main-brand); font-weight: 750; }

.posts { padding: 20px 0; }

/* --- تخطيط الشبكة المميزة (خبر كبير + 4 صغار على الحاسوب) --- */
.featured-news-layout {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 16px;
    align-items: stretch;
}

.main-featured-card {
    height: 100%;
}

.main-featured-card .hero-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.main-featured-card .hero-card .th {
    aspect-ratio: 16 / 9 !important;
    width: 100%;
    overflow: hidden;
}

.main-featured-card .hero-card .th img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

.main-featured-card .hero-card h4 {
    font-size: 20px !important;
    font-weight: 800;
    padding: 14px 14px 6px 14px;
    line-height: 1.4;
}

.main-featured-card .card-details .excerpt {
    margin: 0;
    padding: 0 14px 14px 14px;
    font-size: 14px;
    color: var(--muted);
}

/* شبكة الأخبار الأربعة الصغيرة بجانب الخبر الكبير */
.sub-featured-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.sub-featured-grid .sub-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sub-featured-grid .sub-card .th {
    aspect-ratio: 16 / 10 !important;
    width: 100%;
    overflow: hidden;
}

.sub-featured-grid .sub-card .th img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

.sub-featured-grid .sub-card h4 {
    font-size: 13px !important;
    padding: 8px 10px;
    line-height: 1.35;
}

/* الفوتر */
.site-footer { background: #1b1b1b; color: #ccc; margin-top: 40px; padding: 30px 0; text-align: center; }
.site-footer .fname { color: #fff; font-weight: 900; font-size: 24px; font-family: "Cairo", sans-serif; }
.site-footer ul { list-style: none; padding: 0; display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; margin-top: 15px; }

/* --- التجاوب مع الهواتف والشاشات الصغيرة --- */
@media screen and (max-width: 768px) {
    .top { grid-template-columns: 1fr; }
    .slider { min-height: 320px; }
    .grid4 { grid-template-columns: repeat(2, 1fr); }
    .grid3 { grid-template-columns: 1fr; }
    
    .mainnav .wrap { flex-direction: column; align-items: stretch; }
    .mainnav ul { 
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        white-space: nowrap !important;
        gap: 10px !important;
        padding: 8px 10px !important;
    }
    .mainnav .sub-menu { position: static; box-shadow: none; }
    .brand .name { font-size: 32px; }

    /* إعادة ترتيب تخطيط الخبر الكبير + 4 صغار على الهاتف */
    .featured-news-layout {
        display: block !important;
    }

    .main-featured-card {
        width: 100% !important;
        margin-bottom: 12px !important;
    }

    .main-featured-card .hero-card h4 {
        font-size: 16px !important;
        padding: 10px !important;
    }

    .sub-featured-grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
        width: 100% !important;
    }

    .sub-featured-grid .sub-card h4 {
        font-size: 12px !important;
        padding: 6px !important;
    }
}
/* --- قفل وتثبيت أبعاد الصور على شاشات الحاسوب بدقة --- */
@media screen and (min-width: 769px) {
    /* قفل حاوية الصورة الرئيسية الكبيرة وضبطها */
    .main-featured-card .hero-card .th {
        width: 100% !important;
        aspect-ratio: 16 / 9 !important;
        overflow: hidden !important;
        position: relative !important;
    }

    /* قفل حاويات الصور الأربعة الفرعية */
    .sub-featured-grid .sub-card .th {
        width: 100% !important;
        aspect-ratio: 16 / 10 !important;
        overflow: hidden !important;
        position: relative !important;
    }

    /* إجبار الصورة داخل الحاسوب على ملء الإطار بقص متناسق دون تمدد */
    .featured-news-layout img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
    }
}
/* --- تنسيق قسم صوت وصورة: 4 أفقياً على الحاسوب، و 2 فوق 2 على الهاتف --- */

/* 1. على شاشات الحاسوب والشاشات الكبيرة: عرض 4 عناصر بجانب بعضها أفقياً */
@media screen and (min-width: 769px) {
    .sec .dynamic-grid {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 16px !important;
    }
}
/* --- فرض شكل 2 فوق 2 على الهواتف لقسم صوت وصورة --- */
@media screen and (max-width: 768px) {
    /* استهداف قسم صوت وصورة بالذات عبر معرفة محتواه أو كلاسه */
    section.sec .dynamic-grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px !important;
        width: 100% !important;
    }
    
    section.sec .dynamic-grid .card {
        width: 100% !important;
        margin: 0 !important;
    }

    section.sec .dynamic-grid .card h4 {
        font-size: 11px !important;
        padding: 6px !important;
        line-height: 1.3 !important;
    }
}