/* ================================
   VIDEO_CAROUSEL.CSS - Mixed Gallery Carousel Styles
   ================================
   Styles for the scrolling carousel on the landing page
   Left/Right: Image posts | Middle: Videos
*/

/* Scrolling Posts Preview Container */
.scrolling-posts-container {
    /* Scroll Animation Timing (unitless for calc) */
    --scroll-left: 45;
    --scroll-middle: 85;
    --scroll-right: 70;
    --desktop-factor: 1.5; /* Desktop duration = base * this factor */
    
    /* Video enlargement scale and derived push for adjacent videos */
    --video-scale: 1.06;
    --video-push: calc((var(--video-scale) - 1) / 2 * 100%);
    
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 0px;
    margin-bottom: 60px;
    width: 100%;
    height: 700px;
    position: relative;
    overflow: hidden;
    contain: layout style paint;
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 5%, black 95%, transparent 100%),
                       linear-gradient(to bottom, transparent 0%, black 10%, black 90%, transparent 100%);
    -webkit-mask-composite: source-in;
    mask-image: linear-gradient(to right, transparent 0%, black 5%, black 95%, transparent 100%),
               linear-gradient(to bottom, transparent 0%, black 10%, black 90%, transparent 100%);
    mask-composite: intersect;
}

@media (min-width: 1024px) {
    .scrolling-posts-container {
        max-width: 960px;
        margin-left: auto;
        margin-right: auto;
    }
}

/* Scrolling Columns */
.scrolling-column {
    flex: 0 0 160px;
    position: relative;
    overflow: visible;
    clip-path: inset(-20px);
    contain: layout style;
}

.scrolling-column.middle {
    flex: 0 0 180px;
}

@media (min-width: 768px) {
    .scrolling-column {
        flex-basis: 200px;
    }
    .scrolling-column.middle {
        flex-basis: 220px;
    }
}

@media (min-width: 1024px) {
    .scrolling-column {
        flex-basis: 240px;
    }
    .scrolling-column.middle {
        flex-basis: 280px;
    }
}

/* Posts Wrapper - Contains the scrolling cards */
.posts-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
    will-change: transform;
    contain: layout style;
}

.scrolling-column.left .posts-wrapper {
    animation: scrollUp calc(var(--scroll-left) * 1s) linear infinite running;
}

.scrolling-column.right .posts-wrapper {
    animation: scrollUp calc(var(--scroll-right) * 1s) linear infinite running;
}

.scrolling-column.middle .posts-wrapper {
    animation: scrollDown calc(var(--scroll-middle) * 1s) linear infinite running;
}

@media (min-width: 769px) {
    .scrolling-column.left .posts-wrapper {
        animation-duration: calc(var(--scroll-left) * var(--desktop-factor) * 1s);
    }
    
    .scrolling-column.right .posts-wrapper {
        animation-duration: calc(var(--scroll-right) * var(--desktop-factor) * 1s);
    }
    
    .scrolling-column.middle .posts-wrapper {
        animation-duration: calc(var(--scroll-middle) * var(--desktop-factor) * 1s);
    }
}

@keyframes scrollUp {
    from { transform: translate3d(0, 0, 0); }
    to { transform: translate3d(0, -50%, 0); }
}


@keyframes scrollDown {
    from { transform: translate3d(0, -50%, 0); }
    to { transform: translate3d(0, 0, 0); }
}

@media (hover: hover) {
    .scrolling-column:hover .posts-wrapper {
        animation-play-state: paused;
    }
}

.scrolling-column:has(.video-active) .posts-wrapper,
.scrolling-column:has(.image-active) .posts-wrapper {
    animation-play-state: paused;
}

/* Preview Post Card */
.preview-post-card {
    contain: layout style paint;
}

/* Image Post Card (with caption) */
.image-post-card {
    background: linear-gradient(145deg, #1e1e2e 0%, #13131d 100%);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    position: relative;
    transition: transform 0.3s ease-out;
}

/* Desktop: enlarge on hover */
@media (hover: hover) {
    .image-post-card:hover {
        z-index: 10;
        transform: scale(var(--video-scale));
    }
    
    .image-post-card:hover .post-caption {
        max-height: 150px;
    }
    
    .image-post-card:hover .post-caption::after {
        opacity: 0;
    }
}

/* Mobile: enlarge when active */
@media (hover: none) {
    .image-post-card.image-active {
        z-index: 10;
        transform: scale(var(--video-scale));
    }
    
    .image-post-card.image-active .post-caption {
        max-height: 150px;
    }
    
    .image-post-card.image-active .post-caption::after {
        opacity: 0;
    }
}

/* Push all siblings up/down when a card is active */
.image-post-card.push-up {
    transform: translateY(calc(-1 * var(--video-push)));
}

.image-post-card.push-down {
    transform: translateY(var(--video-push));
}

/* Preview Post Image */
.preview-post-img {
    width: 100%;
    display: block;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

/* Caption Container */
.post-caption {
    padding: 12px 14px;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 11px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.85);
    max-height: 90px;
    overflow: hidden;
    position: relative;
    text-align: left;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    transition: max-height 0.3s ease-out;
}

.post-caption[dir="rtl"] {
    text-align: right;
}

/* Caption fade-out at bottom */
.post-caption::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: linear-gradient(to bottom, transparent, #13131d);
    pointer-events: none;
    transition: opacity 0.3s ease-out;
}

/* Hashtags styling */
.post-caption-text {
    display: block;
}

@media (min-width: 768px) {
    .post-caption {
        padding: 14px 16px;
        font-size: 12px;
        max-height: 100px;
    }
    
    .image-post-card {
        border-radius: 18px;
    }
}

@media (min-width: 1024px) {
    .post-caption {
        padding: 16px 18px;
        font-size: 13px;
        max-height: 110px;
    }
    
    .image-post-card {
        border-radius: 20px;
    }
}

/* Video Card */
.video-card {
    cursor: pointer;
    position: relative;
    transition: transform 0.3s ease-out;
}

/* Desktop: enlarge on hover */
@media (hover: hover) {
    .video-card:hover {
        z-index: 10;
        transform: scale(var(--video-scale));
    }
}

/* Mobile: enlarge when active */
@media (hover: none) {
    .video-card.video-active {
        z-index: 10;
        transform: scale(var(--video-scale));
    }
}

/* Push all siblings up/down when a card is active */
.video-card.push-up {
    transform: translateY(calc(-1 * var(--video-push)));
}

.video-card.push-down {
    transform: translateY(var(--video-push));
}

/* Preview Post Video */
.preview-post-video {
    width: 100%;
    display: block;
    aspect-ratio: 9 / 16;
    object-fit: cover;
    border-radius: 12px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #1a1a2e 100%);
    background-size: 200% 200%;
    animation: videoLoading 2s ease-in-out infinite;
    contain: strict;
}

.preview-post-video.video-loaded {
    animation: none;
    background: #000;
}

@keyframes videoLoading {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}
