/*
Theme Name: Red Twenty Custom
Theme URI: https://example.com
Author: Your Name
Description: قالب سريع جداً (High Performance)، يدعم العربية، مخصص باللون الأحمر والأبيض.
Version: 2.1
License: GNU General Public License v2 or later
Text Domain: red-twenty
*/

:root {
    --primary-color: #D32F2F;
    --secondary-color: #B71C1C;
    --background-color: #ffffff;
    --text-color: #212121;
    --meta-color: #666;
    --border-color: #eee;
    --font-main: 'Cairo', sans-serif;
    --container-width: 1100px;
}

/* Reset & Performance */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    background-color: var(--background-color);
    color: var(--text-color);
    font-family: var(--font-main);
    line-height: 1.7;
    font-size: 17px;
    overflow-x: hidden;
    font-display: swap; /* تسريع ظهور الخطوط */
}

/* RTL Support */
body.rtl { direction: rtl; text-align: right; }

/* Links */
a { color: var(--primary-color); text-decoration: none; transition: color 0.2s ease; }
a:hover { color: #000; }
img, iframe, video { max-width: 100%; height: auto; }

/* Layout */
.site-content {
    max-width: var(--container-width);
    margin: 40px auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 70% 1fr;
    gap: 50px;
    content-visibility: auto; /* تسريع المعالجة للمتصفحات الحديثة */
}

/* Header */
.site-header {
    background: #fff;
    border-top: 5px solid var(--primary-color);
    border-bottom: 1px solid var(--border-color);
    padding: 15px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}
.header-inner {
    max-width: var(--container-width);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}
.site-title { margin: 0; line-height: 1; }
.site-title a { font-size: 28px; font-weight: 900; color: var(--primary-color); text-transform: uppercase; }
.site-description { font-size: 13px; color: #888; margin-top: 5px; display: block; }

/* Navigation */
.main-navigation ul { list-style: none; display: flex; gap: 25px; margin: 0; padding: 0; }
.main-navigation a { color: #333; font-weight: 700; font-size: 16px; }
.main-navigation a:hover { color: var(--primary-color); }
.menu-toggle { display: none; }

/* Posts - Performance & Style */
.post-entry { margin-bottom: 50px; border-bottom: 1px solid var(--border-color); padding-bottom: 40px; }
.post-entry:last-child { border-bottom: none; }

/* CLS Optimization for Images */
.post-thumbnail {
    margin-bottom: 20px;
    border-radius: 8px;
    overflow: hidden;
    background-color: #f0f0f0; /* لون يظهر قبل تحميل الصورة */
    position: relative;
    /* محاولة حجز مساحة لتقليل Layout Shift */
    min-height: 200px; 
    display: block;
}
.post-thumbnail img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

/* Typography */
.entry-title { font-size: 1.8rem; margin-bottom: 10px; line-height: 1.3; font-weight: 800; }
.entry-title a { color: #111; }
.entry-title a:hover { color: var(--primary-color); }

.entry-meta { font-size: 0.85rem; color: var(--meta-color); margin-bottom: 15px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.entry-meta span { display: inline-flex; align-items: center; }
.entry-meta .sep { color: #ddd; }

/* Content Actions */
.entry-content-area { margin-top: 15px; }
.read-more {
    display: inline-block;
    background: var(--primary-color);
    color: #fff;
    padding: 8px 25px;
    border-radius: 50px;
    margin-top: 20px;
    font-weight: bold;
    font-size: 14px;
}
.read-more:hover { background: #222; color: #fff; }

/* Sidebar */
.sidebar-widget { margin-bottom: 30px; background: #fff; border: 1px solid #f0f0f0; padding: 20px; border-radius: 8px; }
.widget-title { font-size: 1.1rem; border-bottom: 2px solid var(--primary-color); padding-bottom: 10px; margin-bottom: 15px; display: inline-block; }
.sidebar-widget ul { list-style: none; padding: 0; }
.sidebar-widget li { margin-bottom: 10px; border-bottom: 1px dashed #eee; padding-bottom: 8px; }

/* Footer */
.site-footer { background: #1a1a1a; color: #888; padding: 40px 0; text-align: center; margin-top: 60px; border-top: 4px solid var(--primary-color); }
.site-footer a { color: #fff; }

/* Mobile Responsive */
@media (max-width: 960px) {
    .site-content { display: block; padding: 0 20px; }
    #secondary { margin-top: 50px; padding-top: 30px; border-top: 1px solid #eee; }
    .post-thumbnail { min-height: auto; } /* إلغاء الارتفاع الثابت في التابلت */
}

@media (max-width: 768px) {
    body { font-size: 16px; }
    .header-inner { padding: 15px 20px; }
    .site-title a { font-size: 22px; }
    
    .menu-toggle {
        display: block;
        background: none;
        border: 2px solid var(--primary-color);
        color: var(--primary-color);
        font-size: 22px;
        line-height: 1;
        padding: 5px 10px;
        border-radius: 5px;
        cursor: pointer;
        margin-inline-start: auto;
    }
    
    .main-navigation ul {
        display: none;
        flex-direction: column;
        width: 100%;
        background: #fff;
        box-shadow: 0 5px 10px rgba(0,0,0,0.1);
        margin-top: 15px;
        padding: 10px;
        border-radius: 5px;
        border-top: 3px solid var(--primary-color);
    }
    
    .main-navigation.toggled ul { display: flex; animation: fadeIn 0.3s; }
    .main-navigation li { border-bottom: 1px solid #eee; padding: 10px 0; text-align: center; }
    .main-navigation li:last-child { border-bottom: none; }
    
    .entry-title { font-size: 1.5rem; }
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }