:root {
    --kg-border: var(--background-color-alt);
    --kg-text: var(--text-color);
    --kg-bg: var(--background-color);
    --kg-node-stroke: 3px;
    --kg-label-stroke: 3px;
    --kg-transition: all 0.2s ease;
}

/* Container */
.knowledge-graph-section { margin: 1rem 0 2rem; }
.blog-description { color: var(--text-color-alt); margin-bottom: 1.5rem; font-style: italic; }

#knowledge-graph-container {
    position: relative;
    width: 100%;
    height: 400px;
    border: 1px solid var(--kg-border);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1rem;
}

#loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--kg-bg);
    color: var(--kg-text);
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 10;
    display: none;
}

#knowledge-graph-svg {
    width: 100%;
    height: 100%;
    background: transparent; /* Transparent for screenshots */
}

/* Nodes */
.node {
    cursor: pointer;
    transition: var(--kg-transition);
}

.node:hover,
.node.highlighted {
    stroke-width: var(--kg-node-stroke);
    stroke: var(--kg-text);
}

.node.highlighted { stroke: #ff6b6b; }

.node.external_link {
    stroke-dasharray: 3,3;
    stroke-width: 2px;
}

.node.external_link:hover {
    stroke-width: 4px;
    stroke: var(--kg-text);
}

/* Node brightness filters by category */
.node.blog-post.tech { filter: brightness(1.1); }
.node.blog-post.personal { filter: brightness(1.15); }
.node.blog-post.projects { filter: brightness(1.05); }
.node.blog-post.tech:hover { filter: brightness(1.3); }
.node.blog-post.personal:hover { filter: brightness(1.35); }
.node.blog-post.projects:hover { filter: brightness(1.25); }

/* Links */
.link {
    transition: stroke-opacity 0.2s ease;
    stroke-linecap: round;
}

.link.highlighted {
    stroke-opacity: 1;
    stroke-width: 3px;
}

.link.external {
    stroke-dasharray: 5,5;
    stroke-opacity: 0.8;
}

/* Labels */
.node-label {
    font: var(--font-weight-medium) 11px var(--font-family);
    text-anchor: middle;
    pointer-events: none;
    fill: #ffffff; /* White text for visibility on both backgrounds */
    stroke: #000000; /* Black stroke for contrast */
    stroke-width: 3px; /* Thicker stroke for better readability */
    stroke-linejoin: round;
    paint-order: stroke;
    stroke-opacity: 0.8; /* Slightly transparent stroke */
}

.node-label.external-link {
    font-size: 10px;
    text-anchor: start;
    dominant-baseline: middle;
    fill: #ffffff; /* White text for consistency */
    stroke: #000000; /* Black stroke for contrast */
    stroke-width: 2.5px; /* Slightly thinner for smaller text */
    stroke-opacity: 0.8;
    font-weight: 500;
    opacity: 0.95;
    transition: var(--kg-transition);
}

.node-label.external-link.highlighted {
    font-size: 11px;
    fill: #ffffff;
    stroke-width: 3px;
    opacity: 1;
}

.node-label.blog-post-number {
    font-weight: bold;
    font-size: 13px;
    stroke-width: 4px; /* Thicker stroke for emphasis */
    letter-spacing: 0.5px;
}

.node-label.highlighted {
    fill: #ff6b6b; /* Keep highlight color distinct */
    stroke: #000000;
    stroke-width: 3px;
}

/* Tooltip */
.svg-tooltip {
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.tooltip-background {
    fill: var(--kg-bg);
    stroke: var(--kg-text);
    stroke-width: 1px;
    rx: 4;
    opacity: 0.95;
}

.svg-tooltip text {
    font: 12px var(--font-family);
    fill: var(--kg-text);
    text-anchor: middle;
    dominant-baseline: middle;
}

.svg-tooltip.hidden { opacity: 0; }
.svg-tooltip.visible { opacity: 1; }

/* Category Hulls */
.category-hull {
    pointer-events: none;
    transition: all 0.3s ease;
    filter: blur(0.5px);
    mix-blend-mode: screen;
    stroke-width: 2px;
    stroke-linejoin: round;
    opacity: 0.8;
}

/* Simplified hull animations */
@keyframes morph {
    0%, 100% { opacity: 0.8; filter: blur(0.5px); }
    50% { opacity: 0.7; filter: blur(0.7px); }
}

.hull-tech { animation: morph 8s ease-in-out infinite; }
.hull-personal { animation: morph 10s ease-in-out infinite; }
.hull-projects { animation: morph 7s ease-in-out infinite; }

/* Category Labels */
.category-label-group {
    pointer-events: none;
}

.category-label {
    font: 700 16px var(--font-family);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    pointer-events: none;
    user-select: none;
    text-anchor: middle;
    dominant-baseline: middle;
    fill: #ffffff;  /* White text for contrast */
    stroke: none;  /* Remove stroke for cleaner look with background */
    opacity: 1;  /* Full opacity for visibility */
}

/* Controls */
.controls-info {
    font-size: 12px;
    fill: #666;
    opacity: 0.7;
}

/* Effects */
.ripple-effect {
    fill: none;
    stroke: var(--kg-text);
    stroke-width: 2px;
    opacity: 0.6;
}

/* Responsive */
@media (max-width: 768px) {
    #knowledge-graph-container { height: 400px; }
    .node-label { font-size: 10px; }
}