.gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    margin: 2em;
}

.gallery-item {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    width: calc(33.333% - 20px); /* Adjust width for 3 items per row with gaps */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.gallery-item:hover {
    transform: scale(1.05);
}

.gallery-item img {
    width: 100%;
    display: block;
    border-bottom: 1px solid #ddd;
    cursor: pointer;
}

.gallery-item p {
    padding: 15px;
    text-align: center;
    color: #555;
    font-size: 1em;
}

@media (max-width: 768px) {
    .gallery-item {
        width: calc(50% - 20px); /* 2 items per row on tablets */
    }
}

@media (max-width: 480px) {
    .gallery-item {
        width: 100%; /* 1 item per row on mobile */
    }
}

/* Lightbox styles */
.lightbox {
    display: none;
    position: fixed;
    z-index: 999;
    padding-top: 60px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.9);
}

.lightbox-content {
    position: relative;
    margin: auto;
    padding: 0;
    width: 90%;
    max-width: 1200px;
}

.lightbox img {
    margin-bottom: -4px;
}

.close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
}

.close:hover,
.close:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}

.prev,
.next {
    cursor: pointer;
    position: absolute;
    top: 50%;
    width: auto;
    padding: 16px;
    margin-top: -50px;
    color: #fff;
    font-weight: bold;
    font-size: 20px;
    transition: 0.3s;
    user-select: none;
    background-color: rgba(0,0,0,0.4);
}

.prev {
    left: 0;
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
}

.next {
    right: 0;
    border-top-left-radius: 10px;
    border-bottom-left-radius: 10px;
}

.prev:hover,
.next:hover {
    background-color: rgba(0,0,0,0.8);
}

.caption {
    color: #FFF;
    font-size: 15px;
    padding: 10px 12px;
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    text-align: center;
    background-color: rgba(0, 0, 0, 0.7);
}

.numbertext {
    color: #fff;
    font-size: 12px;
    padding: 8px 12px;
    position: absolute;
    top: 0;
}
