.gallery {
    padding: 80px 0;
    background: var(--light-bg);
}

.gallery h2 {
    text-align: center;
    margin-bottom: 50px;
    color: var(--primary-color);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.gallery-item {
    width: 100%;
    height: 300px; /* Consistent height for all items */
    border-radius: 15px;
    overflow: hidden;
    position: relative;
    animation: fadeInUp 0.6s ease forwards;
}

.gallery-image {
    position: absolute;
    width: 100%;
    height: 100%;
}

.gallery-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.gallery-content {
    position: absolute;
    bottom: -100%;
    left: 0;
    width: 100%;
    padding: 20px;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    transition: bottom 0.3s ease;
}

.gallery-item:hover .gallery-content {
    bottom: 0;
}

.gallery-item:hover .gallery-image img {
    transform: scale(1.1);
}

.gallery-content h3 {
    color: var(--white);
    font-size: 1.4em;
    margin-bottom: 10px;
    position: relative;
}

.gallery-content h3::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -5px;
    width: 50px;
    height: 2px;
    background: var(--secondary-color);
}

.gallery-content p {
    color: #ddd;
    font-size: 0.9em;
    line-height: 1.6;
    margin-bottom: 15px;
}

.view-more {
    display: inline-block;
    color: var(--secondary-color);
    font-weight: 500;
    cursor: pointer;
}

.view-more::after {
    content: '→';
    margin-left: 5px;
    transition: transform 0.3s ease;
    display: inline-block;
}

.gallery-item:hover .view-more::after {
    transform: translateX(10px);
}

/* Animation for cards appearance */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.gallery-item:nth-child(2) {
    animation-delay: 0.2s;
}

.gallery-item:nth-child(3) {
    animation-delay: 0.4s;
}

.gallery-item:nth-child(4) {
    animation-delay: 0.6s;
}

@media (max-width: 768px) {
    .gallery-content h3 {
        font-size: 1.2em;
    }
    
    .gallery-content p {
        font-size: 0.85em;
    }
} 