/* ============================================
   ECP360 Nexus — AI-Powered Ecosystem
   ============================================ */

.nexus-page {
    --nx-r: 168;
    --nx-g: 85;
    --nx-b: 247;
    --nx-accent: rgb(var(--nx-r), var(--nx-g), var(--nx-b));
    --nx-accent-soft: rgba(var(--nx-r), var(--nx-g), var(--nx-b), 0.14);
}

.nexus-main {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    min-height: 100dvh;
    padding-top: 5.5rem;
}

/* ---- Stage: center NEXUS + split layout ---- */
.nexus-stage {
    position: relative;
    min-height: calc(100vh - 5.5rem);
    min-height: calc(100dvh - 5.5rem);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 2rem 0 3rem;
    width: 100%;
}

.nexus-center {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 0;
}

.nexus-word {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(6rem, 22vw, 18rem);
    font-weight: 900;
    letter-spacing: -0.04em;
    line-height: 0.85;
    background: linear-gradient(
        180deg,
        rgba(168, 85, 247, 0.14) 0%,
        rgba(99, 102, 241, 0.06) 45%,
        rgba(255, 255, 255, 0.02) 100%
    );
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    user-select: none;
    transform: translateY(-2%);
}

.nexus-word-glow {
    position: absolute;
    width: min(70vw, 520px);
    height: min(70vw, 520px);
    border-radius: 50%;
    background: radial-gradient(
        circle,
        rgba(168, 85, 247, 0.22) 0%,
        rgba(99, 102, 241, 0.08) 40%,
        transparent 70%
    );
    filter: blur(40px);
    opacity: 0.4;
}

/* ---- Layout grid over watermark ---- */
.nexus-layout {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 1680px;
    margin: 0 auto;
    padding: 0 clamp(1.25rem, 4vw, 3.5rem);
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(320px, 1.15fr);
    grid-template-areas:
        "intro visual"
        "manifest visual";
    gap: clamp(1.5rem, 3vw, 2.5rem) clamp(1.5rem, 4vw, 3rem);
    align-items: start;
}

.nexus-intro {
    grid-area: intro;
    max-width: 560px;
}

.nexus-manifest {
    grid-area: manifest;
    max-width: 560px;
}

.nexus-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.95rem 0.4rem 0.65rem;
    margin-bottom: 1.25rem;
    background: var(--nx-accent-soft);
    border: 1px solid rgba(var(--nx-r), var(--nx-g), var(--nx-b), 0.35);
    border-radius: 100px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    color: #c4b5fd;
}

.nexus-tag-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #a855f7;
    box-shadow: 0 0 12px rgba(168, 85, 247, 0.8);
    animation: nxPulse 2.2s ease-in-out infinite;
}

@keyframes nxPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}

.nexus-headline {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(2rem, 4.2vw, 3.15rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.08;
    margin: 0 0 1rem;
}

.nexus-headline-grad {
    display: block;
    background: linear-gradient(135deg, #ffffff 0%, #c4b5fd 40%, #a855f7 70%, #6366f1 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nexus-lede {
    font-size: 1.05rem;
    line-height: 1.75;
    color: rgba(255, 255, 255, 0.62);
    margin: 0;
    max-width: 44ch;
}

/* ---- Manifest list (editorial, no cards) ---- */
.nexus-manifest {
    list-style: none;
    padding: 0 0 0 1.35rem;
    margin: 0.5rem 0 0;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0;
    border-left: 1px solid rgba(168, 85, 247, 0.22);
}

.nexus-manifest::before {
    content: '';
    position: absolute;
    left: -1px;
    top: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(
        180deg,
        rgba(168, 85, 247, 0.9) 0%,
        rgba(99, 102, 241, 0.35) 55%,
        transparent 100%
    );
    pointer-events: none;
}

.nexus-item {
    position: relative;
    display: block;
    padding: 1.35rem 0 1.35rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.nexus-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.nexus-item:first-child {
    padding-top: 0;
}

.nexus-item-index {
    position: absolute;
    left: -1.35rem;
    top: 1.35rem;
    transform: translateX(-50%);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: rgba(168, 85, 247, 0.55);
    transition: color 0.4s ease, text-shadow 0.4s ease;
}

.nexus-item:first-child .nexus-item-index {
    top: 0;
}

.nexus-item-body {
    display: block;
}

.nexus-item-title {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(1.05rem, 1.8vw, 1.2rem);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.25;
    color: rgba(255, 255, 255, 0.92);
    margin: 0 0 0.45rem;
    transition: color 0.4s ease;
}

.nexus-item-desc {
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.42);
    margin: 0;
    max-width: 38ch;
    transition: color 0.4s ease;
}

.nexus-item:hover .nexus-item-index {
    color: #c4b5fd;
    text-shadow: 0 0 20px rgba(168, 85, 247, 0.5);
}

.nexus-item:hover .nexus-item-title {
    color: #ffffff;
    background: linear-gradient(135deg, #ffffff 0%, #e9d5ff 50%, #c4b5fd 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nexus-item:hover .nexus-item-desc {
    color: rgba(255, 255, 255, 0.58);
}

/* ---- Right column: visual + CTA ---- */
.nexus-visual-col {
    grid-area: visual;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    width: 100%;
    position: sticky;
    top: 6rem;
}

/* ---- Premium CTA ---- */
.nexus-cta {
    position: relative;
    display: inline-flex;
    width: auto;
    align-items: center;
    gap: 1rem;
    padding: 1.05rem 1.75rem 1.05rem 1.5rem;
    font-family: 'Outfit', sans-serif;
    color: #ffffff;
    text-decoration: none;
    border-radius: 100px;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 42%, #a855f7 100%);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.12) inset,
        0 8px 32px rgba(99, 102, 241, 0.35),
        0 20px 50px rgba(168, 85, 247, 0.2);
    overflow: hidden;
    isolation: isolate;
    transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.45s ease;
}

.nexus-cta-glow {
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: conic-gradient(
        from 0deg,
        transparent,
        rgba(255, 255, 255, 0.35),
        transparent 25%
    );
    opacity: 0;
    animation: nxCtaSpin 4s linear infinite;
    z-index: -1;
    transition: opacity 0.4s ease;
}

.nexus-cta:hover .nexus-cta-glow {
    opacity: 1;
}

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

.nexus-cta-shine {
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(
        105deg,
        transparent 0%,
        rgba(255, 255, 255, 0.18) 45%,
        transparent 100%
    );
    transform: skewX(-18deg);
    transition: left 0.65s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}

.nexus-cta:hover .nexus-cta-shine {
    left: 140%;
}

.nexus-cta:hover {
    transform: translateY(-2px);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.2) inset,
        0 14px 48px rgba(168, 85, 247, 0.45),
        0 28px 64px rgba(99, 102, 241, 0.25);
}

.nexus-cta-mark {
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    padding-right: 1rem;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.nexus-cta-label {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.nexus-cta-arrow {
    display: flex;
    width: 20px;
    height: 20px;
    margin-left: 0.15rem;
    opacity: 0.9;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.nexus-cta:hover .nexus-cta-arrow {
    transform: translate(2px, -2px);
}

/* ---- Right: WebGL + context chips ---- */
.nexus-visual {
    position: relative;
    width: 100%;
    min-height: clamp(360px, 52vh, 620px);
    border-radius: 24px;
    overflow: hidden;
    border: 1px solid rgba(var(--nx-r), var(--nx-g), var(--nx-b), 0.2);
    background:
        radial-gradient(ellipse 80% 60% at 50% 40%, rgba(99, 102, 241, 0.12), transparent),
        rgba(0, 0, 0, 0.5);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.04) inset,
        0 24px 80px rgba(0, 0, 0, 0.55),
        0 0 60px rgba(168, 85, 247, 0.08);
}

#nexus-webgl {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    opacity: 0;
    transition: opacity 0.8s ease;
}

#nexus-webgl.is-ready {
    opacity: 1;
}

#nexus-webgl.is-hidden {
    display: none;
}

.nexus-fallback {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 50% 45%, rgba(168, 85, 247, 0.2), transparent 65%);
}

.nexus-fallback.is-visible {
    display: flex;
}

.nexus-fallback-orb {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #e9d5ff, #a855f7 45%, #4338ca 85%);
    box-shadow: 0 0 80px rgba(168, 85, 247, 0.5);
}

.nexus-visual-scan {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(168, 85, 247, 0.03) 2px,
        rgba(168, 85, 247, 0.03) 4px
    );
    opacity: 0.5;
}

.nexus-visual-vignette {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(ellipse at center, transparent 30%, rgba(0, 0, 0, 0.65) 100%);
}

/* ---- Tablet & mobile ---- */
@media (max-width: 1024px) {
    .nexus-stage {
        justify-content: flex-start;
        min-height: auto;
        padding: 1.25rem 0 2.5rem;
    }

    .nexus-layout {
        grid-template-columns: 1fr;
        grid-template-areas:
            "intro"
            "visual"
            "manifest";
        gap: 1.75rem;
        padding: 0 1.25rem;
    }

    .nexus-intro,
    .nexus-manifest {
        max-width: none;
    }

    .nexus-visual-col {
        position: static;
        top: auto;
    }

    .nexus-word {
        font-size: clamp(3.5rem, 24vw, 8rem);
        opacity: 0.85;
    }

    .nexus-word-glow {
        width: min(85vw, 360px);
        height: min(85vw, 360px);
        opacity: 0.28;
    }

    .nexus-visual {
        min-height: 0;
        aspect-ratio: 1 / 1;
        max-height: min(72vw, 420px);
        border-radius: 20px;
    }
}

@media (max-width: 768px) {
    .nexus-page .gradient-orb-2,
    .nexus-page .gradient-orb-3 {
        opacity: 0.35;
    }

    .nexus-page .ai-background .particles {
        opacity: 0.6;
    }

    .nexus-main {
        padding-top: 4.75rem;
    }

    .nexus-center {
        align-items: flex-start;
        padding-top: 6.5rem;
    }

    .nexus-word {
        font-size: clamp(3rem, 20vw, 5.5rem);
        transform: none;
    }

    .nexus-tag {
        font-size: 0.62rem;
        letter-spacing: 0.14em;
        margin-bottom: 1rem;
    }

    .nexus-headline {
        font-size: clamp(1.75rem, 7.5vw, 2.35rem);
        margin-bottom: 0.75rem;
    }

    .nexus-lede {
        font-size: 0.95rem;
        line-height: 1.65;
        margin-bottom: 0;
    }

    .nexus-manifest {
        margin-top: 0.25rem;
        padding-left: 1rem;
    }

    .nexus-item {
        padding: 1rem 0 1rem 1.1rem;
    }

    .nexus-item-index {
        left: -1rem;
        font-size: 0.6rem;
    }

    .nexus-item-title {
        font-size: 1rem;
    }

    .nexus-item-desc {
        font-size: 0.8125rem;
        line-height: 1.55;
        max-width: none;
    }

    .nexus-visual {
        max-height: none;
        aspect-ratio: 4 / 3;
        width: 100%;
        border-radius: 18px;
    }

    .nexus-visual-col {
        gap: 1rem;
    }

    .nexus-cta {
        min-height: 48px;
        padding: 0.9rem 1.35rem;
        gap: 0.75rem;
    }

    .nexus-cta-mark {
        font-size: 0.85rem;
        padding-right: 0.75rem;
    }

    .nexus-cta-label {
        font-size: 0.875rem;
    }
}

@media (max-width: 480px) {
    .nexus-layout {
        padding: 0 1rem;
        gap: 1.5rem;
    }

    .nexus-stage {
        padding-bottom: 2rem;
    }

    .nexus-center {
        padding-top: 5rem;
    }

    .nexus-word {
        font-size: clamp(2.75rem, 18vw, 4.25rem);
    }

    .nexus-word-glow {
        opacity: 0.2;
    }

    .nexus-headline-grad {
        margin-top: 0.15rem;
    }

    .nexus-visual {
        aspect-ratio: 1 / 1;
        border-radius: 16px;
    }

    .nexus-visual-scan {
        opacity: 0.35;
    }

    .nexus-cta {
        width: auto;
        max-width: 100%;
        justify-content: center;
        padding: 1rem 1.35rem;
    }
}

/* Touch devices: no hover-only shifts */
@media (hover: none) {
    .nexus-item:hover .nexus-item-title {
        -webkit-text-fill-color: rgba(255, 255, 255, 0.92);
        background: none;
    }

    .nexus-item:hover .nexus-item-desc {
        color: rgba(255, 255, 255, 0.42);
    }

    .nexus-item:hover .nexus-item-index {
        text-shadow: none;
        color: rgba(168, 85, 247, 0.55);
    }
}

/* Safe areas (notched phones) */
@supports (padding: max(0px)) {
    .nexus-layout {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }

    @media (min-width: 1025px) {
        .nexus-layout {
            padding-left: max(clamp(1.25rem, 4vw, 3.5rem), env(safe-area-inset-left));
            padding-right: max(clamp(1.25rem, 4vw, 3.5rem), env(safe-area-inset-right));
        }
    }
}

@media (prefers-reduced-motion: reduce) {
    .nexus-tag-dot,
    .nexus-cta-glow {
        animation: none;
    }

    .nexus-item:hover .nexus-item-title {
        -webkit-text-fill-color: #ffffff;
        background: none;
    }
}
