/* ============================================================
   STRAFOR PREMIUM GALLERY — frontend.css
   Modern Masonry/Grid and Ultra Premium Lightbox
============================================================ */

/* ── Gallery Grid ────────────────────────────────── */
.spg-gallery-wrapper {
    margin: 40px auto;
    width: 100%;
    max-width: 1400px;
    /* Adapts nicely but keeps layout controlled */
}

/* Marquee Mode Wrapper Enhancements */
.spg-gallery-wrapper.spg-marquee-mode {
    overflow: hidden;
    /* Prevent horizontal scroll on page */
    position: relative;
    /* Premium fade out effect on left and right edges */
    -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 5%, #000 95%, transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0%, #000 5%, #000 95%, transparent 100%);
}

/* ── Gallery Title (Category Name) ───────────────── */
.spg-gallery-title-wrap {
    text-align: center;
    margin-bottom: 35px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.spg-gallery-title {
    font-size: 32px;
    font-weight: 800;
    color: #1a1f2e;
    margin: 0 0 12px 0;
    letter-spacing: -0.02em;
    text-transform: capitalize;
}

.spg-title-divider {
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, var(--sph-accent, #e74c3c), #ff6b6b);
    border-radius: 4px;
    position: relative;
    box-shadow: 0 2px 10px rgba(231, 76, 60, 0.4);
}

.spg-title-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 1px;
    background: rgba(231, 76, 60, 0.2);
    z-index: -1;
}

/* Normal CSS Grid structure */
.spg-masonry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    grid-gap: 24px;
    align-items: start;
}

/* Marquee Mode: Flex container to create an infinite scrolling marquee */
.spg-marquee-mode .spg-masonry-grid {
    display: flex;
    gap: 24px;
    align-items: center;
    width: max-content;
    padding-right: 24px;
    /* Essential to match missing gap space perfectly */
    animation: spg-marquee 45s linear infinite;
}

.spg-marquee-mode .spg-masonry-grid:hover {
    animation-play-state: paused;
}

@keyframes spg-marquee {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-33.333333%);
    }

    /* Since we cloned the items twice (now 3 sets in total), we slide exactly 1/3 of the width to loop seamlessly */
}

/* Individual Grid Item */
.spg-grid-item {
    position: relative;
    border-radius: 16px;
    /* overflow: hidden; Removed so tooltips can float freely outside */
    cursor: pointer;
    background: #0d1117;
    /* Maintain a specific aspect ratio or allow natural sizes if you want true masonry 
       For uniform premium look, we'll use an aspect ratio wrapper. */
    aspect-ratio: 4/5;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1), box-shadow 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.spg-marquee-mode .spg-grid-item {
    flex: 0 0 320px;
    width: 320px;
}

.spg-grid-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.spg-item-inner {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    /* Moved border-radius here to clip zooming image cleanly */
}

/* The Thumbnail Image */
.spg-item-inner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.7s cubic-bezier(0.165, 0.84, 0.44, 1);
    background: #f1f5f9;
}

.spg-grid-item:hover .spg-item-inner img {
    transform: scale(1.08);
}

/* ── "No Lightbox" (Lookbook) Mode Overrides ── */
.spg-gallery-wrapper[data-lightbox="no"] .spg-grid-item {
    cursor: default;
}

.spg-gallery-wrapper[data-lightbox="no"] .spg-grid-item:hover {
    transform: translateY(0);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    /* Keeps default shadow securely */
}

.spg-gallery-wrapper[data-lightbox="no"] .spg-grid-item:hover .spg-item-inner img {
    transform: scale(1);
    /* No zoom effect */
}

/* Premium Hover Overlay - Glass Effect */
.spg-hover-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s ease;
    z-index: 2;
}

.spg-grid-item:hover .spg-hover-overlay {
    opacity: 1;
}

.spg-zoom-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transform: translateY(20px) scale(0.8);
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.spg-grid-item:hover .spg-zoom-icon {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.spg-zoom-icon svg {
    color: #fff;
}

/* ── Hotspot Pins and Tooltips ───────────────── */
.spg-hotspot-wrapper {
    position: absolute;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    z-index: 50;
    /* Elevated above item bounds */
}

/* Pin (Inner white circle) */
.spg-hotspot-dot {
    position: absolute;
    inset: 6px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
    transition: transform 0.3s ease;
    z-index: 2;
}

/* Pulsing rings (Sonar effect) */
.spg-hotspot-pulse {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.8);
    animation: spg-pulse-ring 2s infinite cubic-bezier(0.455, 0.03, 0.515, 0.955);
}

.spg-hotspot-wrapper:hover .spg-hotspot-dot {
    transform: scale(1.3);
}

@keyframes spg-pulse-ring {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }

    100% {
        transform: scale(2.5);
        opacity: 0;
    }
}

/* Floating Tooltip Card */
.spg-hotspot-tooltip {
    position: absolute;
    bottom: calc(100% + 15px);
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 12px;
    border-radius: 12px;
    width: 200px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
    z-index: 100;
}

/* Caret/Arrow below tooltip */
.spg-hotspot-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 8px;
    border-style: solid;
    border-color: rgba(15, 23, 42, 0.85) transparent transparent transparent;
}

/* Show tooltip on hover */
.spg-hotspot-wrapper:hover .spg-hotspot-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
    /* Allow clicking inside tooltip */
}

/* Tooltip Content */
.spg-hs-img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 10px;
    background: #000;
}

.spg-hs-title {
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 10px 0;
    line-height: 1.3;
}

.spg-hs-button {
    display: inline-block;
    background: var(--sph-accent, #3b82f6);
    color: #fff;
    text-decoration: none;
    padding: 6px 16px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    transition: background 0.2s, transform 0.2s;
}

.spg-hs-button:hover {
    background: var(--spf-accent-glow, #60a5fa);
    transform: scale(1.05);
}

/* ── ULTRA PREMIUM LIGHTBOX (MODAL) ────────────────────────────────── */
.spg-lightbox-modal {
    position: fixed;
    inset: 0;
    z-index: 9999999;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.45s ease, visibility 0.45s ease;
}

.spg-lightbox-modal.spg-active {
    opacity: 1;
    visibility: visible;
}

/* The wrapper that holds the image for scale animations */
.spg-lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(0.9);
    opacity: 0;
    transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.6s ease;
}

.spg-lightbox-modal.spg-active .spg-lightbox-content {
    transform: scale(1);
    opacity: 1;
}

/* Full resolution image inside the modal */
.spg-lightbox-img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
    /* No alt text / titles allowed here visually */
    user-select: none;
    -webkit-user-drag: none;
}

/* Loading Spinner inside modal */
.spg-lightbox-spinner {
    position: absolute;
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: #3b82f6;
    /* Accent color fallback */
    border-top-color: var(--sph-accent, #3b82f6);
    border-radius: 50%;
    animation: spg-spin 1s linear infinite;
    z-index: -1;
}

@keyframes spg-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Lightbox UI Controls ─────────────────────────────────── */
.spg-lightbox-close,
.spg-lightbox-prev,
.spg-lightbox-next {
    position: absolute;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
}

.spg-lightbox-close:hover,
.spg-lightbox-prev:hover,
.spg-lightbox-next:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.1);
}

.spg-lightbox-close {
    top: 25px;
    right: 30px;
    width: 50px;
    height: 50px;
}

.spg-lightbox-prev,
.spg-lightbox-next {
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
}

.spg-lightbox-prev {
    left: 30px;
}

.spg-lightbox-next {
    right: 30px;
}

/* Hide controls optionally when loading new image to prevent spam clicking */
.spg-lightbox-loading .spg-lightbox-img {
    opacity: 0 !important;
    /* Hide old image while loading new one */
}

/* Responsive Overrides */
@media (max-width: 768px) {
    .spg-masonry-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        grid-gap: 16px;
    }

    .spg-marquee-mode .spg-masonry-grid {
        gap: 16px;
        padding-right: 16px;
        display: flex;
    }

    .spg-marquee-mode .spg-grid-item {
        flex: 0 0 240px;
        width: 240px;
    }

    .spg-lightbox-close {
        top: 20px;
        right: 20px;
        width: 44px;
        height: 44px;
    }

    .spg-lightbox-prev,
    .spg-lightbox-next {
        width: 48px;
        height: 48px;
    }

    .spg-lightbox-prev {
        left: 15px;
    }

    .spg-lightbox-next {
        right: 15px;
    }

    .spg-lightbox-content {
        max-width: 100vw;
    }
}