/* Grid Gallery CSS - Gallery Lightbox Implementation */

/* Gallery Block Base Styles */
.gallery-block {
    padding: 20px 0;
}

.gallery-block .item {
    margin-bottom: 20px;
    padding: 5px;
}

.gallery-block .item img {
    border-radius: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
    width: 100%;
    height: auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.gallery-block .item img:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

/* Scale on hover effect for gallery items */
.scale-on-hover {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.scale-on-hover:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Remove default link underlines and borders */
.gallery-block .lightbox {
    text-decoration: none;
    border: none;
    outline: none;
    display: block;
}

.gallery-block .lightbox:hover,
.gallery-block .lightbox:focus {
    text-decoration: none;
    border: none;
    outline: none;
}

/* Grid layout improvements */
.gallery-block .row {
    margin-left: -5px;
    margin-right: -5px;
}

.gallery-block .col-6,
.gallery-block .col-12,
.gallery-block [class*="col-"] {
    padding-left: 5px;
    padding-right: 5px;
}

/* Responsive adjustments */
@media (max-width: 576px) {
    .gallery-block .item {
        margin-bottom: 15px;
    }

    .gallery-block .item img:hover {
        transform: scale(1.02);
    }
}

@media (min-width: 768px) {
    .gallery-block {
        padding: 30px 0;
    }
}

/* BaguetteBox Override Styles */
/* These styles ensure baguetteBox lightbox displays properly */

#baguetteBox-overlay {
    display: none;
    opacity: 0;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1000000;
    cursor: zoom-out;
    transition: opacity 0.3s ease;
}

#baguetteBox-overlay.visible {
    opacity: 1;
}

#baguetteBox-slider {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    direction: ltr;
}

.baguetteBox-button {
    position: absolute;
    top: 50%;
    width: 44px;
    height: 60px;
    margin-top: -30px;
    background-color: rgba(0, 0, 0, 0.5);
    background-position: center;
    background-repeat: no-repeat;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    outline: none;
    padding: 0;
    transition: background-color 0.2s ease;
    z-index: 1000001;
}

.baguetteBox-button:hover {
    background-color: rgba(0, 0, 0, 0.7);
}

.baguetteBox-button#previous-button {
    left: 20px;
    background-image: url("data:image/svg+xml;charset=utf8,%3csvg xmlns='http://www.w3.org/2000/svg' fill='white' viewBox='0 0 24 24'%3e%3cpath d='M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z'/%3e%3c/svg%3e");
}

.baguetteBox-button#next-button {
    right: 20px;
    background-image: url("data:image/svg+xml;charset=utf8,%3csvg xmlns='http://www.w3.org/2000/svg' fill='white' viewBox='0 0 24 24'%3e%3cpath d='M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z'/%3e%3c/svg%3e");
}

.baguetteBox-button#close-button {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 30px;
    height: 30px;
    margin-top: 0;
    background-color: rgba(0, 0, 0, 0.5);
    background-image: url("data:image/svg+xml;charset=utf8,%3csvg xmlns='http://www.w3.org/2000/svg' fill='white' viewBox='0 0 24 24'%3e%3cpath d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/%3e%3c/svg%3e");
    border-radius: 50%;
}

.baguetteBox-figure {
    position: absolute;
    top: 50%;
    left: 50%;
    width: auto;
    height: auto;
    max-width: 90%;
    max-height: 90%;
    margin: 0;
    transform: translate(-50%, -50%);
    cursor: zoom-out;
}

.baguetteBox-image {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    vertical-align: top;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.baguetteBox-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    text-align: center;
    font-family: 'Roboto', sans-serif;
    font-size: 16px;
    color: #ccc;
    background-color: rgba(0, 0, 0, 0.6);
    padding: 12px;
    border-radius: 0 0 4px 4px;
}

/* Mobile responsive adjustments for lightbox */
@media (max-width: 768px) {

    .baguetteBox-button#previous-button,
    .baguetteBox-button#next-button {
        width: 35px;
        height: 50px;
        margin-top: -25px;
    }

    .baguetteBox-button#previous-button {
        left: 10px;
    }

    .baguetteBox-button#next-button {
        right: 10px;
    }

    .baguetteBox-button#close-button {
        top: 10px;
        right: 10px;
        width: 25px;
        height: 25px;
    }

    .baguetteBox-figure {
        max-width: 95%;
        max-height: 95%;
    }

    .baguetteBox-caption {
        font-size: 14px;
        padding: 8px;
    }
}

/* Keyboard navigation styles */
.baguetteBox-button:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Loading spinner */
.baguetteBox-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: baguetteBox-spin 1s linear infinite;
}

@keyframes baguetteBox-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Ensure images in thumbnails maintain aspect ratio */
.gallery-block .img-thumbnail {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 4px;
    background-color: #fff;
    transition: all 0.2s ease-in-out;
}

.gallery-block .img-thumbnail:hover {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Additional lightbox improvements */
.baguetteBox-button {
    opacity: 0.8;
}

.baguetteBox-button:hover {
    opacity: 1;
}

/* Smooth transitions */
#baguetteBox-overlay {
    transition: opacity 0.3s ease;
}

.baguetteBox-figure {
    transition: transform 0.3s ease;
}

/* Touch device improvements */
@media (pointer: coarse) {
    .baguetteBox-button {
        width: 50px;
        height: 70px;
        margin-top: -35px;
    }

    .baguetteBox-button#close-button {
        width: 35px;
        height: 35px;
        margin-top: 0;
    }
}