/* EMM gallery — frontend grid and lightbox */

.emm-gallery {
    margin: 32px 0 16px;
}

.emm-gallery__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
}

.emm-gallery__item {
    display: block;
    overflow: hidden;
    border-radius: 6px;
    background: #f3f4f6;
    line-height: 0;
}

.emm-gallery__img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    transition: transform 0.25s ease;
    display: block;
}

.emm-gallery__item:hover .emm-gallery__img {
    transform: scale(1.03);
}

/* Lightbox */
.emm-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
}

.emm-lightbox.is-open {
    display: flex;
}

.emm-lightbox__figure {
    margin: 0;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.emm-lightbox__img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}

.emm-lightbox__caption {
    color: #e5e7eb;
    font-size: 0.9rem;
    margin-top: 12px;
    text-align: center;
    max-width: 800px;
}

.emm-lightbox__close,
.emm-lightbox__nav {
    position: absolute;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: 0;
    cursor: pointer;
    font-size: 1.4rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.emm-lightbox__close:hover,
.emm-lightbox__nav:hover {
    background: rgba(255, 255, 255, 0.2);
}

.emm-lightbox__close {
    top: 20px;
    right: 20px;
}

.emm-lightbox__nav--prev { left: 20px;  top: 50%; transform: translateY(-50%); }
.emm-lightbox__nav--next { right: 20px; top: 50%; transform: translateY(-50%); }

@media (max-width: 600px) {
    .emm-gallery__img { height: 130px; }
    .emm-lightbox__close { top: 12px; right: 12px; }
    .emm-lightbox__nav--prev { left: 8px; }
    .emm-lightbox__nav--next { right: 8px; }
}

/* Admin sortable placeholder */
.emm-gallery-placeholder {
    border: 2px dashed #b7c4d2 !important;
    background: #f0f5fa !important;
    border-radius: 4px;
    height: 100px;
}
