/* ------------------------------
   GALLERY LAYOUT
   Stable grid with JS masonry support
------------------------------ */

.gallery_wrapper {
    max-width: 1200px;
    margin: 40px auto;
    padding: 20px;

    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    align-items: start;
}

/* Added by masonry.js once images have loaded */
.gallery_wrapper.masonry-layout {
    grid-auto-rows: 10px;
    grid-auto-flow: row dense;
}

.gallery_wrapper > a {
    position: relative;
    display: block;
    min-width: 0;
    margin: 0;
    overflow: hidden;
    text-decoration: none;
}

.gallery_wrapper img {
    width: 100%;
    height: auto;
    display: block;

    border: none;
    outline: none;
    box-shadow: none;

    transition: transform 0.3s ease;
}

/* Purple hover overlay */

.gallery_wrapper > a::after {
    content: "";
    position: absolute;
    inset: 0;

    background-color: rgba(128, 65, 219, 0.48);

    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1;
}

.gallery_wrapper > a > img {
    position: relative;
    z-index: 0;
}

.gallery_wrapper .image-link-title {
    z-index: 2;
}

.gallery_wrapper > a:hover img {
    transform: scale(1.03);
    filter: none;
}

.gallery_wrapper > a:hover::after {
    opacity: 1;
}


/* ------------------------------
   RESPONSIVE GALLERY COLUMNS
------------------------------ */

@media (max-width: 900px) {
    .gallery_wrapper {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

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


/* ------------------------------
   MODAL / LIGHTBOX
------------------------------ */

.modal {
    position: fixed;
    inset: 0;

    background: rgba(0, 0, 0, 0.85);

    display: none;
    align-items: center;
    justify-content: center;

    z-index: 1000;
    padding: 40px;
}

.modal:target {
    display: flex;
}

.modal img {
    width: auto;
    height: auto;

    max-width: 90vw;
    max-height: 85vh;

    object-fit: contain;

    border: none;
    outline: none;
    box-shadow: none;
}

.close {
    position: absolute;
    top: 20px;
    right: 30px;

    z-index: 1001;

    color: white;
    -webkit-text-fill-color: white;

    text-decoration: none;

    font-family: Arial, sans-serif;
    font-size: 48px;
    line-height: 1;
}

.close:hover {
    color: #fff894;
    -webkit-text-fill-color: #fff894;
}