/* Hammerspace Visualizer Canvas styles */

:root {
    --hs-primary: #390BA2;
    --hs-secondary: #4630ED;
    --hs-tertiary: #F62584;
    --hs-neutral: #000000;
    --hs-text-light: #FFFFFF;
    --hs-text-dim: #BBBBBB;

    --hs-font-heading: inherit;
    --hs-font-body: inherit;

    --hs-radius: 8px;
    /* Moderate roundedness */
}

#hs-visualizer-app {
    width: 100%;
    max-width: 1366px;
    margin: 0 auto;
    position: relative;
    color: var(--hs-text-light);
    font-family: var(--hs-font-body);
}

/* Desktop: side-by-side layout */
.hs-layout {
    display: flex;
    flex-direction: row;
    align-items: center;
    width: 100%;
    gap: 40px;
}

.hs-molecule-col {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hs-content-col {
    flex: 1;
    min-width: 0;
}

#hs-visualizer-app * {
    box-sizing: border-box;
}

.hs-canvas-container {
    position: relative;
    width: 600px;
    height: 600px;
    display: flex;
    justify-content: center;
    align-items: center;
    transform-origin: center center;
    margin: 0 auto;
    transition: opacity 0.4s ease;
}

/* SVG Lines between nodes */
.hs-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.hs-line {
    stroke: rgba(255, 255, 255, 0.15);
    stroke-width: 2;
    transition: opacity 0.5s ease;
    transform-origin: 300px 300px;
}

.hs-line.highlight {
    stroke: var(--hs-tertiary);
    stroke-width: 3;
    filter: drop-shadow(0 0 5px var(--hs-tertiary));
}

/* Nodes */
.hs-node {
    position: absolute;
    z-index: 10;
    background: rgba(10, 10, 10, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    cursor: pointer;
    border-radius: 50%;
    transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1), left 0.5s cubic-bezier(0.25, 1, 0.5, 1), top 0.5s cubic-bezier(0.25, 1, 0.5, 1), width 0.5s cubic-bezier(0.25, 1, 0.5, 1), height 0.5s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.5s cubic-bezier(0.25, 1, 0.5, 1), background-color 0.5s ease, border-color 0.5s ease, box-shadow 0.5s ease, filter 0.5s ease;
    transform: translate(calc(-50% + var(--mx, 0px)), calc(-50% + var(--my, 0px)));
    /* Centers and applies magnetic */
}

.hs-node:hover {
    border-color: var(--hs-secondary);
    box-shadow: 0 0 20px rgba(70, 48, 237, 0.7);
    transform: translate(calc(-50% + var(--mx, 0px)), calc(-50% + var(--my, 0px))) scale(1.1);
    z-index: 40;
}

.hs-node-core {
    width: 220px;
    height: 220px;
    background-color: #000000;
    background-image: radial-gradient(circle, var(--hs-primary) 0%, rgba(57, 11, 162, 0.4) 100%);
    border-color: var(--hs-secondary);
    box-shadow: 0 0 30px rgba(70, 48, 237, 0.6);
    z-index: 20;
}

.hs-node-core.inactive {
    transform: translate(calc(-50% + var(--mx, 0px)), calc(-50% + var(--my, 0px))) scale(0.65);
    filter: saturate(0.75) brightness(0.8);
    cursor: pointer;
}

.hs-node-tier1,
.hs-node-tier2 {
    width: 130px;
    height: 130px;
}

.hs-node-tier1.active-hub {
    width: 220px;
    height: 220px;
    background-color: #000000;
    background-image: radial-gradient(circle, var(--hs-secondary) 0%, rgba(70, 48, 237, 0.4) 100%);
    box-shadow: 0 0 30px rgba(70, 48, 237, 0.8);
    border-color: var(--hs-secondary);
    z-index: 20;
}

.hs-node-tier2 {
    width: 130px;
    height: 130px;
    background: rgba(30, 30, 30, 0.8);
    border-color: rgba(246, 37, 132, 0.3);
}

.hs-node-tier2:hover {
    border-color: var(--hs-tertiary);
    box-shadow: 0 0 20px rgba(246, 37, 132, 0.75);
}

@keyframes pulseGlowCore {
    0% {
        box-shadow: 0 0 30px rgba(70, 48, 237, 0.4);
    }

    50% {
        box-shadow: 0 0 50px rgba(70, 48, 237, 0.8), inset 0 0 20px rgba(70, 48, 237, 0.3);
    }

    100% {
        box-shadow: 0 0 30px rgba(70, 48, 237, 0.4);
    }
}

@keyframes pulseGlowTier1 {
    0% {
        box-shadow: 0 0 30px rgba(70, 48, 237, 0.5);
    }

    50% {
        box-shadow: 0 0 50px rgba(70, 48, 237, 0.9), inset 0 0 20px rgba(70, 48, 237, 0.3);
    }

    100% {
        box-shadow: 0 0 30px rgba(70, 48, 237, 0.5);
    }
}

.hs-node-core:not(.inactive) {
    animation: pulseGlowCore 4s infinite ease-in-out;
}

.hs-node-tier1.active-hub {
    animation: pulseGlowTier1 4s infinite ease-in-out;
}

/* Node Text */
.hs-node span {
    font-family: var(--hs-font-heading);
    font-weight: 600;
    font-size: 14px;
    line-height: 1.3;
    padding: 0 10px;
    pointer-events: none;
}

.hs-node-core {
    gap: 10px;
}

.hs-core-svg {
    max-width: 60px;
    max-height: 60px;
    object-fit: contain;
}

.hs-node-core span {
    font-size: 18px;
}

.hs-node-tier1.active-hub span {
    font-size: 16px;
}

/* Panel enter animation: fade-up then single glow pulse */

@keyframes panel-enter {
    0% {
        opacity: 0;
        transform: translateY(14px);
        box-shadow: none;
    }
    25% {
        opacity: 1;
        transform: translateY(0);
        box-shadow: none;
    }
    55% {
        box-shadow: 0 0 14px rgba(255, 255, 255, 0.12), 0 0 28px rgba(255, 255, 255, 0.04);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
        box-shadow: none;
    }
}

.panel-enter {
    animation: panel-enter 2s ease forwards;
}

/* Button to return to main view */
.hs-back-btn {
    display: none;
}

#hs-details-panel {
    position: relative;
    width: 100%;
    min-height: 60px;
    opacity: 0;
    visibility: hidden;
    z-index: 50;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px 30px;
    border-radius: var(--radius-m);
    color: var(--hs-text-light);
    line-height: 1.6;
    display: flex;
    justify-content: center;
    /* Centers the inner div */
    align-items: center;
}

#hs-details-panel>div {
    text-align: left;
    max-width: 100%;
    width: 100%;
    /* Allows it to be as wide as needed, left-justified within */
}

#hs-details-panel h1,
#hs-details-panel h2,
#hs-details-panel h3,
#hs-details-panel h4,
#hs-details-panel h5,
#hs-details-panel h6 {
    color: var(--hs-text-light);
    margin-top: 0;
    margin-bottom: 10px;
}

#hs-details-panel.active {
    opacity: 1;
    visibility: visible;
}

/* Helper text below the diagram */
.hs-diagram-hint {
    font-size: 13px;
    font-style: italic;
    color: var(--hs-text-dim);
    text-align: center;
    margin: 0 0 12px;
    pointer-events: none;
}

/* Background image overlay class (injected via JS) */
.hs-node-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    opacity: 0.6;
    /* Overlay transparency */
    z-index: 0;
    pointer-events: none;
}

.hs-node>span,
.hs-node>.hs-core-svg {
    position: relative;
    z-index: 2;
}

/* Custom Emphasized Aura Nodes */
.hs-node-aura::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    z-index: -1;
    box-shadow: 0 0 10px var(--aura-color), 0 0 30px var(--aura-color);
    animation: pulseAura 4s infinite ease-in-out;
    pointer-events: none;
}

@keyframes pulseAura {
    0% {
        opacity: 0.15;
    }

    50% {
        opacity: 0.35;
    }

    100% {
        opacity: 0.15;
    }
}

/* Suppress left/top transitions during per-frame constellation rotation */
.hs-rotation-lock {
    transition:
        transform 0.5s cubic-bezier(0.25, 1, 0.5, 1),
        width 0.5s cubic-bezier(0.25, 1, 0.5, 1),
        height 0.5s cubic-bezier(0.25, 1, 0.5, 1),
        opacity 0.5s cubic-bezier(0.25, 1, 0.5, 1),
        background-color 0.5s ease,
        border-color 0.5s ease,
        box-shadow 0.5s ease,
        filter 0.5s ease !important;
}

/* Tablet: stack molecule on top, content below */
@media (max-width: 1040px) {
    .hs-layout {
        flex-direction: column;
        align-items: center;
    }

    .hs-content-col {
        width: 100%;
        max-width: 800px;
    }

    #hs-details-panel {
        margin-top: 20px;
    }

    .hs-canvas-container {
        transform: scale(0.85);
        margin: -45px; /* compensate for scale: (600 - 600*0.85)/2 */
    }
}

@media (max-width: 768px) {
    #hs-visualizer-app {
        min-height: 500px;
        padding: 20px 0;
    }

    .hs-canvas-container {
        transform: scale(0.70);
        margin: -90px; /* (600 - 600*0.7)/2 */
    }

    .hs-node span {
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    #hs-visualizer-app {
        min-height: 400px;
    }

    .hs-canvas-container {
        transform: scale(0.60);
        margin: -120px; /* (600 - 600*0.6)/2 */
    }

    .hs-node span {
        font-size: 16px; /* slightly bump text base to fight structural scaling */
    }
}