/* Sticky Section Block Styles */

.sticky-section {
    width: 100%;
    position: relative;
    min-height: 100vh;
}

/* Padding variations */
.sticky-section.padding-none {
    padding: 0;
}

.sticky-section.padding-small {
    padding: 2rem 0;
}

.sticky-section.padding-medium {
    padding: 4rem 0;
}

.sticky-section.padding-large {
    padding: 6rem 0;
}

/* Main container */
.sticky-section-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    margin: 0 auto;
    position: relative;
    align-items: flex-start;
}

/* Text position variations */
.sticky-section.text-position-right .sticky-section-container {
    grid-template-columns: 1fr 1fr;
}

.sticky-section.text-position-right .sticky-text-column {
    order: 2;
}

.sticky-section.text-position-right .scrolling-images-column {
    order: 1;
}

/* Sticky Text Column */
.sticky-text-column {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 0 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sticky-text-content h1,
.sticky-text-content h2,
.sticky-text-content h3 {
    margin-top: 0;
}

.sticky-text-content p:last-child {
    margin-bottom: 0;
}

/* InnerBlocks styles */
.sticky-text-content > .block-editor-inner-blocks,
.sticky-text-content > .block-editor-block-list__layout {
    margin: 0;
}

/* Frontend InnerBlocks */
.sticky-text-content > * {
    max-width: 100%;
}

/* Scrolling Images Column */
.scrolling-images-column {
    display: flex;
    flex-direction: column;
    gap: var(--image-spacing, 100px);
    padding: 0;
}

.image-item {
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    /* Opacity and transform handled by GSAP */
}

.image-item:first-child {
    min-height: 100vh;
    display: flex;
    align-items: center;
}

.sticky-section-image {
    width: 100%;
    height: auto;
    display: block;
    aspect-ratio: 9 / 16;
    object-fit: cover;
}

.image-caption {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: #666;
    font-style: italic;
    text-align: center;
}

/* Tablet breakpoint */
@media screen and (max-width: 1024px) {
    .sticky-section-container {
        gap: 3rem;
        padding: 0 1.5rem;
    }
    
    .sticky-text-column {
        padding: 2rem;
    }
}

/* Mobile breakpoint */
@media screen and (max-width: 768px) {
    .sticky-section {
        min-height: auto;
    }
    
    .sticky-section.padding-small {
        padding: 1rem 0;
    }
    
    .sticky-section.padding-medium {
        padding: 2rem 0;
    }
    
    .sticky-section.padding-large {
        padding: 3rem 0;
    }
    
    .sticky-section-container {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 0 1rem;
        min-height: auto;
    }
    
    /* On mobile, always show text first regardless of desktop position */
    .sticky-text-column {
        position: relative;
        top: 0;
        transform: none;
        order: 1;
        padding: 1.5rem;
        height: auto;
    }
    
    /* Images always follow the text on mobile, whatever the desktop position */
    .sticky-section .scrolling-images-column,
    .sticky-section.text-position-right .scrolling-images-column {
        order: 2;
        padding: 0;
    }
    
    .sticky-section.text-position-right .sticky-text-column {
        order: 1;
    }
    
    /* Horizontal swipe gallery */
    .scrolling-images-column.is-scrollable {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 1rem;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        scroll-padding-inline-start: 1rem;
        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        /* Bleed past the container's side padding so the strip runs edge to edge */
        margin-inline: -1rem;
        padding-inline: 1rem;
    }
    
    .scrolling-images-column.is-scrollable::-webkit-scrollbar {
        display: none;
    }
    
    /* Inset so the ring stays visible on a container that bleeds to the screen edges */
    .scrolling-images-column.is-scrollable:focus-visible {
        outline: 2px solid currentColor;
        outline-offset: -4px;
    }
    
    .scrolling-images-column.is-scrollable > .image-item {
        /* 85% leaves the next image peeking as a swipe hint; the cap stops
           slides becoming oversized on tablet-width screens */
        flex: 0 0 min(85%, 440px);
        /* Without this the image's intrinsic width becomes the item's
           automatic minimum size and the basis above is ignored */
        min-width: 0;
        flex-direction: column;
        align-items: stretch;
        scroll-snap-align: start;
    }
    
    .image-item,
    .image-item:first-child {
        min-height: 0;
    }
    
    .sticky-section-image {
        aspect-ratio: 4 / 5;
    }
}

@media screen and (max-width: 768px) and (prefers-reduced-motion: reduce) {
    .scrolling-images-column.is-scrollable {
        scroll-snap-type: x proximity;
    }
}

/* No content message */
.sticky-section.no-content {
    padding: 2rem;
    background-color: #f8f8f8;
    border: 1px dashed #ccc;
    text-align: center;
}

