* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Keyframes for fading in and out */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Overlay Elements */
.overlay-hidden {
    display: none !important;
}

#project-page-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.5s ease-out;
}

#project-page-overlay.fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

#project-page-overlay.fade-out {
    animation: fadeOut 0.3s ease-out forwards;
}

.page-overlay-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    transition: opacity 0.3s ease; /* Add this line */
}

.page-overlay-background::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    backdrop-filter: blur(50px);
    -webkit-backdrop-filter: blur(50px); /* For Safari */
}

.page-overlay-wrapper {
    position: fixed; /* Changed from fixed to relative */
    top: calc(50% + 40px);
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: 80%;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Content of the overlay */
.page-overlay-content {
    position: relative;
    width: 100%;
    height: 100%;
    background-color: black;
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-sizing: border-box;
    border: 1px white solid;
    z-index: 10;
}

.overlay-video-container {
    max-width: calc(100% - 160px);
    max-height: 65%;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    flex-grow: 1;
    position: relative;
    overflow: hidden;
    margin-top: 20px;
}

.overlay-video-container iframe {
    position: absolute;
    top: 0px;
    left: 0;
    width: 100%;
    height: 100%;
}

.overlay-description-container {
    margin-top: 20px;
    max-width: calc(100% - 160px);
    margin-left: auto;
    margin-right: auto;
    width: 100%;;
    margin-bottom: 40px;
    color: white;
    max-height: 30%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.page-overlay-title {
    color: #ffffff;
    font-size: 2em;
    font-family: "spectral", sans-serif;
    font-weight: 200;
    font-style: italic;
    text-transform: lowercase;
    margin-bottom: 10px;
}

#page-overlay-subtitle {
    color: #ffffff;
    font-size: 1em;
    font-family: "spectral", sans-serif;
    font-weight: 200;
    font-style: italic;
    text-transform: lowercase;
    margin-top: -10px;
    margin-bottom: 20px;
}

.page-overlay-text {
    font-size: 0.9em;
    font-family: "greycliff-cf", sans-serif;
    font-weight: 200;
    text-transform: lowercase;
    color: #ffffff;
}

.festival-selection {
    font-style: italic;
}

.description-columns {
    display: flex;
    gap: 20px;
}

.column {
    flex: 1;
}

.overlay-close-button {
    position: absolute;
    top: 10px;
    right: 55px;
    background: none;
    border: none;
    font-size: 0.9em;
    font-family: "greycliff-cf", sans-serif;
    font-weight: 200;
    font-style: italic;
    text-transform: lowercase;
    color: #ffffff;
    mix-blend-mode: difference;
    cursor: pointer;
    z-index: 5000; /* Ensure it's above wipe-overlay and clickable-bar */
}

.vertical-bar-container {
    position: fixed;
    right: 0;
    top: 0;
    background-color: white;
    width: 40px;
    height: 100%;
    cursor: pointer;
    z-index: 5000;
    transition: all 0.3s ease;
    clip-path: inset(0 0 0 0);
}

.vertical-bar-text {
    position: fixed; /* Keep it fixed relative to the viewport */
    right: 8px; /* Adjust to the initial position */
    top: 50%;
    transform: translateY(-50%);
    writing-mode: vertical-rl;
    pointer-events: none;
    transition: opacity 0.5s ease, transform 0.5s ease;
    z-index: 5000;
    opacity: 1;

    color: black;
    font-size: 1.2em;
    font-family: "spectral", sans-serif;
    font-weight: 200;
    font-style: italic;
    text-transform: lowercase;
}

.vertical-bar-text.fade-out {
    opacity: 0;
}

.vertical-bar-text.fade-in {
    opacity: 1;
}

#wipe-overlay.overlay-hidden {
    display: none;
}

#wipe-overlay {
    /* Base styles */
    position: absolute; 
    top: 0;
    left: 0; /* Cover from the left */
    width: 100%;
    height: 100%;
    z-index: 200;
    background-color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    clip-path: inset(0 0 0 calc(100% - 40px)); /* Initial clip-path */
    overflow: hidden;
}

/* Fullscreen wipe animation */
.fullscreen-wipe {
    animation: wipe-to-fullscreen 2.5s cubic-bezier(.25, 1, .30, 1) forwards;
    /* clip-path is set to 'from' in keyframes */
}

/* Reverse wipe animation */
.reverse-wipe {
    animation: wipe-to-original 2.5s cubic-bezier(.25, 1, .30, 1) forwards;
    /* clip-path is set to 'from' in keyframes */
}

/* Keyframes for the animations */
@keyframes wipe-to-fullscreen {
    from {
        clip-path: inset(0 0 0 calc(100% - 40px));
    }
    to {
        clip-path: inset(0 0 0 40px); /* Stop 40px short */
    }
}

@keyframes wipe-to-original {
    from { 
        clip-path: inset(0 0 0 40px); /* Start from 40px short */
    }
    to { 
        clip-path: inset(0 0 0 calc(100% - 40px)); /* End at 40px short */
    }
}

/* Black Bar Styles */
.clickable-bar {
    position: absolute;
    left: 0;
    top: 0;
    width: 40px;
    height: 100%;
    background-color: black;
    cursor: pointer;
    z-index: 5000;
    border-left: 1px white solid;
    border-top: 1px white solid;
    border-bottom: 1px white solid;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* "Back" Text Styles */
.back-text {
    color: white; /* Ensure the text is visible against the black bar */
    font-size: 1.2em; /* Adjust as needed */
    font-family: "spectral", sans-serif; /* Match your existing font */
    font-weight: 200;
    font-style: italic;
    text-transform: lowercase;
    transform: rotate(-90deg); /* Rotate the text 90 degrees */
    opacity: 0; /* Initially hidden */
    transition: opacity 0.5s ease-in-out; /* Fade-in transition */
    pointer-events: none; /* Allows clicks to pass through if necessary */
}

.back-text.visible {
    opacity: 1; /* Visible state */
}

.hidden {
    display: none;
}

/* Style for the image gallery 
.image-gallery {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 20px;
    max-width: 80%; 
    max-height: 90%; 
    overflow-y: auto;
}

/* Adjust gallery container for responsiveness 
.gallery-container {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    align-items: center;
}*/

#wipe-overlay .image-gallery {
    max-width: 80%;
}

#wipe-overlay .swiper-container {
    width: 100%;
    height: 100%;
    overflow: auto;
}

#wipe-overlay .swiper-slide {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 90%;
}

#wipe-overlay .swiper-slide img {
    width: 100%;
    object-fit: cover;
    margin: 0;
    padding: 0;
}

#wipe-overlay #image-gallery {
    width: 100%;
    height: 100%;
}

/* Hide scrollbar for all browsers */
#wipe-overlay .swiper-container {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

#wipe-overlay .swiper-container::-webkit-scrollbar {
    display: none; /* Chrome, Safari, and Opera */
}

/*=============================
MOBILE STYLES
=============================*/

@media only screen and (max-width: 767px) {

        :root {
            --sab: env(safe-area-inset-bottom);
        }
        
        @supports not (env(safe-area-inset-bottom)) {
            :root {
                --sab: 0px;
            }
        }

        /* Adjust the page overlay wrapper */
        .page-overlay-wrapper {
            position: fixed;
            top: 0; 
            left: 0;
            transform: translateY(100%);
            width: 100%;
            height: calc(100dvh - env(safe-area-inset-bottom));
            padding-top: 100px;
            box-sizing: border-box;
            display: flex;
            flex-direction: column; /* Stack items vertically */
            /*justify-content: flex-start; Align items to the top */
        }

        .page-overlay-content {
            border: 2px solid white;
            padding: 0;
            margin: 0;
            display: flex;
            flex-direction: column;
            flex-grow: 1;    
            flex: 1 0 auto; /* Prevents unwanted stretching */
            will-change: clip-path;
            height: calc(100% - 100px); /* Adjust for the padding-top */
        }

        .overlay-video-container-mobile {
            position: relative;
            width: 100%;
            height: 0;
            margin-top: 60px;
        }

        .overlay-video-container-mobile iframe {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            border: none;

        }

        .overlay-description-container {
            max-width: none;
            margin-left: 10px;
            margin-right: 10px;
            width: 100%;;
            margin-bottom: auto;
            color: white;
            max-height: 30%;
            align-items: center;
            justify-content: center;

        }

        .page-overlay-title {
            font-size: 2.2em;
            margin-top: 0px;
        }

        .page-overlay-subtitle-mobile {
            font-size: 0.9em;
            font-family: "greycliff-cf", sans-serif;
            font-weight: 200;
            text-transform: lowercase;
            color: #ffffff;
        }

        /* Style for Horizontal Bar */
        .vertical-bar-container,
        .vertical-bar-text {
            display: none;
        }

        .horizontal-bar-container {
            position: fixed; /* Fixed at the bottom of the viewport */
            left: 0;
            bottom: 0;
            width: 100%; /* Span the full width */
            height: 62px; /* Adjust height as needed */
            background-color: black;
            border: 2px solid white;
            cursor: pointer;
            z-index: 5000;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.3s ease;
            overflow: hidden;
        }

        .overlay-close-button {
            display: none;
        }

        #close-button-mobile {
            top:    100px;
        }
        
        .horizontal-bar-text {
            font-size: 1.2em; /* Adjust as needed */
            color: white;
            font-family: "greycliff-cf", sans-serif;
            font-weight: 100;
            text-align: center;
            text-transform: lowercase;
            opacity: 1;
            transition: opacity 0.5s ease, transform 0.5s ease;
            pointer-events: none; /* Ensures text doesn't interfere with clicks */
            z-index: 5000;
            margin: 0;
            padding: 0;
        }

        /* Button Animations */
        .ripple {
            position: absolute;
            border-radius: 50%;
            transform: scale(0);
            animation: ripple 600ms linear;
            background-color: rgba(255, 255, 255, 0.7);
            pointer-events: none; /* Ensures the ripple doesn't interfere with clicks */
        }
        
        @keyframes ripple {
            to {
                transform: scale(4);
                opacity: 0;
            }
        }

        /*  Animations for Open/Close Mobile Overlay */
        @keyframes slideUp {
            from {
                transform: translateY(100vh);
            }
            to {
                transform: translateY(0); /* Stop 100px from top */
            }
        }
        
        @keyframes slideDown {
            from {
                transform: translateY(100px);
            }
            to {
                transform: translateY(100%);
            }
        }
        .page-overlay-wrapper.slide-up {
            animation: slideUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
            will-change: transform;
        }
    
        .page-overlay-wrapper.slide-down {
            animation: slideDown 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
            will-change: transform;
        }

        /* =======================
        DETAILS BUTTON
        =========================*/

        #details-overlay {
            position: fixed;
            top: 0; 
            left: 0;
            width: 100%;
            height: 100dvh;
            z-index: 6000;
            display: flex;
            flex-direction: column;
        }

        /* Details button mobile positioning */
        #details-button-mobile {
            position: relative;
            left: 0;
            width: 100%;
            height: 62px;
            background: black;
            color: white;
            z-index: 6001;
        }

        .details-overlay-wrapper {
            position: relative;
            /*top: 162px;*/
            left: 0;
            width: 100%;
            height: calc(100dvh - 62px)
        }

        .details-content {
            background-color: white;
            height: 100%;
            width: 100%;
            color: black;
            padding: 20px;
            overflow-y: auto;
        }

        .page-overlay-text {
            color: black;
            text-align: center;
        }

        /* =======================
        GALLERY BUTTON
        =========================*/

        #gallery-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100dvh;
            z-index: 7000;
            display: flex;
            flex-direction: column;
            transform: translateY(calc(100dvh - 62px - env(safe-area-inset-bottom)));
            overflow: hidden; /* Add this to prevent any overflow */
        }
        
        #gallery-button-mobile {
            position: relative;
            left: 0;
            width: 100%;
            height: 62px;
            background: black;
            color: white;
            z-index: 7001;
        }
        
        .gallery-overlay-wrapper {
            position: relative;
            left: 0;
            width: 100%;
            height: calc(100dvh - 62px);
            overflow: hidden; /* Add this */
        }
        
        #gallery-content {
            width: 100%;
            height: 100%;
            background: white;
            padding: 2px;
            padding-top: 0px;
            overflow: hidden; /* Change from overflow-y: auto */
            display: flex;
            align-items: flex-start; /* Change from center to prevent vertical centering */
            justify-content: flex-start;
        }
        
        #gallery-content.hidden {
            display: none;
        }
        
        /* Swiper specific styles */
        #gallery-content .swiper-container {
            width: 100%;
            height: 100%;
            overflow: hidden; /* Add this */
        }
        
        #gallery-content .swiper-wrapper {
            width: 100%; /* Add this */
        }
        
        #gallery-content .swiper-slide {
            width: 100% !important; /* Add !important */
            height: auto;
            display: flex;
            justify-content: center;
            align-items: flex-start; /* Change from center */
        }
        
        #gallery-content .swiper-slide img {
            width: 100%;
            height: auto;
            object-fit: contain;
            display: block; /* Add this to prevent inline spacing */
        }

}
