/* ═══ JUSTIFIED GALLERY ═══ */
.jg-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    padding: 20px 0;
    /* Show exactly 2 rows: 2 * 220px + 1 gap (8px) */
    max-height: 448px;
    overflow: hidden;
    box-sizing: border-box;
}

/* prevent last incomplete row from stretching */
.jg-gallery::after {
    content: '';
    flex-grow: 999;
}

/* ── Item ── */
.jg-item {
    position: relative;
    height: 220px;
    min-width: 80px;
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    animation: jgIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes jgIn {
    from { opacity: 0; transform: translateY(16px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.jg-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), filter 0.35s ease;
    will-change: transform;
}

.jg-item:hover img {
    transform: scale(1.05);
    filter: brightness(1.06);
}

/* ── Shine sweep ── */
.jg-shine {
    position: absolute;
    top: 0; left: -75%;
    width: 50%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.18), transparent);
    transform: skewX(-20deg);
    transition: none;
    pointer-events: none;
}
.jg-item:hover .jg-shine {
    animation: shineSwipe 0.65s ease forwards;
}
@keyframes shineSwipe {
    to { left: 125%; }
}

/* ── Overlay with label ── */
.jg-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, rgba(0,18,36,0.72) 0%, transparent 55%);
    display: flex;
    align-items: flex-end;
    padding: 14px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.jg-item:hover .jg-overlay {
    opacity: 1;
}

.jg-label {
    font-family: 'Mardoto-Medium', sans-serif;
    font-size: 13px;
    color: #fff;
    line-height: 1.35;
    text-shadow: 0 1px 4px rgba(0,0,0,0.45);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ═══ Responsive ═══ */
@media (max-width: 1200px) {
    .jg-item {
        height: 190px;
    }
    .jg-gallery {
        max-height: 388px; /* 2 * 190 + 8 */
    }
}

@media (max-width: 767px) {
    .jg-gallery {
        gap: 6px;
        max-height: 306px; /* 2 * 150 + 6 */
    }
    .jg-item {
        height: 150px;
        border-radius: 12px;
        min-width: 60px;
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .jg-gallery {
        gap: 4px;
        max-height: 244px; /* 2 * 120 + 4 */
    }
    .jg-item {
        height: 120px;
        border-radius: 10px;
        min-width: 50px;
    }
    .jg-overlay { padding: 8px; }
    .jg-label { font-size: 11px; }
}