/* --- Grid Layout --- */
#projects-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* --- Grid Item --- */
.grid-item {
    position: relative;
    background-color: #fff;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease-in-out;
    cursor: pointer;
}

.grid-item:hover {
    transform: scale(1.02);
}

.grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.3s ease-in-out;
}

/* --- Hover Overlay --- */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

.grid-item:hover .overlay {
    opacity: 1;
    visibility: visible;
}

.overlay-content h3 {
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 1rem;
}

.see-more-btn {
    background-color: #c4d72d;
    color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: 9999px;
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.2s ease-in-out;
    border: none;
    cursor: pointer;
}

.see-more-btn:hover {
    background-color: #aebc2a;
}

/* --- Load More Button --- */
.load-more-container {
    display: flex;
    justify-content: center;
    margin: 2rem 0;
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.load-more-container.hidden {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
}

#load-more-btn {
    background-color: #c4d72d;
    color: #fff;
    padding: 1.5rem 3rem;
    border-radius: 0.5rem;
    font-size: 1.125rem;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

#load-more-btn:hover {
    background-color: #aebc2a;
}

#load-more-btn:disabled {
    background-color: #d1d5db;
    cursor: not-allowed;
}

/* --- Fade In Animation for new items --- */
@keyframes fadeInSlideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.grid-item.animate-in {
    animation: fadeInSlideDown 0.8s ease-out forwards;
}

/* --- Responsive Layout --- */
@media (max-width: 900px) {
    #projects-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    #projects-grid {
        grid-template-columns: 1fr;
    }
}
