/* ==========================================================================
   STORY CAROUSEL COMPONENT
   ========================================================================== */

.story-container {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    overflow: hidden;
    background: transparent;
}

/* ----------------------------------
   DESKTOP (4 COLUMNS)
----------------------------------- */
.story-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.story-grid-5 {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
}

.story-slide {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    /* Soft dim on non-active desktop slides */
    opacity: 0.6;
    transition: opacity 0.3s ease, transform 0.3s ease;
    cursor: pointer;
    background: #000;
}

.story-slide.active {
    opacity: 1;
    transform: scale(1.02);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.story-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    aspect-ratio: 9/16; /* Typical story ratio */
}

/* Progress bar inside each card (Desktop) */
.story-progress-desktop {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    height: 4px;
    background: rgba(255,255,255,0.3);
    border-radius: 4px;
    z-index: 10;
    overflow: hidden;
}

.story-progress-desktop .progress-segment {
    width: 100%;
    height: 100%;
}

.story-progress-desktop .progress-fill {
    height: 100%;
    width: 0%;
    background: #fff;
    border-radius: 4px;
}

/* On Desktop we hide the global mobile progress and touch zones */
.story-progress-mobile {
    display: none;
}
.story-touch-zones {
    display: none;
}


/* ----------------------------------
   MOBILE (1 ITEM, INSTAGRAM STYLE)
----------------------------------- */
@media (max-width: 768px) {
    .story-container {
        position: relative;
        max-width: 400px;
        margin: 0 auto;
        border-radius: 16px;
        box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    }

    .story-grid, .story-grid-5 {
        display: block; /* Stack slides completely on top of each other */
        position: relative;
        aspect-ratio: 9/16; /* Keeps mobile portrait layout */
    }

    .story-slide {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        opacity: 0;
        transform: none !important;
        transition: opacity 0.4s ease;
        pointer-events: none;
    }

    .story-slide.active {
        opacity: 1;
    }

    /* Hide individual desktop progress bars */
    .story-progress-desktop {
        display: none;
    }

    /* Show Global Mobile Progress Bars */
    .story-progress-mobile {
        display: flex;
        position: absolute;
        top: 10px;
        left: 10px;
        right: 10px;
        gap: 5px;
        z-index: 20;
    }

    .story-progress-mobile .progress-segment {
        flex: 1;
        height: 3px;
        background: rgba(255,255,255,0.4);
        border-radius: 2px;
        overflow: hidden;
    }

    .story-progress-mobile .progress-fill {
        height: 100%;
        width: 0%;
        background: #fff;
        border-radius: 2px;
    }

    /* Completed segments stay full */
    .story-progress-mobile .progress-segment.completed .progress-fill {
        width: 100% !important;
        transition: none;
    }

    /* Touch Zones for clicking left/right */
    .story-touch-zones {
        display: flex;
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 15;
    }

    .touch-zone {
        height: 100%;
    }

    .touch-zone.left {
        width: 30%; /* Tapping left 30% goes back */
    }

    .touch-zone.right {
        width: 70%; /* Tapping right 70% goes forward */
    }
}
