/* ===================================
   Layered Hero Gallery Styles
   =================================== */

.layered-gallery-container {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 100%;
}

.layered-gallery-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 100%;
}

.layered-slides-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.layered-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 1s ease-in-out, transform 1s ease-in-out;
    pointer-events: none;
}

.layered-slide.slide-active {
    opacity: 1;
    pointer-events: auto;
    z-index: 10;
}

.layered-images-stack {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 100%;
}

/* Layered Image Styling */
.layered-image {
    position: absolute;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s ease;
    animation: fadeInLayer 0.6s ease-out forwards;
    opacity: 0;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
}

/* Snap to bottom positioning */
.layered-image.snap-bottom {
    bottom: 0 !important;
    transform: none !important;
}

/* Override middle positioning when snap-bottom is active */
.layered-image.pos-middle.snap-bottom {
    left: 50% !important;
    transform: translateX(-50%) !important;
    bottom: 0 !important;
}

@keyframes fadeInLayer {
    to {
        opacity: 1;
    }
}

.layered-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.layered-image a {
    display: block;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.layered-image a img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.layered-image:hover {
    z-index: 100 !important;
}

/* Parallax effect */
.layered-image.parallax-enabled {
    will-change: transform;
    transition: none; /* Remove transition for smooth parallax */
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
}

/* Mobile-specific optimizations */
@media (max-width: 768px) {
    .layered-image {
        -webkit-perspective: 1000;
        perspective: 1000;
    }
    
    .layered-image.parallax-enabled {
        /* Smoother scrolling on iOS */
        -webkit-overflow-scrolling: touch;
    }
}

/* Horizontal Positioning */
.layered-image.pos-left {
    left: 5%;
}

.layered-image.pos-middle {
    left: 50%;
    transform: translate3d(-50%, 0, 0);
}

.layered-image.pos-middle:hover {
    transform: translate3d(-50%, 0, 0) scale(1.02);
}

.layered-image.pos-right {
    right: 5%;
}

/* Size Variations - width-based, height auto-adjusts to aspect ratio */
.layered-image.size-small {
    width: 25%;
    max-width: 300px;
    max-height: 400px;
}

.layered-image.size-medium-small {
    width: 30%;
    max-width: 375px;
    max-height: 450px;
}

.layered-image.size-medium {
    width: 35%;
    max-width: 450px;
    max-height: 500px;
}

.layered-image.size-medium-large {
    width: 45%;
    max-width: 600px;
    max-height: 600px;
}

.layered-image.size-very-large {
    width: 60%;
    max-width: 800px;
    max-height: 700px;
}

/* Backward compatibility: map old "large" to "medium-large" */
.layered-image.size-large {
    width: 45%;
    max-width: 600px;
    max-height: 600px;
}

/* Responsive Design */
@media (max-width: 992px) {
    .layered-image.size-small {
        width: 30%;
        max-width: 250px;
        max-height: 350px;
    }
    
    .layered-image.size-medium-small {
        width: 35%;
        max-width: 300px;
        max-height: 400px;
    }
    
    .layered-image.size-medium {
        width: 40%;
        max-width: 350px;
        max-height: 450px;
    }
    
    .layered-image.size-medium-large {
        width: 50%;
        max-width: 450px;
        max-height: 550px;
    }
    
    .layered-image.size-very-large {
        width: 65%;
        max-width: 600px;
        max-height: 650px;
    }
    
    /* Backward compatibility */
    .layered-image.size-large {
        width: 50%;
        max-width: 450px;
        max-height: 550px;
    }
}

@media (max-width: 768px) {
    .layered-images-stack {
        min-height: 60vh;
    }
    
    .layered-image.size-small {
        width: 35%;
        max-width: 200px;
        max-height: 300px;
    }
    
    .layered-image.size-medium-small {
        width: 40%;
        max-width: 240px;
        max-height: 340px;
    }
    
    .layered-image.size-medium {
        width: 45%;
        max-width: 280px;
        max-height: 380px;
    }
    
    .layered-image.size-medium-large {
        width: 55%;
        max-width: 350px;
        max-height: 450px;
    }
    
    .layered-image.size-very-large {
        width: 70%;
        max-width: 450px;
        max-height: 550px;
    }
    
    /* Backward compatibility */
    .layered-image.size-large {
        width: 55%;
        max-width: 350px;
        max-height: 450px;
    }
    
    .layered-image.pos-left {
        left: 3%;
    }
    
    .layered-image.pos-right {
        right: 3%;
    }
}

@media (max-width: 480px) {
    .layered-images-stack {
        min-height: 60vh;
    }
    
    .layered-image.size-small {
        width: 45%;
        max-height: 250px;
    }
    
    .layered-image.size-medium-small {
        width: 52%;
        max-height: 280px;
    }
    
    .layered-image.size-medium {
        width: 60%;
        max-height: 320px;
    }
    
    .layered-image.size-medium-large {
        width: 75%;
        max-height: 400px;
    }
    
    .layered-image.size-very-large {
        width: 85%;
        max-height: 500px;
    }
    
    /* Backward compatibility */
    .layered-image.size-large {
        width: 75%;
        max-height: 400px;
    }
    
    .layered-image.pos-left,
    .layered-image.pos-right {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
    }
    
    .layered-image.pos-middle {
        left: 50%;
        transform: translateX(-50%);
    }
    
    .layered-image.pos-left:hover,
    .layered-image.pos-right:hover,
    .layered-image.pos-middle:hover {
        transform: translateX(-50%) scale(1.02);
    }
}

/* ===================================
   Slideshow Animations
   =================================== */

/* Exit animations for right direction (slide out to right) */
.slideshow-direction-right .layered-slide.slide-exit-right {
    opacity: 0;
    transform: translateX(100px);
}

/* Exit animations for left direction (slide out to left) */
.slideshow-direction-left .layered-slide.slide-exit-left {
    opacity: 0;
    transform: translateX(-100px);
}

/* Static mode - no animations */
.static-mode .layered-slide {
    transition: none;
}

.static-mode .layered-slide.slide-active {
    opacity: 1;
}

/* ===================================
   Gallery Text Overlay
   =================================== */

.gallery-text-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    pointer-events: none;
    z-index: 100;
    padding-top: var(--layered-overlay-padding-top, 0);
    padding-bottom: var(--layered-overlay-padding-bottom, 0);
    padding-left: var(--layered-overlay-padding-left, 0);
    padding-right: var(--layered-overlay-padding-right, 0);
}

.gallery-text-content {
    pointer-events: auto;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    max-width: 800px;
}

/* Horizontal Alignment */
.gallery-text-overlay.text-h-left {
    justify-content: flex-start;
}

.gallery-text-overlay.text-h-center {
    justify-content: center;
}

.gallery-text-overlay.text-h-right {
    justify-content: flex-end;
}

/* Vertical Alignment */
.gallery-text-overlay.text-v-top {
    align-items: flex-start;
}

.gallery-text-overlay.text-v-center {
    align-items: center;
}

.gallery-text-overlay.text-v-bottom {
    align-items: flex-end;
}

/* Text Elements */
.gallery-message {
    margin: 0 0 15px 0;
    line-height: 1.2;
}

.gallery-description {
    margin: 0;
    line-height: 1.6;
}

/* Responsive text */
@media (max-width: 768px) {
    .gallery-message {
        font-size: 24px !important;
    }
    
    .gallery-description {
        font-size: 14px !important;
    }
}
