/* RESET & VARIABLES */
:root {
    --bg-black: #000000;
    --text-primary: #e0f2f1;
    --text-secondary: #80cbc4;
    --accent: #ffd700;
    --transition-speed: 0.5s;
    
    /* Sephirah Glow Colors */
    --glow-kether: 0 0 25px 8px rgba(255, 255, 255, 0.9), 0 0 45px 12px rgba(255, 255, 255, 0.4);
    --glow-chokmah: 0 0 25px 8px rgba(139, 164, 249, 0.9);
    --glow-binah: 0 0 25px 8px rgba(185, 139, 249, 0.9);
    --glow-daath: 0 0 25px 8px rgba(224, 209, 255, 0.7);
    --glow-chesed: 0 0 25px 8px rgba(52, 152, 219, 0.9);
    --glow-geburah: 0 0 25px 8px rgba(231, 76, 60, 0.9);
    --glow-tiphareth: 0 0 25px 8px rgba(241, 196, 15, 0.9);
    --glow-netzach: 0 0 25px 8px rgba(46, 204, 113, 0.9);
    --glow-hod: 0 0 25px 8px rgba(230, 126, 34, 0.9);
    --glow-yesod: 0 0 25px 8px rgba(155, 89, 182, 0.9);
    --glow-malkuth: 0 0 25px 8px rgba(139, 90, 43, 0.9);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-black);
    color: var(--text-primary);
    font-family: 'Almendra', serif;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    position: relative;
    font-size: 1.1rem;
}

/* UNIVERSE WORKSPACE */
.mystic-universe {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2;
}

/* CENTERED TREE CONTAINER */
.tree-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 20px;
}

.tree-wrapper {
    position: relative;
    height: 92vh;
    aspect-ratio: 3 / 4;
    max-height: 950px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.6s cubic-bezier(0.19, 1, 0.22, 1);
}

.tree-image {
    height: 100%;
    width: auto;
    object-fit: contain;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.3)) drop-shadow(0 0 15px rgba(255, 255, 255, 0.1));
}

/* SEPHIROT OVERLAYS */
.node-overlay {
    position: absolute;
    width: 11.5%;
    aspect-ratio: 1 / 1;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: 2px solid rgba(255, 255, 255, 0);
}

.node-overlay[data-node="kether"] { color: #ffffff; }
.node-overlay[data-node="chokmah"] { color: #8ba4f9; }
.node-overlay[data-node="binah"] { color: #b98bf9; }
.node-overlay[data-node="daath"] { color: #e0d1ff; }
.node-overlay[data-node="chesed"] { color: #3498db; }
.node-overlay[data-node="geburah"] { color: #e74c3c; }
.node-overlay[data-node="tiphareth"] { color: #f1c40f; }
.node-overlay[data-node="netzach"] { color: #2ecc71; }
.node-overlay[data-node="hod"] { color: #e67e22; }
.node-overlay[data-node="yesod"] { color: #9b59b6; }
.node-overlay[data-node="malkuth"] { color: #8b5a2b; }

.node-overlay[data-node="kether"]:hover, .node-overlay[data-node="kether"].active { box-shadow: var(--glow-kether); border-color: rgba(255, 255, 255, 0.85); }
.node-overlay[data-node="chokmah"]:hover, .node-overlay[data-node="chokmah"].active { box-shadow: var(--glow-chokmah); border-color: rgba(139, 164, 249, 0.85); }
.node-overlay[data-node="binah"]:hover, .node-overlay[data-node="binah"].active { box-shadow: var(--glow-binah); border-color: rgba(185, 139, 249, 0.85); }
.node-overlay[data-node="daath"]:hover, .node-overlay[data-node="daath"].active { box-shadow: var(--glow-daath); border-color: rgba(224, 209, 255, 0.65); }
.node-overlay[data-node="chesed"]:hover, .node-overlay[data-node="chesed"].active { box-shadow: var(--glow-chesed); border-color: rgba(52, 152, 219, 0.85); }
.node-overlay[data-node="geburah"]:hover, .node-overlay[data-node="geburah"].active { box-shadow: var(--glow-geburah); border-color: rgba(231, 76, 60, 0.85); }
.node-overlay[data-node="tiphareth"]:hover, .node-overlay[data-node="tiphareth"].active { box-shadow: var(--glow-tiphareth); border-color: rgba(241, 196, 15, 0.85); }
.node-overlay[data-node="netzach"]:hover, .node-overlay[data-node="netzach"].active { box-shadow: var(--glow-netzach); border-color: rgba(46, 204, 113, 0.85); }
.node-overlay[data-node="hod"]:hover, .node-overlay[data-node="hod"].active { box-shadow: var(--glow-hod); border-color: rgba(230, 126, 34, 0.85); }
.node-overlay[data-node="yesod"]:hover, .node-overlay[data-node="yesod"].active { box-shadow: var(--glow-yesod); border-color: rgba(155, 89, 182, 0.85); }
.node-overlay[data-node="malkuth"]:hover, .node-overlay[data-node="malkuth"].active { box-shadow: var(--glow-malkuth); border-color: rgba(139, 90, 43, 0.85); }

.node-overlay:hover, .node-overlay.active {
    animation: nodePulseGlow 2.5s ease-in-out infinite;
}

.pulse-ring {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 1.5px dashed currentColor;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0.4;
    animation: spin 24s linear infinite;
    pointer-events: none;
    transition: all 0.4s ease;
}

.node-overlay:hover .pulse-ring, .node-overlay.active .pulse-ring {
    border-style: dashed;
    border-width: 2px;
    scale: 1.15;
    opacity: 0.95;
    animation: spin 6s linear infinite;
    filter: drop-shadow(0 0 6px currentColor);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes nodePulseGlow {
    0% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.04); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

/* SVG BEAM OVERLAY */
#beam-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 5;
}

.beam-line {
    fill: none;
    stroke-width: 2.5px;
    stroke-linecap: round;
    stroke-dasharray: 6 6;
    animation: dash 0.8s linear infinite;
    filter: drop-shadow(0 0 10px currentColor);
}

@keyframes dash {
    to { stroke-dashoffset: -20; }
}

/* FRAMELESS TEXT INTERFACE */
.frameless-interface {
    position: absolute;
    width: 400px;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s cubic-bezier(0.19, 1, 0.22, 1), transform 0.5s cubic-bezier(0.19, 1, 0.22, 1);
}

.frameless-interface.left-aligned {
    left: 6%;
    transform: translateX(-40px);
}

.frameless-interface.right-aligned {
    right: 6%;
    transform: translateX(40px);
}

.frameless-interface.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
}

/* CLOSE BUTTON */
.close-interface-btn {
    position: absolute;
    top: -30px;
    right: 0;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 2.2rem;
    cursor: pointer;
    transition: color 0.3s;
}

.close-interface-btn:hover {
    color: #ffffff;
}

/* MYSTIC GLOW TYPOGRAPHY */
.mystic-text-glow {
    font-family: 'Uncial Antiqua', serif;
    font-size: 2.8rem;
    font-weight: 900;
    letter-spacing: 4px;
    margin-bottom: 5px;
    text-shadow: 0 0 15px currentColor;
    background: linear-gradient(135deg, #ffffff 40%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.content-wrapper h3 {
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--text-secondary);
    letter-spacing: 2px;
    margin-bottom: 20px;
    text-transform: uppercase;
}

.content-wrapper p {
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--text-primary);
    margin-bottom: 30px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

/* CONSTELLATION GRAPH AREA (FLEX LAYOUT HEADER ROW) */
.header-constellation-row {
    display: flex;
    align-items: center;
    gap: 25px;
    margin-bottom: 25px;
}

.title-block {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.constellation-zone {
    width: 70px;
    height: 70px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}

/* CONSTELLATION CORE */
.constellation-core {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid var(--accent);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    position: relative;
    z-index: 15;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.2);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.core-symbol {
    font-size: 1.8rem;
    color: #ffffff;
}

.core-ripple {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 1px solid var(--accent);
    animation: coreRippleAnim 2.5s infinite;
    pointer-events: none;
}

@keyframes coreRippleAnim {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(1.6); opacity: 0; }
}

.constellation-core:hover {
    transform: scale(1.1);
    box-shadow: 0 0 30px var(--accent);
}

/* CONSTELLATION ORBITS (NODES) */
.orbit-container {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
}

.orbit-node {
    position: absolute;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid var(--text-secondary);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    pointer-events: auto;
    z-index: 12;
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
    left: 50%;
    top: 50%;
    transition: all 0.6s cubic-bezier(0.19, 1, 0.22, 1);
    box-shadow: 0 0 10px rgba(128, 203, 196, 0.2);
}

.node-icon {
    font-size: 1.1rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

.mystic-svg {
    width: 22px;
    height: 22px;
    color: inherit;
    display: block;
    filter: drop-shadow(0 0 3px currentColor);
}

.orbit-node:hover {
    transform: translate(-50%, -50%) scale(1.25) !important;
    animation: intenseMysticGlow 1.5s ease-in-out infinite;
}

.orbit-node:hover .mystic-svg {
    animation: rotateMysticIcon 3s linear infinite;
}

@keyframes intenseMysticGlow {
    0% {
        box-shadow: 0 0 12px currentColor, 0 0 20px rgba(255, 255, 255, 0.1);
        border-color: rgba(255, 255, 255, 0.8);
    }
    50% {
        box-shadow: 0 0 28px currentColor, 0 0 45px currentColor, inset 0 0 10px currentColor;
        border-color: #ffffff;
    }
    100% {
        box-shadow: 0 0 12px currentColor, 0 0 20px rgba(255, 255, 255, 0.1);
        border-color: rgba(255, 255, 255, 0.8);
    }
}

@keyframes rotateMysticIcon {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* CONSTELATION NODES POSITIONING (POLAR EXPANSION) */
.constellation-zone.active .orbit-node {
    opacity: 1;
    scale: 1;
}

/* Custom angular offsets for orbits when active (relative to 70px core container center) */
.constellation-zone.active .orbit-node:nth-child(1) { left: 50%; top: -85px; transform: translate(-50%, -50%) scale(1); transition-delay: 0.05s; }
.constellation-zone.active .orbit-node:nth-child(2) { left: 135px; top: -25px; transform: translate(-50%, -50%) scale(1); transition-delay: 0.1s; }
.constellation-zone.active .orbit-node:nth-child(3) { left: 100px; top: 95px; transform: translate(-50%, -50%) scale(1); transition-delay: 0.15s; }
.constellation-zone.active .orbit-node:nth-child(4) { left: -30px; top: 95px; transform: translate(-50%, -50%) scale(1); transition-delay: 0.2s; }
.constellation-zone.active .orbit-node:nth-child(5) { left: -65px; top: -25px; transform: translate(-50%, -50%) scale(1); transition-delay: 0.25s; }

/* TOOLTIP DISPLAY ON HOVER */
.orbit-tooltip {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: rgba(0, 0, 0, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 8px 12px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.19, 1, 0.22, 1);
    box-shadow: 0 5px 15px rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.orbit-tooltip strong {
    font-size: 0.75rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 2px;
}

.orbit-tooltip span {
    font-size: 0.85rem;
    color: #ffffff;
}

.orbit-node:hover .orbit-tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* CONSTELLATION HINT */
.constellation-hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 12px;
    border-radius: 8px;
    margin-top: 15px;
}

/* UTILITY */
.hidden { display: none !important; }

/* RESPONSIVE LAYOUT */
@media (max-width: 950px) {
    .tree-wrapper {
        height: 60vh;
        max-height: auto;
    }
    
    .frameless-interface {
        position: fixed;
        bottom: 5vh;
        left: 50% !important;
        right: auto !important;
        transform: translate(-50%, 30px) !important;
        width: 90%;
        max-width: 380px;
    }
    
    .frameless-interface.visible {
        transform: translate(-50%, 0) !important;
    }
}

/* BACK TO SEPHIRAH BUTTON */
.back-to-sephirah-btn {
    font-size: 0.8rem;
    color: var(--accent);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: color 0.3s, text-shadow 0.3s;
    display: inline-block;
    margin-top: 8px;
    font-family: 'Almendra', serif;
}

.back-to-sephirah-btn:hover {
    color: #ffffff;
    text-shadow: 0 0 8px var(--accent);
}

/* MYSTIC EXTERNAL LINK BUTTON */
#externalLinkContainer {
    margin-top: 25px;
    display: flex;
    justify-content: flex-start;
}

.mystic-external-btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    color: #ffffff;
    background: transparent;
    border: 1px solid var(--accent);
    font-weight: bold;
    font-size: 0.85rem;
    letter-spacing: 1px;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.1);
    transition: all 0.3s ease;
    font-family: 'Almendra', serif;
}

.mystic-external-btn:hover {
    background: var(--accent);
    color: #000000;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.4);
    transform: translateY(-2px);
}

/* FLOWING EMANATION DASHED LINES */
.emanation-line {
    fill: none;
    stroke-dasharray: 8 6;
    animation: flowDashes 1.5s linear infinite;
    pointer-events: none;
}

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

/* AMBIENT PARTICLES CANVAS */
#ambient-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* SHOCKWAVE RIPPLE EFFECT */
.shockwave-ripple {
    position: absolute;
    border: 1px solid var(--accent);
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.85;
    animation: rippleOut 0.8s cubic-bezier(0.1, 0.8, 0.25, 1) forwards;
    z-index: 9;
}

@keyframes rippleOut {
    to {
        transform: translate(-50%, -50%) scale(5.5);
        opacity: 0;
    }
}

/* CORE ROTATING ZODIAC RING */
.core-zodiac-ring {
    position: absolute;
    width: 120%;
    height: 120%;
    border-radius: 50%;
    border: 1.5px dashed var(--accent);
    animation: spin 16s linear infinite;
    pointer-events: none;
    opacity: 0.55;
    transition: border-color 0.3s;
}
