/* =====================================================
   Story — LunarStar Part 6: Our Story (Timeline Experience)
   - 品牌成长电影
   - 白色开场 → 横向滚动轨道 → 光球节点 → 开放式结尾
   - GSAP ScrollTrigger Horizontal Scroll
   ===================================================== */

/* ===== Section Container ===== */
.story-section {
    position: relative;
    height: 500svh;
    overflow: hidden;
    background: #fafaf9;
    transition: background 1.2s ease;
}

/* ===== Section-level background transition layers ===== */
.story-bg-layer {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    transition: opacity 1.8s ease;
}

.story-bg-white {
    background: #fafaf9;
    opacity: 1;
}

.story-bg-cosmic {
    background: 
        radial-gradient(ellipse 800px 600px at 30% 50%, rgba(140, 160, 220, 0.12), transparent),
        radial-gradient(ellipse 600px 400px at 70% 55%, rgba(180, 150, 210, 0.10), transparent),
        radial-gradient(ellipse at center, #f0eff5 0%, #e8e6f0 40%, #dedce8 100%);
    opacity: 0;
}

/* ===== Sticky wrapper (pinned by ScrollTrigger) ===== */
.story-sticky {
    position: sticky;
    top: 0;
    height: 100vh;
    width: 100%;
    overflow: hidden;
    z-index: 1;
}

/* ===== Horizontal scroll track ===== */
.story-track {
    display: flex;
    align-items: center;
    height: 100%;
    will-change: transform;
    position: relative;
}

/* =====================================================
   Phase 1: Hero Opening (White background + two lines)
   ===================================================== */

.story-hero {
    flex-shrink: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 10;
}

.story-hero-inner {
    text-align: center;
    max-width: 800px;
    padding: 0 2rem;
}

.story-hero-line {
    font-family: 'Noto Serif SC', Georgia, 'Times New Roman', serif;
    font-weight: 200;
    font-size: clamp(2.2rem, 5vw, 4rem);
    line-height: 1.35;
    color: #1a1a1a;
    letter-spacing: -0.01em;
    opacity: 0;
    transform: translateY(20px);
    filter: blur(6px);
}

.story-hero-line + .story-hero-line {
    margin-top: clamp(2rem, 4vw, 3.5rem);
}

.story-hero-line-2 {
    font-weight: 300;
    color: #444;
}

/* ===== Hero fade-out transition zone ===== */
.story-hero-fade {
    position: absolute;
    top: 0;
    left: 100vw;
    width: 40vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9;
    background: linear-gradient(to right, rgba(250,250,249,1) 0%, rgba(250,250,249,0) 100%);
}

/* =====================================================
   Phase 2: Timeline Track
   ===================================================== */

.story-timeline-wrap {
    flex-shrink: 0;
    height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    z-index: 5;
}

/* ===== SVG Trajectory ===== */
.story-trajectory-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.story-trajectory-path {
    fill: none;
    stroke: rgba(140, 130, 180, 0.35);
    stroke-width: 1.5;
    stroke-dasharray: 6 4;
    stroke-linecap: round;
}

.story-trajectory-glow {
    fill: none;
    stroke: rgba(160, 145, 200, 0.18);
    stroke-width: 8;
    stroke-linecap: round;
    filter: blur(6px);
}

/* ===== Trail reveal (animated stroke) ===== */
.story-trail-reveal {
    fill: none;
    stroke: rgba(180, 160, 220, 0.6);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-dasharray: var(--trail-length);
    stroke-dashoffset: var(--trail-length);
}

/* =====================================================
   Orb Nodes
   ===================================================== */

.story-node {
    position: absolute;
    z-index: 10;
    transform: translate(-50%, -50%);
    cursor: pointer;
    user-select: none;
}

/* Orb core */
.story-orb-core {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, 
        rgba(255, 255, 255, 0.95),
        rgba(200, 185, 230, 0.8) 40%,
        rgba(150, 130, 195, 0.5) 100%
    );
    box-shadow:
        0 0 8px rgba(200, 185, 230, 0.6),
        0 0 20px rgba(170, 150, 210, 0.35),
        0 0 40px rgba(140, 120, 190, 0.15);
    margin: 0 auto;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.5s ease;
}

/* Orb aura ring */
.story-orb-aura {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(180, 165, 215, 0.25);
    opacity: 0;
    transition: all 0.6s ease;
}

/* Orb pulse ring */
.story-orb-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid rgba(200, 180, 230, 0.3);
    animation: orbPulse 3s ease-in-out infinite;
}

@keyframes orbPulse {
    0%, 100% {
        width: 18px;
        height: 18px;
        opacity: 0.5;
    }
    50% {
        width: 48px;
        height: 48px;
        opacity: 0;
    }
}

/* ===== Orb hover state ===== */
.story-node:hover .story-orb-core,
.story-node.active .story-orb-core {
    transform: scale(1.8);
    box-shadow:
        0 0 16px rgba(210, 195, 240, 0.8),
        0 0 32px rgba(180, 160, 220, 0.5),
        0 0 60px rgba(150, 130, 200, 0.3),
        0 0 90px rgba(130, 110, 185, 0.15);
    background: radial-gradient(circle at 40% 35%, 
        rgba(255, 255, 255, 1),
        rgba(220, 200, 245, 0.9) 40%,
        rgba(180, 155, 215, 0.6) 100%
    );
}

.story-node:hover .story-orb-aura,
.story-node.active .story-orb-aura {
    opacity: 1;
    width: 64px;
    height: 64px;
    border-color: rgba(200, 180, 225, 0.5);
}

/* ===== Orb label (below orb) ===== */
.story-orb-label {
    position: absolute;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    font-family: 'Noto Serif SC', Georgia, serif;
    font-size: 0.75rem;
    font-weight: 400;
    color: rgba(80, 70, 100, 0.6);
    letter-spacing: 0.04em;
    transition: all 0.4s ease;
    opacity: 0.7;
}

.story-node:hover .story-orb-label,
.story-node.active .story-orb-label {
    opacity: 1;
    color: rgba(60, 50, 80, 0.9);
    transform: translateX(-50%) translateY(2px);
}

/* =====================================================
   Orb Expanded Content (on click)
   ===================================================== */

.story-orb-content {
    position: fixed;
    z-index: 100;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(180, 160, 210, 0.2);
    border-radius: 20px;
    padding: 2rem 2.2rem;
    min-width: 300px;
    max-width: 420px;
    box-shadow: 
        0 4px 30px rgba(0,0,0,0.06),
        0 1px 4px rgba(0,0,0,0.04);
}

.story-orb-content.visible {
    opacity: 1;
    pointer-events: auto;
}

.story-orb-content-year {
    font-family: 'Noto Serif SC', Georgia, serif;
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(140, 120, 190, 0.8);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 0.8rem;
}

.story-orb-content-title {
    font-family: 'Noto Serif SC', Georgia, serif;
    font-size: 1.5rem;
    font-weight: 400;
    color: #1a1a1a;
    line-height: 1.3;
    margin-bottom: 0.6rem;
}

.story-orb-content-text {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Noto Serif SC', sans-serif;
    font-size: 0.95rem;
    font-weight: 300;
    color: #555;
    line-height: 1.65;
}

.story-orb-content-close {
    position: absolute;
    top: 0.8rem;
    right: 1rem;
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(0,0,0,0.04);
    border-radius: 50%;
    color: #999;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.story-orb-content-close:hover {
    background: rgba(0,0,0,0.08);
    color: #444;
}

/* =====================================================
   Phase 3: Ending
   ===================================================== */

.story-ending {
    flex-shrink: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 10;
    padding: 0 2rem;
}

.story-ending-line {
    font-family: 'Noto Serif SC', Georgia, 'Times New Roman', serif;
    font-weight: 200;
    font-size: clamp(1.8rem, 4vw, 3.2rem);
    line-height: 1.4;
    color: #1a1a1a;
    text-align: center;
    letter-spacing: -0.01em;
    opacity: 0;
    transform: translateY(20px);
}

.story-ending-cta {
    margin-top: 2.5rem;
    opacity: 0;
    transform: translateY(16px);
}

.story-ending-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 36px;
    border: 1.5px solid rgba(140, 120, 185, 0.5);
    background: transparent;
    border-radius: 40px;
    font-family: 'Noto Serif SC', Georgia, serif;
    font-size: 1rem;
    font-weight: 400;
    color: #333;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    letter-spacing: 0.02em;
}

.story-ending-btn:hover {
    background: rgba(160, 140, 200, 0.08);
    border-color: rgba(160, 140, 200, 0.7);
    color: rgba(100, 80, 140, 1);
    box-shadow: 0 0 20px rgba(160, 140, 200, 0.15);
    transform: translateY(-2px);
}

.story-ending-btn-arrow {
    display: inline-block;
    transition: transform 0.3s ease;
    font-size: 0.9rem;
}

.story-ending-btn:hover .story-ending-btn-arrow {
    transform: translateX(4px);
}

/* ===== Trajectory continues off-screen ===== */
.story-ending-trail {
    position: absolute;
    right: -200px;
    top: 50%;
    height: 2px;
    background: linear-gradient(to right, 
        rgba(180, 160, 220, 0.4),
        rgba(180, 160, 220, 0.05)
    );
    width: 300px;
    z-index: 1;
    pointer-events: none;
}

.story-ending-dot {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(160, 140, 200, 0.3);
}

.story-ending-dot:nth-child(1) { right: 40px; }
.story-ending-dot:nth-child(2) { right: 100px; opacity: 0.6; }
.story-ending-dot:nth-child(3) { right: 170px; opacity: 0.3; }
.story-ending-dot:nth-child(4) { right: 250px; opacity: 0.1; }

/* =====================================================
   Active node indicator (timeline marker)
   ===================================================== */

.story-timeline-progress {
    position: fixed;
    bottom: 2.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 6px;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.story-progress-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(160, 140, 200, 0.3);
    transition: all 0.3s ease;
}

.story-progress-dot.active {
    background: rgba(180, 155, 220, 0.8);
    box-shadow: 0 0 8px rgba(180, 155, 220, 0.5);
    transform: scale(1.3);
}

/* =====================================================
   Responsive
   ===================================================== */

@media (max-width: 768px) {
    .story-section {
        height: 400svh;
    }

    .story-hero-line {
        font-size: clamp(1.8rem, 6vw, 2.6rem);
    }

    .story-orb-core {
        width: 14px;
        height: 14px;
    }

    .story-orb-label {
        font-size: 0.7rem;
    }

    .story-orb-content {
        min-width: 260px;
        max-width: 340px;
        padding: 1.5rem;
    }

    .story-orb-content-title {
        font-size: 1.2rem;
    }

    .story-orb-content-text {
        font-size: 0.85rem;
    }

    .story-ending-line {
        font-size: clamp(1.4rem, 5vw, 2.4rem);
    }

    .story-timeline-progress {
        bottom: 1.5rem;
    }

    .story-progress-dot {
        width: 5px;
        height: 5px;
    }
}

@media (max-width: 480px) {
    .story-orb-content {
        min-width: 240px;
        max-width: 300px;
        padding: 1.2rem;
        border-radius: 16px;
    }

    .story-endin-btn {
        padding: 12px 28px;
        font-size: 0.9rem;
    }
}
