/* ============================================================
   PORTFOLIO CONSTELLATION — Graph, Nodes, Edges
   ============================================================ */

/* ---- Container ---- */
.constellation-wrap {
    position: relative;
    width: 100%;
    min-height: calc(100vh - 72px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 2rem 1rem 4rem;
    background: transparent;
}

#portfolio-constellation {
    position: relative;
    width: 100%;
    max-width: 2600px;
    aspect-ratio: 2600 / 1400;
    margin: 0 auto;
    transition: transform 0.4s ease;
}

#portfolio-constellation.constellation--panel-open {
    transform: translateX(-120px);
}

/* ---- SVG edges ---- */
.constellation-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.constellation-edge {
    stroke: var(--text-secondary-color, #aaa);
    stroke-width: 1.2;
    opacity: 0.3;
    transition: opacity 0.3s ease, stroke 0.3s ease, stroke-width 0.3s ease;
}

.constellation-edge--skill-skill {
    stroke: var(--text-secondary-color, #999);
    stroke-width: 1.2;
    opacity: 0.22;
}

.constellation-edge--award-skill {
    stroke: var(--text-secondary-color, #999);
    stroke-dasharray: 5 4;
    stroke-width: 1;
    opacity: 0.2;
}

.constellation-edge--me-hub {
    stroke: var(--text-secondary-color, #999);
    stroke-width: 1.8;
    opacity: 0.15;
}

.constellation-edge--experience-skill,
.constellation-edge--course-skill {
    stroke: var(--text-secondary-color, #999);
    stroke-dasharray: 3 3;
    stroke-width: 0.8;
    opacity: 0.15;
}

.constellation-edge--active {
    stroke: var(--text-color, #222) !important;
    stroke-width: 2.5 !important;
    opacity: 0.85 !important;
    filter: drop-shadow(0 0 2px rgba(0,0,0,0.15));
}

.constellation-edge--dimmed {
    opacity: 0.03 !important;
}

/* ---- Nodes container ---- */
.constellation-nodes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* ---- Base node ---- */
.cnode {
    position: absolute;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    gap: 0.3rem;
    pointer-events: auto;
    cursor: pointer;
    transition: opacity 0.3s ease, filter 0.3s ease;
    z-index: 2;
    will-change: transform;
}

/* ---- ME node ---- */
.cnode--me {
    flex-direction: column;
    gap: 0.4rem;
    z-index: 10;
}

.cnode-photo {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--secondary-background-color);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
    position: relative;
    z-index: 2;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.cnode--me:hover .cnode-photo {
    transform: scale(1.08);
    box-shadow: 0 6px 32px rgba(0, 0, 0, 0.2);
}

.cnode-ring {
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 124px;
    height: 124px;
    border-radius: 50%;
    border: 2px solid var(--text-secondary-color);
    opacity: 0.2;
    animation: ringPulse 3s ease-in-out infinite;
}

@keyframes ringPulse {
    0%, 100% { transform: translateX(-50%) scale(1); opacity: 0.2; }
    50% { transform: translateX(-50%) scale(1.12); opacity: 0.08; }
}

.cnode-me-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-color, #1a1a1a);
    text-align: center;
    white-space: nowrap;
    margin-top: 0.1rem;
}

.cnode-me-subtitle {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary-color, #999);
    text-align: center;
    white-space: nowrap;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---- SKILL node ---- */
.cnode--skill {
    background-color: var(--secondary-background-color, #fff);
    border: 1.5px solid rgba(0,0,0,0.08);
    border-radius: 100px;
    padding: 0.4rem 0.85rem 0.4rem 0.5rem;
    gap: 0.4rem;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
    font-size: 0.92rem;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease, opacity 0.3s ease;
}

.cnode--skill:hover {
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.1);
    border-color: var(--node-color, var(--text-secondary-color));
    z-index: 5;
}

.cnode-icon {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: var(--node-color, #ccc);
    color: #fff;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.cnode-icon i {
    font-size: 0.8rem;
}

.cnode-custom-icon {
    font-size: 0.52rem;
    font-weight: 800;
    font-family: 'Courier New', monospace;
    line-height: 1;
}

.cnode-label {
    font-weight: 600;
    color: var(--text-color, #1a1a1a);
    white-space: nowrap;
}

/* ---- AWARD node ---- */
.cnode--award {
    background-color: var(--secondary-background-color, #fff);
    border: 1.5px solid rgba(0,0,0,0.08);
    border-radius: 10px;
    padding: 0.45rem 0.9rem 0.45rem 0.55rem;
    gap: 0.45rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.07);
    font-size: 0.95rem;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease, opacity 0.3s ease;
}

.cnode--award:hover {
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12);
    border-color: var(--node-color, var(--text-secondary-color));
    z-index: 5;
}

.cnode-icon--award {
    background-color: var(--node-color, #e74c3c);
    width: 34px;
    height: 34px;
    font-size: 0.85rem;
}

/* ---- EXPERIENCE / EDUCATION node ---- */
.cnode--experience,
.cnode--education {
    background-color: var(--secondary-background-color, #fff);
    border: 1.5px solid rgba(0,0,0,0.08);
    border-radius: 10px;
    padding: 0.45rem 0.85rem 0.45rem 0.5rem;
    gap: 0.4rem;
    box-shadow: 0 1px 8px rgba(0, 0, 0, 0.06);
    font-size: 0.92rem;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease, opacity 0.3s ease;
}

.cnode--experience:hover,
.cnode--education:hover {
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.1);
    border-color: var(--node-color, var(--text-secondary-color));
    z-index: 5;
}

/* ---- COURSE / CERTIFICATE node ---- */
.cnode--course,
.cnode--certificate {
    flex-direction: column;
    gap: 0.15rem;
}

.cnode-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--node-color, #ccc);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.65rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.cnode--course:hover .cnode-dot,
.cnode--certificate:hover .cnode-dot {
    transform: scale(1.2);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.cnode-hover-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary-color, #999);
    white-space: nowrap;
    opacity: 0;
    transform: translateY(2px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.cnode--course:hover .cnode-hover-label,
.cnode--certificate:hover .cnode-hover-label,
.cnode--active .cnode-hover-label,
.cnode--connected .cnode-hover-label {
    opacity: 1;
    transform: translateY(0);
}

/* ---- Interaction states ---- */
.cnode--active {
    z-index: 10 !important;
}

.cnode--active.cnode--skill,
.cnode--active.cnode--award,
.cnode--active.cnode--experience,
.cnode--active.cnode--education {
    border-color: var(--node-color, var(--text-color)) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
}

.cnode--connected {
    z-index: 5 !important;
}

.cnode--connected.cnode--skill,
.cnode--connected.cnode--award,
.cnode--connected.cnode--experience,
.cnode--connected.cnode--education {
    border-color: var(--node-color, rgba(0,0,0,0.1)) !important;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08) !important;
}

.cnode--dimmed {
    opacity: 0.15 !important;
    filter: grayscale(0.5);
}

/* ---- Dark mode ---- */
.dark .cnode--skill,
.dark .cnode--award,
.dark .cnode--experience,
.dark .cnode--education {
    background-color: var(--secondary-background-color, #1a1a1a);
    border-color: rgba(255,255,255,0.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.dark .cnode--skill:hover,
.dark .cnode--award:hover,
.dark .cnode--experience:hover,
.dark .cnode--education:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.dark .cnode-photo {
    border-color: var(--secondary-background-color, #1a1a1a);
}

.dark .constellation-edge--active {
    stroke: var(--text-color, #f0f0f0) !important;
}

/* ---- Scroll hint ---- */
.constellation-scroll-hint {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    color: var(--text-secondary-color, #999);
    font-size: 0.7rem;
    font-weight: 500;
    opacity: 0.5;
    animation: scrollHintBounce 2s ease-in-out infinite;
    pointer-events: none;
    z-index: 5;
}

.constellation-scroll-hint i {
    font-size: 1rem;
}

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

/* ---- Visitor Node ---- */
.constellation-visitor-node {
    position: absolute;
    left: 2.5rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    animation: visitorFloat 4s ease-in-out infinite;
}

@keyframes visitorFloat {
    0%, 100% { transform: translateY(-50%) translateX(0); }
    50% { transform: translateY(calc(-50% - 6px)) translateX(3px); }
}

.visitor-count {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-color, #1a1a1a);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    letter-spacing: -0.5px;
    opacity: 0.3;
    transition: opacity 0.6s ease, transform 0.4s ease;
    transform: translateY(4px);
}

.visitor-count--loaded {
    opacity: 1;
    transform: translateY(0);
}

.visitor-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.1rem;
    box-shadow: 0 4px 18px rgba(102, 126, 234, 0.35);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.constellation-visitor-node:hover .visitor-icon {
    transform: scale(1.12);
    box-shadow: 0 6px 24px rgba(102, 126, 234, 0.5);
}

.visitor-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary-color, #999);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ---- Hire Me CTA ---- */
.hire-me-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 0.35rem 0.9rem;
    font-size: 0.68rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    letter-spacing: 0.3px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
    margin-top: 0.2rem;
}
.hire-me-btn:hover {
    transform: scale(1.06);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.45);
}

.hire-me-popup {
    display: none;
    flex-direction: column;
    gap: 0;
    background: var(--secondary-background-color, #fff);
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    overflow: hidden;
    min-width: 160px;
    z-index: 50;
    margin-top: 0.3rem;
}
.hire-me-popup--open {
    display: flex;
}
.hire-me-popup a {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.55rem 0.9rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-color, #333);
    text-decoration: none;
    transition: background 0.15s ease;
    white-space: nowrap;
}
.hire-me-popup a:hover {
    background: rgba(102, 126, 234, 0.08);
}
.hire-me-popup a i {
    font-size: 1rem;
    width: 1.2rem;
    text-align: center;
}
.hire-me-popup a .fa-telegram { color: #0088cc; }
.hire-me-popup a .fa-envelope { color: #e74c3c; }
.hire-me-popup a .fa-facebook { color: #1877f2; }
.hire-me-popup a .fa-instagram { color: #e4405f; }
.hire-me-popup a .fa-x-twitter { color: var(--text-color, #333); }

@media (max-width: 991px) {
    .constellation-visitor-node {
        position: relative;
        left: auto;
        top: auto;
        transform: none;
        animation: none;
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
        margin-bottom: 0.5rem;
    }
    .visitor-icon {
        width: 36px;
        height: 36px;
        font-size: 0.85rem;
    }
    .visitor-count {
        font-size: 1.1rem;
        order: -1;
        transform: none;
        opacity: 0.3;
    }
    .visitor-count--loaded {
        opacity: 1;
    }
    .visitor-label {
        font-size: 0.65rem;
    }
    .hire-me-btn {
        font-size: 0.6rem;
        padding: 0.28rem 0.7rem;
    }
    .hire-me-popup {
        position: absolute;
        top: 100%;
        left: 50%;
        transform: translateX(-50%);
        margin-top: 0.4rem;
    }
}

@media (max-width: 767px) {
    .constellation-visitor-node {
        gap: 0.4rem;
        margin-bottom: 0.3rem;
    }
    .visitor-icon {
        width: 30px;
        height: 30px;
        font-size: 0.75rem;
    }
    .visitor-count {
        font-size: 0.9rem;
    }
    .visitor-label {
        font-size: 0.55rem;
    }
    .hire-me-btn {
        font-size: 0.55rem;
        padding: 0.24rem 0.6rem;
    }
    .hire-me-popup a {
        padding: 0.45rem 0.75rem;
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    .constellation-visitor-node {
        gap: 0.3rem;
    }
    .visitor-icon {
        width: 26px;
        height: 26px;
        font-size: 0.65rem;
    }
    .visitor-count {
        font-size: 0.8rem;
    }
    .visitor-label {
        font-size: 0.5rem;
    }
    .hire-me-btn {
        font-size: 0.5rem;
        padding: 0.2rem 0.5rem;
    }
    .hire-me-popup a {
        padding: 0.4rem 0.65rem;
        font-size: 0.65rem;
    }
}

/* ---- Legend ---- */
.constellation-legend {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.2rem 1.6rem;
    padding: 1.2rem 2rem;
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    background: transparent;
    border: none;
}

.constellation-legend-item {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-color, #333);
    font-family: var(--font, 'Inter', sans-serif);
    white-space: nowrap;
}

.constellation-legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1200px) {
    #portfolio-constellation.constellation--panel-open {
        transform: translateX(-80px);
    }
}

@media (max-width: 991px) {
    .constellation-wrap {
        min-height: auto;
        padding: 2rem 0 1.5rem;
        overflow: visible;
    }

    #portfolio-constellation {
        aspect-ratio: auto;
        height: 650px;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
    }

    #portfolio-constellation.constellation--panel-open {
        transform: none;
    }

    .constellation-nodes {
        min-width: 1200px;
        min-height: 650px;
    }
    .constellation-svg {
        min-width: 1200px;
        min-height: 650px;
    }

    .constellation-legend {
        position: relative;
        bottom: auto;
        left: auto;
        transform: none;
        padding: 1rem 1rem 0;
        gap: 0.8rem 1.2rem;
    }
    .constellation-legend-item {
        font-size: 0.78rem;
    }
    .constellation-legend-dot {
        width: 10px;
        height: 10px;
    }

    .constellation-scroll-hint {
        display: block;
    }
}

/* ---- Phone: vertical portrait graph ---- */
@media (max-width: 767px) {
    .constellation-wrap {
        padding: 0.5rem 0 0.5rem;
    }

    #portfolio-constellation {
        width: 100%;
        height: auto;
        aspect-ratio: 700 / 1400;
        overflow: visible;
    }

    .constellation-nodes {
        min-width: 0;
        min-height: 0;
        width: 100%;
        height: 100%;
    }
    .constellation-svg {
        min-width: 0;
        min-height: 0;
        width: 100%;
        height: 100%;
    }

    /* Thicker, more visible edges */
    .constellation-edge { stroke-width: 1.8; opacity: 0.35; }
    .constellation-edge--skill-skill { stroke-width: 1.6; opacity: 0.28; }
    .constellation-edge--award-skill { stroke-width: 1.4; opacity: 0.25; }
    .constellation-edge--me-hub { stroke-width: 2.5; opacity: 0.2; }
    .constellation-edge--active { stroke-width: 3.5 !important; }

    /* ---- ME node — big and prominent ---- */
    .cnode-photo {
        width: 72px;
        height: 72px;
        border-width: 2.5px;
        box-shadow: 0 4px 20px rgba(0,0,0,0.18);
    }
    .cnode-ring {
        width: 86px;
        height: 86px;
        top: -6px;
    }
    .cnode-me-name {
        font-size: 0.9rem;
    }
    .cnode-me-subtitle {
        font-size: 0.65rem;
        max-width: 160px;
    }

    /* ---- SKILL nodes — chunky pills with glow ---- */
    .cnode--skill {
        font-size: 0.78rem;
        padding: 0.3rem 0.6rem 0.3rem 0.35rem;
        gap: 0.35rem;
        box-shadow: 0 2px 12px rgba(0,0,0,0.1);
        border-width: 1.5px;
    }
    .cnode-icon {
        width: 26px;
        height: 26px;
        font-size: 0.62rem;
    }
    .cnode-icon i { font-size: 0.62rem; }
    .cnode-custom-icon { font-size: 0.42rem; }

    /* ---- PROJECT nodes ---- */
    .cnode--award {
        font-size: 0.78rem;
        padding: 0.32rem 0.65rem 0.32rem 0.4rem;
        gap: 0.38rem;
        box-shadow: 0 3px 14px rgba(0,0,0,0.1);
    }
    .cnode-icon--award {
        width: 28px;
        height: 28px;
        font-size: 0.68rem;
    }

    /* ---- EXPERIENCE / EDUCATION ---- */
    .cnode--experience,
    .cnode--education {
        font-size: 0.76rem;
        padding: 0.28rem 0.6rem 0.28rem 0.35rem;
        gap: 0.35rem;
        box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    }

    /* ---- COURSE / CERTIFICATE dots ---- */
    .cnode-dot {
        width: 26px;
        height: 26px;
        font-size: 0.5rem;
        box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    }
    .cnode-hover-label {
        font-size: 0.65rem;
        padding: 0.2rem 0.5rem;
    }

    /* ---- Glow on all interactive nodes ---- */
    .cnode--skill,
    .cnode--award,
    .cnode--experience,
    .cnode--education {
        -webkit-backdrop-filter: blur(2px);
        backdrop-filter: blur(2px);
    }

    .cnode--active {
        filter: drop-shadow(0 0 6px rgba(0,0,0,0.15)) !important;
    }

    /* ---- Legend ---- */
    .constellation-legend {
        gap: 0.6rem 1rem;
        padding: 0.8rem 0.8rem 0;
    }
    .constellation-legend-item {
        font-size: 0.72rem;
    }
    .constellation-legend-dot {
        width: 10px;
        height: 10px;
    }

    .constellation-scroll-hint {
        display: none;
    }
}

@media (max-width: 480px) {
    .cnode-photo {
        width: 62px;
        height: 62px;
    }
    .cnode-ring {
        width: 76px;
        height: 76px;
    }
    .cnode-me-name { font-size: 0.82rem; }
    .cnode-me-subtitle { font-size: 0.58rem; max-width: 140px; }

    .cnode--skill {
        font-size: 0.7rem;
        padding: 0.25rem 0.52rem 0.25rem 0.3rem;
    }
    .cnode-icon {
        width: 22px;
        height: 22px;
        font-size: 0.55rem;
    }
    .cnode-icon i { font-size: 0.55rem; }

    .cnode--award {
        font-size: 0.7rem;
        padding: 0.26rem 0.55rem 0.26rem 0.34rem;
    }
    .cnode-icon--award {
        width: 24px;
        height: 24px;
        font-size: 0.6rem;
    }

    .cnode--experience,
    .cnode--education {
        font-size: 0.68rem;
        padding: 0.24rem 0.5rem 0.24rem 0.3rem;
    }

    .cnode-dot {
        width: 22px;
        height: 22px;
        font-size: 0.44rem;
    }
    .cnode-hover-label {
        font-size: 0.58rem;
    }

    .constellation-legend {
        gap: 0.5rem 0.8rem;
        padding: 0.6rem 0.5rem 0;
    }
    .constellation-legend-item {
        font-size: 0.65rem;
    }
    .constellation-legend-dot {
        width: 9px;
        height: 9px;
    }
}
