/* Project Egregore - Modern Flexbox Layout - FIXED */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%);
    color: #e2e8f0;
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Network Canvas Background */
#networkCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.3;
}

/* Main Container */
.main-container {
    position: relative;
    z-index: 1;
    min-height: 100vh;
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(15, 15, 35, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(100, 255, 218, 0.2);
    z-index: 1000;
    transition: transform 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: #64ffda;
    text-decoration: none;
}

.navbar-subtitle {
    font-size: 0.9rem;
    color: #94a3b8;
    margin-left: 0.5rem;
}

.navbar-nav {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.navbar-nav a {
    color: #e2e8f0;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
}

.navbar-nav a:hover {
    background: rgba(100, 255, 218, 0.1);
    color: #64ffda;
}

/* Content Sections */
.content-section {
    min-height: 100vh;
    padding: 6rem 2rem 4rem;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.content-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Hero Section */
.hero-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    min-height: 100vh;
    padding: 2rem;
    position: relative;
    z-index: 2;
}

.hero-title {
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 800;
    background: linear-gradient(135deg, #64ffda 0%, #a78bfa 50%, #f472b6 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1rem;
    line-height: 1.1;
    text-align: center;
}

.hero-subtitle {
    font-size: clamp(1.2rem, 3vw, 1.8rem);
    color: #94a3b8;
    margin-bottom: 2rem;
    max-width: 800px;
    text-align: center;
}

.hero-description {
    font-size: 1.2rem;
    color: #cbd5e1;
    margin-bottom: 3rem;
    max-width: 600px;
    line-height: 1.7;
    text-align: center;
}

.hero-metrics {
    display: flex;
    gap: 3rem;
    margin-top: 2rem;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.metric {
    text-align: center;
}

.metric-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: #64ffda;
    display: block;
}

.metric-label {
    font-size: 0.9rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Section Headers */
.section-header {
    text-align: center;
    margin-bottom: 4rem;
}

.section-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 700;
    color: #f1f5f9;
    margin-bottom: 1rem;
}

.section-subtitle {
    font-size: 1.3rem;
    color: #94a3b8;
    max-width: 800px;
    margin: 0 auto;
}

/* Content Blocks */
.content-block {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 2.5rem;
    margin-bottom: 2rem;
    border: 1px solid rgba(100, 255, 218, 0.1);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
}

.content-block:hover {
    transform: translateY(-4px);
    border-color: rgba(100, 255, 218, 0.3);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.content-block h3 {
    font-size: 1.8rem;
    color: #64ffda;
    margin-bottom: 1rem;
}

.content-block p {
    margin-bottom: 1rem;
    color: #cbd5e1;
    line-height: 1.7;
}

/* Cards Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
    position: relative;
    z-index: 2;
}

.card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 2rem;
    border: 1px solid rgba(100, 255, 218, 0.1);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 2;
}

.card:hover {
    transform: translateY(-8px);
    border-color: rgba(100, 255, 218, 0.3);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
}

.card-header {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.card-icon {
    font-size: 2rem;
    margin-right: 1rem;
}

.card-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #f1f5f9;
}

.card-content {
    flex: 1;
    color: #cbd5e1;
    line-height: 1.6;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, #64ffda 0%, #4ade80 100%);
    color: #0f172a;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(100, 255, 218, 0.3);
}

.btn-secondary {
    background: rgba(100, 255, 218, 0.1);
    color: #64ffda;
    border: 1px solid #64ffda;
}

.btn-secondary:hover {
    background: rgba(100, 255, 218, 0.2);
    transform: translateY(-2px);
}

/* Demo Controls */
.demo-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.demo-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
}

.demo-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

/* Physics Demo */
.physics-demo {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 2rem;
    margin: 2rem 0;
    border: 1px solid rgba(100, 255, 218, 0.1);
    position: relative;
    z-index: 2;
}

.demo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.client-node {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.client-node h4 {
    color: #f1f5f9;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.client-node .metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.client-node .metric span:first-child {
    font-size: 0.9rem;
    color: #94a3b8;
}

.client-node .metric .value {
    font-weight: 600;
    color: #f1f5f9;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin: 0 0.5rem;
}

.progress {
    height: 100%;
    background: linear-gradient(90deg, #00ff88, #00cc66);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.game-view {
    text-align: center;
    padding: 0.5rem;
    border-radius: 6px;
    font-weight: 600;
    margin-top: 1rem;
    background: rgba(0, 0, 0, 0.2);
}

/* Visual Diagrams */
.visual-network-diagram,
.visual-queue-diagram {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 15px;
    padding: 2rem;
    margin: 2rem 0;
    border: 1px solid rgba(100, 255, 218, 0.2);
    position: relative;
    z-index: 2;
}

/* Network Diagram Styles */
.server-layer {
    text-align: center;
    margin-bottom: 2rem;
}

.server-node {
    display: inline-block;
    background: rgba(100, 255, 218, 0.1);
    border: 2px solid #64ffda;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 0 auto;
}

.server-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.server-label {
    font-weight: bold;
    color: #64ffda;
    font-size: 1.2rem;
}

.server-sublabel {
    color: #94a3b8;
    font-size: 0.9rem;
}

.escalation-line {
    text-align: center;
    margin: 1rem 0;
    color: #ffa500;
    font-style: italic;
}

.p2p-layer {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 1.5rem;
}

.layer-title {
    text-align: center;
    font-weight: bold;
    color: #64ffda;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.nodes-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.peer-node {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    border: 2px solid transparent;
    position: relative;
}

.peer-node.high-trust {
    border-color: #4caf50;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.3);
}

.peer-node.medium-trust {
    border-color: #2196f3;
    box-shadow: 0 0 10px rgba(33, 150, 243, 0.3);
}

.peer-node.low-trust {
    border-color: #f44336;
    box-shadow: 0 0 10px rgba(244, 67, 54, 0.3);
}

.peer-node.cheater {
    animation: cheaterPulse 1.5s infinite;
}

@keyframes cheaterPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.cheater-indicator {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: #ff4444;
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: bold;
}

.node-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.node-label {
    font-weight: bold;
    color: #f1f5f9;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.node-stats {
    font-size: 0.7rem;
    color: #94a3b8;
}

.scenario-description {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.scenario-description h4 {
    color: #64ffda;
    margin-bottom: 1rem;
}

.scenario-description ol {
    color: #cbd5e1;
    padding-left: 1.5rem;
}

.scenario-description li {
    margin-bottom: 0.5rem;
}

.diagram-legend {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #94a3b8;
}

.legend-color {
    width: 20px;
    height: 4px;
    border-radius: 2px;
}

.p2p-color {
    background: #64ffda;
}

.consensus-color {
    background: #a78bfa;
}

.escalation-color {
    background: #ffa500;
}

/* Queue System Styles */
.queue-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.work-queue {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 1rem;
    border: 2px solid transparent;
}

.velocity-queue {
    border-color: #2196f3;
    box-shadow: 0 0 15px rgba(33, 150, 243, 0.3);
}

.gravity-queue {
    border-color: #9c27b0;
    box-shadow: 0 0 15px rgba(156, 39, 176, 0.3);
}

.collision-queue {
    border-color: #ff5722;
    box-shadow: 0 0 15px rgba(255, 87, 34, 0.3);
}

.other-queue {
    border-color: #607d8b;
    box-shadow: 0 0 15px rgba(96, 125, 139, 0.3);
}

.queue-header {
    font-weight: bold;
    text-align: center;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
}

.task-item {
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 5px;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.task-item.ready {
    background: rgba(76, 175, 80, 0.2);
    border-left: 4px solid #4caf50;
}

.task-item.processing {
    background: rgba(255, 152, 0, 0.2);
    border-left: 4px solid #ff9800;
    animation: processingPulse 1.5s infinite;
}

@keyframes processingPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.pull-arrows {
    text-align: center;
    margin: 1.5rem 0;
}

.arrow-container {
    display: flex;
    justify-content: space-around;
    max-width: 800px;
    margin: 0 auto;
}

.pull-arrow {
    font-size: 1.5rem;
    color: #64ffda;
    animation: pullAnimation 1.5s ease-in-out infinite;
}

@keyframes pullAnimation {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(8px); }
}

.client-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.client-node.high-end {
    border-color: #4caf50;
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.3);
}

.client-node.mid-range {
    border-color: #2196f3;
    box-shadow: 0 0 15px rgba(33, 150, 243, 0.3);
}

.client-node.laptop {
    border-color: #ff9800;
    box-shadow: 0 0 15px rgba(255, 152, 0, 0.3);
}

.client-node.old-pc {
    border-color: #f44336;
    box-shadow: 0 0 15px rgba(244, 67, 54, 0.3);
}

/* Expandable Sections */
.expandable-section {
    margin: 1rem 0;
}

.expand-trigger {
    background: rgba(100, 255, 218, 0.1);
    border: 1px solid rgba(100, 255, 218, 0.3);
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.expand-trigger:hover {
    background: rgba(100, 255, 218, 0.2);
}

.expand-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 0 0 8px 8px;
}

.expand-content.expanded {
    max-height: 2000px;
    padding: 1.5rem;
}

/* Fade-in Animation - FIXED */
.fade-in {
    opacity: 1 !important;
    transform: translateY(0) !important;
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in:not(.visible) {
    opacity: 0;
    transform: translateY(30px);
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Text Utilities */
.text-center { 
    text-align: center; 
}

/* Responsive Design */
@media (max-width: 768px) {
    .navbar {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
    }
    
    .navbar-nav {
        gap: 1rem;
    }
    
    .content-section {
        padding: 5rem 1rem 2rem;
    }
    
    .hero-metrics {
        gap: 2rem;
    }
    
    .cards-grid {
        grid-template-columns: 1fr;
    }
    
    .demo-grid {
        grid-template-columns: 1fr;
    }
    
    .queue-container {
        grid-template-columns: 1fr;
    }
    
    .client-container {
        grid-template-columns: 1fr;
    }
    
    .nodes-container {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }
    
    .diagram-legend {
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 2.5rem;
    }
    
    .content-block {
        padding: 1.5rem;
    }
    
    .card {
        padding: 1.5rem;
    }
}

/* Utility Classes */
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

