/* ==========================================
   ARTICLES - PERSIAN VERSION WITH VAZIRMATN
   FIXED ALIGNMENT + 3-LINE TITLE LIMIT
========================================== */

/* FORCE VAZIRMATN ON ALL ARTICLES CONTENT */
.articles,
.articles *,
.article-card,
.article-body,
.article-description,
.article-description-tooltip,
.article-category,
.read-more,
.section-heading,
.section-heading *,
.articles-footer .btn,
.articles-footer a {
    font-family: 'Vazirmatn', 'Inter', sans-serif !important;
}

.articles {
    background: white;
    direction: rtl;
    font-family: 'Vazirmatn', sans-serif;
}

.section-heading {
    text-align: center;
    max-width: 700px;
    margin: auto;
}

.section-tag {
    display: inline-block;
    padding: 8px 18px;
    border-radius: 999px;
    background: #eef5ff;
    color: var(--primary);
    font-size: .85rem;
    font-weight: 600;
    letter-spacing: 1px;
    margin-bottom: 18px;
}

.section-heading h2 {
    margin-bottom: 18px;
    font-family: 'Vazirmatn', sans-serif;
}

.section-heading p {
    color: var(--text-light);
    font-family: 'Vazirmatn', sans-serif;
}

/* ==========================================
   GRID
========================================== */

.articles-grid {
    margin-top: 70px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 35px;
}

/* ==========================================
   CARD - Equal height cards
========================================== */

.article-card {
    background: white;
    border-radius: 22px;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: .35s;
    box-shadow: var(--shadow-sm);
    direction: rtl;
    font-family: 'Vazirmatn', sans-serif;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.article-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-lg);
}

.article-card a {
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

/* ==========================================
   IMAGE
========================================== */

.article-card img {
    width: 100%;
    height: 240px;
    object-fit: cover;
    transition: .4s;
    flex-shrink: 0;
}

.article-card:hover img {
    transform: scale(1.06);
}

/* ==========================================
   BODY - Takes remaining space
========================================== */

.article-body {
    padding: 30px;
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.article-category {
    display: inline-block;
    padding: 7px 14px;
    border-radius: 50px;
    background: #edf4ff;
    color: var(--primary);
    font-size: .82rem;
    font-weight: 600;
    margin-bottom: 18px;
    font-family: 'Vazirmatn', sans-serif;
    align-self: flex-start;
}

/* ==========================================
   TITLE - NEW: 3-line limit with tooltip
========================================== */

/* Title wrapper for tooltip positioning */
.article-title-wrapper {
    position: relative;
    display: block;
    width: 100%;
    margin-bottom: 18px;
    cursor: pointer;
}

.article-body h3 {
    line-height: 1.4;
    transition: .3s;
    font-family: 'Vazirmatn', sans-serif;
    font-weight: 700;
    font-size: 1.15rem;
    /* 3-LINE LIMIT */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 72px; /* 3 lines × 1.4 × 1.15rem ≈ 72px */
    margin: 0;
}

.article-card:hover h3 {
    color: var(--primary);
}

/* Title Tooltip - Full text on hover */
.article-title-tooltip {
    position: absolute;
    bottom: calc(100% + 12px);
    right: 0;
    background: var(--secondary);
    color: white;
    padding: 16px 20px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    line-height: 1.8;
    max-width: 400px;
    min-width: 260px;
    box-shadow: var(--shadow-lg);
    z-index: 100;
    font-family: 'Vazirmatn', sans-serif;
    text-align: right;
    opacity: 0;
    visibility: hidden;
    transition: all .25s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-weight: 400;
}

/* Title Tooltip arrow */
.article-title-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    right: 30px;
    border: 8px solid transparent;
    border-top-color: var(--secondary);
}

/* Show title tooltip on hover */
.article-title-wrapper:hover .article-title-tooltip {
    opacity: 1;
    visibility: visible;
}

/* ==========================================
   DESCRIPTION - 3-line limit with tooltip
========================================== */

.article-description-wrapper {
    position: relative;
    display: block;
    width: 100%;
    flex: 1;
    cursor: pointer;
}

.article-description {
    font-family: 'Vazirmatn', sans-serif;
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--text-light);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
    transition: color .3s ease;
    min-height: 80px;
    margin: 0 0 25px 0;
}

.article-description:hover {
    color: var(--text);
}

/* ==========================================
   DESCRIPTION TOOLTIP
========================================== */

.article-description-tooltip {
    position: absolute;
    bottom: calc(100% + 12px);
    right: 0;
    background: var(--secondary);
    color: white;
    padding: 18px 22px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    line-height: 1.9;
    max-width: 380px;
    min-width: 280px;
    box-shadow: var(--shadow-lg);
    z-index: 100;
    font-family: 'Vazirmatn', sans-serif;
    text-align: right;
    opacity: 0;
    visibility: hidden;
    transition: all .25s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Description Tooltip arrow */
.article-description-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    right: 30px;
    border: 8px solid transparent;
    border-top-color: var(--secondary);
}

/* Show description tooltip on hover */
.article-description-wrapper:hover .article-description-tooltip {
    opacity: 1;
    visibility: visible;
}

/* ==========================================
   READ MORE - Pinned to bottom
========================================== */

.read-more {
    color: var(--primary);
    font-weight: 600;
    font-family: 'Vazirmatn', sans-serif;
    display: inline-block;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    width: 100%;
}

.read-more a {
    text-decoration: none;
    color: inherit;
    transition: .3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.read-more a::before {
    content: '←';
    display: inline-block;
    transition: transform 0.3s;
}

.read-more a:hover::before {
    transform: translateX(-4px);
}

.read-more a:hover {
    color: var(--primary-dark);
}

/* ==========================================
   FOOTER
========================================== */

.articles-footer {
    text-align: center;
    margin-top: 70px;
}

.articles-footer .btn {
    font-family: 'Vazirmatn', sans-serif;
}

/* ==========================================
   RESPONSIVE
========================================== */

@media(max-width:1100px) {
    .articles-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media(max-width:700px) {
    .articles-grid {
        grid-template-columns: 1fr;
        max-width: 500px;
        margin-left: auto;
        margin-right: auto;
    }

    .article-body {
        padding: 20px;
    }

    .article-body h3 {
        min-height: 65px;
        font-size: 1.05rem;
    }

    .article-description {
        min-height: 70px;
        font-size: 0.9rem;
    }

    .article-title-tooltip {
        max-width: 280px;
        min-width: 220px;
        font-size: 0.9rem;
        padding: 14px 18px;
        right: 0;
    }

    .article-description-tooltip {
        max-width: 280px;
        min-width: 220px;
        font-size: 0.85rem;
        padding: 14px 18px;
        right: 0;
    }
}

@media(max-width:480px) {
    .articles-grid {
        max-width: 100%;
    }
    
    .article-card img {
        height: 200px;
    }

    .article-body {
        padding: 16px;
    }

    .article-body h3 {
        min-height: 58px;
        font-size: 0.95rem;
    }

    .article-description {
        min-height: 60px;
        font-size: 0.85rem;
    }

    .article-title-tooltip {
        max-width: 220px;
        min-width: 180px;
        font-size: 0.85rem;
        padding: 12px 14px;
        bottom: calc(100% + 8px);
    }

    .article-description-tooltip {
        max-width: 220px;
        min-width: 180px;
        font-size: 0.8rem;
        padding: 12px 14px;
        bottom: calc(100% + 8px);
    }

    .read-more {
        font-size: 0.85rem;
    }
}

/* ==========================================
   BONUS: Optional hover effect on cards
========================================== */

.article-card:hover .article-body {
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(37, 99, 235, 0.02) 100%
    );
}