/* Gallery Page Styles */

/* Gallery page navbar customization */
#navbar {
    position: absolute;
    box-shadow: none;
    border: none;
    border-bottom: none;
    background-image: none;
}

#navbar .nav-container {
    justify-content: space-between;
    box-shadow: none;
    border: none;
    background: none;
}

#navbar .logo {
    display: block;
    margin-left: 2rem;
    line-height: 1;
}

/* Ensure nav links are same size as main page */
#navbar .nav-links {
    align-self: center;
}

#navbar .nav-links a {
    font-size: 0.9rem;
    line-height: 1;
}

.gallery-section {
    min-height: 100vh;
    padding-top: 160px;
    padding-bottom: 30px;
    background-color: #000000;
}

.gallery-container {
    max-width: 100%;
    margin: 0;
    padding: 0 4.5%;
}

.gallery-container h1 {
    font-size: 3rem;
    font-weight: 200;
    letter-spacing: 4px;
    margin-bottom: 1rem;
    text-align: center;
    color: #ffffff;
    text-transform: uppercase;
}

.gallery-intro {
    text-align: center;
    font-size: 1.2rem;
    color: #cccccc;
    margin-bottom: 4rem;
    font-weight: 300;
}

.gallery-tagline {
    text-align: left;
    font-size: 1.1rem;
    color: #ffffff;
    font-weight: 400;
    letter-spacing: 0.5px;
    line-height: 1.8;
    margin-top: -75px;
    margin-bottom: 32px;
}

.tagline-indent {
    padding-left: 6rem;
}

.tagline-indent-sm {
    padding-left: 10.5rem;
}

/* Grid Gallery Layout */
.masonry-gallery {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-auto-rows: 10px;
    grid-auto-flow: dense;
    gap: 12px;
}

.gallery-item {
    grid-row: span 15;
    position: relative;
    overflow: hidden;
    border-radius: 0;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background-color: #1a1a1a;
}

.gallery-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(74, 158, 255, 0.3);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease, opacity 0.4s ease;
    opacity: 0;
}

.gallery-item img.loaded {
    opacity: 1;
}

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

/* Placeholder for demonstration */
.placeholder-gallery {
    width: 100%;
    padding: 60% 20px 20px 20px;
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
    border: 2px dashed rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666666;
    font-size: 1rem;
    text-align: center;
}

.gallery-item-tall .placeholder-gallery {
    padding: 100% 20px 20px 20px;
}

.gallery-item-wide .placeholder-gallery {
    padding: 40% 20px 20px 20px;
}

/* Lightbox overlay */
.lightbox {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.lightbox img {
    max-width: 90%;
    max-height: 90vh;
    object-fit: contain;
    transform: scale(0.92);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.lightbox.active img {
    transform: scale(1);
}

.lightbox-close {
    position: absolute;
    top: 30px;
    right: 40px;
    font-size: 3rem;
    color: #ffffff;
    cursor: pointer;
    font-weight: 200;
    transition: color 0.3s ease;
}

.lightbox-close:hover {
    color: #4a9eff;
}

/* Hide mobile slideshow on desktop */
.mobile-slideshow {
    display: none;
}

/* Split Gallery Layout */
.split-gallery {
    display: flex;
    gap: 4.5%;
    align-items: flex-start;
}

.featured-photo {
    flex: 0 0 48%;
    position: sticky;
    top: 180px;
    height: calc(100vh - 260px);
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #000000;
    overflow: hidden;
}

.featured-photo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity 0.4s ease;
}

.featured-photo img.fade-out {
    opacity: 0;
}

.gallery-scroll {
    flex: 1;
    min-width: 0;
    height: calc(100vh - 260px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.gallery-scroll::-webkit-scrollbar {
    width: 5px;
}

.gallery-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.gallery-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

/* Selected thumbnail highlight */
.gallery-item.selected {
    outline: 3px solid #4a9eff;
    outline-offset: -3px;
    box-shadow: 0 0 20px rgba(74, 158, 255, 0.4);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .masonry-gallery {
        grid-template-columns: repeat(3, 1fr);
        grid-auto-rows: 10px;
    }

    .gallery-container h1 {
        font-size: 2.5rem;
    }

    .featured-photo {
        flex: 0 0 45%;
    }
}

@media (max-width: 768px) {
    #navbar .logo {
        margin-left: auto;
        margin-right: auto;
        font-size: 2.18rem;
        letter-spacing: 2px;
        text-align: center;
        width: 100%;
    }

    .gallery-section {
        min-height: auto;
        padding-top: 80px;
        padding-bottom: 20px;
    }

    .gallery-container {
        padding: 0 8px;
    }

    .gallery-container h1 {
        font-size: 1.6rem;
        margin-bottom: 0.4rem;
    }

    .gallery-intro {
        font-size: 0.85rem;
        margin-bottom: 1rem;
    }

    /* Gallery tagline - only show third sentence on mobile */
    .gallery-tagline {
        font-size: 0;
        line-height: 0;
        text-align: center;
        margin-top: -30px;
        margin-bottom: 15px;
    }

    .gallery-tagline br,
    .tagline-indent {
        display: none;
    }

    .tagline-indent-sm {
        display: block;
        font-size: 0.78rem;
        padding-left: 0;
        text-align: center;
        margin-top: 30px;
        margin-bottom: 5px;
    }

    /* Hide the split-view layout on mobile, show slideshow */
    .split-gallery {
        display: block;
    }

    .featured-photo {
        display: none;
    }

    .gallery-scroll {
        display: none;
    }

    .mobile-slideshow {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0;
        width: 100%;
        height: 65vh;
        position: relative;
        margin-top: -10px;
    }

    .slideshow-img {
        max-width: calc(100% - 70px);
        max-height: 100%;
        object-fit: contain;
        transition: opacity 0.4s ease;
    }

    .slideshow-img.fade {
        opacity: 0;
    }

    .slideshow-arrow {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        background: none;
        border: none;
        color: rgba(255, 255, 255, 0.6);
        font-size: 2.5rem;
        cursor: pointer;
        z-index: 10;
        padding: 15px 10px;
        transition: color 0.2s ease;
        line-height: 1;
    }

    .slideshow-arrow:hover,
    .slideshow-arrow:active {
        color: rgba(255, 255, 255, 1);
    }

    .slideshow-prev {
        left: 0px;
    }

    .slideshow-next {
        right: 0px;
    }
}
