/* ============================================
   concengine.net — Concurrent Event Simulation Engine
   Ocean Deep / Japanese Minimal / Crystalline
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'Saira', sans-serif;
    font-weight: 300;
    background: #070b14;
    color: #e0f4ff;
    overflow-x: hidden;
    line-height: 1.7;
}

/* --- Sidebar --- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 240px;
    height: 100vh;
    background: #0a0f1a;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    animation: sidebarFadeIn 600ms ease-out forwards;
}

@keyframes sidebarFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.sidebar-nodes {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
}

.hex-node {
    cursor: default;
    transition: transform 200ms ease-out, filter 200ms ease-out;
}

.hex-node polygon {
    fill: none;
    stroke: #1a4f6e;
    stroke-width: 2;
    transition: fill 400ms ease, stroke 400ms ease;
}

.hex-node.active polygon {
    fill: #4ecdc4;
    stroke: #4ecdc4;
}

.hex-node:hover {
    transform: scale(1.2);
}

.hex-node:hover polygon {
    stroke: #a8e6cf;
    fill: rgba(168, 230, 207, 0.15);
}

.sidebar-label {
    position: absolute;
    bottom: 40px;
    left: 50%;
    font-family: 'Share Tech Mono', monospace;
    font-size: 10px;
    text-transform: uppercase;
    color: #1a4f6e;
    letter-spacing: 0.15em;
    transform: translateX(-50%) rotate(-90deg);
    transform-origin: center center;
    white-space: nowrap;
}

/* --- Sidebar Dividing Line --- */
.sidebar-line {
    position: fixed;
    top: 0;
    left: 240px;
    width: 1px;
    height: 100vh;
    background: #1a4f6e;
    z-index: 99;
    animation: linePulse 2s ease-in-out infinite;
}

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

/* --- Main Content --- */
.main-content {
    margin-left: 240px;
    width: calc(100vw - 240px);
}

/* --- Sections --- */
.section {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #070b14;
    overflow: hidden;
}

.section-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    flex: 1;
    position: relative;
}

/* --- Section Titles --- */
.section-title {
    font-family: 'Saira Stencil One', sans-serif;
    font-weight: 400;
    font-size: clamp(5rem, 15vw, 12rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #e0f4ff;
    text-shadow: 0 0 40px rgba(26, 79, 110, 0.6);
    z-index: 10;
    position: relative;
    opacity: 0;
    transition: opacity 600ms ease;
}

.section-title.visible {
    opacity: 1;
}

/* Fork title glow pulse */
#forkTitle.visible {
    animation: glowPulse 1.5s ease-out forwards;
}

@keyframes glowPulse {
    0% { text-shadow: 0 0 0px rgba(26, 79, 110, 0); opacity: 0; }
    30% { text-shadow: 0 0 40px rgba(26, 79, 110, 0.6); opacity: 1; }
    100% { text-shadow: 0 0 20px rgba(26, 79, 110, 0.4); opacity: 1; }
}

/* --- Section Dividers --- */
.section-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px 0;
    width: 100%;
}

.micro-hex polygon {
    fill: none;
    stroke: #1a4f6e;
    stroke-width: 1;
    transition: fill 300ms ease, stroke 300ms ease;
}

.micro-hex.lit polygon {
    fill: #4ecdc4;
    stroke: #4ecdc4;
}

/* --- FORK Section --- */
.crystal-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 5;
}

.crystal-left,
.crystal-right {
    transition: transform 0.1s linear;
}

.crystal-left {
    transform: translateX(0) scaleX(-1);
}

.crystal-right {
    transform: translateX(0);
}

/* --- EXECUTE Section --- */
.hex-grid {
    display: grid;
    grid-template-columns: repeat(8, 48px);
    grid-template-rows: repeat(8, 48px);
    gap: 4px;
    margin: 40px auto;
}

.hex-cell {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hex-cell svg polygon {
    fill: none;
    stroke: #1a4f6e;
    stroke-width: 1.5;
    transition: fill 150ms ease, stroke 150ms ease;
}

.hex-cell.lit svg polygon {
    stroke: #4ecdc4;
}

.hex-cell.lit-1 svg polygon {
    fill: #1a4f6e;
    stroke: #4ecdc4;
}

.hex-cell.lit-2 svg polygon {
    fill: #4ecdc4;
    stroke: #4ecdc4;
}

.hex-cell.lit-3 svg polygon {
    fill: #a8e6cf;
    stroke: #a8e6cf;
}

.execute-caption {
    font-family: 'Share Tech Mono', monospace;
    font-size: 13px;
    color: #8fb8cc;
    text-align: center;
    margin-top: 24px;
}

.execute-caption code {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

/* --- CONVERGE Section --- */
.converge-crystal-container {
    position: relative;
    width: 400px;
    height: 400px;
    margin: 40px auto;
}

.converge-crystal {
    width: 100%;
    height: 100%;
}

.converge-crystal .frag {
    transition: transform 600ms ease-out, opacity 600ms ease-out;
}

.converge-flash {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(78, 205, 196, 0.4) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0;
}

.converge-flash.active {
    animation: flashBurst 400ms ease-out forwards;
}

@keyframes flashBurst {
    0% { width: 0; height: 0; opacity: 1; }
    100% { width: 500px; height: 500px; opacity: 0; }
}

/* --- RESOLVE Section --- */
.resolve-crystal-wrapper {
    perspective: 800px;
    margin: 40px auto;
}

.resolve-crystal {
    animation: crystalRotate 20s linear infinite;
    filter: drop-shadow(0 0 20px rgba(78, 205, 196, 0.3))
            drop-shadow(0 0 60px rgba(26, 79, 110, 0.4));
}

@keyframes crystalRotate {
    from { transform: rotateY(0deg); }
    to { transform: rotateY(360deg); }
}

.resolve-command {
    font-family: 'Share Tech Mono', monospace;
    font-size: 16px;
    color: #8fb8cc;
    margin-top: 48px;
    text-align: center;
}

.resolve-link {
    position: relative;
    cursor: pointer;
    color: #8fb8cc;
    display: inline-block;
    transition: color 300ms ease;
}

.resolve-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: #ff6b35;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 300ms ease;
}

.resolve-link:hover {
    color: #ff6b35;
}

.resolve-link:hover::after {
    transform: scaleX(1);
}

/* --- Cursor Particles --- */
.cursor-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    overflow: hidden;
}

.cursor-particle {
    position: absolute;
    width: 6px;
    height: 6px;
    pointer-events: none;
    opacity: 0.6;
    animation: particleFade 600ms ease-out forwards;
}

.cursor-particle svg polygon {
    fill: #1a4f6e;
}

@keyframes particleFade {
    0% { opacity: 0.6; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.3); }
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .sidebar {
        width: 60px;
    }

    .sidebar-label {
        display: none;
    }

    .sidebar-line {
        left: 60px;
    }

    .main-content {
        margin-left: 60px;
        width: calc(100vw - 60px);
    }

    .section-title {
        font-size: clamp(3rem, 12vw, 8rem);
    }

    .hex-grid {
        grid-template-columns: repeat(8, 36px);
        grid-template-rows: repeat(8, 36px);
        gap: 3px;
    }

    .hex-cell {
        width: 36px;
        height: 36px;
    }
}

@media (max-width: 600px) {
    .sidebar {
        display: none;
    }

    .sidebar-line {
        display: none;
    }

    .main-content {
        margin-left: 0;
        width: 100vw;
    }

    .hex-grid {
        grid-template-columns: repeat(8, 28px);
        grid-template-rows: repeat(8, 28px);
        gap: 2px;
    }

    .hex-cell {
        width: 28px;
        height: 28px;
    }

    .converge-crystal-container {
        width: 280px;
        height: 280px;
    }
}
