/**
 * Gallery Styles - RS Aquatics
 * Desktop: 4x4 Grid | Mobile: Carousel | Click to Expand
 */

/* ==========================================================================
   Gallery Section Container
   ========================================================================== */

.gallery-section {
    position: relative;
    padding: 6rem 0;
    background-color: #111118;
}

.gallery-section .section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.gallery-section .section-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: rgba(0, 229, 255, 0.1);
    border: 1px solid rgba(0, 229, 255, 0.3);
    border-radius: 9999px;
    color: #00e5ff;
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.gallery-section .section-title {
    font-family: 'Poppins', sans-serif;
    font-size: 2.25rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 1rem;
}

.gallery-section .section-description {
    color: #9ca3af;
    max-width: 42rem;
    margin: 0 auto;
}

/* ==========================================================================
   Skeleton Loading State
   ========================================================================== */

.gallery-skeleton-wrapper {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.gallery-skeleton-wrapper.hidden {
    display: none !important;
}

.gallery-skeleton-item {
    aspect-ratio: 1;
    background: linear-gradient(90deg, #1a1a24 25%, #252532 50%, #1a1a24 75%);
    background-size: 200% 100%;
    border-radius: 0.75rem;
    animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ==========================================================================
   Desktop Grid Layout (4x4)
   ========================================================================== */

.gallery-grid-desktop {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.gallery-grid-desktop.hidden {
    display: none !important;
}

.gallery-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 0.75rem;
    overflow: hidden;
    cursor: pointer;
    background: #1a1a24;
    transition: all 0.3s ease;
}

.gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 229, 255, 0.15);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.gallery-item:hover img {
    transform: scale(1.1);
}

/* Hover Overlay */
.gallery-item .gallery-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0) 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.gallery-item .gallery-icon {
    width: 3rem;
    height: 3rem;
    background: rgba(0, 229, 255, 0.2);
    border: 2px solid #00e5ff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #00e5ff;
    font-size: 1.25rem;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.gallery-item:hover .gallery-icon {
    transform: translateY(0);
}

/* ==========================================================================
   Mobile Carousel Layout
   ========================================================================== */

.gallery-carousel-mobile {
    display: none;
}

.gallery-carousel-mobile .gallery-item {
    padding: 0 0.5rem;
}

.gallery-carousel-mobile .gallery-item > div {
    aspect-ratio: 1;
    border-radius: 0.75rem;
    overflow: hidden;
    position: relative;
}

.gallery-carousel-mobile .gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Slick Carousel Customization */
.gallery-carousel-mobile .slick-list {
    margin: 0 -0.5rem;
}

.gallery-carousel-mobile .slick-prev,
.gallery-carousel-mobile .slick-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 40px;
    height: 40px;
    background: rgba(0, 229, 255, 0.1);
    border: 2px solid #00e5ff;
    border-radius: 50%;
    color: #00e5ff;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-carousel-mobile .slick-prev:hover,
.gallery-carousel-mobile .slick-next:hover {
    background: rgba(0, 229, 255, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.gallery-carousel-mobile .slick-prev {
    left: -10px;
}

.gallery-carousel-mobile .slick-next {
    right: -10px;
}

.gallery-carousel-mobile .slick-prev::before,
.gallery-carousel-mobile .slick-next::before {
    display: none;
}

.gallery-carousel-mobile .slick-dots {
    bottom: -35px;
}

.gallery-carousel-mobile .slick-dots li {
    margin: 0 4px;
}

.gallery-carousel-mobile .slick-dots li button {
    width: 10px;
    height: 10px;
    background: rgba(0, 229, 255, 0.3);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.gallery-carousel-mobile .slick-dots li button::before {
    display: none;
}

.gallery-carousel-mobile .slick-dots li.slick-active button {
    background: #00e5ff;
    transform: scale(1.2);
}

/* ==========================================================================
   Lightbox Styles
   ========================================================================== */

.gallery-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 15, 0.98);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.gallery-lightbox.active {
    display: flex;
}

.gallery-lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-lightbox img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* Close Button */
.gallery-lightbox-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 48px;
    height: 48px;
    background: rgba(0, 229, 255, 0.1);
    border: 2px solid rgba(0, 229, 255, 0.3);
    border-radius: 50%;
    color: #00e5ff;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.gallery-lightbox-close:hover {
    background: rgba(0, 229, 255, 0.2);
    border-color: #00e5ff;
    transform: scale(1.1);
}

/* Navigation Arrows in Lightbox */
.gallery-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    background: rgba(0, 229, 255, 0.1);
    border: 2px solid rgba(0, 229, 255, 0.3);
    border-radius: 50%;
    color: #00e5ff;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.gallery-lightbox-nav:hover {
    background: rgba(0, 229, 255, 0.2);
    border-color: #00e5ff;
    transform: translateY(-50%) scale(1.1);
}

.gallery-lightbox-nav.prev {
    left: 1.5rem;
}

.gallery-lightbox-nav.next {
    right: 1.5rem;
}

/* Image Counter */
.gallery-lightbox-counter {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 1.5rem;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 9999px;
    color: #fff;
    font-size: 0.875rem;
    font-weight: 500;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

/* Tablet (768px - 1023px) */
@media (max-width: 1023px) {
    .gallery-grid-desktop {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .gallery-skeleton-wrapper {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Mobile (below 768px) - Switch to Carousel */
@media (max-width: 767px) {
    .gallery-grid-desktop {
        display: none !important;
    }
    
    .gallery-skeleton-wrapper {
        display: none !important;
    }
    
    .gallery-carousel-mobile {
        display: block;
    }
    
    .gallery-section .section-title {
        font-size: 1.75rem;
    }
    
    .gallery-lightbox {
        padding: 1rem;
    }
    
    .gallery-lightbox-nav {
        width: 44px;
        height: 44px;
        font-size: 1rem;
    }
    
    .gallery-lightbox-nav.prev {
        left: 0.5rem;
    }
    
    .gallery-lightbox-nav.next {
        right: 0.5rem;
    }
    
    .gallery-lightbox-close {
        top: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
    }
}

/* Extra Small (below 412px) */
@media (max-width: 411px) {
    .gallery-section {
        padding: 4rem 0;
    }
    
    .gallery-section .section-title {
        font-size: 1.5rem;
    }
    
    .gallery-carousel-mobile .gallery-item {
        padding: 0 0.25rem;
    }
    
    .gallery-carousel-mobile .slick-list {
        margin: 0 -0.25rem;
    }
}

/* ==========================================================================
   Animation Keyframes
   ========================================================================== */

@keyframes gallery-fade-in {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.gallery-lightbox.active .gallery-lightbox-content {
    animation: gallery-fade-in 0.3s ease;
}

/* ==========================================================================
   Accessibility & Focus States
   ========================================================================== */

.gallery-item:focus,
.gallery-lightbox-close:focus,
.gallery-lightbox-nav:focus {
    outline: 2px solid #00e5ff;
    outline-offset: 2px;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .gallery-item,
    .gallery-item img,
    .gallery-overlay,
    .gallery-icon,
    .gallery-lightbox-close,
    .gallery-lightbox-nav {
        transition: none !important;
        animation: none !important;
    }
}
