/* xanadu.science - Hypertext Topology Interface */

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    background-color: #F8F6F1;
    color: #1A1A1A;
    font-family: 'Source Serif 4', Georgia, serif;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    position: relative;
}

/* Subtle paper texture overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg width='4' height='4' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='4' height='4' fill='%23F8F6F1'/%3E%3Crect x='0' y='0' width='1' height='1' fill='%23000' fill-opacity='0.008'/%3E%3Crect x='2' y='2' width='1' height='1' fill='%23000' fill-opacity='0.005'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 9999;
}

/* Main container */
#container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Left panel - Force-directed graph */
#graph-panel {
    width: 35%;
    min-width: 280px;
    height: 100vh;
    position: relative;
    border-right: 1px solid #CCCCCC;
    background-color: #F8F6F1;
    overflow: hidden;
    flex-shrink: 0;
}

#graph-svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* SVG node styles */
.node-circle {
    cursor: pointer;
    transition: transform 0.3s ease;
}

.node-circle:hover {
    filter: brightness(0.95);
}

.node-label {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 500;
    font-size: 9px;
    text-transform: uppercase;
    fill: #1A1A1A;
    pointer-events: none;
    user-select: none;
    letter-spacing: 0.05em;
}

.link-line {
    fill: none;
    stroke: #333333;
    stroke-opacity: 0.4;
    stroke-width: 1;
}

.link-line.weak {
    stroke: #CCCCCC;
    stroke-dasharray: 4 3;
    stroke-opacity: 0.6;
}

.link-line.temporal {
    stroke: #C87233;
    stroke-opacity: 0.3;
}

.link-line.active-path {
    stroke: #3B9FA8;
    stroke-opacity: 0.7;
    stroke-width: 2;
    transition: stroke-opacity 0.3s ease;
}

/* Active node ring animation */
.active-ring {
    fill: none;
    stroke: #3B9FA8;
    stroke-width: 1.5;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.active-ring.visible {
    opacity: 1;
}

/* Right panel - Prose content */
#prose-panel {
    flex: 1;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4rem 3rem 6rem 3rem;
    scroll-behavior: smooth;
}

#prose-panel section {
    max-width: 65ch;
    margin: 0 auto 3em auto;
    position: relative;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

#prose-panel section.visible {
    opacity: 1;
    transform: translateY(0);
}

#prose-panel section.highlight-pulse h2 {
    animation: headingPulse 2.5s ease-out;
}

@keyframes headingPulse {
    0% { background-color: transparent; }
    15% { background-color: rgba(59, 159, 168, 0.08); }
    100% { background-color: transparent; }
}

/* Typography - Headlines */
h2 {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-size: clamp(1.6rem, 4vw, 2.8rem);
    color: #1A1A1A;
    margin-bottom: 0.3em;
    padding: 0.1em 0.2em;
    line-height: 1.2;
}

/* Footnote anchor symbol */
.footnote-anchor {
    display: block;
    font-size: 1.2rem;
    color: #B8A044;
    margin-bottom: 1.2em;
    line-height: 1;
}

/* Body text */
p {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    line-height: 1.65;
    font-size: clamp(0.95rem, 2.2vw, 1.15rem);
    color: #1A1A1A;
    margin-bottom: 1.5em;
}

p:last-child {
    margin-bottom: 0;
}

/* Section dividers */
.section-divider {
    max-width: 65ch;
    margin: 0 auto 3em auto;
    border-top: 2px dashed #CCCCCC;
    padding-top: 0.8em;
    text-align: center;
}

.section-divider span {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #CCCCCC;
}

/* Scrollbar styling */
#prose-panel::-webkit-scrollbar {
    width: 6px;
}

#prose-panel::-webkit-scrollbar-track {
    background: #F8F6F1;
}

#prose-panel::-webkit-scrollbar-thumb {
    background: #CCCCCC;
    border-radius: 3px;
}

#prose-panel::-webkit-scrollbar-thumb:hover {
    background: #999999;
}

/* Node entrance animations */
@keyframes nodeAppear {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    60% {
        opacity: 1;
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes linkFadeIn {
    0% { stroke-opacity: 0; }
    100% { stroke-opacity: 0.4; }
}

/* Node activation pulse */
@keyframes nodePulse {
    0% { r: 16; }
    50% { r: 18.4; }
    100% { r: 16; }
}

/* Responsive: stacked layout below 900px */
@media (max-width: 900px) {
    #container {
        flex-direction: column;
    }

    #graph-panel {
        width: 100%;
        min-width: auto;
        height: 200px;
        border-right: none;
        border-bottom: 1px solid #CCCCCC;
    }

    #prose-panel {
        height: calc(100vh - 200px);
        padding: 2rem 1.5rem 4rem 1.5rem;
    }

    #prose-panel section {
        max-width: 100%;
    }

    .section-divider {
        max-width: 100%;
    }

    h2 {
        font-size: clamp(1.2rem, 5vw, 2rem);
    }
}

@media (max-width: 600px) {
    #prose-panel {
        padding: 1.5rem 1rem 3rem 1rem;
    }

    .node-label {
        font-size: 7px;
    }
}
