/* ============================================
   ARTICLE.CSS - Cleaned & Unified
   Supports all current articles
============================================ */

/* ---------- Fonts ---------- */
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: 400;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Medium.woff2') format('woff2');
    font-weight: 500;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Bold.woff2') format('woff2');
    font-weight: 700;
}

/* ---------- Base ---------- */
body {
    font-family: 'Vazirmatn', sans-serif;
    direction: rtl;
    background: #f8fafc;
    color: #334155;
    line-height: 2.2;
    margin: 0;
}

/* ---------- Header ---------- */
.article-header {
    background: white;
    border-bottom: 1px solid #e2e8f0;
}

.header-container {
    max-width: 1200px;
    margin: auto;
    padding: 22px 24px;
}

.back-link {
    color: #2563eb;
    font-weight: 600;
    text-decoration: none;
}

.back-link:hover {
    color: #1d4ed8;
}

/* ---------- Hero ---------- */
.article-hero {
    position: relative;
    max-width: 1200px;
    margin: 40px auto;
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08);
}

.hero-image {
    width: 100%;
    height: 480px;
    object-fit: cover;
    display: block;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(15, 23, 42, 0.88), rgba(15, 23, 42, 0.25));
    display: flex;
    align-items: flex-end;
}

.hero-content {
    padding: 48px;
    color: white;
}

.article-category {
    display: inline-block;
    padding: 8px 18px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(6px);
    margin-bottom: 22px;
    font-size: 0.9rem;
}

.article-title {
    font-size: 3rem;
    line-height: 1.4;
    margin: 0 0 12px;
}

.article-subtitle {
    font-size: 1.35rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.85);
    margin: 0 0 18px;
    line-height: 1.6;
}

.article-meta {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    font-size: 0.95rem;
    color: #e2e8f0;
}

/* ---------- Layout ---------- */
.article-main {
    max-width: 1200px;
    margin: auto;
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 40px;
    padding: 0 24px 80px;
}

/* ---------- Table of Contents ---------- */
.toc {
    position: sticky;
    top: 120px;
    align-self: start;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 24px;
}

.toc h3 {
    margin: 0 0 16px;
    color: #0f172a;
}

.toc ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc li {
    margin-bottom: 12px;
}

.toc a {
    text-decoration: none;
    color: #475569;
    transition: color 0.2s ease;
}

.toc a:hover {
    color: #2563eb;
}

.toc ul ul {
    padding-right: 1.5rem;
    margin-top: 0.25rem;
}

.toc ul ul li {
    font-size: 0.9rem;
    margin-bottom: 8px;
}

/* ---------- Article Content ---------- */
.article-content {
    background: white;
    border-radius: 24px;
    padding: 56px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.05);
}

.article-content h2 {
    color: #0f172a;
    margin-top: 56px;
    margin-bottom: 20px;
    font-size: 2rem;
}

.article-content h2:first-child {
    margin-top: 0;
}

.article-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #0f172a;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    padding-right: 0.75rem;
    border-right: 3px solid #2563eb;
}

.article-content p {
    font-size: 1.14rem;
    text-align: justify;
}

.article-content ul,
.article-content ol {
    padding-right: 24px;
}

.article-content li {
    margin-bottom: 12px;
}

.article-content figure {
    margin: 48px 0;
}

.article-content img {
    width: 100%;
    border-radius: 18px;
    display: block;
}

figcaption {
    text-align: center;
    color: #64748b;
    margin-top: 12px;
    font-size: 0.95rem;
}

blockquote {
    margin: 48px 0;
    padding: 24px 28px;
    border-right: 5px solid #2563eb;
    background: #f1f5f9;
    border-radius: 16px;
    font-size: 1.1rem;
    color: #0f172a;
}

/* ---------- Highlight / Info Boxes ---------- */
.highlight-box {
    background: #fff7ed;
    border-right: 5px solid #f97316;
    padding: 22px;
    border-radius: 16px;
    margin: 32px 0;
    line-height: 1.8;
}

.highlight-box strong {
    color: #0f172a;
}

.tip-box {
    background: #effdf5;
    border-right: 5px solid #22c55e;
    padding: 22px;
    border-radius: 16px;
    margin: 32px 0;
}

.warning-box {
    background: #fef2f2;
    border-right: 5px solid #ef4444;
    padding: 22px;
    border-radius: 16px;
    margin: 32px 0;
    line-height: 1.8;
}

.example-box {
    background: #f8fafc;
    border-right: 4px solid #2563eb;
    padding: 1.25rem 1.5rem;
    border-radius: 8px;
    margin: 1.5rem 0;
    font-size: 1.05rem;
    color: #0f172a;
}

.quote-box {
    background: #f1f5f9;
    border-right: 5px solid #64748b;
    padding: 1.5rem 1.75rem;
    border-radius: 12px;
    margin: 2rem 0;
    font-style: italic;
    color: #334155;
    font-size: 1.1rem;
}

/* ---------- Legal / Formula Boxes (Article 3) ---------- */
.legal-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 2rem;
    margin: 2rem 0;
}

.legal-title {
    font-size: 0.95rem;
    color: #64748b;
    margin-bottom: 1.25rem;
}

.legal-clause {
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px dashed #e2e8f0;
}

.legal-clause:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.formula-box {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.formula-box h4 {
    margin: 0 0 0.75rem;
    color: #1e40af;
}

.formula {
    background: white;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    direction: ltr;
    text-align: left;
    color: #0f172a;
    border: 1px solid #dbeafe;
}

/* ---------- Comparison Boxes (Article 2) ---------- */
.comparison-box {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin: 2rem 0;
}

.comparison-item {
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.comparison-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

.comparison-item.bad {
    background: #fef2f2;
    border-color: #fca5a5;
}

.comparison-item.bad h4 {
    color: #dc2626;
}

.comparison-item.good {
    background: #f0fdf4;
    border-color: #86efac;
}

.comparison-item.good h4 {
    color: #16a34a;
}

.comparison-item h4 {
    font-size: 1.05rem;
    margin-bottom: 0.75rem;
}

.comparison-item ul {
    margin: 0.75rem 0;
    padding-right: 1.5rem;
}

.comparison-item code {
    display: block;
    background: rgba(0, 0, 0, 0.05);
    padding: 0.75rem;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    direction: ltr;
    text-align: left;
    margin: 0.75rem 0;
}

/* ---------- Code Examples ---------- */
.code-example {
    background: #1e293b;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.code-example h4 {
    color: #e2e8f0;
    margin: 0 0 0.75rem;
}

.code-example pre {
    overflow-x: auto;
    margin: 0;
}

.code-example code {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.8;
    color: #e2e8f0;
    direction: ltr;
    text-align: left;
    white-space: pre;
}

.code-caption {
    color: #94a3b8;
    font-size: 0.85rem;
    margin-top: 0.75rem;
    text-align: left;
    direction: ltr;
}

/* ---------- Rule Example ---------- */
.rule-example {
    background: #f8fafc;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    border: 1px solid #e2e8f0;
}

.rule {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px dashed #e2e8f0;
}

.rule:last-of-type {
    border-bottom: none;
}

.rule-arrow {
    font-size: 1.2rem;
}

.rule-result {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    margin-top: 0.75rem;
    background: #ecfdf5;
    border-radius: 8px;
}

/* ---------- Data Sources Grid ---------- */
.data-sources-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin: 1.5rem 0;
}

.data-source {
    background: #f8fafc;
    padding: 1.25rem;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    text-align: center;
    transition: all 0.3s ease;
}

.data-source:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    border-color: #2563eb;
}

.data-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

.data-source h4 {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    color: #0f172a;
}

.data-source ul {
    list-style: none;
    padding: 0;
    font-size: 0.85rem;
    color: #64748b;
}

.data-source ul li {
    padding: 0.15rem 0;
}

/* ---------- English Title Helper ---------- */
.en-title {
    font-size: 0.8rem;
    font-weight: 400;
    color: #64748b;
    direction: ltr;
    display: inline-block;
    margin-right: 0.5rem;
}

/* ---------- Tags ---------- */
.article-tags {
    margin-top: 56px;
    padding-top: 1.5rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.article-tags span {
    background: #eef5ff;
    color: #2563eb;
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 0.92rem;
}

/* ---------- Navigation (Centered) ---------- */
.article-navigation {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 2rem 3rem;
    padding: 2rem 1.5rem;
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    margin: 2rem auto;
    max-width: 1200px;
}

.article-navigation a {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: #2563eb;
    font-weight: 600;
    font-size: 0.95rem;
    transition: color 0.2s ease, transform 0.2s ease;
}

.article-navigation a:hover {
    color: #1d4ed8;
}

.nav-prev:hover {
    transform: translateX(4px); /* RTL */
}

.nav-next:hover {
    transform: translateX(-4px); /* RTL */
}

/* ---------- Footer ---------- */
.article-footer {
    background: #0f172a;
    color: rgba(255, 255, 255, 0.8);
    padding: 2rem 0;
    margin-top: 3rem;
    text-align: center;
}

.article-footer .footer-note {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 0.25rem;
}

/* ============================================
   Responsive
============================================ */
@media (max-width: 992px) {
    .article-main {
        grid-template-columns: 1fr;
    }

    .toc {
        display: none;
    }

    .article-content {
        padding: 40px 28px;
    }

    .article-title {
        font-size: 2.2rem;
    }

    .comparison-box {
        grid-template-columns: 1fr;
    }

    .data-sources-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .article-navigation {
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
    }

    .article-navigation a {
        justify-content: center;
        padding: 0.75rem 1rem;
        background: #f8fafc;
        border-radius: 8px;
        width: 100%;
        max-width: 350px;
        margin: 0 auto;
    }

    .nav-prev:hover,
    .nav-next:hover {
        transform: none;
    }

    .article-subtitle {
        font-size: 1.1rem;
    }

    .data-sources-grid {
        grid-template-columns: 1fr;
    }

    .code-example code {
        font-size: 0.75rem;
    }

    .comparison-item {
        padding: 1rem;
    }

    .highlight-box,
    .warning-box,
    .tip-box {
        padding: 1rem;
        font-size: 0.95rem;
    }

    .article-tags {
        justify-content: center;
    }
}

@media (max-width: 600px) {
    .hero-image {
        height: 320px;
    }

    .hero-content {
        padding: 28px;
    }

    .article-title {
        font-size: 1.8rem;
    }

    .article-content {
        padding: 28px 20px;
    }
}

@media (max-width: 480px) {
    .article-title {
        font-size: 1.5rem;
    }

    .article-subtitle {
        font-size: 0.95rem;
    }

    .article-content h3 {
        font-size: 1.1rem;
    }

    .article-navigation a {
        font-size: 0.85rem;
        padding: 0.6rem 0.75rem;
    }
}