/* Scroll Masonry Widget Styles */
.orpheon-scroll-masonry {
    position: relative;
    overflow: hidden;
    display: flex;
    height: 100vh;
    width: 100%;
    contain: layout style;
    background: #fff; /* Fallback background */
    scroll-snap-type: y mandatory;
}

.orpheon-scroll-masonry.scroll-snap-enabled {
    scroll-snap-type: y mandatory;
}

.orpheon-scroll-masonry .center-section {
    scroll-snap-align: start;
}

/* Columns Layout */
.masonry-column {
    flex: 1;
    position: relative;
    height: 100%;
    overflow: hidden;
    contain: layout;
    min-height: 400px; /* Ensure minimum height for debugging */
}

.left-column,
.right-column {
    display: flex;
    align-items: flex-start;
}

.center-column {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    z-index: 10;
}


/* Gallery Content */
.masonry-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 0;
    transition: transform 0.1s ease-out;
    will-change: transform;
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
}

/* Ambient animation for galleries */
.masonry-content.ambient-animation {
    animation: ambientFloat 8s ease-in-out infinite;
}

.right-column .masonry-content.ambient-animation {
    animation: ambientFloatReverse 10s ease-in-out infinite;
}

@keyframes ambientFloat {
    0%, 100% {
        transform: translate3d(0, 0, 0);
    }
    50% {
        transform: translate3d(0, -10px, 0);
    }
}

@keyframes ambientFloatReverse {
    0%, 100% {
        transform: translate3d(0, 0, 0);
    }
    50% {
        transform: translate3d(0, 10px, 0);
    }
}

/* Masonry Images */
.masonry-image {
    position: relative;
    width: 100%;
    overflow: hidden;
    opacity: 1; /* Make visible by default */
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translate3d(0, 0, 0);
    margin-bottom: 15px; /* Fallback for gap */
    border-radius: 12px;
}

.masonry-image:last-child {
    margin-bottom: 0;
}

.masonry-image.visible {
    opacity: 1;
}

.masonry-image img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    object-position: center;
}

/* Height Ratios for Masonry Effect - CSS Custom Properties for easy customization */
:root {
    --masonry-base-height: 240px;
    --masonry-gap: 20px;
}

.masonry-image[data-height-ratio="0.5"] {
    height: calc(var(--masonry-base-height) * 0.5);
}

.masonry-image[data-height-ratio="0.75"] {
    height: calc(var(--masonry-base-height) * 0.75);
}

.masonry-image[data-height-ratio="1"] {
    height: var(--masonry-base-height);
}

.masonry-image[data-height-ratio="1.25"] {
    height: calc(var(--masonry-base-height) * 1.25);
}

.masonry-image[data-height-ratio="1.5"] {
    height: calc(var(--masonry-base-height) * 1.5);
}

.masonry-image[data-height-ratio="2"] {
    height: calc(var(--masonry-base-height) * 2);
}

.masonry-image[data-height-ratio="0.5"] img,
.masonry-image[data-height-ratio="0.75"] img,
.masonry-image[data-height-ratio="1"] img,
.masonry-image[data-height-ratio="1.25"] img,
.masonry-image[data-height-ratio="1.5"] img,
.masonry-image[data-height-ratio="2"] img {
    height: 100%;
}

/* Center Column Sections */
.center-section {
    height: 100vh;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translate3d(0, 0, 0);
    /* transition removed - using GSAP for all animations */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding-inline: 20px;
    backface-visibility: hidden;
    will-change: opacity, transform;
    justify-content: center;
    align-items: center;
    pointer-events: none;
}

.center-section:first-child {
    opacity: 1;
    pointer-events: auto;
}

.center-section.active {
    opacity: 1;
    transform: translate3d(0, 0, 0);
    pointer-events: auto;
}

/* Center Content Layout */
.center-image-top,
.center-image-bottom {
    flex: 0 0 20%;
    width: 100%;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 15px;
}

.center-title-wrapper {
    flex: 0 0 60%;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.center-title {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    line-height: 1.2;
    font-weight: bold;
    max-width: 100%;
    word-wrap: break-word;
    hyphens: auto;
    display: block;
}

.center-image-top img,
.center-image-bottom img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

/* Scroll Jack Container */
.orpheon-scroll-masonry[data-scroll-jack="yes"] {
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Full viewport when scroll jacking is active */
.orpheon-scroll-masonry.scroll-jacked {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
    background: #fff;
}

.orpheon-scroll-masonry.scroll-jacked .masonry-column {
    height: 100vh;
}

@media (max-width: 1024px) {
    .orpheon-scroll-masonry.scroll-jacked {
        flex-direction: column;
    }
    
    .orpheon-scroll-masonry.scroll-jacked .left-column,
    .orpheon-scroll-masonry.scroll-jacked .right-column {
        height: 35vh;
    }
    
    .orpheon-scroll-masonry.scroll-jacked .center-column {
        height: 30vh;
    }
}

/* Performance Optimizations */
.masonry-content,
.center-section {
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
}

/* Responsive: Large Tablet */
@media (max-width: 1200px) {
    :root {
        --masonry-base-height: 200px;
        --masonry-gap: 15px;
    }
    
    .center-title {
        font-size: clamp(1.3rem, 3.5vw, 2rem);
    }
    
    .masonry-content {
        gap: 15px;
        padding: 15px;
    }

}

/* Responsive: Tablet */
@media (max-width: 1024px) {
    :root {
        --masonry-base-height: 180px;
    }
}

/* Mobile and Tablet Layout */
@media (max-width: 1024px) {
    .orpheon-scroll-masonry {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        scroll-snap-type: y mandatory;
        gap: 20px;
    }
    
    .masonry-column {
        width: 100%;
        height: auto;
        position: relative;
        overflow: visible;
    }
    
    /* Top gallery (was left) */
    .left-column {
        order: 1;
        min-height: 300px;
        overflow: hidden;
    }
    
    .left-column .masonry-content {
        position: relative !important;
        display: flex !important;
        flex-direction: row !important;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-behavior: smooth;
        padding: 10px 0;
        gap: 15px;
    }
    
    .left-column .masonry-image {
        flex-shrink: 0;
        width: 250px;
        height: 200px;
        margin-right: 0;
        opacity: 1 !important;
    }
    
    /* Center title */
    .center-column {
        order: 2;
        min-height: 30vh;
        justify-content: center;
        display: flex;
        align-items: center;
        text-align: center;
        position: relative;
    }
    
    .center-section {
        position: relative !important;
        height: auto !important;
        min-height: 30vh;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        opacity: 0;
        padding: 20px;
    }
    
    .center-section.active {
        opacity: 1 !important;
        position: relative !important;
    }
    
    /* Hide center images on mobile */
    .center-image-top,
    .center-image-bottom {
        display: none !important;
    }
    
    /* Show only center title on mobile */
    .center-title-wrapper {
        flex: 1;
        width: 100%;
        display: flex !important;
        align-items: center;
        justify-content: center;
        text-align: center;
    }
    
    .center-title {
        font-size: clamp(1.2rem, 4vw, 1.8rem);
        text-align: center;
        margin: 0;
        display: block;
    }
    
    /* Bottom gallery (was right) */
    .right-column {
        order: 3;
        min-height: 300px;
        overflow: hidden;
    }
    
    .right-column .masonry-content {
        position: relative !important;
        display: flex !important;
        flex-direction: row !important;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-behavior: smooth;
        padding: 10px 0;
        gap: 15px;
    }
    
    .right-column .masonry-image {
        flex-shrink: 0;
        width: 250px;
        height: 200px;
        margin-right: 0;
        opacity: 1 !important;
    }

    /* Mobile image styling for both galleries */
    .left-column .masonry-image img,
    .right-column .masonry-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: 8px;
    }

    /* Ensure galleries are properly positioned for automatic scrolling */
    .left-column .masonry-content,
    .right-column .masonry-content {
        transform: translate3d(0, 0, 0);
        will-change: transform;
        transition: transform 0.3s ease;
    }
}

/* Mobile Portrait */
@media (max-width: 480px) {
    :root {
        --masonry-base-height: 140px;
    }
    

    
    .masonry-content {
        padding: 10px;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .masonry-image,
    .center-section {
        transition: none;
    }
    
    .masonry-content {
        transition: none;
    }
}

/* Hide scrollbars for clean appearance */
.orpheon-scroll-masonry::-webkit-scrollbar,
.masonry-column::-webkit-scrollbar {
    display: none;
}

.orpheon-scroll-masonry,
.masonry-column {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Ambient Animation Keyframes */
@keyframes ambientFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
}

@keyframes ambientSway {
    0%, 100% { transform: translateX(0px); }
    50% { transform: translateX(4px); }
}

/* Ambient Animation Classes */
.left-column.ambient-active .masonry-content {
    animation: ambientFloat var(--ambient-speed, 3s) ease-in-out infinite;
}

.right-column.ambient-active .masonry-content {
    animation: ambientSway var(--ambient-speed, 3s) ease-in-out infinite reverse;
}

/* Disable ambient on mobile to prevent conflicts */
@media (max-width: 1024px) {
    .left-column.ambient-active .masonry-content,
    .right-column.ambient-active .masonry-content {
        animation: none;
    }
}

/* High DPI Display Optimizations */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .masonry-image img,
    .center-image-top img,
    .center-image-bottom img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Print styles */
@media print {
    .orpheon-scroll-masonry {
        position: static;
        height: auto;
        overflow: visible;
        flex-direction: column;
        page-break-inside: avoid;
    }
    
    .masonry-column {
        min-height: auto;
        overflow: visible;
        page-break-inside: avoid;
    }
    
    .center-section {
        position: static;
        opacity: 1;
        transform: none;
        page-break-inside: avoid;
    }
    
    .masonry-image {
        opacity: 1;
        page-break-inside: avoid;
    }
}