/* =========================
   RTL Adjustments for Arabic
========================= */

/* Alexandria Font للنصوص العربية */
body.rtl,
.rtl .project-card,
.rtl .project-title,
.rtl .category-title,
.rtl #popup-title,
.rtl .discover-more {
    font-family: 'Alexandria', sans-serif;
}

/* عكس اتجاه الـ Grid */
.projects-grid {
    direction: rtl;
}

/* الكارد نفسه */
.project-card {
    padding-right: 0;
    padding-left: 20px; /* الخط على الشمال بدل اليمين */
    text-align: right;
}

/* عنوان المشروع */
.project-card h3 {
    text-align: right;
}

.project-title {
    text-align: right;
}

/* =========================
   Timeline Line + Dots (Left Side)
========================= */
.line {
    right: auto;
    left: 0; /* الخط على الشمال */
}

.dot {
    right: auto;
    left: -4.5px; /* النقطة الفوقانية على الشمال */
}

/* النقطة التحتانية */
.project-card::after {
    right: auto;
    left: -4.5px; /* على الشمال */
}

/* =========================
   Eye Circle (Left Side in RTL)
========================= */
.project-eye {
    margin-left: 0;
    margin-right: auto; /* يخليها شمال */
}

/* =========================
   ✅ FIX: Remove divider from LAST item in RTL
   (في RTL آخر عنصر هو اللي على اليمين = 5n)
========================= */
.projects-grid .project-card:nth-child(5n) .line,
.projects-grid .project-card:nth-child(5n)::after {
    display: none !important;
}

/* إظهار الخط لكل العناصر التانية */
.projects-grid .project-card .line,
.projects-grid .project-card::after {
    display: block;
}

/* =========================
   Popup RTL
========================= */
.popup-box {
    direction: rtl;
    text-align: right;
}

#popup-title {
    text-align: right;
    font-family: 'Alexandria', sans-serif;
}

/* Close button on the left in RTL */
.popup-close {
    right: auto;
    left: 20px;
}

/* Swiper buttons */
.project-swiper .swiper-button-next,
.project-swiper .swiper-button-prev {
    /* Swiper automatically handles RTL */
}

/* =========================
   Category Title RTL
========================= */
.category-title.outside {
    text-align: right;
    font-family: 'Alexandria', sans-serif;
}

/* Discover More Button */
.discover-more {
    font-family: 'Alexandria', sans-serif;
}

/* =========================
   Responsive RTL
========================= */
@media (max-width: 768px) {

    /* ✅ Remove divider from LAST item in each row (Mobile RTL)
       في الموبايل كل صف فيه 2 عناصر، فآخر عنصر = 2n */
    .projects-grid .project-card:nth-child(2n) .line,
    .projects-grid .project-card:nth-child(2n)::after {
        display: none !important;
    }

    /* إظهار الخط لكل العناصر الفردية */
    .projects-grid .project-card:nth-child(2n+1) .line,
    .projects-grid .project-card:nth-child(2n+1)::after {
        display: block;
    }

    /* العنصر الخامس padding adjustment */
    .projects-grid .project-card:nth-child(5n) {
        padding: 0px 40px;
    }
}