:root {
    /* Main Color Palette */
    --color-1: #059422; /* Green: CTAs, tags, active */
    --color-2: #220594; /* Deep Indigo: Header, footer, titles */
    --color-3: #942205; /* Brick Red: link hovers, warnings, separators */
    
    /* Supporting Colors */
    --surface: #ffffff;
    --bg-light: #f5f7fa;
    --text-main: #2d3748;
    --text-secondary: #718096;
    --border-light: #e2e8f0;
    
    /* Typography */
    --font-fa: 'Vazirmatn', system-ui, sans-serif;
    --font-en: 'Outfit', system-ui, sans-serif;
    
    /* Layout & Effects */
    --radius: 12px;
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 10px 15px -3px rgba(34, 5, 148, 0.08), 0 4px 6px -2px rgba(34, 5, 148, 0.04);
    --shadow-lg: 0 20px 25px -5px rgba(34, 5, 148, 0.15), 0 10px 10px -5px rgba(34, 5, 148, 0.08);
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Global Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-fa);
    background-color: var(--bg-light);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}
::-webkit-scrollbar-track {
    background: var(--bg-light);
}
::-webkit-scrollbar-thumb {
    background: var(--color-2);
    border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--color-1);
}

/* Selection */
::selection {
    background-color: var(--color-1);
    color: white;
}

/* Accessibility */
:focus-visible {
    outline: 3px solid var(--color-1);
    outline-offset: 2px;
}

a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--color-3);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    color: var(--color-2);
    line-height: 1.3;
}

.en-text {
    font-family: var(--font-en);
}

/* Header Styles */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: linear-gradient(135deg, var(--color-2), #11024a);
    color: white;
    border-bottom: 3px solid var(--color-1);
    transition: background 0.4s ease, backdrop-filter 0.4s ease, padding 0.4s ease;
    padding: 1.5rem 0;
    animation: slideDown 0.6s ease-out forwards;
}

.site-header.scrolled {
    background: rgba(34, 5, 148, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 1rem 0;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-brand a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 900;
    color: white;
}

.site-brand a:hover {
    color: #e2e8f0;
}

.brand-logo {
    height: 48px;
    width: auto;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.95);
    padding: 4px 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: var(--transition);
}

.site-brand a:hover .brand-logo {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.main-nav a {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    font-size: 1.1rem;
}

.main-nav a:hover {
    color: white;
    text-shadow: 0 0 8px rgba(255,255,255,0.4);
}

.tagline {
    font-weight: 300;
    opacity: 0.8;
    font-size: 0.9rem;
    display: none;
}

@media (min-width: 768px) {
    .tagline { display: block; }
}

/* Main Container */
.main-container {
    max-width: 1200px;
    margin: 3rem auto;
    padding: 0 1.5rem;
    min-height: calc(100vh - 350px);
}

.section-title {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.section-title::before {
    content: '';
    display: block;
    width: 8px;
    height: 1em;
    background-color: var(--color-1);
    border-radius: 4px;
}

/* Card Grid */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

/* Card Styles */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    border-top: 3px solid transparent;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease, border-color 0.4s ease;
    
    /* Animation initial state */
    opacity: 0;
}

.card.visible {
    animation: fadeInUp 0.7s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-top-color: var(--color-1);
}

.card-image-wrapper {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

.card-image-wrapper::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(to top, rgba(0,0,0,0.4) 0%, transparent 100%);
    pointer-events: none;
}

.card-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.card:hover .card-image-wrapper img {
    transform: scale(1.08);
}

.card-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--color-1);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    z-index: 10;
    box-shadow: var(--shadow-sm);
}

.card-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card-title {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

.card-title a {
    color: var(--color-2);
}

.card-title a:hover {
    color: var(--color-3);
}

.card-date {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.card-date::before {
    content: '🕒';
    font-size: 0.9rem;
}

.btn-read-more {
    margin-top: auto;
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--color-1);
    color: white;
    padding: 0.6rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
}

.btn-read-more:hover {
    background-color: #047a1c;
    color: white;
    transform: translateX(-4px); /* RTL move left */
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: white;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 1.2rem;
    grid-column: 1 / -1;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 3rem;
}

.page-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 0.5rem;
    background: white;
    color: var(--text-main);
    border-radius: 8px;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

.page-btn:hover {
    background: var(--color-3);
    color: white;
}

.page-btn.active {
    background: var(--color-2);
    color: white;
    pointer-events: none;
}

/* Single Post Page */
.single-post-container {
    max-width: 800px;
    margin: 0 auto;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.breadcrumb {
    padding: 1.5rem 2rem 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.breadcrumb-sep {
    color: var(--border-light);
}

.single-post-header {
    padding: 1.5rem 2rem;
}

.single-post-title {
    font-size: clamp(2rem, 5vw, 3rem);
    margin-bottom: 1rem;
}

.single-post-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 1.5rem;
}

.single-featured-image {
    width: 100%;
    max-height: 500px;
    object-fit: cover;
}

.single-post-content {
    padding: 2rem;
    font-size: 1.1rem;
    line-height: 1.9;
    color: #374151;
}

.single-post-content p {
    margin-bottom: 1.5rem;
}

.single-post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 2rem 0;
}

.post-footer {
    padding: 2rem;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--color-1);
    font-weight: 700;
}

.btn-back:hover {
    color: #047a1c;
    transform: translateX(4px); /* RTL move right */
}

/* Footer */
.site-footer {
    background: linear-gradient(to bottom, var(--color-2), #11024a);
    color: rgba(255, 255, 255, 0.8);
    padding: 4rem 0 0;
    margin-top: 4rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem 3rem;
}

@media (min-width: 768px) {
    .footer-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.footer-col-title {
    color: white;
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 0.5rem;
}

.footer-col-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 40px;
    height: 3px;
    background: var(--color-1);
    border-radius: 2px;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.75rem;
}

.footer-links a:hover {
    color: var(--color-3);
    padding-right: 5px;
}

.footer-bottom {
    background: rgba(0, 0, 0, 0.2);
    text-align: center;
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.9rem;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}
