/* Container */
.aivah-swg-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: #000;
}
.aivah-swg-container .swiper-wrapper {
    height: 100vh;
}
.aivah-swg-container::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    background: rgba(255, 255, 255, 0.1); /* Central horizontal line */
    z-index: 15;
    pointer-events: none;
}
.aivah-swg-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 1px;
    height: 100%;
    background: rgba(255, 255, 255, 0.1); /* Central vertical line */
    z-index: 15;
    pointer-events: none;
}

/* 5% and 95% Grid Lines */
.aivah-swg-container .swiper-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 5%;
    width: 1px;
    height: 100%;
    background: rgba(255, 255, 255, 0.1); /* 5% vertical line */
    z-index: 15;
    pointer-events: none;
}
.aivah-swg-container .swiper-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    left: 95%;
    width: 1px;
    height: 100%;
    background: rgba(255, 255, 255, 0.1); /* 95% vertical line */
    z-index: 15;
    pointer-events: none;
}

/* Slides */
.aivah-swg-slide {
    width: 100%;
    height: 100%;
    position: relative;
}

/* Post Navigation */
.aivah-swg-post-nav {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
	margin-top: -20px;
    transform: translateY(-50%);
    z-index: 20;
    pointer-events: none;
}
.aivah-swg-post-prev {
    position: absolute;
    left: 40px;
}
.aivah-swg-post-next {
    position: absolute;
    right: 40px;
}
.aivah-swg-post-prev,
.aivah-swg-post-next {
    display: flex;
    align-items: center;
    gap: 15px;
    color: #fff;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: all 0.3s ease;
    pointer-events: auto;
}
.aivah-swg-post-prev:hover,
.aivah-swg-post-next:hover {
    color: #00e5ff;
}
.aivah-swg-post-prev svg,
.aivah-swg-post-next svg {
    transition: transform 0.3s ease;
}
.aivah-swg-post-prev:hover svg {
    transform: translateX(-5px);
}
.aivah-swg-post-next:hover svg {
    transform: translateX(5px);
}

.aivah-swg-slices {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Disable Swiper fade opacity so clip-path handles visibility, 
   but allow a microscopic opacity change (0.99 to 1) so the browser fires 
   the transitionend event and Swiper doesn't freeze! */
.aivah-swg-container .swiper-slide {
    opacity: 0.99 !important;
    visibility: visible !important;
}
.aivah-swg-container .swiper-slide-active {
    opacity: 1 !important;
}

/* Because slides are always visible for the slice animation, we must manually fade the video wrapper */
.aivah-swg-video-wrapper {
    opacity: 0;
    visibility: hidden;
    transition: opacity 1s ease, visibility 1s ease;
}
.swiper-slide-active .aivah-swg-video-wrapper {
    opacity: 1;
    visibility: visible;
}

.aivah-swg-slice {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 1;
    transition: clip-path 1s cubic-bezier(0.77, 0, 0.175, 1);
}

/* Base state (Prev State / Hidden Left for Top, Hidden Right for Bottom) - Collapsed OUT */
/* Top Row: Collapsed to Left */
.slice-1 { clip-path: polygon(0 0, 0 0, 0 50.1%, 0 50.1%); transition-delay: 0s; }
.slice-2 { clip-path: polygon(5% 0, 5% 0, 5% 50.1%, 5% 50.1%); transition-delay: 0s; }
.slice-3 { clip-path: polygon(50% 0, 50% 0, 50% 50.1%, 50% 50.1%); transition-delay: 0s; }
.slice-4 { clip-path: polygon(95% 0, 95% 0, 95% 50.1%, 95% 50.1%); transition-delay: 0s; }

/* Bottom Row: Collapsed to Right */
.slice-5 { clip-path: polygon(5.1% 50%, 5.1% 50%, 5.1% 100%, 5.1% 100%); transition-delay: 0s; }
.slice-6 { clip-path: polygon(50.1% 50%, 50.1% 50%, 50.1% 100%, 50.1% 100%); transition-delay: 0s; }
.slice-7 { clip-path: polygon(95.1% 50%, 95.1% 50%, 95.1% 100%, 95.1% 100%); transition-delay: 0s; }
.slice-8 { clip-path: polygon(100% 50%, 100% 50%, 100% 100%, 100% 100%); transition-delay: 0s; }

/* Next State (Hidden Right for Top, Hidden Left for Bottom) - Waiting to scrub IN */
/* Top Row: Anchored Right */
.swiper-slide-next .slice-1 { clip-path: polygon(5.1% 0, 5.1% 0, 5.1% 50.1%, 5.1% 50.1%); }
.swiper-slide-next .slice-2 { clip-path: polygon(50.1% 0, 50.1% 0, 50.1% 50.1%, 50.1% 50.1%); }
.swiper-slide-next .slice-3 { clip-path: polygon(95.1% 0, 95.1% 0, 95.1% 50.1%, 95.1% 50.1%); }
.swiper-slide-next .slice-4 { clip-path: polygon(100% 0, 100% 0, 100% 50.1%, 100% 50.1%); }

/* Bottom Row: Anchored Left */
.swiper-slide-next .slice-5 { clip-path: polygon(0 50%, 0 50%, 0 100%, 0 100%); }
.swiper-slide-next .slice-6 { clip-path: polygon(5% 50%, 5% 50%, 5% 100%, 5% 100%); }
.swiper-slide-next .slice-7 { clip-path: polygon(50% 50%, 50% 50%, 50% 100%, 50% 100%); }
.swiper-slide-next .slice-8 { clip-path: polygon(95% 50%, 95% 50%, 95% 100%, 95% 100%); }

/* Active states (Scrub IN to Full Width) */
.swiper-slide-active .aivah-swg-slice {
    transition: clip-path 1s cubic-bezier(0.77, 0, 0.175, 1);
}

.swiper-slide-active .slice-1 { clip-path: polygon(0 0, 5.1% 0, 5.1% 50.1%, 0 50.1%); transition-delay: calc(1.2s + var(--aivah-gap, 1000ms)); }
.swiper-slide-active .slice-2 { clip-path: polygon(5% 0, 50.1% 0, 50.1% 50.1%, 5% 50.1%); transition-delay: calc(1.2s + var(--aivah-gap, 1000ms)); }
.swiper-slide-active .slice-3 { clip-path: polygon(50% 0, 95.1% 0, 95.1% 50.1%, 50% 50.1%); transition-delay: calc(1.2s + var(--aivah-gap, 1000ms)); }
.swiper-slide-active .slice-4 { clip-path: polygon(95% 0, 100% 0, 100% 50.1%, 95% 50.1%); transition-delay: calc(1.2s + var(--aivah-gap, 1000ms)); }

.swiper-slide-active .slice-5 { clip-path: polygon(0 50%, 5.1% 50%, 5.1% 100%, 0 100%); transition-delay: calc(1.2s + var(--aivah-gap, 1000ms)); }
.swiper-slide-active .slice-6 { clip-path: polygon(5% 50%, 50.1% 50%, 50.1% 100%, 5% 100%); transition-delay: calc(1.2s + var(--aivah-gap, 1000ms)); }
.swiper-slide-active .slice-7 { clip-path: polygon(50% 50%, 95.1% 50%, 95.1% 100%, 50% 100%); transition-delay: calc(1.2s + var(--aivah-gap, 1000ms)); }
.swiper-slide-active .slice-8 { clip-path: polygon(95% 50%, 100% 50%, 100% 100%, 95% 100%); transition-delay: calc(1.2s + var(--aivah-gap, 1000ms)); }

/* Overlay */
.aivah-swg-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 35vh;
    background: linear-gradient(0deg, #000000 0%, rgba(0,0,0,0) 100%);
    z-index: 9999 !important;
    display: flex;
    align-items: flex-end;
    padding: 40px;
    box-sizing: border-box;
    pointer-events: none !important;
}

/* Controls Wrapper */
.aivah-swg-controls-wrapper {
    display: flex;
    align-items: center;
    width: 100%;
    position: relative;
    pointer-events: auto !important;
    z-index: 10000 !important;
}

/* Arrows */
.aivah-swg-arrows {
    display: flex;
    gap: 15px;
    margin-right: 30px;
    z-index: 11;
}

.aivah-swg-prev,
.aivah-swg-next {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.aivah-swg-prev:hover,
.aivah-swg-next:hover {
    border-color: #00e5ff;
    color: #00e5ff;
    transform: scale(1.05);
}

.aivah-swg-prev svg,
.aivah-swg-next svg {
    width: 20px;
    height: 20px;
    pointer-events: none;
}

/* Content (Title & Meta) */
.aivah-swg-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    z-index: 11;
}

.aivah-swg-title {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 5px 0;
    line-height: 1.2;
}

.aivah-swg-meta {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
}

/* Pagination */
.aivah-swg-pagination {
    position: absolute;
    bottom: 50% !important;
    margin-bottom: 8px;
    z-index: 11;
    /* Let Swiper handle width, flex, and transform for dynamicBullets */
}

.swiper-pagination-bullet {
    width: 8px;
    height: 8px;
    margin: 0 4px !important;
    background: rgba(255, 255, 255, 0.4);
    opacity: 1;
    border-radius: 50%;
    transition: all 0.3s ease;
    vertical-align: middle !important;
    display: inline-block;
}

.swiper-pagination-bullet-active {
    background: #00e5ff;
    transform: scale(1.2);
}

/* EXIF */
.aivah-swg-exif-wrapper {
    margin-left: auto;
    z-index: 11;
}

.aivah-swg-exif {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 30px;
    align-items: center;
}

.aivah-swg-exif li {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    font-family: inherit;
    border-left: 1px solid rgba(255, 255, 255, 0.2);
    padding-left: 30px;
}

.aivah-swg-exif li:first-child {
    border-left: none;
    padding-left: 0;
}

.aivah-swg-exif li svg {
    opacity: 0.6;
    width: 16px;
    height: 16px;
}

/* Divider Line */
.aivah-swg-controls-wrapper::before {
    content: '';
    position: absolute;
    top: -40px;
    left: 0;
    width: 100%;
    height: 1px;
    background: rgba(255, 255, 255, 0.15);
}

/* Responsive */
@media (max-width: 1024px) {
    .aivah-swg-exif {
        gap: 15px;
    }
    .aivah-swg-exif li {
        padding-left: 15px;
    }
}

@media (max-width: 767px) {
    /* Hide post navigation on mobile if toggle enabled */
    .aivah-swg-container.aivah-swg-hide-post-nav-mobile .aivah-swg-post-nav {
        display: none !important;
    }

    /* Hide background grid lines on mobile */
    .aivah-swg-container::before,
    .aivah-swg-container::after,
    .aivah-swg-container .swiper-wrapper::before,
    .aivah-swg-container .swiper-wrapper::after {
        display: none !important;
    }

    .aivah-swg-container {
        display: flex;
        flex-direction: column;
        height: 100vh;
        z-index: 1 !important;
    }

    .aivah-swg-container .swiper-wrapper {
        height: 100vh !important;
    }

    .aivah-swg-overlay {
        position: absolute !important;
        height: 35vh !important;
        min-height: 0 !important;
        background: linear-gradient(0deg, #000000 10%, rgba(0,0,0,0) 100%) !important;
        padding: 30px 40px !important;
        display: flex !important;
        align-items: flex-start !important;
        bottom: 0 !important;
        z-index: 10 !important;
    }

    .aivah-swg-controls-wrapper {
        height: 100% !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        justify-content: flex-start !important;
        gap: 15px !important;
    }

    .aivah-swg-controls-wrapper::before {
        top: -30px !important; /* Divider line at the top border of bottom area */
        left: -40px !important;
        width: calc(100% + 80px) !important;
    }

    .aivah-swg-pagination {
        position: relative !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        margin-top: 5px !important;
        margin-bottom: 0 !important;
        bottom: 0 !important;
    }

    .aivah-swg-exif-wrapper {
        display: none !important;
    }

    .aivah-swg-arrows {
        margin-right: 0;
        margin-bottom: 5px;
    }
}
/* Custom Video Controls */
.aivah-swg-video-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
}
.aivah-swg-video-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: contain !important;
    display: block;
}
.aivah-swg-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    cursor: pointer;
    z-index: 10001;
    opacity: 0.8;
    transition: opacity 0.3s;
    pointer-events: none; /* Let clicks pass to wrapper */
}
.swiper-slide:not(.swiper-slide-active) {
    pointer-events: none !important;
}
.swiper-slide:not(.swiper-slide-active) .aivah-swg-play-btn {
    opacity: 0 !important;
    display: none !important;
}
.aivah-swg-video-wrapper.is-playing .aivah-swg-play-btn {
    opacity: 0;
}
.aivah-swg-video-wrapper.is-playing.mouse-moving .aivah-swg-play-btn {
    opacity: 0.8;
}
.aivah-swg-play-btn svg {
    width: 100%;
    height: 100%;
    fill: #fff;
}
.aivah-swg-play-btn .icon-pause {
    display: none;
}
.aivah-swg-video-wrapper.is-playing .icon-play {
    display: none;
}
.aivah-swg-video-wrapper.is-playing .icon-pause {
    display: block;
}

/* Thumbnails Navigation */
.aivah-swg-thumbnails {
    position: absolute;
    bottom: calc(100% + 20px);
    left: 0;
    width: 100%;
    display: flex;
    gap: 10px;
    justify-content: center;
    z-index: 12;
    pointer-events: auto;
    flex-wrap: nowrap !important;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Hide scrollbar in Firefox */
    -ms-overflow-style: none; /* Hide scrollbar in IE/Edge */
    box-sizing: border-box;
    padding-left: 20px;
    padding-right: 20px;
}

.aivah-swg-thumbnails::-webkit-scrollbar {
    display: none; /* Hide scrollbar in Chrome, Safari, Opera */
}

.aivah-swg-thumbnail-item {
    width: 64px;
    height: 42px;
    cursor: pointer;
    overflow: hidden;
    position: relative;
    border-style: solid;
    border-width: 1px;
    border-color: rgba(255, 255, 255, 0.3);
    opacity: 0.6;
    transition: all 0.3s ease;
    box-sizing: border-box;
    flex-shrink: 0;
}

.aivah-swg-thumbnail-item:hover {
    opacity: 0.9;
    border-color: rgba(255, 255, 255, 0.8);
}

.aivah-swg-thumbnail-item.is-active {
    opacity: 1;
    border-color: #00e5ff;
}

.aivah-swg-thumbnail-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Video Thumbnail Placeholder (No thumbnail, black background, white play icon) */
.aivah-swg-thumb-video-placeholder {
    width: 100%;
    height: 100%;
    background-color: #000000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.aivah-swg-thumb-video-placeholder svg {
    width: 20px;
    height: 20px;
    display: block;
}

/* Responsive adjustment for Mobile */
@media (max-width: 767px) {
    .aivah-swg-thumbnails {
        position: relative !important;
        bottom: auto !important;
        left: auto !important;
        width: 100% !important;
        margin-top: 15px !important;
        margin-bottom: 5px !important;
        order: -1;
        justify-content: center !important;
    }
}

