/* =================================
   PHASE 3 - REVELATION WEB
   Explorable, interconnected insights
   ================================= */

/* Connection Web Container */
.connection-web {
    position: relative;
    width: 100%;
    height: 600px;
    margin: var(--space-xl) 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Central Node */
.web-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
}

/* Insight Nodes */
.insight-node {
    position: absolute;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 2px solid var(--accent-lavender);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-smooth);
    padding: var(--space-xs);
    line-height: 1.3;
}

/* Positioning around circle using custom property */
.insight-node:not(.central) {
    --radius: 220px;
    top: calc(50% + var(--radius) * sin(var(--angle)));
    left: calc(50% + var(--radius) * cos(var(--angle)));
    transform: translate(-50%, -50%);
}

/* Calculate positions using degrees */
.insight-node[style*="--angle: 0deg"] {
    top: 50%;
    left: calc(50% + 220px);
}

.insight-node[style*="--angle: 45deg"] {
    top: calc(50% - 155px);
    left: calc(50% + 155px);
}

.insight-node[style*="--angle: 90deg"] {
    top: calc(50% - 220px);
    left: 50%;
}

.insight-node[style*="--angle: 135deg"] {
    top: calc(50% - 155px);
    left: calc(50% - 155px);
}

.insight-node[style*="--angle: 180deg"] {
    top: 50%;
    left: calc(50% - 220px);
}

.insight-node[style*="--angle: 225deg"] {
    top: calc(50% + 155px);
    left: calc(50% - 155px);
}

.insight-node[style*="--angle: 270deg"] {
    top: calc(50% + 220px);
    left: 50%;
}

.insight-node[style*="--angle: 315deg"] {
    top: calc(50% + 155px);
    left: calc(50% + 155px);
}

/* Central node styling */
.insight-node.central {
    width: 160px;
    height: 160px;
    background: linear-gradient(135deg, var(--accent-lavender), var(--accent-sage));
    border: 3px solid var(--accent-amber);
    font-size: 1rem;
    font-weight: 700;
    box-shadow: 0 0 30px rgba(167, 139, 204, 0.4);
}

/* Hover states */
.insight-node:not(.central):hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-amber);
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 0 20px rgba(167, 139, 204, 0.3);
    z-index: 5;
}

.insight-node.active {
    background: var(--accent-lavender);
    color: var(--bg-primary);
    border-color: var(--accent-amber);
    box-shadow: 0 0 30px rgba(167, 139, 204, 0.6);
    z-index: 6;
}

/* Insight Details Container */
.insight-details-container {
    margin-top: var(--space-lg);
    min-height: 400px;
}

.insight-detail {
    display: none;
    opacity: 0;
    animation: fadeIn 0.5s forwards;
}

.insight-detail.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.insight-detail h3 {
    color: var(--accent-lavender);
    font-size: 2rem;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 2px solid var(--accent-lavender);
}

.insight-detail p {
    margin-bottom: var(--space-md);
}

.insight-detail ul {
    margin: var(--space-md) 0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .connection-web {
        height: 500px;
    }
    
    .insight-node {
        width: 90px;
        height: 90px;
        font-size: 0.75rem;
    }
    
    .insight-node.central {
        width: 120px;
        height: 120px;
        font-size: 0.9rem;
    }
    
    /* Smaller radius for mobile */
    .insight-node[style*="--angle: 0deg"] {
        left: calc(50% + 160px);
    }
    
    .insight-node[style*="--angle: 45deg"] {
        top: calc(50% - 113px);
        left: calc(50% + 113px);
    }
    
    .insight-node[style*="--angle: 90deg"] {
        top: calc(50% - 160px);
    }
    
    .insight-node[style*="--angle: 135deg"] {
        top: calc(50% - 113px);
        left: calc(50% - 113px);
    }
    
    .insight-node[style*="--angle: 180deg"] {
        left: calc(50% - 160px);
    }
    
    .insight-node[style*="--angle: 225deg"] {
        top: calc(50% + 113px);
        left: calc(50% - 113px);
    }
    
    .insight-node[style*="--angle: 270deg"] {
        top: calc(50% + 160px);
    }
    
    .insight-node[style*="--angle: 315deg"] {
        top: calc(50% + 113px);
        left: calc(50% + 113px);
    }
}

@media (max-width: 480px) {
    .connection-web {
        height: 400px;
    }
    
    .insight-node {
        width: 70px;
        height: 70px;
        font-size: 0.65rem;
        padding: 0.25rem;
    }
    
    .insight-node.central {
        width: 100px;
        height: 100px;
        font-size: 0.8rem;
    }
    
    /* Even smaller radius for very small screens */
    .insight-node[style*="--angle: 0deg"] {
        left: calc(50% + 120px);
    }
    
    .insight-node[style*="--angle: 45deg"] {
        top: calc(50% - 85px);
        left: calc(50% + 85px);
    }
    
    .insight-node[style*="--angle: 90deg"] {
        top: calc(50% - 120px);
    }
    
    .insight-node[style*="--angle: 135deg"] {
        top: calc(50% - 85px);
        left: calc(50% - 85px);
    }
    
    .insight-node[style*="--angle: 180deg"] {
        left: calc(50% - 120px);
    }
    
    .insight-node[style*="--angle: 225deg"] {
        top: calc(50% + 85px);
        left: calc(50% - 85px);
    }
    
    .insight-node[style*="--angle: 270deg"] {
        top: calc(50% + 120px);
    }
    
    .insight-node[style*="--angle: 315deg"] {
        top: calc(50% + 85px);
        left: calc(50% + 85px);
    }
}
