/* ═══════════════════════════════════════════
   GALLERY + LIGHTBOX — Homeland Bodrum
   ═══════════════════════════════════════════ */

/* Gallery Grid */
.gallery-grid {
    display: grid;
    gap: 4px;
    border-radius: 16px;
    overflow: hidden;
}
.gallery-grid--multi {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}
.gallery-grid--multi .gallery-item:first-child {
    grid-row: 1 / -1;
}
@media (max-width: 767px) {
    .gallery-grid--multi {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }
    .gallery-grid--multi .gallery-item:first-child {
        grid-row: auto;
    }
    .gallery-grid--multi .gallery-item:nth-child(n+3) {
        display: none;
    }
}
.gallery-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    background: #f1f5f9;
}
.gallery-item img,
.gallery-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}
.gallery-item:hover img,
.gallery-item:hover video {
    transform: scale(1.05);
}
.gallery-item .play-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.gallery-item .play-icon svg {
    width: 48px;
    height: 48px;
    fill: white;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.4));
    transition: transform 0.3s;
}
.gallery-item:hover .play-icon svg {
    transform: scale(1.1);
}
.gallery-more-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    font-weight: 700;
    backdrop-filter: blur(2px);
    pointer-events: none;
}

/* Thumbnails Strip (mobile) */
.gallery-thumbs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 8px 0;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}
.gallery-thumbs::-webkit-scrollbar { height: 0; }
.gallery-thumb {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    scroll-snap-align: start;
    transition: border-color 0.2s;
}
.gallery-thumb.active,
.gallery-thumb:hover {
    border-color: var(--brand-500, #1A45B6);
}
.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.gallery-thumb--video {
    position: relative;
}
.gallery-thumb--video::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}
.gallery-thumb--video::before {
    content: '▶';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
    z-index: 2;
}

/* ═══ LIGHTBOX ═══ */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0,0,0,0.95);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}
.lightbox.active {
    display: flex;
    opacity: 1;
}
.lightbox-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
    backdrop-filter: blur(8px);
    transition: background 0.2s;
}
.lightbox-close:hover { background: rgba(255,255,255,0.2); }

.lightbox-counter {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.7);
    font-size: 14px;
    font-weight: 600;
    z-index: 10;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 20px;
    cursor: pointer;
    z-index: 10;
    backdrop-filter: blur(8px);
    transition: background 0.2s, transform 0.2s;
}
.lightbox-nav:hover { background: rgba(255,255,255,0.25); transform: translateY(-50%) scale(1.1); }
.lightbox-nav--prev { left: 16px; }
.lightbox-nav--next { right: 16px; }

.lightbox-content {
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.lightbox-content img {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    user-select: none;
    -webkit-user-drag: none;
    transition: transform 0.3s ease;
}
.lightbox-content video {
    max-width: 90vw;
    max-height: 80vh;
    border-radius: 8px;
    background: #000;
}
.lightbox-content .slide {
    display: none;
    animation: lbFadeIn 0.3s ease;
}
.lightbox-content .slide.active {
    display: flex;
    align-items: center;
    justify-content: center;
}
@keyframes lbFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* Lightbox thumbnails */
.lightbox-thumbs {
    display: flex;
    gap: 6px;
    margin-top: 16px;
    overflow-x: auto;
    max-width: 90vw;
    padding: 4px 0;
}
.lightbox-thumbs::-webkit-scrollbar { height: 4px; }
.lightbox-thumbs::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.3); border-radius: 4px; }
.lightbox-thumb {
    flex-shrink: 0;
    width: 56px;
    height: 42px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    opacity: 0.5;
    transition: opacity 0.2s, border-color 0.2s;
}
.lightbox-thumb.active,
.lightbox-thumb:hover {
    opacity: 1;
    border-color: white;
}
.lightbox-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Zoom support */
.lightbox-content img.zoomed {
    cursor: grab;
    max-width: none;
    max-height: none;
}
.lightbox-content img.zoomed:active {
    cursor: grabbing;
}

/* Touch swipe hint */
@media (max-width: 767px) {
    .lightbox-nav { display: none; }
    .lightbox-content {
        max-width: 100vw;
        max-height: 85vh;
    }
    .lightbox-content img {
        max-width: 100vw;
    }
    .lightbox-close {
        top: env(safe-area-inset-top, 12px);
        right: 12px;
    }
}
