/* ── Recipe Image Gallery ────────────────────────────────────────────────── */

.delice-gallery {
    margin: 20px 0;
}

.delice-gallery-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
}

.delice-gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 6px;
    cursor: pointer;
    aspect-ratio: 1;
}

.delice-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    display: block;
}

.delice-gallery-item:hover img {
    transform: scale(1.05);
}

/* ── Lightbox ───────────────────────────────────────────────────────────── */

.delice-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9000;  /* modals tier */
    background: rgba(0, 0, 0, 0.9);
    align-items: center;
    justify-content: center;
}

.delice-lightbox.delice-lightbox-open {
    display: flex !important;
}

.delice-lightbox-img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 4px;
}

.delice-lightbox-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    font-size: 28px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.delice-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.delice-lightbox-prev,
.delice-lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    font-size: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.delice-lightbox-prev { left: 16px; }
.delice-lightbox-next { right: 16px; }

.delice-lightbox-prev:hover,
.delice-lightbox-next:hover {
    background: rgba(255, 255, 255, 0.3);
}

.delice-lightbox-counter {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
    .delice-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .delice-lightbox-prev,
    .delice-lightbox-next {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
}

/* ── Dark mode ──────────────────────────────────────────────────────────── */

@media (prefers-color-scheme: dark) {
    .delice-gallery-item {
        border: 1px solid var(--drm-border, #334155);
    }
}
