/* Stylesheet for Composition page — Oriane Droubay */

body.compo-light-theme {
    background-color: #FFFFFF;
    color: #101010;
}

/* Header Adjustments - Frosted Glass White Blur */
body.compo-dark-theme .site-header {
    background-color: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

/* Page Layout Wrappers */
.compo-page-wrapper {
    position: relative;
    width: 100%;
    min-height: 100vh;
    background: #FFFFFF;
    overflow: hidden;
}

.compo-layout-container {
    position: relative;
    width: 1728px;
    height: 850px;
    margin: 0 auto;
    background: #FFFFFF;
}

/* Diapositives (Slides) */
.slide {
    position: absolute;
    top: 20px;
    height: 540.18px;
    container-type: inline-size;
    overflow: hidden;
    cursor: pointer;
    user-select: none;
    -webkit-user-drag: none;
    touch-action: none; /* Smooth dragging on mobile/tablet */
    /* Smooth transitions for moving between states */
    transition: left 0.8s cubic-bezier(0.16, 1, 0.3, 1), width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Three Carousel State Positions */
/* --- Slide 0: Shooting Fleuri (Portrait, W_center = 394.33px, W_side = 300px) --- */
.slide-shooting.state-left {
    left: 95.66px;
    width: 300px;
    z-index: 2;
}
.slide-shooting.state-center {
    left: 666.83px;
    width: 394.33px;
    z-index: 5;
    cursor: default;
}
.slide-shooting.state-right {
    left: 1311.43px;
    width: 300px;
    z-index: 2;
}

/* --- Slide 1: Compo 02 (Landscape, W_center = 812.6px, W_side = 406.3px) --- */
.slide-compo02.state-left {
    left: -10.64px;
    width: 406.3px;
    z-index: 2;
}
.slide-compo02.state-center {
    left: 457.7px;
    width: 812.6px;
    z-index: 5;
    cursor: default;
}
.slide-compo02.state-right {
    left: 1311.43px;
    width: 406.3px;
    z-index: 2;
}

/* --- Slide 2: Compo 01 (Landscape, W_center = 864.07px, W_side = 432.04px) --- */
.slide-compo01.state-left {
    left: -36.38px;
    width: 432.04px;
    z-index: 2;
}
.slide-compo01.state-center {
    left: 431.96px;
    width: 864.07px;
    z-index: 5;
    cursor: default;
}
.slide-compo01.state-right {
    left: 1311.43px;
    width: 432.04px;
    z-index: 2;
}

/* Slide Before/After Images */
.slide-image {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    pointer-events: none;
}

/* After image (background layer) takes 100% of current slide width */
.image-after {
    width: 100%;
}

/* Before image wrapper (clipped overlay) */
.slide-before-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    overflow: hidden;
    width: var(--slider-pos, 50%);
    pointer-events: none;
}

/* Before image width uses container query width (cqw) to stay fixed size during animations */
.image-before {
    width: 100cqw;
}

/* Vertical Slider Handle Bar — Glassmorphism */
.slide-bar {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 4px;
    left: var(--slider-pos, 50%);
    margin-left: -2px;
    background: linear-gradient(180deg,
        rgba(255, 255, 255, 0.4) 0%,
        rgba(255, 255, 255, 0.88) 30%,
        rgba(255, 255, 255, 0.88) 70%,
        rgba(255, 255, 255, 0.4) 100%);
    backdrop-filter: blur(16px) saturate(200%);
    -webkit-backdrop-filter: blur(16px) saturate(200%);
    border-left: 1px solid rgba(255, 255, 255, 0.9);
    border-right: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 18px rgba(255, 255, 255, 0.7), 0 0 6px rgba(0, 0, 0, 0.3);
    z-index: 10;
    cursor: ew-resize;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.4s ease, visibility 0s linear 0.4s;
}

.slide.state-center .slide-bar {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    /* when appearing: show visibility instantly, then fade opacity */
    transition: opacity 0.4s ease, visibility 0s linear 0s;
}

/* Hit area helper for slide-bar to make it easier to grab on touch screens */
.slide-bar::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 60px; /* Touch-friendly hit area */
    transform: translateX(-50%);
    background: transparent;
    z-index: 11;
    cursor: ew-resize;
}

/* Custom Drag Handle using arrow-slider-base.webp (restored original base version) */
.slide-bar::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 56px;
    height: 56px;
    transform: translate(-50%, -50%) scale(1);
    background-image: url('../08-Composition/arrow-slider-base.webp');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    pointer-events: none;
    z-index: 12;
    transition: transform 0.2s ease;
}

.slide.dragging .slide-bar::after {
    transform: translate(-50%, -50%) scale(1.15);
}

/* Stationary Side Gradients */
.gradient-overlay {
    position: absolute;
    height: 543px;
    pointer-events: none;
    z-index: 8;
}

.gradient-left {
    width: 355px;
    left: -6px;
    top: 19px;
    background: linear-gradient(90deg, #FFFFFF 0%, rgba(255, 255, 255, 0) 100%);
}

.gradient-right {
    width: 355px;
    left: 1373px;
    top: 20px;
    background: linear-gradient(270deg, #FFFFFF 0%, rgba(255, 255, 255, 0) 100%);
}

/* Navigation Arrows */
.nav-arrow {
    position: absolute;
    width: 64px;
    height: 64px;
    top: 50% !important; /* Centered dynamically */
    z-index: 15;
    cursor: pointer;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.55) 0%, rgba(245, 245, 245, 0.25) 100%); /* Slightly more opaque glassmorphism */
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.4); /* Frosted glass border reflection */
    border-radius: 50%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.45);
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease;
}

.nav-arrow img {
    width: 26px; /* Larger arrow chevrons */
    height: 26px;
    object-fit: contain;
    filter: brightness(0) invert(1); /* White chevron */
    transition: transform 0.2s ease;
}

.arrow-left {
    left: 326px; /* Positioned on the left slide, closer to the center composition */
    transform: translateY(-50%) !important;
}

.arrow-right {
    left: 1338px; /* Positioned on the right slide, closer to the center composition */
    transform: translateY(-50%) rotate(180deg) !important;
}

.nav-arrow:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.75) 0%, rgba(245, 245, 245, 0.45) 100%);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.arrow-left:hover {
    transform: translateY(-50%) scale(1.08) !important;
}

.arrow-right:hover {
    transform: translateY(-50%) rotate(180deg) scale(1.08) !important;
}

.nav-arrow:hover img {
    transform: translateX(-2px);
}

.compo-descriptif-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 25px 20px;
    gap: 10px;
    position: absolute;
    width: 61.57%;
    height: auto;
    left: 19.21%;
    top: 630px;
    background: #FFFFFF;
    border: 1px solid #000000;
    border-radius: 0;
    box-sizing: border-box;
    z-index: 10;
    cursor: pointer;
    transition: box-shadow 0.3s ease;
}

.compo-descriptif-container:hover {
    box-shadow: 0px 8px 24px rgba(0, 0, 0, 0.08);
}

.compo-descriptif-text {
    width: 100%;
    height: auto;
    font-family: 'Source Code Pro', monospace;
    font-style: normal;
    font-weight: 400;
    font-size: 14px;
    line-height: 20px;
    color: #101010;
    text-align: left;
    margin: 0;
    white-space: pre-line;
    flex: none;
    order: 0;
    align-self: stretch;
    flex-grow: 0;
}

.compo-descriptif-text strong {
    font-size: 14px;
    font-weight: 600;
}

/* Down arrow button container */
.compo-bouton-tout-voir {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 0px;
    width: 22px;
    height: 13px;
    flex: none;
    order: 1;
    flex-grow: 0;
    transition: transform 0.3s ease;
}

.compo-descriptif-container:hover .compo-bouton-tout-voir {
    transform: translateY(-4px);
}

.compo-fluent-arrow {
    margin: 0 auto;
    width: 22px;
    height: 13px;
    transform: rotate(180deg);
    display: block;
}

.compo-fluent-arrow img {
    width: 100%;
    height: 100%;
    display: block;
    filter: brightness(0); /* Pure black arrow */
}

/* Footer Styles - White Background */
body.compo-dark-theme .site-footer {
    background-color: #FFFFFF !important;
    color: #101010 !important;
    max-width: 100% !important;
    padding: 70px 41px 70px !important;
}

/* Before/After Badges */
.slide-label {
    position: absolute;
    top: 24px;
    padding: 6px 14px;
    background: rgba(13, 13, 13, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #FFFFFF;
    font-family: 'Source Code Pro', monospace;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 30px;
    pointer-events: none;
    z-index: 9;
    user-select: none;
    transition: opacity 0.3s ease;
}

.label-before {
    left: 24px;
}

.label-after {
    right: 24px;
    z-index: 4; /* Behind the before wrapper but in front of after image */
}

/* Hide labels when actively dragging for a clean comparison */
.slide.dragging .slide-label {
    opacity: 0 !important;
}

/* Inactive side slides have faded badges */
.slide.state-left .slide-label,
.slide.state-right .slide-label {
    opacity: 0.4;
}

.compo-drag-hint {
    position: absolute;
    left: 895px; /* Shifted more to the right to align fingertip on double arrows */
    top: 325px;   /* Shifted more down to align fingertip on double arrows */
    z-index: 25;
    pointer-events: none;
    user-select: none;
    transform: scale(1);
    transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.compo-drag-hint.hidden {
    opacity: 0 !important;
    transform: scale(0.8);
}

.compo-drag-hint img {
    display: block;
    width: 75px; /* Larger click icon */
    height: auto;
    /* Translate the image so that the fingertip (at 30.7% width, 21.3% height) is at the center */
    transform: translate(-30.7%, -21.3%);
    transform-origin: 30.7% 21.3%;
    animation: handClick 1.6s infinite ease-in-out;
}

.compo-drag-hint .click-wave {
    position: absolute;
    left: 0;
    top: 0;
    width: 50px;
    height: 50px;
    margin-left: -25px;
    margin-top: -25px;
    border: 2px solid #101010;
    border-radius: 50%;
    pointer-events: none;
    transform: scale(0);
    opacity: 0;
    animation: clickWave 1.6s infinite cubic-bezier(0.1, 0.8, 0.3, 1);
}

@keyframes handClick {
    0%, 100% {
        transform: translate(-30.7%, -21.3%) scale(1);
    }
    30% {
        transform: translate(-30.7%, -21.3%) scale(1);
    }
    40% {
        transform: translate(-30.7%, -21.3%) scale(0.8); /* Press down */
    }
    50% {
        transform: translate(-30.7%, -21.3%) scale(1.05); /* Rebound */
    }
    60% {
        transform: translate(-30.7%, -21.3%) scale(1);
    }
}

@keyframes clickWave {
    0%, 35% {
        transform: scale(0);
        opacity: 0;
    }
    40% {
        transform: scale(0.2);
        opacity: 0.8;
    }
    100% {
        transform: scale(1.8);
        opacity: 0;
    }
}

/* Carousel Pagination Dots */
.compo-pagination {
    position: absolute;
    left: 50%;
    top: 590px;
    transform: translate(-50%, -50%);
    display: flex;
    gap: 12px;
    z-index: 20;
}

.compo-pagination-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: rgba(16, 16, 16, 0.25);
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.compo-pagination-dot:hover {
    background-color: rgba(16, 16, 16, 0.55);
}

.compo-pagination-dot.active {
    background-color: #101010;
    transform: scale(1.25);
}

/* DYNAMIC RESPONSIVE SCALING */
@media (min-width: 1441px) and (max-width: 1728px) {
    .compo-page-wrapper {
        height: calc(850px * (100vw / 1728));
        overflow-x: hidden;
        display: flex;
        justify-content: center;
    }
    
    .compo-layout-container {
        transform: scale(calc(100vw / 1728));
        transform-origin: top center;
        margin: 0;
        flex-shrink: 0;
    }
}

/* RESPONSIVE LAYOUT OVERRIDES (SMALL LAPTOPS, TABLETS & PHONES) */
@media (max-width: 1440px) {
    .compo-page-wrapper {
        height: auto !important;
        min-height: auto !important; /* Allow the content to determine height, removing blank spacing on tablets */
        overflow-y: visible !important;
    }

    .compo-layout-container {
        transform: none !important;
        width: 100% !important;
        height: auto !important;
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 80px 20px 15px !important;
        box-sizing: border-box !important;
    }

    /* Hide inactive slides */
    .slide {
        display: none !important;
        position: relative !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: auto !important;
        margin: 0 auto !important;
        border-radius: 8px;
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
        transition: none !important; /* Disable transition on mobile layout */
    }

    /* Show only the active centered slide */
    .slide.state-center {
        display: block !important;
    }

    /* Set exact aspect ratio for each slide to avoid image crop */
    .slide-shooting {
        aspect-ratio: 1183 / 1621 !important;
        max-width: 394px !important;
    }
    .slide-compo02 {
        aspect-ratio: 2438 / 1621 !important;
        max-width: 812px !important;
    }
    .slide-compo01 {
        aspect-ratio: 2593 / 1621 !important;
        max-width: 864px !important;
    }

    /* Set images to occupy 100% of the slide and scale properly */
    .slide-image {
        width: 100% !important;
        height: 100% !important;
        background-size: 100% 100% !important;
    }

    .image-before {
        width: 100cqw !important;
    }

    /* Hide edge gradients */
    .gradient-overlay {
        display: none !important;
    }

    /* Navigation Arrows: positioned relative to screen width, overlayed at vertical center of active slide area */
    .nav-arrow {
        position: absolute !important;
        top: 50% !important; /* Centré dynamiquement au centre vertical de l'image */
        width: 44px !important;
        height: 44px !important;
        z-index: 100 !important;
        /* Dark glassmorphism to contrast with light images and page background */
        background: rgba(16, 16, 16, 0.65) !important;
        backdrop-filter: blur(10px) !important;
        -webkit-backdrop-filter: blur(10px) !important;
        border: 1px solid rgba(255, 255, 255, 0.25) !important;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15) !important;
    }

    .nav-arrow img {
        filter: brightness(0) invert(1) !important;
        width: 18px !important;
        height: 18px !important;
    }

    .arrow-left {
        left: 10px !important;
        transform: translateY(-50%) !important;
    }

    .arrow-right {
        right: 10px !important;
        left: auto !important;
        transform: translateY(-50%) rotate(180deg) !important;
    }

    .nav-arrow:hover {
        transform: translateY(-50%) scale(1.05) !important;
        background: rgba(16, 16, 16, 0.8) !important;
    }
    
    .arrow-right:hover {
        transform: translateY(-50%) rotate(180deg) scale(1.05) !important;
    }

    /* Position navigation arrows outside the slide on larger tablet/laptop screens */
    @media (min-width: 769px) {
        .nav-arrow {
            /* Inherits top 50% !important */
        }
        .arrow-left {
            left: calc(50% - 470px) !important; /* Place just outside the max-width 864px slide */
            transform: translateY(-50%) !important;
        }
        .arrow-right {
            right: calc(50% - 470px) !important;
            left: auto !important;
            transform: translateY(-50%) rotate(180deg) !important;
        }
        
        /* If viewport is narrow and slide takes full width, keep arrows inside margins */
        @media (max-width: 980px) {
            .arrow-left { left: 20px !important; }
            .arrow-right { right: 20px !important; }
        }
    }

    /* Drag hint adjustments */
    .compo-drag-hint {
        transform: scale(0.8) !important;
    }

    /* Pagination Dots under the slide */
    .compo-pagination {
        position: relative !important;
        left: auto !important;
        top: auto !important;
        transform: none !important;
        margin: 24px 0 16px !important;
        display: flex;
        justify-content: center;
        gap: 12px;
        z-index: 20;
    }

    /* Description Card under the pagination */
    .compo-descriptif-container {
        position: relative !important;
        left: auto !important;
        top: auto !important;
        width: 100% !important;
        max-width: 812px !important; /* Expanded for small laptops/tablets */
        height: auto !important;
        background-image: none !important;
        background: #FFFFFF !important;
        border: 1px solid #101010 !important;
        border-radius: 4px;
        padding: 20px 16px !important;
        margin: 10px 0 10px !important;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04) !important;
        box-sizing: border-box !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
    }

    .site-footer {
        height: auto !important;
        padding: 20px 20px 40px !important;
        margin-top: 10px !important;
    }
    
    @media (max-width: 768px) {
        .compo-descriptif-container {
            max-width: 450px !important;
        }
    }

    .compo-descriptif-text {
        width: 100% !important;
        height: auto !important;
        font-size: 13px !important;
        line-height: 1.5em !important;
        text-align: left !important;
        white-space: pre-line !important;
    }

    .compo-bouton-tout-voir {
        margin-top: 12px !important;
    }
}

/* --- LIGHTBOX OVERLAY --- */
.compo-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(10, 10, 10, 0.95);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.4s ease;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.compo-lightbox-overlay.visible {
    opacity: 1;
}

/* Lightbox Close Button */
.compo-lightbox-close {
    position: absolute;
    top: 30px;
    right: 40px;
    background: transparent;
    border: none;
    color: #FFFFFF;
    font-size: 45px;
    font-family: 'Source Code Pro', monospace;
    cursor: pointer;
    z-index: 1010;
    transition: transform 0.2s ease, opacity 0.2s ease;
    opacity: 0.7;
}

.compo-lightbox-close:hover {
    transform: scale(1.1);
    opacity: 1;
}

/* Lightbox Slider Box */
.compo-lightbox-slider {
    position: relative;
    max-width: 90vw;
    max-height: 80vh;
    width: auto;
    height: auto;
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    overflow: hidden;
    container-type: inline-size;
    touch-action: none; /* Make dragging super smooth by blocking scroll */
}

/* Ensure images inside lightbox slider take full space */
.compo-lightbox-slider .slide-image {
    width: 100% !important;
    height: 100% !important;
    background-size: cover !important;
    background-position: center !important;
}

.compo-lightbox-slider .image-before {
    width: 100cqw !important;
}

/* Show slide bar and labels inside lightbox slider */
.compo-lightbox-slider .slide-bar {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

.compo-lightbox-slider .slide-label {
    opacity: 1 !important;
}

/* Hide labels when dragging in lightbox */
.compo-lightbox-slider.dragging .slide-label {
    opacity: 0 !important;
}

/* Touch and snappy transition optimizations for mobile/tablet */
@media (max-width: 1024px) {
    .nav-arrow,
    .compo-pagination-dot,
    .compo-descriptif-container,
    .compo-lightbox-close {
        transition-duration: 200ms !important;
        transition-delay: 0s !important;
        touch-action: manipulation !important;
    }

    .nav-arrow:active {
        opacity: 0.7 !important;
        transform: translateY(-50%) scale(0.9) !important;
        transition: none !important;
    }

    .arrow-right:active {
        transform: translateY(-50%) rotate(180deg) scale(0.9) !important;
    }

    .compo-descriptif-container:active {
        background-color: #f7f7f7 !important;
        transform: scale(0.98) !important;
        transition: none !important;
    }

    .compo-lightbox-close:active {
        opacity: 0.5 !important;
        transform: scale(0.9) !important;
        transition: none !important;
    }
}

