/* story.css */

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: radial-gradient(circle at top, #101827 0, #020617 60%);
    font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    color: #f9fafb;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

/* Layout */
.page-wrapper {
    width: 100%;
    max-width: 1100px;
    padding: 24px 24px 32px;
}

/* Top bar */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    color: #e5e7eb;
}

.top-left {
    display: flex;
    flex-direction: column;
    gap: 4px; /* slightly reduced gap for mobile later */
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px; /* reduced height to save space */
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.4);
    color: #e5e7eb;
}

.story-title {
    font-size: 22px;
    font-weight: 600;
    margin: 0;
    max-width: none;        /* allow full title in desktop */
    white-space: normal;    /* wrap instead of truncate */
}

/* Right side controls */
.top-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-btn,
.close-btn {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 42, 0.9);
    display: inline-flex;
    justify-content: center;
    align-items: center;
    color: #e5e7eb;
    text-decoration: none;
    transition: all 0.2s ease;
}

.icon-btn {
    cursor: pointer;
    padding: 0;
}

.icon-btn:hover,
.close-btn:hover {
    background: rgba(15, 23, 42, 1);
    border-color: rgba(248, 250, 252, 0.8);
}

/* Story shell */
.story-shell {
    display: flex;
    justify-content: center;
}

.story-container {
    position: relative;
    width: 360px;
    height: 640px;
    background: #020617;
    overflow: hidden;
    border-radius: 28px;
    margin: 0 auto;
    box-shadow:
        0 30px 60px rgba(15, 23, 42, 0.8),
        0 0 0 1px rgba(15, 23, 42, 0.9);
}

/* Slides */
.slide {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: none;
    background: #000;
}

.slide.active {
    display: block;
}

.slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Gradients */
.gradient-top,
.gradient-bottom {
    position: absolute;
    left: 0;
    right: 0;
    pointer-events: none;
}

.gradient-top {
    top: 0;
    height: 150px;
    background: linear-gradient(to bottom, rgba(15, 23, 42, 0.9), transparent);
}

.gradient-bottom {
    bottom: 0;
    height: 240px;
    background: linear-gradient(to top, rgba(15, 23, 42, 0.95), transparent);
}

/* Overlay text */
.overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 18px;
    padding: 12px 18px 16px;
    color: #f9fafb;
    text-shadow: 0 8px 30px rgba(15, 23, 42, 0.9);
    background: linear-gradient(
        to top,
        rgba(15, 23, 42, 0.85) 0%,
        rgba(15, 23, 42, 0.65) 40%,
        transparent 100%
    );
    border-radius: 16px 16px 0 0;
}

.overlay h2 {
    margin: 0 0 6px;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.overlay p {
    margin: 0;
    font-size: 14px;
    line-height: 1.45;
    color: #e5e7eb;
    max-height: 4.2em;
    overflow: hidden;
}

/* Progress bars */
.progress-container {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    gap: 4px;
    z-index: 20;
}

.progress-bar {
    flex: 1;
    background: rgba(148, 163, 184, 0.28);
    height: 3px;
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #f97316, #fb7185);
    border-radius: inherit;
    transition: width 0.1s linear;
}

/* Related slide */
.related-content {
    width: 90%;
    max-width: 320px;
    text-align: left;
    margin: 24px auto 0 auto;
    color: #e5e7eb;
}

.related-content h2 {
    margin: 0 0 16px;
    font-size: 18px;
    font-weight: 700;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 18px;
}

.related-item {
    display: block;
    text-decoration: none;
    color: #f9fafb;
    border-radius: 16px;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(51, 65, 85, 0.6);
    backdrop-filter: blur(14px);
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.6);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.related-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 24px 55px rgba(15, 23, 42, 0.9);
    border-color: rgba(248, 250, 252, 0.85);
}

.related-thumb {
    width: 100%;
    height: 120px;
    overflow: hidden;
}

.related-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.related-title {
    display: block;
    padding: 8px 9px 10px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    max-height: 2.8em;
    overflow: hidden;
}

/* Back link */
.back-home {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #cbd5f5;
    text-decoration: none;
    opacity: 0.9;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.back-home:hover {
    opacity: 1;
    transform: translateX(-1px);
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(4px) scale(0.99);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Desktop arrows — fixed position, desktop only, zero mobile impact */
.desktop-arrow {
    display: none;
}

@media (min-width: 769px) {
    .desktop-arrow {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 50%;
        transform: translateY(-50%);
        width: 44px;
        height: 44px;
        border-radius: 50%;
        border: 2.5px solid rgba(255, 255, 255, 0.85);
        background: transparent;
        color: #ffffff;
        cursor: pointer;
        padding: 0;
        z-index: 100;
        transition: background 0.2s ease, transform 0.15s ease;
        filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5));
    }

    .arrow-prev {
        left: calc(50% - 180px - 14px - 44px); /* center minus half story width minus gap minus button width */
    }

    .arrow-next {
        left: calc(50% + 180px + 14px); /* center plus half story width plus gap */
    }

    .desktop-arrow:hover {
        background: rgba(255, 255, 255, 0.15);
        border-color: #ffffff;
        transform: translateY(-50%) scale(1.08);
    }

    .desktop-arrow:active {
        transform: translateY(-50%) scale(0.94);
    }

    .desktop-arrow i {
        font-size: 16px;
    }
}

/* Responsive */
@media (max-width: 768px) {
    body {
        align-items: flex-start;
    }

    .page-wrapper {
        padding: 12px 10px 18px;
    }

    .top-bar {
        margin-bottom: 10px;
    }

    .story-title {
        font-size: 18px;
        max-width: none;
        white-space: normal;
    }

    .story-container {
        width: 100%;
        max-width: 420px;
        height: calc(100vh - 90px);
        border-radius: 20px;
    }

    .badge {
        padding: 2px 8px;  /* smaller chip on mobile */
        font-size: 10px;
    }

    .top-right {
        gap: 6px;
    }
}