/* ==========================================================================
   Fabsector Gallery — Auto-scrolling marquee + lightbox
   ========================================================================== */

/* ----- Marquee track ----- */
.gallery-marquee-wrap {
    position: relative;
    overflow: hidden;
}

.gallery-marquee-wrap::before,
.gallery-marquee-wrap::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 80px;
    z-index: 2;
    pointer-events: none;
}
.gallery-marquee-wrap::before {
    left: 0;
    background: linear-gradient(to right, #ffffff, transparent);
}
.gallery-marquee-wrap::after {
    right: 0;
    background: linear-gradient(to left, #ffffff, transparent);
}

.gallery-track {
    display: flex;
    gap: 16px;
    width: max-content;
    padding: 8px 0;
    animation: gallery-scroll 60s linear infinite;
}
.gallery-track:hover,
.gallery-track.paused {
    animation-play-state: paused;
}

@keyframes gallery-scroll {
    from { transform: translateX(0); }
    to   { transform: translateX(calc(-50% - 8px)); }
}

/* ----- Individual item ----- */
.gallery-item {
    position: relative;
    width: 240px;
    height: 180px;
    flex-shrink: 0;
    border-radius: 1rem;
    overflow: hidden;
    cursor: pointer;
    background: #0A2540;
    border: none;
    padding: 0;
    transition: transform 0.2s, box-shadow 0.2s;
}
.gallery-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(10, 37, 64, 0.15);
}
.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
    display: block;
}
.gallery-item:hover img {
    transform: scale(1.05);
}
.gallery-item .gallery-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(10, 37, 64, 0.8), transparent 55%);
}
.gallery-item .gallery-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    background: #FF4D00;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(255, 77, 0, 0.4);
    transition: transform 0.2s;
}
.gallery-item:hover .gallery-play {
    transform: translate(-50%, -50%) scale(1.1);
}
.gallery-item .gallery-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px;
    color: white;
    font-size: 12px;
    font-weight: 600;
    text-align: left;
}

/* ----- Lightbox (site-wide) ----- */
#gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.92);
    padding: 16px;
}
#gallery-lightbox.open {
    display: flex;
}
#gallery-lightbox .gallery-lb-content {
    position: relative;
    max-width: 1100px;
    width: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}
#gallery-lightbox .gallery-lb-media {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
#gallery-lightbox .gallery-lb-media img,
#gallery-lightbox .gallery-lb-media video {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    object-fit: contain;
}
#gallery-lightbox .gallery-lb-caption {
    color: white;
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
}
#gallery-lightbox .gallery-lb-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s;
    z-index: 1;
}
#gallery-lightbox .gallery-lb-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ----- Accessibility: reduced motion ----- */
@media (prefers-reduced-motion: reduce) {
    .gallery-track { animation: none; }
    .gallery-item, .gallery-item img, .gallery-item .gallery-play { transition: none; }
}
