/* ============================================================
   chloengine.com -- Retro-Futuristic Engine Boot Sequence
   Colors: #0a0c10 #141820 #1e2430 #00e5ff #39ff14 #f5a623
           #ff2d55 #d0d8e8 #7a8599
   Fonts: Orbitron, Chakra Petch, IBM Plex Sans, IBM Plex Mono
   ============================================================ */

:root {
    --void: #0a0c10;
    --charcoal: #141820;
    --slate: #1e2430;
    --cyan: #00e5ff;
    --green: #39ff14;
    --amber: #f5a623;
    --red: #ff2d55;
    --silver: #d0d8e8;
    --dim: #7a8599;
    --cyan-glow: rgba(0, 229, 255, 0.2);
}

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

html { scroll-behavior: smooth; }

body {
    background: var(--void);
    color: var(--silver);
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 16px;
    line-height: 1.65;
    overflow-x: hidden;
}

/* ===== Navigation ===== */
#main-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 32px;
    background: rgba(10, 12, 16, 0.85);
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s ease, background 0.3s ease;
}

#main-nav.scrolled {
    border-bottom-color: var(--cyan-glow);
    background: rgba(10, 12, 16, 0.95);
}

.nav-logo {
    width: 32px;
    height: 32px;
    cursor: pointer;
}

.logo-cube {
    width: 100%;
    height: 100%;
    transition: transform 0.4s ease;
}

.nav-logo:hover .logo-cube {
    transform: rotateY(90deg);
}

.nav-links {
    display: flex;
    gap: 32px;
}

.nav-links a {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    color: var(--dim);
    text-decoration: none;
    letter-spacing: 0.04em;
    position: relative;
    transition: color 0.3s ease;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 1px;
    background: var(--cyan);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.nav-links a:hover {
    color: var(--cyan);
}

.nav-links a:hover::after {
    transform: scaleX(1);
}

/* ===== Hero Viewport ===== */
#hero-viewport {
    min-height: 100vh;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--void);
}

.scanlines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.04) 2px,
        rgba(0, 0, 0, 0.04) 4px
    );
    pointer-events: none;
    z-index: 5;
}

.grid-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(30, 36, 48, 0.3) 1px, transparent 1px),
        linear-gradient(90deg, rgba(30, 36, 48, 0.3) 1px, transparent 1px);
    background-size: 40px 40px;
    transform: perspective(800px) rotateX(40deg) scale(2.5);
    transform-origin: center 80%;
    opacity: 0.4;
    z-index: 1;
}

#wireframe-terrain {
    position: absolute;
    bottom: 10%;
    left: 0;
    width: 100%;
    height: 50%;
    z-index: 2;
    opacity: 0;
    transition: opacity 1s ease;
}

#wireframe-terrain.visible {
    opacity: 1;
}

.hero-title-block {
    position: relative;
    z-index: 10;
    text-align: center;
    opacity: 0;
    transition: opacity 1s ease;
}

.hero-title-block.visible {
    opacity: 1;
}

.hero-title {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: clamp(48px, 10vw, 120px);
    letter-spacing: 0.08em;
    color: var(--silver);
    text-shadow: 0 0 30px var(--cyan-glow);
}

.hero-subtitle {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: clamp(20px, 4vw, 48px);
    letter-spacing: 0.25em;
    color: var(--dim);
    margin-top: -4px;
}

.boot-cursor {
    display: inline-block;
    width: 12px;
    height: 24px;
    background: var(--cyan);
    margin-left: 8px;
    vertical-align: middle;
    animation: cursorBlink 1s step-end infinite;
}

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

#hud-stats {
    position: absolute;
    bottom: 16px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 32px;
    z-index: 10;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    color: rgba(168, 230, 207, 0.7);
    letter-spacing: 0.02em;
}

.stat-val {
    color: var(--cyan);
}

.scroll-chevron {
    position: absolute;
    bottom: 48px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    opacity: 0;
    animation: chevronPulse 2s ease-in-out infinite;
    animation-play-state: paused;
}

.scroll-chevron.visible {
    animation-play-state: running;
    opacity: 1;
}

@keyframes chevronPulse {
    0%, 100% { opacity: 0.3; transform: translateX(-50%) translateY(0); }
    50% { opacity: 1; transform: translateX(-50%) translateY(6px); }
}

/* ===== Pipeline Section ===== */
#pipeline-section {
    padding: 120px 0 80px;
    position: relative;
}

.pipeline-stage {
    max-width: 700px;
    margin: 0 auto 40px;
    background: var(--charcoal);
    border: 1px solid rgba(0, 229, 255, 0.15);
    position: relative;
    clip-path: polygon(0 0, 100% 4%, 100% 96%, 0 100%);
    opacity: 0;
    transform: translateX(-60px);
    transition: opacity 0.5s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.pipeline-stage.visible {
    opacity: 1;
    transform: translateX(0);
}

.stage-progress {
    height: 2px;
    background: var(--cyan);
    width: 0%;
    transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.pipeline-stage.visible .stage-progress {
    width: 100%;
}

.stage-content {
    padding: 32px 40px;
    display: flex;
    align-items: flex-start;
    gap: 24px;
}

.stage-icon {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
}

.stage-icon svg {
    width: 100%;
    height: 100%;
}

.stage-title {
    font-family: 'Chakra Petch', sans-serif;
    font-weight: 600;
    font-size: 20px;
    letter-spacing: 0.06em;
    color: var(--cyan);
    margin-bottom: 8px;
}

.stage-desc {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 15px;
    color: var(--dim);
    line-height: 1.6;
}

/* ===== Node Graph Section ===== */
#nodes-section {
    padding: 100px 24px;
    position: relative;
}

.section-header {
    font-family: 'Chakra Petch', sans-serif;
    font-weight: 600;
    font-size: clamp(28px, 4vw, 44px);
    letter-spacing: 0.04em;
    color: var(--silver);
    text-align: center;
    margin-bottom: 60px;
}

.node-graph-container {
    position: relative;
    width: 100%;
    max-width: 1100px;
    height: 320px;
    margin: 0 auto;
}

.node-connections-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.node-connections-svg path {
    fill: none;
    stroke: var(--cyan);
    stroke-width: 2;
    opacity: 0.4;
    stroke-dasharray: 8 4;
    animation: dashFlow 2s linear infinite;
    filter: drop-shadow(0 0 2px var(--cyan-glow));
}

@keyframes dashFlow {
    to { stroke-dashoffset: -24; }
}

.node-graph {
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 2;
}

.feature-node {
    position: absolute;
    background: var(--charcoal);
    border: 1px solid var(--cyan);
    border-radius: 6px;
    padding: 14px 20px;
    cursor: pointer;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.4s ease, transform 0.4s ease,
                box-shadow 0.3s ease;
}

.feature-node.visible {
    opacity: 1;
    transform: scale(1);
}

.feature-node:hover {
    box-shadow: 0 0 16px var(--cyan-glow), 0 0 4px var(--cyan-glow);
}

.node-label {
    display: block;
    font-family: 'Chakra Petch', sans-serif;
    font-weight: 600;
    font-size: 14px;
    color: var(--cyan);
    letter-spacing: 0.04em;
}

.node-detail {
    display: block;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    color: var(--dim);
    margin-top: 4px;
}

/* ===== Console Section ===== */
#console-section {
    padding: 100px 24px;
}

.console-panel {
    max-width: 800px;
    margin: 0 auto;
    background: var(--void);
    border: 1px solid rgba(0, 229, 255, 0.15);
    border-radius: 4px;
    overflow: hidden;
}

.console-titlebar {
    background: var(--charcoal);
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid rgba(0, 229, 255, 0.1);
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dot-r { background: var(--red); }
.dot-y { background: var(--amber); }
.dot-g { background: var(--green); }

.console-title {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    color: var(--dim);
    margin-left: 8px;
}

#console-output {
    padding: 16px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 14px;
    line-height: 1.8;
    min-height: 280px;
    max-height: 400px;
    overflow-y: auto;
}

.cline {
    color: var(--silver);
    min-height: 1.8em;
    white-space: pre-wrap;
}

.cline-green { color: var(--green); }
.cline-amber { color: var(--amber); }

.console-input-line {
    padding: 8px 16px 16px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 14px;
    color: var(--green);
    display: flex;
    align-items: center;
    cursor: pointer;
}

.prompt { color: var(--green); }

.block-cursor {
    display: inline-block;
    width: 8px;
    height: 16px;
    background: var(--green);
    animation: cursorBlink 1s step-end infinite;
    margin-left: 2px;
}

/* ===== Build Footer ===== */
#build-footer {
    padding: 60px 24px;
    background: var(--void);
    position: relative;
}

.build-output {
    max-width: 700px;
    margin: 0 auto;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 14px;
    color: var(--dim);
    line-height: 2;
}

.build-success {
    color: var(--green);
    font-weight: 400;
    text-shadow: 0 0 8px rgba(57, 255, 20, 0.3);
}

.build-line {
    opacity: 0;
    transition: opacity 0.4s ease;
}

.build-line.visible {
    opacity: 1;
}

#flash-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    opacity: 0;
    pointer-events: none;
    z-index: 999;
    transition: opacity 0.2s ease;
}

#flash-overlay.flash {
    opacity: 0.08;
}

/* ===== Mobile ===== */
@media (max-width: 768px) {
    #hud-stats {
        flex-wrap: wrap;
        gap: 12px;
        font-size: 10px;
        padding: 0 16px;
    }

    .pipeline-stage {
        clip-path: none;
        margin: 0 16px 24px;
    }

    .stage-content {
        padding: 20px;
        flex-direction: column;
    }

    .node-graph-container {
        height: 500px;
    }

    .feature-node {
        padding: 10px 14px;
    }

    .nav-links {
        gap: 16px;
    }

    .nav-links a {
        font-size: 11px;
    }
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
    .boot-cursor, .block-cursor {
        animation: none;
        opacity: 1;
    }

    .node-connections-svg path {
        animation: none;
    }

    .scroll-chevron {
        animation: none;
        opacity: 0.5;
    }

    .pipeline-stage,
    .feature-node,
    .build-line {
        opacity: 1;
        transform: none;
        transition: none;
    }
}
