*, *::before, *::after { box-sizing: border-box; }

.projects-timeline, .projects-grid-section {
    background-color: #FFFFFF;
    padding: 6rem 5%;
    font-family: 'Tajawal', sans-serif;
    overflow: hidden;
}

.projects-timeline .timeline-container, 
.projects-grid-section .grid-container {
    max-width: 1000px;
    margin: 0 auto;
}

/* --- تنسيق العناوين --- */
.section-header { text-align: center; margin-bottom: 5rem; }
.sub-title { color: var(--gold-dark, #9B7D23); font-size: 1.1rem; font-weight: 700; margin-bottom: 0.5rem; display: block; }
.main-title { color: var(--primary, #0A1128); font-size: 2.5rem; font-weight: 800; margin-bottom: 1rem; }
.title-line { width: 60px; height: 3px; background-color: var(--gold, #D4AF37); margin: 0 auto; border-radius: 3px; }

/* إخفاء مبدئي للـ GSAP */
.projects-timeline .section-header, .projects-timeline .timeline-dot, 
.projects-timeline .timeline-content, .projects-timeline .timeline-more { opacity: 0; visibility: hidden; }

/* --- المسار الزمني (Timeline) --- */
.projects-timeline .timeline-wrapper { position: relative; }
.projects-timeline .timeline-line-track { position: absolute; top: 0; right: 0; width: 4px; height: 100%; background-color: #E2E8F0; border-radius: 2px; z-index: 1; }
.projects-timeline .timeline-line-fill { position: absolute; top: 0; right: 0; width: 4px; height: 0%; background: linear-gradient(to bottom, var(--gold-light, #E4C580), var(--gold-dark, #9B7D23)); border-radius: 2px; z-index: 2; }
.projects-timeline .timeline-item { position: relative; padding-right: 50px; margin-bottom: 3rem; }
.projects-timeline .timeline-dot { position: absolute; top: 20px; right: -18px; width: 40px; height: 40px; background-color: #FFFFFF; color: var(--gold, #D4AF37); border: 4px solid #E2E8F0; border-radius: 50%; display: flex; justify-content: center; align-items: center; font-size: 1.1rem; z-index: 3; transition: all 0.4s ease; }

/* --- الكارت (تم ضبطه كـ Block لمنع التكسير) --- */
.projects-timeline .timeline-content,
.projects-grid-section .project-card {
    display: block;
    text-decoration: none;
    background-color: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 16px;
    padding: 2rem;
    position: relative;
    transition: all 0.4s ease;
    cursor: pointer;
    text-align: right; /* إجبار المحاذاة لليمين */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

/* المثلث الصغير */
.projects-timeline .timeline-content::before {
    content: ''; position: absolute; top: 30px; right: -11px; width: 20px; height: 20px;
    background-color: #FFFFFF; border-top: 1px solid #E2E8F0; border-right: 1px solid #E2E8F0;
    transform: rotate(45deg); transition: all 0.4s ease; z-index: 2;
}

/* نصوص الكارت الافتراضية وإلغاء هوامش الووردبريس */
.timeline-year {
    display: inline-block; background-color: rgba(212, 175, 55, 0.1); color: var(--gold-dark, #9B7D23);
    padding: 0.4rem 1.2rem; border-radius: 30px; font-weight: 800; font-size: 0.95rem;
    margin-bottom: 1rem; border: 1px solid rgba(212, 175, 55, 0.2); transition: all 0.4s ease;
}
.timeline-title { color: var(--primary, #0A1128); font-size: 1.4rem; font-weight: 700; margin-bottom: 0.8rem; line-height: 1.4; transition: color 0.4s ease; }
.timeline-desc { color: #64748B; font-size: 1.05rem; line-height: 1.7; margin: 0; transition: color 0.4s ease; }
.timeline-desc p { margin-bottom: 0; } /* منع فقرات الووردبريس من عمل مساحات بيضاء زائدة */

/* ✨ تأثير الـ Hover (التحول للكحلي Navy) ✨ */
.projects-timeline .timeline-item:hover .timeline-content,
.projects-grid-section .project-card:hover {
    background-color: var(--primary, #0A1128);
    border-color: var(--primary, #0A1128);
    transform: translateX(-10px);
    box-shadow: 0 20px 40px rgba(10, 17, 40, 0.2);
}
.projects-grid-section .project-card:hover { transform: translateY(-10px); }

.projects-timeline .timeline-item:hover .timeline-content::before {
    background-color: var(--primary, #0A1128);
    border-top-color: var(--primary, #0A1128);
    border-right-color: var(--primary, #0A1128);
}

.projects-timeline .timeline-item:hover .timeline-title, .projects-grid-section .project-card:hover .timeline-title { color: #FFFFFF; }
.projects-timeline .timeline-item:hover .timeline-desc, .projects-grid-section .project-card:hover .timeline-desc, 
.projects-timeline .timeline-item:hover .timeline-desc p, .projects-grid-section .project-card:hover .timeline-desc p { color: #CBD5E1; }
.projects-timeline .timeline-item:hover .timeline-year, .projects-grid-section .project-card:hover .timeline-year {
    background-color: rgba(255, 255, 255, 0.1); color: var(--gold, #D4AF37); border-color: rgba(255, 255, 255, 0.2);
}
.projects-timeline .timeline-item:hover .timeline-dot {
    transform: scale(1.2); background-color: var(--gold, #D4AF37); color: var(--primary, #0A1128); border-color: var(--gold, #D4AF37);
}

/* --- زر عرض المزيد --- */
.timeline-more { text-align: center; margin-top: 4rem; }
.view-all-btn { display: inline-flex; align-items: center; gap: 0.8rem; background-color: transparent; color: var(--primary, #0A1128); border: 2px solid var(--primary, #0A1128); padding: 1rem 2.5rem; border-radius: 50px; font-size: 1.1rem; font-weight: 700; text-decoration: none; transition: all 0.3s ease; }
.view-all-btn:hover { background-color: var(--primary, #0A1128); color: var(--gold, #D4AF37); gap: 1.2rem; }

/* --- تنسيقات شبكة المشروعات (الأرشيف) --- */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2rem; }

/* التجاوب مع الجوال */
@media (max-width: 768px) {
    .projects-timeline, .projects-grid-section {
        padding: 3.5rem 1.2rem;
    }
    .projects-timeline .section-header, .projects-grid-section .section-header {
        margin-bottom: 2.5rem;
    }
    .projects-timeline .main-title, .projects-grid-section .main-title {
        font-size: 1.85rem;
    }
    .projects-timeline .timeline-wrapper {
        padding-right: 15px;
    }
    .projects-timeline .timeline-line-track,
    .projects-timeline .timeline-line-fill {
        right: 15px;
    }
    .projects-timeline .timeline-item {
        padding-right: 28px;
        margin-bottom: 2rem;
    }
    .projects-timeline .timeline-dot {
        right: -14px;
        width: 30px;
        height: 30px;
        font-size: 0.85rem;
        border-width: 3px;
        top: 22px;
    }
    .projects-timeline .timeline-content {
        padding: 1.2rem;
        border-radius: 12px;
    }
    .projects-timeline .timeline-content::before {
        top: 26px;
    }
    .timeline-title {
        font-size: 1.15rem;
    }
    .timeline-desc {
        font-size: 0.92rem;
        line-height: 1.65;
    }
    .timeline-year {
        font-size: 0.85rem;
        padding: 0.3rem 0.9rem;
        margin-bottom: 0.6rem;
    }
    .projects-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    .projects-timeline .view-all-btn {
        padding: 0.85rem 2rem;
        font-size: 1rem;
        width: 100%;
        max-width: 280px;
        justify-content: center;
    }
}

/* ==========================================================================
   LTR / English Mode Support
   ========================================================================== */
.projects-timeline[dir="ltr"],
.projects-timeline.pe-ltr,
.projects-grid-section[dir="ltr"],
.projects-grid-section.pe-ltr {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    direction: ltr;
}

.projects-timeline[dir="ltr"] .timeline-line-track,
.projects-timeline.pe-ltr .timeline-line-track,
.projects-timeline[dir="ltr"] .timeline-line-fill,
.projects-timeline.pe-ltr .timeline-line-fill {
    right: auto;
    left: 0;
}

.projects-timeline[dir="ltr"] .timeline-item,
.projects-timeline.pe-ltr .timeline-item {
    padding-right: 0;
    padding-left: 50px;
}

.projects-timeline[dir="ltr"] .timeline-dot,
.projects-timeline.pe-ltr .timeline-dot {
    right: auto;
    left: -18px;
}

.projects-timeline[dir="ltr"] .timeline-content,
.projects-timeline.pe-ltr .timeline-content,
.projects-grid-section[dir="ltr"] .project-card,
.projects-grid-section.pe-ltr .project-card {
    text-align: left;
}

/* Triangle rotated for LTR (pointing left towards the dot) */
.projects-timeline[dir="ltr"] .timeline-content::before,
.projects-timeline.pe-ltr .timeline-content::before {
    right: auto;
    left: -11px;
    border-top: none;
    border-right: none;
    border-bottom: 1px solid #E2E8F0;
    border-left: 1px solid #E2E8F0;
}

.projects-timeline[dir="ltr"] .timeline-item:hover .timeline-content,
.projects-timeline.pe-ltr .timeline-item:hover .timeline-content {
    transform: translateX(10px);
}

.projects-timeline[dir="ltr"] .timeline-item:hover .timeline-content::before,
.projects-timeline.pe-ltr .timeline-item:hover .timeline-content::before {
    border-top-color: transparent;
    border-right-color: transparent;
    border-bottom-color: var(--primary, #0A1128);
    border-left-color: var(--primary, #0A1128);
}

.projects-timeline[dir="ltr"] .view-all-btn,
.projects-timeline.pe-ltr .view-all-btn {
    flex-direction: row;
}

@media (max-width: 768px) {
    .projects-timeline[dir="ltr"] .timeline-wrapper,
    .projects-timeline.pe-ltr .timeline-wrapper {
        padding-right: 0;
        padding-left: 15px;
    }

    .projects-timeline[dir="ltr"] .timeline-line-track,
    .projects-timeline.pe-ltr .timeline-line-track,
    .projects-timeline[dir="ltr"] .timeline-line-fill,
    .projects-timeline.pe-ltr .timeline-line-fill {
        right: auto;
        left: 15px;
    }

    .projects-timeline[dir="ltr"] .timeline-item,
    .projects-timeline.pe-ltr .timeline-item {
        padding-right: 0;
        padding-left: 28px;
    }

    .projects-timeline[dir="ltr"] .timeline-dot,
    .projects-timeline.pe-ltr .timeline-dot {
        right: auto;
        left: -14px;
    }
}