/* ============================================
   Mission & Vision — Vertical Story design
   (resets, body, ai-background live in shared/base.css)
   ============================================ */

.story-main {
    position: relative;
    z-index: 1;
    padding-top: 110px;
    overflow: hidden;
}

/* ============================================
   01 / 02 / 03 SIDE RAIL  (vertical scroll progress)
   ============================================ */
.story-rail {
    position: fixed;
    top: 50%;
    right: 2.4rem;
    transform: translateY(-50%);
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 1rem;
    pointer-events: none; /* re-enabled on links */
}

.story-rail-line {
    position: relative;
    width: 1px;
    height: 240px;
    background: rgba(255, 255, 255, 0.08);
}

.story-rail-fill {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 0%;
    background: linear-gradient(180deg, #a855f7 0%, #6366f1 50%, #3b82f6 100%);
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.55);
    transition: height 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.story-rail-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 240px;
    pointer-events: auto;
}

.story-rail-link {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.45);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    transition: color 0.3s ease, transform 0.3s ease;
}

.story-rail-link:hover { color: #ffffff; transform: translateX(-2px); }

.rail-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

.rail-num {
    color: rgba(196, 181, 253, 0.55);
    transition: color 0.3s ease;
}

.rail-name { display: inline-block; }

.story-rail-link.is-active {
    color: #ffffff;
}
.story-rail-link.is-active .rail-num { color: #c4b5fd; }
.story-rail-link.is-active .rail-dot {
    background: linear-gradient(135deg, #a855f7, #3b82f6);
    border-color: rgba(168, 85, 247, 0.7);
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.7);
    transform: scale(1.4);
}

@media (max-width: 1100px) {
    .story-rail { display: none; }
}

/* ============================================
   PAGE INTRO
   ============================================ */
.story-intro {
    max-width: 1100px;
    margin: 0 auto;
    padding: 5rem 4rem 3rem;
    text-align: center;
}

.location-stamp {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.4rem 0.95rem 0.4rem 0.75rem;
    background: rgba(168, 85, 247, 0.08);
    border: 1px solid rgba(168, 85, 247, 0.22);
    border-radius: 100px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    color: rgba(221, 214, 254, 0.95);
    margin-bottom: 1.6rem;
}

.loc-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.65);
    animation: locDotPulse 2.4s ease-in-out infinite;
}

@keyframes locDotPulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
    50%      { opacity: 0.85; box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
}

.story-title {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(2.5rem, 5.4vw, 5rem);
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -0.025em;
    margin-bottom: 1.25rem;
    background: linear-gradient(135deg, #ffffff 0%, #e0e7ff 50%, #c4b5fd 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.story-lede {
    max-width: 620px;
    margin: 0 auto;
    font-size: 1.1rem;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.78);
}

/* ============================================
   STORY SECTION  (one per chapter)
   ============================================ */
.story-section {
    position: relative;
    max-width: 1280px;
    margin: 0 auto;
    padding: 7rem 4rem;
    overflow: hidden;
}

/* Soft horizontal divider between sections */
.story-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: min(60%, 700px);
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(168, 85, 247, 0.35), transparent);
}

/* Huge section number watermark */
.story-num {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-family: 'Outfit', sans-serif;
    font-size: clamp(13rem, 26vw, 24rem);
    font-weight: 900;
    line-height: 0.85;
    letter-spacing: -0.06em;
    pointer-events: none;
    -webkit-user-select: none;
    user-select: none;
    z-index: 0;
    background: linear-gradient(180deg,
        rgba(168, 85, 247, 0.08) 0%,
        rgba(99, 102, 241, 0.04) 50%,
        rgba(255, 255, 255, 0.0) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

/* Per-section watermark anchor: opposite side of the visual */
.story-num-01 { right: -2rem; }
.story-num-02 { left:  -2rem; }
.story-num-03 { right: -2rem; }

/* Two-column grid (text + visual). Flip swaps the order. */
.story-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5rem;
    align-items: center;
}

.story-section-flip .story-grid {
    direction: rtl; /* reverse column order */
}
.story-section-flip .story-grid > * {
    direction: ltr; /* restore content direction inside */
}

/* ----- Text column ----- */
.story-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
}

.story-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.95rem;
    background: rgba(168, 85, 247, 0.08);
    border: 1px solid rgba(168, 85, 247, 0.25);
    border-radius: 100px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #c4b5fd;
}

.story-h {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(2rem, 3.6vw, 3.4rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin: 0.5rem 0 0.5rem;
    background: linear-gradient(135deg, #ffffff 0%, #e0e7ff 60%, #c4b5fd 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.story-p {
    font-size: 1.1rem;
    line-height: 1.78;
    color: rgba(255, 255, 255, 0.78);
    max-width: 560px;
    margin: 0;
}

.story-p strong {
    color: #ffffff;
    font-weight: 600;
}

.story-p em {
    color: #c4b5fd;
    font-style: italic;
}

/* Stamps strip (under About) */
.story-stamps {
    list-style: none;
    padding: 0;
    margin: 1rem 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem 0.85rem;
}

.story-stamps li {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.95rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 100px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.85);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.stamp-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #a855f7;
    box-shadow: 0 0 6px rgba(168, 85, 247, 0.6);
}

.story-section-02 .stamp-dot { background: #6366f1; box-shadow: 0 0 6px rgba(99, 102, 241, 0.6); }
.story-section-03 .stamp-dot { background: #3b82f6; box-shadow: 0 0 6px rgba(59, 130, 246, 0.6); }

/* CTA at bottom of Vision */
.story-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.9rem 1.5rem;
    margin-top: 0.75rem;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    color: #ffffff;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    text-decoration: none;
    border-radius: 100px;
    box-shadow:
        0 4px 24px rgba(168, 85, 247, 0.4),
        inset 0 0 0 1px rgba(255, 255, 255, 0.12);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.story-cta:hover {
    transform: translateY(-2px);
    box-shadow:
        0 8px 36px rgba(168, 85, 247, 0.55),
        inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.story-cta svg, .story-cta i { width: 16px; height: 16px; transition: transform 0.3s ease; }
.story-cta:hover svg, .story-cta:hover i { transform: translateX(3px); }

/* ----- Visual column ----- */
.story-visual {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    max-width: 480px;
    justify-self: center;
}

.story-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

/* ============================================
   01 — Constellation animations
   ============================================ */
.cg-line {
    stroke-dashoffset: 0;
    animation: cgLineFlow 4s linear infinite;
}
.cg-line-2 { animation-duration: 5s; animation-direction: reverse; }
.cg-line-3 { animation-duration: 6s; }
.cg-line-4 { animation-duration: 4.5s; animation-direction: reverse; }

@keyframes cgLineFlow {
    to { stroke-dashoffset: -28; }
}

.cg-sat {
    transform-origin: center;
    transform-box: fill-box;
    animation: cgSatBob 5s ease-in-out infinite;
}
.cg-sat-1 { animation-delay: 0s;    transform-origin: 100px 100px; }
.cg-sat-2 { animation-delay: -1.2s; transform-origin: 380px 100px; }
.cg-sat-3 { animation-delay: -2.4s; transform-origin: 100px 380px; }
.cg-sat-4 { animation-delay: -3.6s; transform-origin: 380px 380px; }

@keyframes cgSatBob {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}

.cg-core {
    transform-origin: 240px 240px;
    transform-box: fill-box;
    animation: cgCorePulse 3.6s ease-in-out infinite;
}

@keyframes cgCorePulse {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 0 transparent); }
    50%      { transform: scale(1.06); filter: drop-shadow(0 0 12px rgba(168,85,247,0.6)); }
}

.cg-ring {
    transform-origin: 240px 240px;
    transform-box: fill-box;
    animation: cgRingSpin 38s linear infinite;
}

@keyframes cgRingSpin { to { transform: rotate(360deg); } }

/* ============================================
   02 — Trajectory animations
   ============================================ */
.tr-arc {
    /* JS draws this in on scroll-into-view (stroke-dashoffset 100 → 0).
       Fallback: visible if JS fails. */
    transition: stroke-dashoffset 1.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.story-section-02.is-revealed .tr-arc { stroke-dashoffset: 0; }

.tr-target {
    transform-box: fill-box;
    animation: trTargetPulse 2.4s ease-in-out infinite;
}

@keyframes trTargetPulse {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 0 transparent); }
    50%      { transform: scale(1.12); filter: drop-shadow(0 0 16px rgba(168,85,247,0.7)); }
}

.tr-way {
    transform-box: fill-box;
    animation: trWayBlink 2s ease-in-out infinite;
}
.tr-way-1 { animation-delay: 0s; transform-origin: 160px 280px; }
.tr-way-2 { animation-delay: -0.5s; transform-origin: 240px 200px; }
.tr-way-3 { animation-delay: -1s; transform-origin: 320px 140px; }

@keyframes trWayBlink {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50%      { opacity: 1;   transform: scale(1.5); }
}

/* ============================================
   03 — Horizon / Vision animations
   ============================================ */
.vh-sphere {
    transform-origin: 240px 280px;
    transform-box: fill-box;
    animation: vhSphereFloat 6s ease-in-out infinite;
}

@keyframes vhSphereFloat {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-10px); }
}

.star { animation: vhStarTwinkle 3s ease-in-out infinite; }
.star-2 { animation-delay: -0.4s; }
.star-3 { animation-delay: -0.8s; }
.star-4 { animation-delay: -1.2s; }
.star-5 { animation-delay: -1.6s; }
.star-6 { animation-delay: -2s;   }
.star-7 { animation-delay: -2.4s; }
.star-8 { animation-delay: -2.8s; }
.star-9 { animation-delay: -3s;   }

@keyframes vhStarTwinkle {
    0%, 100% { opacity: var(--star-base, 0.6); }
    50%      { opacity: 0.2; }
}

/* ============================================
   Reduced motion: hold all decorative loops still
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .cg-line, .cg-sat, .cg-core, .cg-ring,
    .tr-target, .tr-way,
    .vh-sphere, .star,
    .loc-dot {
        animation: none !important;
    }
    .tr-arc { stroke-dashoffset: 0 !important; }
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1100px) {
    .story-section { padding: 5rem 2rem; }
    .story-grid    { gap: 3rem; }
    .story-num     { font-size: clamp(10rem, 32vw, 18rem); opacity: 0.7; }
}

@media (max-width: 860px) {
    .story-section { padding: 4.5rem 1.5rem; }

    .story-intro { padding: 4rem 1.5rem 2rem; }

    .story-grid,
    .story-section-flip .story-grid {
        grid-template-columns: 1fr;
        gap: 2.5rem;
        direction: ltr;
        text-align: center;
    }

    .story-text { align-items: center; }
    .story-stamps { justify-content: center; }

    .story-visual { max-width: 360px; }

    .story-num-01,
    .story-num-02,
    .story-num-03 {
        right: auto;
        left: 50%;
        top: -1.5rem;
        transform: translateX(-50%);
        font-size: clamp(7rem, 30vw, 12rem);
    }
}
