/* TG Smart Gallery */

.tg-sg-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 240px;
    gap: 12px;
}

/* ── Items ── */
.tg-sg-item {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    cursor: pointer;
    display: block;
}

/* Portrait: span 2 rows */
.tg-sg-portrait {
    grid-row: span 2;
}

/* ── Image ── */
.tg-sg-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.tg-sg-zoom:hover img {
    transform: scale(1.06);
}

/* ── Hover overlay ── */
.tg-sg-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(14, 165, 233, 0);
    transition: background 0.25s ease;
    pointer-events: none;
    border-radius: inherit;
}

.tg-sg-item:hover::after {
    background: rgba(14, 165, 233, 0.18);
}

/* ── Zoom icon ── */
.tg-sg-zoom-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
    z-index: 2;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4));
}

.tg-sg-item:hover .tg-sg-zoom-icon {
    opacity: 1;
}

/* ══ Lightbox ══════════════════════════════════════════════════════════════ */

.tg-sg-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
}

.tg-sg-lightbox.tg-sg-lb-open {
    opacity: 1;
    pointer-events: auto;
}

.tg-sg-lb-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(4px);
    cursor: zoom-out;
}

.tg-sg-lb-img-wrap {
    position: relative;
    z-index: 1;
    max-width: min(90vw, 1200px);
    max-height: 88vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tg-sg-lb-img {
    max-width: 100%;
    max-height: 88vh;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.6);
    transition: opacity 0.15s ease;
}

.tg-sg-lb-img.tg-sg-lb-loading {
    opacity: 0;
}

/* Close / Prev / Next buttons */
.tg-sg-lb-close,
.tg-sg-lb-prev,
.tg-sg-lb-next {
    position: absolute;
    z-index: 2;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
    line-height: 1;
    backdrop-filter: blur(4px);
}

.tg-sg-lb-close:hover,
.tg-sg-lb-prev:hover,
.tg-sg-lb-next:hover {
    background: rgba(255, 255, 255, 0.28);
}

.tg-sg-lb-close {
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    font-size: 26px;
}

.tg-sg-lb-prev,
.tg-sg-lb-next {
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    font-size: 32px;
}

.tg-sg-lb-prev { left: 20px; }
.tg-sg-lb-next { right: 20px; }

.tg-sg-lb-prev:disabled,
.tg-sg-lb-next:disabled {
    opacity: 0.25;
    cursor: default;
}
