/* --- Gallery Page Styles --- */

/* Filter Buttons */
.filter-buttons {
    margin-bottom: 2rem;
}

.filter-buttons .btn {
    margin: 5px;
    border-radius: 20px;
    padding: 8px 20px;
    transition: all 0.3s ease;
    font-weight: 500;
    border-width: 2px;
}

.filter-buttons .btn.active {
    background-color: #800080; /* Your primary color */
    color: #fff;
    border-color: #800080;
}

.filter-buttons .btn:not(.active):hover {
    background-color: #f0e6f0;
}

/* Gallery Grid */
.gallery-grid {
    margin: 0 -10px; /* Gutter compensation */
    /* Hide grid initially to prevent FOUC. JS will reveal it. */
    opacity: 0;
    transition: opacity 0.6s ease-in-out;
}

.gallery-grid:after {
    content: '';
    display: block;
    clear: both;
}

.gallery-item {
    width: calc(33.333% - 20px); /* 3 columns with gutters */
    margin: 10px;
    float: left;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(128, 0, 128, 0.2);
}

.gallery-item a {
    display: block;
    position: relative;
}

.gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.4s ease;
}

.gallery-item:hover img {
    transform: scale(1.1);
}

.gallery-item .overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(128, 0, 128, 0.7); /* Primary color overlay */
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.4s ease;
    text-align: center;
    padding: 20px;
}

.gallery-item:hover .overlay {
    opacity: 1;
}

.overlay h5 {
    margin-top: 10px;
    font-weight: bold;
    color: #fff;
}

/* Responsive adjustments */
@media (max-width: 991px) {
    .gallery-item {
        width: calc(50% - 20px); /* 2 columns */
    }
}

@media (max-width: 767px) {
    .gallery-item {
        width: calc(100% - 20px); /* 1 column */
    }
}

/* --- Fancybox Lightbox Customization --- */

/* Style the caption container to be an overlay */
.fancybox__caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 5rem 2.5rem 2.5rem; /* Increased padding for larger text */
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0) 100%);
    color: #fff;
    text-align: left;
    pointer-events: none; /* Allows clicking through the caption to the image */
    max-width: 100%;
    box-sizing: border-box;
}

/* Style the caption title */
.fancybox__caption h3 {
    font-size: 2.4rem; /* Further increased font size for the title */
    font-weight: 700; /* Bolder */
    color: #fff; /* Explicitly set title color to white */
    margin: 0 0 0.5rem 0;
    text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.9);
}

/* Style the caption description */
.fancybox__caption p {
    font-size: 1.3rem; /* Further increased font size for the description */
    margin: 0;
    line-height: 1.6;
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.9);
}