/* rational.monster — styles.css */

/* ===== RESET & BASE ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-deep: #0B0C10;
    --bg-main: #0F1118;
    --text-primary: #EDF2F4;
    --text-muted: #8D99AE;
    --accent-cyan: #2EC4B6;
    --accent-neon: #00F0FF;
    --accent-red: #FF4D6A;
    --accent-gold: #E6A817;
    --bg-mid: #1C2541;
    --sidebar-width: 280px;
    --font-display: 'Anybody', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;
    --font-ui: 'Space Grotesk', sans-serif;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ===== SIDEBAR ===== */
#sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-deep);
    border-right: 1px solid rgba(46, 196, 182, 0.15);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow: hidden;
}

#sidebar-header {
    padding: 24px 20px 16px;
    border-bottom: 1px solid rgba(141, 153, 174, 0.15);
}

.domain-title {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-cyan);
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.entity-status {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

#status-indicator {
    color: var(--accent-neon);
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Sidebar Nav */
#sidebar-nav {
    padding: 20px 0;
    flex-shrink: 0;
}

.nav-label {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--text-muted);
    letter-spacing: 0.15em;
    padding: 0 20px 10px;
    text-transform: uppercase;
}

.nav-link {
    display: block;
    padding: 8px 20px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
    letter-spacing: 0.05em;
    transition: all 0.2s ease;
    border-left: 2px solid transparent;
}

.nav-link:hover {
    color: var(--text-primary);
    background: rgba(46, 196, 182, 0.05);
}

.nav-link.active {
    color: var(--accent-cyan);
    border-left-color: var(--accent-cyan);
    background: rgba(46, 196, 182, 0.08);
}

/* Diagnostic Panel */
#diagnostic-panel {
    flex: 1;
    padding: 16px 20px;
    border-top: 1px solid rgba(141, 153, 174, 0.1);
    overflow: hidden;
}

.diag-label {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--accent-gold);
    letter-spacing: 0.15em;
    margin-bottom: 12px;
    text-transform: uppercase;
}

.diag-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-family: var(--font-mono);
    font-size: 0.7rem;
}

.diag-key {
    color: var(--text-muted);
}

.diag-val {
    color: var(--accent-neon);
    transition: color 0.3s;
}

.diag-val.warning {
    color: var(--accent-red);
}

.diag-stream {
    margin-top: 12px;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: rgba(141, 153, 174, 0.5);
    line-height: 1.4;
    max-height: 200px;
    overflow: hidden;
}

/* Sidebar Footer */
#sidebar-footer {
    padding: 12px 20px;
    border-top: 1px solid rgba(141, 153, 174, 0.1);
    flex-shrink: 0;
}

.scan-line {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-cyan), transparent);
    margin-bottom: 8px;
    animation: scanLine 3s linear infinite;
}

@keyframes scanLine {
    0% { opacity: 0.2; }
    50% { opacity: 0.8; }
    100% { opacity: 0.2; }
}

.build-info {
    font-family: var(--font-mono);
    font-size: 0.55rem;
    color: rgba(141, 153, 174, 0.4);
    letter-spacing: 0.08em;
}

/* ===== MAIN CONTENT ===== */
#content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    position: relative;
}

/* ===== THEOREM ZONES ===== */
.theorem-zone {
    min-height: 100vh;
    padding: 80px 60px;
    position: relative;
    border-bottom: 1px solid rgba(141, 153, 174, 0.08);
}

.theorem-zone::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, var(--accent-cyan), transparent 60%);
    opacity: 0.3;
}

.zone-header {
    margin-bottom: 60px;
    position: relative;
}

.zone-number {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.2em;
    display: block;
    margin-bottom: 12px;
}

.zone-title {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(2.8rem, 8vw, 6.5rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-primary);
    line-height: 0.95;
    font-stretch: 150%;
    position: relative;
}

.zone-subtitle {
    font-family: var(--font-ui);
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 16px;
    letter-spacing: 0.03em;
}

/* ===== GLITCH TEXT EFFECT ===== */
.glitch-text {
    position: relative;
}

.glitch-text::before,
.glitch-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
}

.glitch-text::before {
    color: var(--accent-red);
    z-index: -1;
}

.glitch-text::after {
    color: var(--accent-neon);
    z-index: -1;
}

.glitch-text.glitching::before {
    opacity: 0.8;
    animation: glitchBefore 0.3s steps(2) both;
}

.glitch-text.glitching::after {
    opacity: 0.8;
    animation: glitchAfter 0.3s steps(2) both;
}

@keyframes glitchBefore {
    0% { clip-path: inset(40% 0 61% 0); transform: translate(-2px, -1px); }
    20% { clip-path: inset(92% 0 1% 0); transform: translate(1px, 2px); }
    40% { clip-path: inset(43% 0 1% 0); transform: translate(-1px, -1px); }
    60% { clip-path: inset(25% 0 58% 0); transform: translate(2px, 1px); }
    80% { clip-path: inset(54% 0 7% 0); transform: translate(-1px, 2px); }
    100% { clip-path: inset(58% 0 43% 0); transform: translate(0); }
}

@keyframes glitchAfter {
    0% { clip-path: inset(65% 0 13% 0); transform: translate(2px, 1px); }
    20% { clip-path: inset(79% 0 14% 0); transform: translate(-2px, -1px); }
    40% { clip-path: inset(20% 0 62% 0); transform: translate(1px, 1px); }
    60% { clip-path: inset(48% 0 29% 0); transform: translate(-1px, 2px); }
    80% { clip-path: inset(70% 0 5% 0); transform: translate(2px, -1px); }
    100% { clip-path: inset(30% 0 48% 0); transform: translate(0); }
}

/* ===== ZONE BODY ===== */
.zone-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: start;
}

/* ===== DECISION TREES (SVG) ===== */
.decision-tree-container {
    position: relative;
}

.decision-tree {
    width: 100%;
    max-width: 600px;
    height: auto;
}

.tree-branch {
    stroke: var(--text-muted);
    stroke-width: 1.5;
    opacity: 0.5;
    transition: opacity 0.3s;
}

.tree-branch.dashed {
    stroke-dasharray: 6 4;
}

.tree-branch.recursive-path {
    stroke: var(--accent-red);
    stroke-width: 1;
    stroke-dasharray: 4 4;
    opacity: 0.6;
    animation: recursivePulse 2s ease-in-out infinite;
}

.tree-branch.emergent-link {
    stroke: var(--accent-gold);
    stroke-width: 1;
    stroke-dasharray: 3 3;
    opacity: 0.4;
}

@keyframes recursivePulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.8; }
}

.tree-node {
    fill: var(--bg-deep);
    stroke: var(--accent-cyan);
    stroke-width: 2;
    transition: all 0.3s;
}

.tree-node.node-root {
    stroke: var(--accent-neon);
    stroke-width: 2.5;
    filter: drop-shadow(0 0 6px rgba(0, 240, 255, 0.4));
}

.tree-node.node-leaf {
    stroke: var(--text-muted);
    stroke-width: 1.5;
}

.tree-node.node-active {
    stroke: var(--accent-gold);
    fill: rgba(230, 168, 23, 0.15);
}

.tree-node.node-paradox {
    stroke: var(--accent-red);
    fill: rgba(255, 77, 106, 0.1);
    filter: drop-shadow(0 0 8px rgba(255, 77, 106, 0.3));
}

.tree-node.node-convergence {
    stroke: var(--accent-gold);
    stroke-width: 2.5;
    fill: rgba(230, 168, 23, 0.1);
    filter: drop-shadow(0 0 8px rgba(230, 168, 23, 0.3));
}

.tree-node.node-emergence {
    stroke: var(--accent-neon);
    stroke-width: 3;
    fill: rgba(0, 240, 255, 0.08);
    filter: drop-shadow(0 0 12px rgba(0, 240, 255, 0.4));
    animation: emergencePulse 3s ease-in-out infinite;
}

@keyframes emergencePulse {
    0%, 100% { filter: drop-shadow(0 0 12px rgba(0, 240, 255, 0.2)); }
    50% { filter: drop-shadow(0 0 20px rgba(0, 240, 255, 0.6)); }
}

.tree-label {
    font-family: var(--font-mono);
    font-size: 9px;
    fill: var(--text-muted);
    text-anchor: middle;
    letter-spacing: 0.1em;
}

.tree-node-rect {
    fill: var(--bg-deep);
    stroke: var(--accent-cyan);
    stroke-width: 2;
}

/* ===== ZONE TEXT ===== */
.zone-text {
    max-width: 560px;
}

.theorem-statement {
    font-family: var(--font-ui);
    font-size: 1.15rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.7;
    margin-bottom: 24px;
    position: relative;
    padding-left: 20px;
    border-left: 2px solid var(--accent-cyan);
}

.theorem-proof {
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.8;
    margin-bottom: 24px;
}

.theorem-proof em {
    color: var(--accent-gold);
    font-style: italic;
}

/* Annotations */
.annotation-block {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(46, 196, 182, 0.05);
    border: 1px solid rgba(46, 196, 182, 0.15);
    border-radius: 2px;
    margin-top: 20px;
}

.annotation-marker {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent-cyan);
    flex-shrink: 0;
}

.annotation-text {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.annotation-warning {
    background: rgba(255, 77, 106, 0.05);
    border-color: rgba(255, 77, 106, 0.2);
}

.annotation-warning .annotation-marker {
    color: var(--accent-red);
}

.annotation-final {
    background: rgba(0, 240, 255, 0.05);
    border-color: rgba(0, 240, 255, 0.2);
}

.annotation-final .annotation-marker {
    color: var(--accent-neon);
}

/* Probability Cascade */
.probability-cascade {
    margin-top: 24px;
    padding: 16px;
    background: #1C2541;
    border: 1px solid rgba(141, 153, 174, 0.1);
}

.cascade-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    border-bottom: 1px solid rgba(141, 153, 174, 0.06);
}

.cascade-row:last-child {
    border-bottom: none;
}

.cascade-hyp {
    color: var(--text-muted);
}

.cascade-prob {
    color: var(--accent-cyan);
    transition: all 0.3s;
}

/* ===== GLITCH OVERLAY ===== */
.glitch-overlay {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 50;
    opacity: 0;
    transition: opacity 0.1s;
}

.glitch-overlay.active {
    opacity: 1;
}

/* Scan lines across entire content */
#content::after {
    content: '';
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.03) 2px,
        rgba(0, 0, 0, 0.03) 4px
    );
    pointer-events: none;
    z-index: 10;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .zone-body {
        grid-template-columns: 1fr;
        gap: 40px;
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 0px;
    }

    #sidebar {
        transform: translateX(-100%);
        width: 280px;
        transition: transform 0.3s ease;
    }

    #sidebar.open {
        transform: translateX(0);
    }

    #content {
        margin-left: 0;
    }

    #content::after {
        left: 0;
    }

    .glitch-overlay {
        left: 0;
    }

    .theorem-zone {
        padding: 60px 24px;
    }
}

/* ===== ZONE VISIBILITY ANIMATIONS ===== */
.theorem-zone {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.theorem-zone.visible {
    opacity: 1;
    transform: translateY(0);
}
