/* Projects / Work Section */
.projects-section {
    padding: 14rem 2rem 5rem; /* Increased top padding for more space below hero */
    max-width: 1350px;
    margin: 0 auto;
    position: relative;
    z-index: 10;
}

.projects-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 4rem;
    gap: 2rem;
    padding-left: 1rem;
}

.projects-header h2 {
    font-family: var(--font-heading);
    font-size: 2.8rem;
    font-weight: 500; /* Matching hero section weight slightly */
    color: var(--text-secondary);
    max-width: 700px;
    line-height: 1.15;
    letter-spacing: -1.5px;
}

.projects-header h2 strong {
    font-weight: 600;
    color: var(--text-primary);
}

.projects-header p {
    font-family: var(--font-body); /* Matching hero subtext */
    color: var(--text-secondary);
    max-width: 320px;
    font-size: 1rem;
    text-align: right;
    line-height: 1.6;
}

/* Projects Track (Horizontal Scroll) */
.projects-track {
    display: flex;
    gap: 2rem;
    overflow-x: auto;
    padding-bottom: 3rem;
    padding-left: 1rem;
    padding-right: calc(50vw - 50% + 2rem); /* Break out right padding */
    margin-right: calc(50% - 50vw);         /* Break out right margin */
    scroll-behavior: smooth;
    /* Hide scrollbar */
    -ms-overflow-style: none;  
    scrollbar-width: none;  
}

.projects-track::-webkit-scrollbar {
    display: none;
}

/* Base Card Styling (With Animation Setup) */
.project-card {
    flex: 0 0 auto;
    width: 380px;
    height: 480px;
    border-radius: 24px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border-color);
    background-color: var(--surface-color);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    
    /* Animation Initial State */
    opacity: 0;
    transform: translateX(150px);
    transition: opacity 0.9s cubic-bezier(0.2, 0.8, 0.2, 1), 
                transform 0.9s cubic-bezier(0.2, 0.8, 0.2, 1),
                box-shadow 0.3s ease, 
                border-color 0.3s ease;
}

/* Hover effects */
.project-card:hover {
    border-color: rgba(84, 227, 70, 0.4);
    box-shadow: 0 15px 40px rgba(0,0,0,0.5);
    transform: translateY(-10px); /* Small lift on hover */
}

/* Animation 'In-View' class applied by JavaScript */
.project-card.in-view {
    opacity: 1;
    transform: translateX(0); /* Resets to originally rendered spot */
}

/* Stagger the animation across multiple cards */
.project-card:nth-child(1) { transition-delay: 0.1s; }
.project-card:nth-child(2) { transition-delay: 0.25s; }
.project-card:nth-child(3) { transition-delay: 0.4s; }
.project-card:nth-child(4) { transition-delay: 0.55s; }

/* Ensure hover lift overrides the delayed structural translation */
.project-card.in-view:hover {
    transform: translateY(-10px);
}

/* Card Internal Layout */
.project-image {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    background-color: #0d100d;
    background-size: cover;
    background-position: center;
    transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* If user decides to use standard <img> tags instead of background images */
.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.project-details {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 2rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.7) 40%, rgba(0, 0, 0, 0.2) 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    z-index: 5;
}

.project-details h3 {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 600;
    letter-spacing: -0.5px;
    margin-bottom: 0.3rem;
    color: var(--text-primary);
}

.project-details p {
    font-family: var(--font-body);
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

.project-link {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: color 0.3s;
}

.project-link:hover {
    color: var(--accent-primary);
}

/* Responsive */
@media (max-width: 900px) {
    .projects-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .projects-header h2 {
        font-size: 2.2rem;
    }
    .projects-header p {
        text-align: left;
    }
}

@media (max-width: 600px) {
    .projects-section {
        padding: 8rem 1rem 3rem; /* Extra top spacing added on mobile too */
    }
    .projects-header h2 {
        font-size: 2rem;
        letter-spacing: -1px;
    }
    .project-card {
        width: 320px;
        height: 480px;
    }
    .project-details h3 {
        font-size: 1.5rem;
    }
}

/* Projects Navigation Arrows */
.projects-nav {
    display: flex;
    justify-content: flex-end;
    gap: 1.5rem;
    padding-right: 2rem;
    margin-top: 1rem;
    max-width: 1350px;
    margin-left: auto;
    margin-right: auto;
}

.slider-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.slider-btn:hover {
    background-color: var(--accent-primary);
    color: #000;
    border-color: var(--accent-primary);
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(84, 227, 70, 0.4);
}

@media (max-width: 600px) {
    .projects-nav {
        justify-content: center;
        padding-right: 0;
        margin-top: 2rem;
    }
}

/* Ensure the Images cover the section correctly without distortion */
.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}


/* Trim overly long descriptions with an ellipsis so the card doesn't overflow */
.project-desc {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

/* Ensure the specific titles don't wrap awkwardly */
.project-details h3 {
    font-size: 1.6rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* Add Project Card Hover interactions */
.project-card:hover .project-details {
    opacity: 1;
    transform: translateY(0);
}

.project-card:hover .project-image {
    transform: scale(1.05); /* Slight zoom on the image when hovered */
}

/* For touch screens, keep the details visible by default since they can't 'hover' properly */
@media (hover: none) {
    .project-details {
        opacity: 1;
        transform: translateY(0);
        background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.4) 60%, rgba(0, 0, 0, 0) 100%);
    }
}
