/* =============================================
   متغیرها و ریشه - نسخه مدرن
   ============================================= */
:root {
    --white: #ffffff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --navy: #1e293b;
    --navy-light: #334155;
    --navy-dark: #0f172a;
    --accent: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.1);
    
    --font-fa: 'Vazirmatn', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-en: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    
    --container-width: 1200px;
    --container-wide: 1400px;
    --border-radius-sm: 8px;
    --border-radius: 16px;
    --border-radius-lg: 24px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-fa);
    background: var(--gray-50);
    color: var(--navy);
    line-height: 1.7;
    direction: rtl;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

/* =============================================
   کانتینر پهن و مدرن
   ============================================= */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 32px;
}

.container-wide {
    max-width: var(--container-wide);
    margin: 0 auto;
    padding: 0 32px;
}

@media (max-width: 768px) {
    .container, .container-wide {
        padding: 0 20px;
    }
}

/* =============================================
   هدر شیشه‌ای (Glassmorphism)
   ============================================= */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--gray-200);
    padding: 16px 0;
    margin-bottom: 48px;
}

.glass-effect {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

/* =============================================
   تصویر دایره‌ای نویسنده در هدر
   ============================================= */
.author-avatar {
    margin-bottom: 16px;
    text-align: center;
}

.author-avatar img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--white);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.author-avatar img:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

@media (min-width: 769px) {
    .header-inner {
        gap: 30px;
    }
    
    .site-branding {
        display: flex;
        align-items: center;
        gap: 20px;
        text-align: right;
    }
    
    .author-avatar {
        margin-bottom: 0;
    }
    
    .author-avatar img {
        width: 60px;
        height: 60px;
    }
}

.site-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.site-title a {
    color: var(--navy);
    text-decoration: none;
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: var(--transition);
}

.site-title a:hover {
    opacity: 0.8;
}

.site-description {
    color: var(--gray-400);
    font-size: 0.8rem;
    margin-top: 4px;
}

/* =============================================
   منوی مدرن با پشتیبانی از زیرمنوها
   ============================================= */
.main-navigation {
    position: relative;
}

.nav-menu {
    list-style: none;
    display: flex;
    gap: 8px;
    margin: 0;
    padding: 0;
}

.nav-menu li a {
    display: block;
    padding: 8px 20px;
    text-decoration: none;
    color: var(--gray-500);
    font-weight: 500;
    font-size: 0.9rem;
    border-radius: 40px;
    transition: var(--transition);
}

.nav-menu li a:hover {
    color: var(--navy);
    background: var(--gray-100);
}

.nav-menu li.current-menu-item a {
    color: var(--navy);
    background: var(--gray-100);
    font-weight: 600;
}

/* استایل زیرمنوها (dropdown) */
.menu-item-has-children {
    position: relative;
}

.sub-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 220px;
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    padding: 12px 0;
    list-style: none;
    display: none;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 100;
    border: 1px solid var(--gray-200);
}

.sub-menu li {
    margin: 0;
}

.sub-menu li a {
    display: block;
    padding: 8px 20px;
    font-size: 0.85rem;
    color: var(--gray-500);
}

.sub-menu li a:hover {
    background: var(--gray-100);
    color: var(--navy);
}

/* زیرمنوهای سطح دوم */
.sub-menu .sub-menu {
    top: 0;
    right: 100%;
    margin-right: 8px;
}

/* منوی همبرگری برای موبایل */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
}

.menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--navy);
    margin: 5px 0;
    transition: var(--transition);
}

@media (max-width: 768px) {
    .header-inner {
        flex-direction: column;
        text-align: center;
    }
    
    .menu-toggle {
        display: block;
        position: absolute;
        left: 20px;
        top: 20px;
    }
    
    .nav-menu {
        display: none;
        flex-direction: column;
        width: 100%;
        background: var(--white);
        padding: 20px;
        border-radius: var(--border-radius);
        box-shadow: var(--shadow-lg);
        margin-top: 16px;
    }
    
    .nav-menu.show {
        display: flex;
    }
    
    .nav-menu li a {
        text-align: center;
    }
    
    .sub-menu {
        position: static;
        display: none;
        box-shadow: none;
        border: none;
        padding-right: 20px;
        margin-top: 8px;
    }
    
    .sub-menu.show {
        display: block;
    }
    
    .menu-item-has-children > a {
        position: relative;
    }
    
    .menu-item-has-children > a::after {
        content: "▼";
        font-size: 10px;
        margin-right: 8px;
        display: inline-block;
    }
}

/* =============================================
   کارت‌های نوشته‌ها (با جایگزین تصویر شاخص)
   ============================================= */
.archive-post,
.search-result {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    margin-bottom: 40px;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.archive-post:hover,
.search-result:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* تصویر شاخص یا جایگزین خلاقانه */
.post-thumbnail {
    position: relative;
    width: 100%;
    height: 260px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--gray-100) 0%, var(--gray-200) 100%);
}

.post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.archive-post:hover .post-thumbnail img {
    transform: scale(1.05);
}

/* جایگزین خلاقانه برای پست‌های بدون تصویر */
.post-thumbnail.no-image {
    min-height: 260px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.thumbnail-placeholder {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 40px 24px;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0.2) 100%);
}

.placeholder-icon {
    font-size: 56px;
    margin-bottom: 16px;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
}

.placeholder-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--white);
    line-height: 1.4;
    max-width: 90%;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* برای صفحه اصلی که عنوان خلاصه‌تر است */
.archive-post .thumbnail-placeholder .placeholder-title {
    font-size: 1.1rem;
}

/* برای صفحه تکی که عنوان کامل می‌آید */
.single-post .thumbnail-placeholder .placeholder-title {
    font-size: 1.6rem;
}

.thumbnail-random-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-size: 40px 40px;
    background-image: radial-gradient(circle, rgba(255,255,255,0.15) 1px, transparent 1px);
    z-index: 1;
}

.placeholder-decoration {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
}

/* محتوای کارت */
.archive-post .entry-header,
.search-result .entry-header {
    padding: 24px 28px 16px;
}

.entry-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 12px;
    line-height: 1.3;
}

.entry-title a {
    color: var(--navy);
    text-decoration: none;
    transition: var(--transition);
}

.entry-title a:hover {
    color: var(--accent);
}

.entry-meta {
    color: var(--gray-400);
    font-size: 0.85rem;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 16px;
}

.entry-summary {
    padding: 0 28px 24px;
    color: var(--gray-500);
    line-height: 1.7;
}

/* =============================================
   صفحه تکی نوشته - بهبود یافته
   ============================================= */
.single-post {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    padding: 48px;
    margin-bottom: 48px;
    box-shadow: var(--shadow);
}

@media (max-width: 768px) {
    .single-post {
        padding: 24px;
    }
}

.single-post .entry-title {
    font-size: 2.5rem;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .single-post .entry-title {
        font-size: 1.8rem;
    }
}

.single-post .entry-meta {
    padding-bottom: 20px;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 28px;
}

.entry-content {
    font-size: 1.05rem;
    line-height: 1.8;
}

.entry-content h2 {
    font-size: 1.8rem;
    margin: 48px 0 20px;
    padding-right: 16px;
    border-right: 4px solid var(--navy);
}

.entry-content h3 {
    font-size: 1.4rem;
    margin: 32px 0 16px;
    color: var(--navy-light);
}

.entry-content p {
    margin-bottom: 24px;
}

.entry-content a {
    color: var(--navy);
    text-decoration: underline;
    text-underline-offset: 4px;
}

.entry-content ul,
.entry-content ol {
    margin: 20px 0 24px 40px;
}

.entry-content li {
    margin-bottom: 8px;
}

.entry-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius);
    margin: 20px 0;
}

.entry-content blockquote {
    border-right: 4px solid var(--navy);
    padding-right: 20px;
    margin: 32px 0;
    font-style: italic;
    color: var(--gray-500);
}

.post-tags {
    margin: 48px 0 32px;
    padding: 20px 0;
    border-top: 1px solid var(--gray-200);
}

.post-tags a {
    display: inline-block;
    background: var(--gray-100);
    padding: 6px 16px;
    border-radius: 30px;
    font-size: 0.8rem;
    color: var(--navy);
    text-decoration: none;
    margin-left: 8px;
    margin-bottom: 8px;
    transition: var(--transition);
}

.post-tags a:hover {
    background: var(--navy);
    color: var(--white);
}

/* =============================================
   بخش نظرات - با کادرهای زیبا
   ============================================= */
.comments-area {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    padding: 40px;
    margin-top: 32px;
    box-shadow: var(--shadow);
}

@media (max-width: 768px) {
    .comments-area {
        padding: 24px;
    }
}

.comments-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--navy);
    display: inline-block;
}

.comment-list {
    list-style: none;
}

.comment,
.pingback,
.trackback {
    background: var(--gray-50);
    border-radius: var(--border-radius);
    padding: 24px;
    margin-bottom: 24px;
    transition: var(--transition);
    border: 1px solid var(--gray-200);
}

.comment:hover {
    border-color: var(--gray-300);
    box-shadow: var(--shadow-sm);
}

.comment-body {
    position: relative;
}

.comment-meta {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-200);
}

.comment-author {
    font-weight: 700;
    color: var(--navy);
    font-size: 1rem;
}

.comment-author .avatar {
    border-radius: 50%;
    margin-left: 12px;
    vertical-align: middle;
    border: 2px solid var(--white);
    box-shadow: var(--shadow-sm);
}

.comment-metadata {
    font-size: 0.75rem;
    color: var(--gray-400);
    margin-top: 8px;
}

.comment-content {
    line-height: 1.7;
    color: var(--navy-light);
}

.reply {
    margin-top: 16px;
    text-align: left;
}

.comment-reply-link {
    display: inline-block;
    background: none;
    color: var(--navy);
    padding: 6px 16px;
    border-radius: 30px;
    font-size: 0.8rem;
    text-decoration: none;
    border: 1px solid var(--gray-300);
    transition: var(--transition);
}

.comment-reply-link:hover {
    background: var(--navy);
    color: var(--white);
    border-color: var(--navy);
}

/* پاسخ به نظرات (nested) */
.children {
    list-style: none;
    margin-top: 24px;
    margin-right: 40px;
}

@media (max-width: 768px) {
    .children {
        margin-right: 16px;
    }
}

/* فرم نظر */
.comment-respond {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--gray-200);
}

.comment-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.comment-form input,
.comment-form textarea {
    width: 100%;
    padding: 14px 18px;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-sm);
    font-family: var(--font-fa);
    transition: var(--transition);
    background: var(--white);
}

.comment-form input:focus,
.comment-form textarea:focus {
    outline: none;
    border-color: var(--navy);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.comment-form input[type="submit"] {
    width: auto;
    background: var(--navy);
    color: var(--white);
    border: none;
    cursor: pointer;
    padding: 12px 32px;
    border-radius: 40px;
    font-weight: 600;
}

.comment-form input[type="submit"]:hover {
    background: var(--navy-dark);
    transform: translateY(-2px);
}

/* =============================================
   حذف عنوان "آخرین نوشته‌ها" در صفحه اصلی
   ============================================= */
.home .page-header,
.blog .page-header {
    display: none;
}

/* =============================================
   فوتر
   ============================================= */
.site-footer {
    background: var(--white);
    border-top: 1px solid var(--gray-200);
    padding: 48px 0 32px;
    margin-top: 80px;
    text-align: center;
}

.footer-menu-list {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 28px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.footer-menu-list a {
    text-decoration: none;
    color: var(--gray-400);
    font-size: 0.85rem;
    transition: var(--transition);
}

.footer-menu-list a:hover {
    color: var(--navy);
}

.site-info p {
    color: var(--gray-400);
    font-size: 0.8rem;
    margin-bottom: 6px;
}

.powered-by {
    font-size: 0.75rem;
}

/* =============================================
   صفحه‌بندی (pagination)
   ============================================= */
.pagination,
.posts-navigation {
    text-align: center;
    margin: 48px 0;
}

.page-numbers,
.posts-navigation a {
    display: inline-block;
    padding: 10px 16px;
    margin: 0 4px;
    background: var(--white);
    color: var(--navy);
    border: 1px solid var(--gray-200);
    border-radius: 40px;
    text-decoration: none;
    transition: var(--transition);
}

.page-numbers.current,
.page-numbers:hover,
.posts-navigation a:hover {
    background: var(--navy);
    color: var(--white);
    border-color: var(--navy);
}

/* =============================================
   صفحه خطا (404)
   ============================================= */
.error-404 {
    text-align: center;
    padding: 80px 0;
}

.error-404 .page-title {
    font-size: 3rem;
    margin-bottom: 20px;
    color: var(--navy);
}

.error-404 .page-content {
    margin-top: 32px;
}

.home-link {
    margin-top: 32px;
}

.button,
.home-link a {
    display: inline-block;
    background: var(--navy);
    color: var(--white);
    padding: 12px 32px;
    border-radius: 40px;
    text-decoration: none;
    transition: var(--transition);
}

.button:hover,
.home-link a:hover {
    background: var(--navy-dark);
    transform: translateY(-2px);
}

/* =============================================
   فرم جستجو
   ============================================= */
.search-form {
    display: flex;
    gap: 12px;
    margin: 20px 0;
}

.search-form input[type="search"] {
    flex: 1;
    padding: 12px 18px;
    border: 1px solid var(--gray-200);
    border-radius: 40px;
    font-family: var(--font-fa);
}

.search-form input[type="submit"] {
    background: var(--navy);
    color: var(--white);
    border: none;
    padding: 12px 28px;
    border-radius: 40px;
    cursor: pointer;
    transition: var(--transition);
}

.search-form input[type="submit"]:hover {
    background: var(--navy-dark);
}

/* =============================================
   واکنش‌گرایی کامل (Responsive)
   ============================================= */
@media (max-width: 1024px) {
    .container-wide {
        max-width: 960px;
    }
}

@media (max-width: 768px) {
    :root {
        --container-wide: 100%;
    }
    
    .entry-title {
        font-size: 1.3rem;
    }
    
    .archive-post .entry-header,
    .search-result .entry-header {
        padding: 20px;
    }
    
    .entry-summary {
        padding: 0 20px 20px;
    }
    
    .post-thumbnail,
    .post-thumbnail.no-image {
        height: 200px;
        min-height: 200px;
    }
    
    .placeholder-title {
        font-size: 1rem;
    }
    
    .single-post .placeholder-title {
        font-size: 1.2rem !important;
    }
    
    .placeholder-icon {
        font-size: 40px;
    }
}

@media (max-width: 480px) {
    .site-title {
        font-size: 1.2rem;
    }
    
    .entry-meta {
        flex-direction: column;
        gap: 6px;
    }
    
    .post-thumbnail,
    .post-thumbnail.no-image {
        height: 180px;
        min-height: 180px;
    }
    
    .comment {
        padding: 16px;
    }
    
    .children {
        margin-right: 8px;
    }
    
    .pagination .page-numbers {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
}

/* =============================================
   انیمیشن‌های نرم
   ============================================= */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.archive-post,
.search-result,
.single-post,
.comments-area {
    animation: fadeInUp 0.5s ease-out;
}

/* =============================================
   پشتیبانی از زبان انگلیسی
   ============================================= */
[lang="en"] body,
body:lang(en) {
    direction: ltr;
    font-family: var(--font-en);
}

[lang="en"] .container,
[lang="en"] .container-wide {
    direction: ltr;
}

[lang="en"] .entry-content h2 {
    border-right: none;
    border-left: 4px solid var(--navy);
    padding-right: 0;
    padding-left: 16px;
}

[lang="en"] blockquote {
    border-right: none;
    border-left: 4px solid var(--navy);
    padding-right: 0;
    padding-left: 20px;
}