@charset "UTF-8";

/**
 * Modern Gallery Component
 * 
 * Purpose: Modern, responsive image gallery display
 * Features:
 * - Responsive grid layout
 * - Hover effects
 * - Lightbox-ready structure
 * - 100% responsive
 * 
 * @version 1.0.0
 * @date 2026-01-25
 */

/* ============================================================
   GALLERY SECTION
   ============================================================ */

.nx-gallery-section {
    padding: 4rem 0;
    background: #fafafa;
    position: relative;
}

.nx-gallery-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Gallery section title: home-section-unified.modern.css */

/* ============================================================
   GALLERY GRID
   ============================================================ */

.nx-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    width: 100%;
}

@media (max-width: 991px) {
    .nx-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 1.25rem;
    }
}

@media (max-width: 768px) {
    .nx-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
    }
}

@media (max-width: 576px) {
    .nx-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
}

/* ============================================================
   GALLERY ITEM
   ============================================================ */

.nx-gallery-item {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08),
                0 0 0 1px rgba(0, 0, 0, 0.04);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: pointer;
}

.nx-gallery-item:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15),
                0 4px 12px rgba(0, 0, 0, 0.1);
}

.nx-gallery-link {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

/* ============================================================
   GALLERY IMAGE
   ============================================================ */

.nx-gallery-image-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #f5f5f7;
}

.nx-gallery-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                filter 0.4s ease;
    filter: brightness(1) contrast(1);
}

.nx-gallery-item:hover .nx-gallery-image {
    transform: scale(1.1);
    filter: brightness(1.05) contrast(1.05);
}

/* ============================================================
   GALLERY OVERLAY
   ============================================================ */

.nx-gallery-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0) 0%,
        rgba(0, 0, 0, 0.3) 100%
    );
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    pointer-events: none;
    z-index: 2;
}

.nx-gallery-item:hover .nx-gallery-overlay {
    opacity: 1;
}

.nx-gallery-icon {
    width: 48px;
    height: 48px;
    color: #ffffff;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
    transform: scale(0.8);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nx-gallery-item:hover .nx-gallery-icon {
    transform: scale(1);
}

/* ============================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================ */

@media (max-width: 576px) {
    .nx-gallery-item {
        border-radius: 12px;
    }
    
    .nx-gallery-icon {
        width: 36px;
        height: 36px;
    }
}

/* ============================================================
   LOADING STATE
   ============================================================ */

.nx-gallery-image.lazyload {
    opacity: 0;
    transition: opacity 0.4s ease;
}

.nx-gallery-image.lazyloaded {
    opacity: 1;
}

/* ============================================================
   ANIMATION
   ============================================================ */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.nx-gallery-item {
    animation: fadeInUp 0.6s ease-out forwards;
    opacity: 0;
}

.nx-gallery-item:nth-child(1) { animation-delay: 0.1s; }
.nx-gallery-item:nth-child(2) { animation-delay: 0.2s; }
.nx-gallery-item:nth-child(3) { animation-delay: 0.3s; }
.nx-gallery-item:nth-child(4) { animation-delay: 0.4s; }
.nx-gallery-item:nth-child(5) { animation-delay: 0.5s; }
.nx-gallery-item:nth-child(6) { animation-delay: 0.6s; }
.nx-gallery-item:nth-child(n+7) { animation-delay: 0.7s; }

/* ============================================================
   SMALL DEVICES: touch horizontal scroll + scroll-snap
   (same idea as .nx-settings-banner-row.nx-banner-count-3)
   ============================================================ */

@media (max-width: 767px) {
    .nx-gallery-grid {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        grid-template-columns: unset;
        gap: 0.75rem;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        scroll-padding-inline: 0.5rem;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-x;
        padding: 0 0.25rem;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .nx-gallery-grid::-webkit-scrollbar {
        display: none;
    }

    .nx-gallery-grid .nx-gallery-item {
        flex: 0 0 85%;
        min-width: 85%;
        max-width: 85%;
        scroll-snap-align: start;
        scroll-snap-stop: always;
    }
}

@media (max-width: 576px) {
    .nx-gallery-grid .nx-gallery-item {
        flex: 0 0 88%;
        min-width: 88%;
        max-width: 88%;
    }
}

@media (max-width: 360px) {
    .nx-gallery-grid .nx-gallery-item {
        flex: 0 0 90%;
        min-width: 90%;
        max-width: 90%;
    }
}
