/* Projects page styles */
.projects-page {
    margin-top: 76px;
    padding: 2rem 0;
}

/* Project title styles */
.project-title {
    font-weight: 600;
    color: #333;
    margin-top: 2rem;
    margin-bottom: 2.5rem;
    padding-bottom: 1rem;
    position: relative;
}

.project-title:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background-color: #333;
}

/* Project grid styles - working with masonry.js */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    padding: 0 2rem;
    grid-auto-rows: 10px; /* Required for masonry.js to calculate rows */
    max-width: 1800px;
    margin: 0 auto;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(0px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Project card styles */
.project-card {
    position: relative;
    cursor: pointer;
    margin-bottom: 2rem;
    opacity: 0;
    animation: fadeInUp 0.8s ease forwards;
    display: flex;
    flex-direction: column;
}

/* Add staggered delay for each card */
.project-card:nth-child(1) { animation-delay: 0.1s; }
.project-card:nth-child(2) { animation-delay: 0.2s; }
.project-card:nth-child(3) { animation-delay: 0.3s; }
.project-card:nth-child(4) { animation-delay: 0.4s; }
.project-card:nth-child(5) { animation-delay: 0.5s; }
.project-card:nth-child(6) { animation-delay: 0.6s; }
.project-card:nth-child(7) { animation-delay: 0.7s; }
.project-card:nth-child(8) { animation-delay: 0.8s; }
.project-card:nth-child(9) { animation-delay: 0.9s; }

.project-card .position-relative {
    position: relative;
    width: 100%;
    display: block;
    margin-bottom: 0;
    overflow: hidden;
    border-radius: 8px 8px 0 0;
}

.project-card img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Project description styles */
.project-description {
    width: 100%;
    background-color: #333;
    padding: .7rem;
    border-radius: 0 0 8px 8px;
    margin-top: 0;
    transition: all 0.3s ease;
}

.project-description:hover {
    background-color: #555;
}

.project-description h3 {
    font-size: 1.1rem;
    color: white;
    font-weight: 500;
    margin: 0;
    text-align: center;
    letter-spacing: 0.5px;
}

/* Hover effect styles - desktop only */
.project-card .main-image {
    transition: opacity 0.3s ease;
    position: relative;
    z-index: 1;
}

.project-card .hover-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 8px 8px 0 0;
    object-fit: cover;
}

/* Only apply hover effects on non-touch devices */
@media (hover: hover) {
    .project-card:hover .main-image {
        opacity: 0;
    }
    
    .project-card:hover .hover-image {
        opacity: 1;
    }
}

.project-link {
    text-decoration: none;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .projects-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 1.5rem;
        padding: 0 1.5rem;
    }
}

@media (max-width: 992px) {
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.2rem;
        padding: 0 1.2rem;
    }
    
    .project-description {
        padding: 1.3rem;
    }
    
    .project-description h3 {
        font-size: 1.1rem;
    }
}

@media (max-width: 768px) {
    .projects-page {
        margin-top: 76px;
        padding: 1rem 0;
    }
    
    .projects-grid {
        grid-template-columns: repeat(1, 1fr);
        gap: 2rem;
        padding: 0 1.5rem;
    }
    
    .project-description {
        padding: 1.5rem;
        background-color: #333;
    }
    
    .project-description h3 {
        font-size: 1.3rem;
        font-weight: 500;
    }
    
    /* Disable hover effects and show main image clearly on mobile */
    .project-card .main-image {
        opacity: 1;
    }
    
    .project-card .hover-image {
        display: none;
    }
    
    /* Create touch feedback */
    .project-card:active {
        transform: scale(0.98);
    }
    
    .project-card img {
        box-shadow: 0 6px 15px rgba(0,0,0,0.2);
    }
}

@media (max-width: 576px) {
    .project-title {
        font-size: 1.75rem;
        margin-top: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .project-title:after {
        width: 60px;
        height: 2px;
    }
    
    .projects-grid {
        gap: 2.5rem;
        padding: 0 0.75rem;
    }
    
    .project-card {
        box-shadow: 0 8px 20px rgba(0,0,0,0.15);
        border-radius: 12px;
    }
    
    .project-card .position-relative {
        border-radius: 12px 12px 0 0;
    }
    
    .project-card img {
        border-radius: 12px 12px 0 0;
    }
    
    .project-description {
        padding: 1.6rem 1rem;
        border-radius: 0 0 12px 12px;
        background-color: #333;
    }
    
    .project-description h3 {
        font-size: 1.4rem;
        font-weight: 600;
        letter-spacing: 0.75px;
    }
    
    /* Reset any Bootstrap margins that might be interfering */
    .container .row > * {
        margin-top: 0 !important;
    }
}