.knowledge-graph {
    margin-top: clamp(2.5rem, 6vw, 4rem);
    padding: clamp(1.1rem, 3vw, 2rem);
    border: 1px solid rgba(181, 205, 231, .16);
    border-radius: 1.2rem;
    background:
        radial-gradient(ellipse at 94% 0, rgba(80, 129, 184, .17), transparent 30rem),
        linear-gradient(145deg, rgba(23, 38, 58, .92), rgba(11, 20, 33, .92));
    box-shadow: 0 24px 60px rgba(0, 0, 0, .18);
}

.knowledge-graph-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1.4rem;
}

.knowledge-graph-kicker,
.knowledge-detail-kicker {
    margin: 0 0 .45rem;
    color: #89c5dd;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .1em;
}

.knowledge-graph-heading h2 {
    margin: 0;
    color: #eef4fa;
    font-size: clamp(1.4rem, 3vw, 1.9rem);
    line-height: 1.35;
}

.knowledge-graph-heading > div:first-child > p:last-child {
    max-width: 580px;
    margin: .55rem 0 0;
    color: #a7b6c8;
    font-size: .82rem;
    line-height: 1.75;
}

.knowledge-search {
    display: grid;
    width: min(100%, 270px);
    flex: 0 0 270px;
    gap: .35rem;
}

.knowledge-search label {
    color: #c8d6e5;
    font-size: .73rem;
    font-weight: 650;
}

.knowledge-search input {
    width: 100%;
    min-height: 42px;
    padding: .6rem .8rem;
    border: 1px solid rgba(186, 207, 230, .23);
    border-radius: .65rem;
    background: rgba(8, 17, 29, .72);
    color: #eff5fb;
    font: inherit;
    font-size: .8rem;
}

.knowledge-search input::placeholder {
    color: #8d9daf;
}

.knowledge-search input:focus-visible {
    border-color: #83b9d8;
    outline: 3px solid rgba(85, 156, 197, .25);
}

.knowledge-search > span {
    color: #91a2b6;
    font-size: .67rem;
}

.knowledge-graph-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(220px, .7fr);
    gap: .9rem;
    align-items: stretch;
}

.knowledge-canvas {
    position: relative;
    min-height: 330px;
    overflow: hidden;
    border: 1px solid rgba(182, 206, 232, .15);
    border-radius: .9rem;
    background:
        radial-gradient(circle at 50% 50%, rgba(52, 94, 139, .3), transparent 13rem),
        linear-gradient(rgba(185, 210, 235, .04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(185, 210, 235, .04) 1px, transparent 1px),
        rgba(10, 19, 31, .68);
    background-size: auto, 26px 26px, 26px 26px, auto;
}

.knowledge-edges {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.knowledge-edges path {
    fill: none;
    stroke: #6684a5;
    stroke-dasharray: 4 5;
    stroke-width: 2;
    vector-effect: non-scaling-stroke;
}

.knowledge-edges path[hidden] {
    display: none;
}

.knowledge-node {
    position: absolute;
    z-index: 1;
    display: grid;
    min-width: 138px;
    min-height: 62px;
    gap: .16rem;
    padding: .6rem .8rem;
    border: 1px solid rgba(183, 207, 233, .22);
    border-radius: .78rem;
    background: rgba(23, 37, 55, .96);
    box-shadow: 0 8px 20px rgba(0, 0, 0, .16);
    color: #b6c6d8;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.knowledge-node:hover {
    border-color: #85b7d8;
    box-shadow: 0 12px 24px rgba(0, 0, 0, .22);
    transform: translateY(-2px);
}

.knowledge-node:focus-visible {
    outline: 3px solid rgba(126, 188, 225, .5);
    outline-offset: 3px;
}

.knowledge-node[aria-pressed="true"] {
    border-color: #79b4d6;
    background: #203b58;
    box-shadow: 0 9px 25px rgba(30, 103, 151, .2);
}

.knowledge-node[hidden] {
    display: none;
}

.knowledge-node span {
    color: #91a5ba;
    font-size: .62rem;
}

.knowledge-node strong {
    color: #edf4fa;
    font-size: .8rem;
    font-weight: 700;
}

.knowledge-node-main {
    top: 40%;
    left: 42%;
    min-width: 150px;
    min-height: 72px;
    text-align: center;
}

.knowledge-node-interviews { top: 12%; left: 7%; }
.knowledge-node-principles { top: 12%; right: 7%; }
.knowledge-node-timeline { bottom: 10%; left: 7%; }
.knowledge-node-preferences { right: 7%; bottom: 10%; }

.knowledge-detail {
    min-width: 0;
    padding: 1.15rem;
    border: 1px solid rgba(182, 206, 232, .16);
    border-radius: .9rem;
    background: rgba(255, 255, 255, .045);
}

.knowledge-detail h3 {
    margin: 0;
    color: #eff5fb;
    font-size: 1.1rem;
    line-height: 1.45;
}

.knowledge-detail > p:not(.knowledge-detail-kicker) {
    margin: .62rem 0 1rem;
    color: #a7b7c9;
    font-size: .8rem;
    line-height: 1.8;
}

.knowledge-relations {
    padding-top: .85rem;
    border-top: 1px solid rgba(183, 207, 233, .12);
}

.knowledge-relations h4 {
    margin: 0 0 .55rem;
    color: #c8d6e5;
    font-size: .72rem;
    font-weight: 650;
}

.knowledge-relations ul {
    display: flex;
    flex-wrap: wrap;
    gap: .38rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.knowledge-relations li {
    padding: .3rem .52rem;
    border: 1px solid rgba(184, 207, 231, .16);
    border-radius: 999px;
    background: rgba(255, 255, 255, .045);
    color: #b5c4d5;
    font-size: .66rem;
}

.knowledge-graph-note {
    margin: .8rem 0 0;
    color: #8fa0b4;
    font-size: .67rem;
    line-height: 1.6;
}

@media (max-width: 760px) {
    .knowledge-graph-heading {
        align-items: stretch;
        flex-direction: column;
        gap: 1rem;
    }

    .knowledge-search {
        width: 100%;
        flex-basis: auto;
    }

    .knowledge-graph-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .knowledge-canvas {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        min-height: 0;
        gap: .5rem;
        padding: .7rem;
    }

    .knowledge-edges {
        display: none;
    }

    .knowledge-node,
    .knowledge-node-main,
    .knowledge-node-interviews,
    .knowledge-node-principles,
    .knowledge-node-timeline,
    .knowledge-node-preferences {
        position: static;
        width: 100%;
        min-width: 0;
        min-height: 60px;
    }

    .knowledge-node-main {
        grid-column: 1 / -1;
        text-align: left;
    }

    .knowledge-node:hover {
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .knowledge-node {
        transition: none;
    }
}
