/* Gallery Layout */
.gallery-section {
    padding: 6rem 1.5rem;
    background: #fafafc;
    min-height: 100vh;
}

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

.gallery-header h1 {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2.5rem, 6vw, 4rem);
    color: #001133;
    margin-bottom: 1rem;
}

.gallery-header p {
    font-size: 1.1rem;
    color: #4a5568;
    max-width: 600px;
    margin: 0 auto;
}

/* 2-Column Grid Architecture */
.masonry-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Photo Holder Base */
.gal-item {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    background: #e2e8f0;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.5s ease;
    cursor: pointer;
    aspect-ratio: 1 / 1;
}

.gal-item:hover {
    transform: translateY(-6px) scale(1.01);
    box-shadow: 0 20px 40px rgba(0,17,51,0.15);
}

.gal-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s ease-out;
}

.gal-video-holder {
    grid-column: span 2;
    aspect-ratio: 9 / 16;
    cursor: default;
    background: #001133;
}

.gal-video-holder:hover {
    transform: translateY(-6px);
}

.video-slider,
.video-slide-frame,
.video-slide-frame iframe {
    width: 100%;
    height: 100%;
}

.video-slider {
    position: relative;
    background: #001133;
}

.video-slide-frame {
    position: relative;
    overflow: hidden;
    background: #001133;
}

.video-slide-frame iframe {
    display: block;
    border: 0;
}

.video-slide-btn {
    position: absolute;
    top: 50%;
    z-index: 3;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 999px;
    display: grid;
    place-items: center;
    color: #ffffff;
    background: rgba(0, 17, 51, 0.72);
    box-shadow: 0 10px 24px rgba(0, 17, 51, 0.28);
    cursor: pointer;
    transform: translateY(-50%);
    transition: background 0.25s ease, transform 0.25s ease;
}

.video-slide-btn:hover {
    background: rgba(0, 17, 51, 0.92);
    transform: translateY(-50%) scale(1.04);
}

.video-slide-btn svg {
    width: 22px;
    height: 22px;
}

.video-slide-btn--prev {
    left: 12px;
}

.video-slide-btn--next {
    right: 12px;
}

.video-slide-dots {
    position: absolute;
    left: 50%;
    bottom: 14px;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 10px;
    border-radius: 999px;
    background: rgba(0, 17, 51, 0.62);
    transform: translateX(-50%);
}

.video-slide-dots button {
    width: 8px;
    height: 8px;
    border: 0;
    border-radius: 999px;
    padding: 0;
    background: rgba(255, 255, 255, 0.46);
    cursor: pointer;
}

.video-slide-dots button.active {
    width: 22px;
    background: #ffffff;
}

/* Static image zoom */
.gal-item.is-zoomed:not(.dynamic-holder) img {
    transform: scale(1.01);
}

/* Layout Spans */
.gal-main {
    grid-column: span 2;
    grid-row: span 2;
}

.gal-1x1 {
    grid-column: span 1;
    grid-row: span 1;
}

.gal-h {
    grid-column: span 2;
    grid-row: span 1;
}

.gal-v {
    grid-column: span 1;
    grid-row: span 2;
}

/* Infinity Scroll Marquee Row */
.gal-marquee-row {
    grid-column: span 2;
    grid-row: span 1; /* Keep it relatively slim like a horizontal holder */
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
    display: flex;
    align-items: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    position: relative;
}

.marquee-track {
    display: flex;
    gap: 1.5rem;
    width: fit-content;
    animation: marquee 20s linear infinite;
    padding: 0 1.5rem;
}

.marquee-track:hover {
    animation-play-state: paused;
}

.marquee-track img {
    height: clamp(150px, 15vw, 250px);
    width: auto;
    border-radius: 12px;
    object-fit: cover;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

@keyframes marquee {
    from { transform: translateX(0); }
    to { transform: translateX(calc(-50% - 0.75rem)); }
}

/* Dynamic Photo Holder (Slide Transition) */
.dynamic-holder {
    position: relative;
    overflow: hidden;
}

.dynamic-holder img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: transform 0.8s cubic-bezier(0.65, 0, 0.35, 1);
}

/* Setup the sliding queue with zoom integration */
.dynamic-holder img.inactive {
    transform: translateX(100%) scale(1); /* Waiting off-screen right */
    z-index: 1;
}

.dynamic-holder.is-zoomed img.inactive {
    transform: translateX(100%) scale(1.04);
}

.dynamic-holder img.active {
    transform: translateX(0) scale(1); /* On-screen */
    z-index: 2;
}

.dynamic-holder.is-zoomed img.active {
    transform: translateX(0) scale(1.04);
}

.dynamic-holder img.exit {
    transform: translateX(-100%) scale(1); /* Leaving off-screen left */
    z-index: 2;
}

.dynamic-holder.is-zoomed img.exit {
    transform: translateX(-100%) scale(1.04);
}

/* Glass Overlay - Permanent now */
.gal-overlay {
    position: absolute;
    inset: 0;
    background: none;
    opacity: 1;
    z-index: 5;
    display: flex;
    align-items: flex-end;
    padding: 1.5rem;
    color: white;
    pointer-events: none; /* Let clicks pass through if needed */
}

.gal-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.25rem;
    font-weight: 700;
    transform: translateY(0);
    color: #ffffff;
    text-shadow: 
        -1px -1px 0px rgba(0, 0, 0, 0.9),  
         1px -1px 0px rgba(0, 0, 0, 0.9),
        -1px  1px 0px rgba(0, 0, 0, 0.9),
         1px  1px 0px rgba(0, 0, 0, 0.9),
         0px  2px 4px rgba(0, 0, 0, 0.9);
}

/* Scroll Animation Classes */
.fade-up {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.fade-up.visible {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 768px) {
    /* Keep 2 columns on mobile but reduce row height */
    .masonry-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 155px; /* Increased from 130px to zoom out / show more of the image */
        gap: 0.9rem;
    }

    .gal-video-holder {
        grid-column: span 2;
        grid-row: span 4;
        aspect-ratio: 9 / 16;
    }

    .video-slide-btn {
        width: 34px;
        height: 34px;
    }

    .video-slide-btn--prev {
        left: 8px;
    }

    .video-slide-btn--next {
        right: 8px;
    }
    
    .gal-item img {
        object-position: center 80%; /* Shift image up to show the bottom result */
    }
    
    .gal-h img {
        object-position: center 85%; /* Shift even more for short horizontal images */
    }
    
    .gallery-section {
        padding: 4rem 1rem;
    }
    
    .gal-overlay {
        padding: 0.75rem;
    }
    
    .gal-title {
        font-size: 0.95rem;
        padding: 0;
    }
}
