/* Gallery wrapper */
.myndir-gallery-wrap {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}


/* Gallery grid */
.myndir-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(3, calc((100% - 24px) / 3));
}


/* 1 column */
.myndir-grid.myndir-col-1 {
    grid-template-columns: repeat(1, 100%);
}


/* 2 columns */
.myndir-grid.myndir-col-2 {
    grid-template-columns: repeat(2, calc((100% - 12px) / 2));
}


/* 3 columns */
.myndir-grid.myndir-col-3 {
    grid-template-columns: repeat(3, calc((100% - 24px) / 3));
}


/* 4 columns */
.myndir-grid.myndir-col-4 {
    grid-template-columns: repeat(4, calc((100% - 36px) / 4));
}


/* Gallery item */
.myndir-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    border-radius: 4px;
    background: #111;
    aspect-ratio: 4 / 3;
}


/* Gallery image */
.myndir-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease, opacity 0.3s ease;
}


/* Gallery image hover */
.myndir-item:hover img {
    transform: scale(1.05);
    opacity: 0.85;
}


/* Gallery overlay */
.myndir-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
    background: rgba(0, 0, 0, 0.25);
}


/* Gallery overlay hover */
.myndir-item:hover .myndir-overlay {
    opacity: 1;
}


/* Lightbox */
.myndir-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}


/* Lightbox overlay */
.myndir-lightbox-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    cursor: pointer;
}


/* Lightbox inner */
.myndir-lightbox-inner {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 1200px;
    padding: 20px 60px;
    box-sizing: border-box;
}


/* Lightbox image wrapper */
.myndir-lb-img-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: 85vh;
}


/* Lightbox image */
.myndir-lb-img {
    max-width: 100%;
    max-height: 85vh;
    width: auto;
    height: auto;
    display: block;
    border-radius: 4px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
    transition: opacity 0.2s ease;
    object-fit: contain;
}


/* Lightbox image loading */
.myndir-lb-img.loading {
    opacity: 0.3;
}


/* Lightbox previous and next buttons */
.myndir-lb-prev,
.myndir-lb-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #fff;
    font-size: 42px;
    line-height: 1;
    padding: 6px 14px 10px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
    z-index: 2;
    user-select: none;
}


/* Previous button */
.myndir-lb-prev {
    left: 12px;
}


/* Next button */
.myndir-lb-next {
    right: 12px;
}


/* Previous and next button hover */
.myndir-lb-prev:hover,
.myndir-lb-next:hover {
    background: rgba(255, 255, 255, 0.25);
}


/* Lightbox close button */
.myndir-lb-close {
    position: absolute;
    top: 14px;
    right: 14px;
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #fff;
    font-size: 28px;
    line-height: 1;
    padding: 4px 10px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
    z-index: 3;
}


/* Close button hover */
.myndir-lb-close:hover {
    background: rgba(255, 255, 255, 0.28);
}


/* Lightbox counter */
.myndir-lb-counter {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.75);
    font-size: 14px;
    font-family: sans-serif;
    white-space: nowrap;
    letter-spacing: 0.04em;
}


/* No posts message */
.myndir-no-posts {
    text-align: center;
    color: #888;
    padding: 40px 0;
}


/* Tablet / mobile */
@media (max-width: 768px) {

    .myndir-grid.myndir-col-3,
    .myndir-grid.myndir-col-4 {
        grid-template-columns: repeat(2, calc((100% - 12px) / 2));
    }

    .myndir-lightbox-inner {
        padding: 10px 44px;
    }

    .myndir-lb-prev {
        left: 4px;
        font-size: 32px;
    }

    .myndir-lb-next {
        right: 4px;
        font-size: 32px;
    }

}


/* Small mobile */
@media (max-width: 480px) {

    .myndir-grid,
    .myndir-grid.myndir-col-2,
    .myndir-grid.myndir-col-3,
    .myndir-grid.myndir-col-4 {
        grid-template-columns: 100%;
    }

}