/*
Theme Name: KHABAYA NEWS.MA
Theme URI: https://example.com/khabaya-news-ma
Author: Your Agency
Author URI: https://example.com
Description: قالب إخباري آمن ومخصص لووردبريس، مبني بالكامل بدون أي اعتمادية خارجية (No CDNs / No external libraries). مصمم مع دعم أصيل للغة العربية واتجاه القراءة من اليمين إلى اليسار (RTL)، ويعتمد على Flexbox و CSS Grid لضمان الاستجابة الكاملة عبر جميع الأجهزة.
Version: 1.1.0
Requires at least: 6.0
Tested up to: 7.0.2
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: secure-news-ar
Tags: news, rtl, custom-menu, featured-images, translation-ready
*/

/* =========================================================
   1) إعادة ضبط أساسية (Reset) - بدون أي مكتبات خارجية
   ========================================================= */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

/* =========================================================
   2) دعم اللغة العربية والاتجاه من اليمين لليسار (RTL)
   ========================================================= */
body {
    direction: rtl;
    text-align: right;
    unicode-bidi: embed;
    font-family: "Tahoma", "Segoe UI", "Arial", sans-serif; /* خطوط نظام آمنة بدون استدعاء خارجي */
    line-height: 1.8;
    color: #1a1a1a;
    background-color: #f7f7f8;
}

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

a {
    color: inherit;
    text-decoration: none;
}

ul, ol {
    list-style: none;
}

/* في حال وجود محتوى إنجليزي داخل مقال عربي، نحافظ على اتجاهه الصحيح */
[dir="ltr"],
.ltr-content {
    direction: ltr;
    unicode-bidi: isolate;
    text-align: left;
}

/* =========================================================
   3) الحاوية الرئيسية المرنة (Responsive Container)
   ========================================================= */
.site-container {
    width: 100%;
    max-width: 1240px;
    margin-inline: auto;
    padding-inline: 1rem;
}

/* =========================================================
   4) الهيدر (Header) - Flexbox
   ========================================================= */
.site-header {
    background: #0b1e33;
    color: #ffffff;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding-block: 0.75rem;
}

.site-branding .site-title {
    font-size: 1.6rem;
    font-weight: 800;
}

.site-branding .site-description {
    font-size: 0.8rem;
    color: #b9c6d6;
}

/* قائمة التنقل الرئيسية */
.main-navigation ul {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
}

.main-navigation a {
    font-weight: 600;
    padding: 0.4rem 0.2rem;
    border-bottom: 2px solid transparent;
    transition: border-color 0.2s ease, opacity 0.2s ease;
}

.main-navigation a:hover,
.main-navigation a:focus {
    border-bottom-color: #e63946;
    opacity: 0.9;
}

/* زر القائمة للجوال */
.menu-toggle {
    display: none;
    background: transparent;
    border: 1px solid #ffffff55;
    color: #fff;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
}

/* =========================================================
   5) شريط التمرير للأخبار العاجلة (Breaking News Slider)
   ========================================================= */
.breaking-slider {
    position: relative;
    overflow: hidden;
    background: #10233b;
    border-radius: 10px;
    margin-block: 1.5rem;
}

.breaking-slider__track {
    display: flex;
    transition: transform 0.6s ease-in-out;
    /* transform يُحدَّث ديناميكياً عبر جافاسكربت مضمّن بالقالب (بدون مكتبات خارجية) */
}

.breaking-slide {
    flex: 0 0 100%;
    display: grid;
    grid-template-columns: 1fr;
    min-height: 320px;
    position: relative;
    color: #fff;
}

.breaking-slide img {
    width: 100%;
    height: 320px;
    object-fit: cover;
    filter: brightness(0.55);
}

.breaking-slide__content {
    position: absolute;
    inset-inline-start: 0;
    bottom: 0;
    padding: 1.25rem 1.5rem;
    max-width: 720px;
}

.breaking-slide__badge {
    display: inline-block;
    background: #e63946;
    padding: 0.2rem 0.7rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.breaking-slide__content h2 {
    font-size: 1.5rem;
    line-height: 1.4;
}

.breaking-slider__nav {
    position: absolute;
    inset-block: 0;
    inset-inline: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-inline: 0.5rem;
    pointer-events: none;
}

.breaking-slider__nav button {
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
}

.breaking-slider__dots {
    display: flex;
    justify-content: center;
    gap: 0.4rem;
    padding-block: 0.6rem;
    background: #0b1e33;
}

.breaking-slider__dots button {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    border: none;
    background: #ffffff55;
    cursor: pointer;
}

.breaking-slider__dots button[aria-current="true"] {
    background: #e63946;
}

/* =========================================================
   6) شبكة الأخبار الرئيسية (CSS Grid)
   ========================================================= */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-block: 2rem;
}

.news-card {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.news-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.news-card__thumb {
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

.news-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.news-card__body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.news-card__category {
    font-size: 0.75rem;
    color: #e63946;
    font-weight: 700;
}

.news-card__title {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.5;
}

.news-card__excerpt {
    font-size: 0.9rem;
    color: #555;
}

.news-card__meta {
    margin-top: auto;
    font-size: 0.78rem;
    color: #888;
    display: flex;
    gap: 0.75rem;
}

/* =========================================================
   7) تخطيط الصفحة الرئيسية (محتوى + شريط جانبي)
   ========================================================= */
.content-area-wrap {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 992px) {
    .content-area-wrap {
        grid-template-columns: 2.5fr 1fr;
    }
}

/* =========================================================
   8) صفحة المقال المفرد (single.php) - تركيز على القراءة
   ========================================================= */
.single-article {
    background: #fff;
    padding: 1.5rem;
    border-radius: 10px;
    max-width: 820px;
    margin-inline: auto;
}

.single-article__header {
    margin-bottom: 1.25rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 1rem;
}

.single-article__title {
    font-size: 2rem;
    line-height: 1.5;
    margin-bottom: 0.6rem;
}

.single-article__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.85rem;
    color: #777;
}

.single-article__featured-media {
    margin-block: 1.5rem;
    border-radius: 8px;
    overflow: hidden;
}

.single-article__content {
    font-size: 1.1rem;
    line-height: 2;
}

.single-article__content p {
    margin-bottom: 1.2rem;
}

.single-article__content img,
.single-article__content video,
.single-article__content iframe {
    width: 100%;
    height: auto;
    border-radius: 8px;
    margin-block: 1.2rem;
}

/* حاوية وسائط مخصصة داخل المقال (صورة/فيديو + شرح) */
.media-embed {
    background: #f2f2f4;
    border-radius: 8px;
    padding: 0.75rem;
    margin-block: 1.5rem;
}

.media-embed figcaption {
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.5rem;
    text-align: center;
}

/* =========================================================
   9) الشريط الجانبي
   ========================================================= */
.widget-area .widget {
    background: #fff;
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.widget-title {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    border-inline-start: 4px solid #e63946;
    padding-inline-start: 0.5rem;
}

/* =========================================================
   10) الفوتر (Footer)
   ========================================================= */
.site-footer {
    background: #0b1e33;
    color: #cfd8e3;
    margin-top: 3rem;
    padding-block: 2rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}

.footer-bottom {
    text-align: center;
    font-size: 0.8rem;
    padding-top: 1.5rem;
    margin-top: 1.5rem;
    border-top: 1px solid #ffffff22;
}

/* =========================================================
   11) الاستجابة للشاشات الصغيرة (Responsive / Mobile-First adjustments)
   ========================================================= */
@media (max-width: 782px) {
    .menu-toggle {
        display: inline-block;
    }

    .main-navigation {
        width: 100%;
        display: none;
    }

    .main-navigation.is-open {
        display: block;
    }

    .main-navigation ul {
        flex-direction: column;
        gap: 0.25rem;
    }

    .single-article__title {
        font-size: 1.5rem;
    }
}

/* =========================================================
   12) فئات مساعدة عامة (Utilities)
   ========================================================= */
.screen-reader-text {
    position: absolute !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
    white-space: nowrap;
}

.skip-link {
    position: absolute;
    right: -9999px;
    top: -9999px;
    background: #fff;
    color: #000;
    padding: 0.6rem 1rem;
    z-index: 999999;
}

.skip-link:focus {
    right: 1rem;
    top: 1rem;
}
