/*
Theme Name: Arabic Magazine V5
Theme URI: https://saeedtaghavi.com
Author: Saeed
Description: A bold, news-style Arabic theme based on Design #5.
Version: 1.6
Text Domain: arabic-mag
*/

/* --- Imports: Noto Kufi (Titles) & Noto Naskh (Body) --- */
@import url('https://fonts.googleapis.com/css2?family=Noto+Kufi+Arabic:wght@600;700;800;900&family=Noto+Naskh+Arabic:wght@400;500;700&display=swap');

:root {
    --primary: #e11d48;
    --dark: #111;
    --light: #f8f9fa;
    --gray: #64748b;
    --border: #e2e8f0;
}

/* --- Reset & Global --- */
* { box-sizing: border-box; }

body {
    direction: rtl;
    text-align: right;
    /* فونت متن اصلی: نوتو نسخ */
    font-family: 'Noto Naskh Arabic', serif;
    background: #fff;
    color: var(--dark);
    margin: 0;
    line-height: 1.9;
    font-size: 17px;
    overflow-x: hidden;
}

a { text-decoration: none; color: inherit; transition: 0.3s; }
a:hover { color: var(--primary); }
img { max-width: 100%; height: auto; display: block; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* --- Typography: Force Noto Kufi for Headings --- */
h1, h2, h3, h4, h5, h6,
.site-title,
.main-navigation a,
.view-all-btn,
.post-title,
.single-title,
.hero-title,
.hero-cat,
.cat-header h2,
.page-title-box h1,
.comments-title,
.comment-reply-title,
.form-submit .submit {
    font-family: 'Noto Kufi Arabic', sans-serif;
}

/* --- Header --- */
.site-header { border-bottom: 4px solid var(--primary); padding: 20px 0; margin-bottom: 40px; }
.header-inner { display: flex; justify-content: space-between; align-items: center; }
.site-title a { font-size: 2rem; font-weight: 900; color: var(--dark); letter-spacing: -1px; }
.main-navigation ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 20px; }
.main-navigation a { font-weight: 700; font-size: 1.1rem; }

/* --- Layouts --- */
.page-title-box { margin-bottom: 30px; border-bottom: 2px solid var(--dark); padding-bottom: 10px; }
.page-title-box h1 { margin: 0; font-size: 2.5rem; font-weight: 900; }

/* --- Post Grid --- */
.posts-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); 
    gap: 30px; 
}

.post-card { 
    border-bottom: 1px solid var(--border); 
    padding-bottom: 20px; 
    display: flex;
    flex-direction: column;
    height: 100%; 
}

.post-thumbnail { 
    height: 200px; 
    background: #eee; 
    overflow: hidden; 
    border-radius: 8px; 
    margin-bottom: 15px; 
}

.post-thumbnail img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.post-card:hover .post-thumbnail img { transform: scale(1.05); }

.post-title { font-size: 1.3rem; margin: 10px 0 10px 0; font-weight: 800; line-height: 1.4; }

.post-meta { 
    margin-top: auto; 
    font-size: 0.85rem; 
    color: var(--gray); 
    display: flex; 
    gap: 10px; 
    align-items: center; 
    flex-wrap: wrap; 
}

/* --- Index Sections --- */
.category-section { 
    margin-bottom: 60px; 
    padding-bottom: 10px;
}

.cat-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 25px; 
    border-bottom: 2px solid var(--primary); 
    padding-bottom: 10px; 
}

.cat-header h2 { margin: 0; font-size: 1.8rem; font-weight: 900; color: var(--primary); }
.view-all-btn { background: var(--dark); color: #fff; padding: 6px 15px; font-size: 0.9rem; font-weight: bold; border-radius: 4px; }
.view-all-btn:hover { background: var(--primary); color: #fff; }

/* --- Single Post Content --- */
.single-post-header { margin-bottom: 30px; }
.single-title { font-size: 2.5rem; font-weight: 900; line-height: 1.3; margin-bottom: 20px; }
.featured-image { margin-bottom: 30px; border-radius: 12px; overflow: hidden; }

.post-content { font-size: 1.2rem; line-height: 1.9; color: #333; }
.post-content p { margin-bottom: 20px; text-align: justify; }
.post-content a { color: var(--primary); font-weight: bold; border-bottom: 2px solid transparent; transition: 0.2s; }
.post-content a:hover { border-bottom-color: var(--primary); }
.post-content h2 { font-size: 1.8rem; border-right: 5px solid var(--primary); padding-right: 15px; margin-top: 40px; margin-bottom: 20px; font-weight: 800; }
.post-content h3 { font-size: 1.5rem; margin-top: 30px; margin-bottom: 15px; font-weight: 800; }

/* Lists & Tables */
.post-content ul, .post-content ol { margin-bottom: 25px; padding-right: 20px; }
.post-content ul li::before { content: "■"; color: var(--primary); font-size: 0.8em; position: absolute; right: -25px; top: 6px; }
.post-content blockquote { background: var(--light); border-right: 5px solid var(--primary); margin: 30px 0; padding: 20px; font-style: italic; font-size: 1.2rem; color: #555; }

.post-content table { width: 100%; border-collapse: collapse; margin-bottom: 30px; font-size: 1rem; }
.post-content th, .post-content td { padding: 12px; border: 1px solid var(--border); text-align: right; }
.post-content th { background-color: var(--dark); color: #fff; }
.post-content tr:nth-child(even) { background-color: #f9f9f9; }

/* Responsive adjustments */
@media screen and (max-width: 768px) {
    .posts-grid { gap: 20px; }
    .post-content table { display: block; overflow-x: auto; white-space: nowrap; }
    .header-inner { flex-direction: column; gap: 15px; }
}

/* --- Footer & Comments --- */
.cat-desc-bottom { background: var(--light); padding: 30px; margin-top: 50px; border-radius: 8px; }
.comments-area { margin-top: 60px; padding-top: 30px; border-top: 1px solid var(--border); }
.comment-list { list-style: none; padding: 0; }
.comment-body { background: var(--light); padding: 20px; margin-bottom: 20px; border-radius: 8px; }
.comment-form textarea, .comment-form input { width: 100%; padding: 10px; border: 1px solid var(--border); margin-bottom: 10px; font-family: 'Noto Kufi Arabic', sans-serif; }
.form-submit .submit { background: var(--primary); color: #fff; border: none; padding: 10px 30px; font-weight: bold; cursor: pointer; }
.error-404 { text-align: center; padding: 80px 0; }
.error-404 h1 { font-size: 5rem; margin: 0; color: var(--primary); }

/* --- Fix Video Embeds (YouTube) --- */
.post-content iframe, 
.post-content object, 
.post-content embed,
.post-content video {
    max-width: 100% !important;
    width: 100% !important;
    aspect-ratio: 16/9;
    height: auto !important;
    border: none;
    display: block;
    margin: 20px 0;
    background: #000;
    border-radius: 8px;
}

/* --- Hero Section (Magazine Style) --- */
.hero-wrapper {
    margin-bottom: 60px;
}
.hero-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr; 
    grid-template-rows: 250px 250px; 
    gap: 10px; 
}

/* آیتم‌ها */
.hero-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    background: #000;
}

/* اولین پست (بزرگ) */
.hero-item:nth-child(1) {
    grid-column: 1 / 2; 
    grid-row: 1 / 3;    
}

/* تصویر پس‌زمینه */
.hero-bg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
    opacity: 0.8;
}
.hero-item:hover .hero-bg {
    transform: scale(1.1);
    opacity: 0.6;
}

/* متن روی عکس */
.hero-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
    color: #fff;
    pointer-events: none; 
}

.hero-cat {
    background: var(--primary);
    color: #fff;
    padding: 3px 10px;
    font-size: 0.75rem;
    font-weight: bold;
    display: inline-block;
    margin-bottom: 8px;
    border-radius: 4px;
}

.hero-title {
    margin: 0;
    font-size: 1.1rem;
    line-height: 1.4;
    font-weight: 800;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

/* استایل مخصوص پست بزرگ */
.hero-item:nth-child(1) .hero-title {
    font-size: 2rem; 
}

/* لینک کامل روی کارت */
.hero-link {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 2;
}

/* ریسپانسیو موبایل */
@media screen and (max-width: 768px) {
    .hero-grid {
        display: flex;
        flex-direction: column;
    }
    .hero-grid { grid-template-rows: auto; }
    .hero-item { height: 250px; } 
    .hero-item:nth-child(1) { height: 350px; } 
}

/* --- Mobile Menu Styles --- */

/* مخفی کردن دکمه منو در دسکتاپ */
.menu-toggle {
    display: none;
}

/* استایل مخصوص موبایل */
@media screen and (max-width: 768px) {
    
    .header-inner {
        flex-wrap: wrap; 
    }

    .menu-toggle {
        display: block;
        background: transparent;
        border: 2px solid var(--dark);
        color: var(--dark);
        font-size: 1.5rem;
        cursor: pointer;
        padding: 5px 10px;
        border-radius: 4px;
        line-height: 1;
        margin-right: auto; 
    }
    
    .menu-toggle:hover {
        background: var(--dark);
        color: #fff;
    }

    .main-navigation {
        width: 100%;
        display: none; 
        margin-top: 20px;
        background: var(--light);
        border-top: 2px solid var(--primary);
        padding: 0;
    }

    .main-navigation.toggled {
        display: block;
        animation: slideDown 0.3s ease;
    }

    .main-navigation ul {
        flex-direction: column; 
        width: 100%;
        gap: 0;
    }

    .main-navigation ul li {
        width: 100%;
        border-bottom: 1px solid #ddd;
    }

    .main-navigation ul li a {
        display: block;
        padding: 15px;
    }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
/* --- Editorial / Numeric List Style (The "Pro" Look) --- */

.editorial-list-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr; /* سه ستون! برای استفاده بهتر از فضا */
    gap: 30px;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid var(--dark); /* خط مشکی ضخیم برای جدا کردن بخش بالا و پایین */
}

/* باکس هر خبر */
.editorial-item {
    display: flex;
    align-items: flex-start; /* تراز از بالا */
    gap: 15px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee; /* خط زیرین نازک */
    position: relative;
    transition: 0.3s ease;
}

/* عدد بزرگ گرافیکی */
.editorial-number {
    font-family: 'Cairo', sans-serif; /* فونت هندسی برای اعداد */
    font-size: 2.5rem; /* خیلی درشت */
    font-weight: 900;
    line-height: 1;
    color: #e0e0e0; /* خاکستری خیلی روشن */
    transition: 0.3s ease;
    width: 50px; /* فضای ثابت برای عدد */
    flex-shrink: 0;
}

/* افکت هاور روی عدد */
.editorial-item:hover .editorial-number {
    color: var(--primary); /* قرمز شدن عدد */
    transform: translateY(-5px); /* کمی بالا رفتن */
}

.editorial-content {
    flex: 1;
}

/* تیتر خبر */
.editorial-title {
    margin: 0 0 8px 0;
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--dark);
    font-family: 'Noto Kufi Arabic', sans-serif;
}

.editorial-title a {
    color: var(--dark);
    text-decoration: none;
    background-image: linear-gradient(var(--primary), var(--primary));
    background-position: 0% 100%;
    background-repeat: no-repeat;
    background-size: 0% 2px; /* خط زیرین نامرئی */
    transition: background-size .3s;
}

/* خط قرمز زیر تیتر موقع هاور */
.editorial-item:hover .editorial-title a {
    background-size: 100% 2px;
}

/* تاریخ و متا */
.editorial-meta {
    font-size: 0.8rem;
    color: #888;
    font-family: 'Cairo', sans-serif;
}

/* ریسپانسیو */
@media screen and (max-width: 900px) {
    .editorial-list-grid {
        grid-template-columns: 1fr 1fr; /* در تبلت دو ستون */
    }
}

@media screen and (max-width: 600px) {
    .editorial-list-grid {
        grid-template-columns: 1fr; /* در موبایل تک ستون */
        gap: 20px;
    }
    .editorial-item {
        border-bottom: 1px dashed #ddd; /* خط‌چین در موبایل */
    }
}