/* ========================================= */
/* 1. CORE STYLES (DESKTOP DEFAULT)          */
/* ========================================= */
:root {
    --bg-dark: #050505;
    --bg-panel: #0a0a0a;
    --primary: #00ff41; /* Terminal Green */
    --text-main: #e0e0e0;
    --text-dim: #888;
    --border: #333;
    --font-heading: 'Inter', sans-serif;
    --font-mono: 'Space Mono', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-heading);
    line-height: 1.6;
    overflow-x: hidden; /* Prevents side scroll on mobile */
}

/* Scanline Effect Overlay */
body::before {
    content: " ";
    display: block;
    position: absolute;
    top: 0; left: 0; bottom: 0; right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.1) 50%);
    background-size: 100% 2px;
    pointer-events: none;
    z-index: 999;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* UTILS */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.highlight { color: var(--primary); }
.dim { color: var(--text-dim); }

/* SHARED HEADER */
header {
    border-bottom: 1px solid var(--border);
    padding: 20px 0;
    position: fixed;
    width: 100%;
    background: rgba(5, 5, 5, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1000;
}

header .container { display: flex; justify-content: space-between; align-items: center; }

a.logo { 
    display: flex; align-items: center; gap: 10px; 
    font-weight: 800; letter-spacing: -1px; font-size: 1.2rem; 
    text-decoration: none; color: inherit; cursor: pointer;
}
.logo-icon { width: 12px; height: 12px; background: var(--primary); box-shadow: 0 0 10px var(--primary); }

/* HIDE MENU TOGGLE ON DESKTOP */
.menu-toggle {
    display: none;
}

.nav-links a { 
    margin-left: 30px; 
    font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 1px; 
    color: var(--text-dim); transition: 0.2s; text-transform: uppercase; 
}
.nav-links a:hover { color: var(--primary); }

.btn-primary {
    border: 1px solid var(--primary);
    padding: 8px 16px;
    color: var(--primary) !important;
    font-weight: bold;
    background: transparent;
}
.btn-primary:hover { background: var(--primary); color: black !important; }

/* HERO */
#hero {
    height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    border-bottom: 1px solid var(--border);
    padding-top: 60px;
}

.grid-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: 
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 40px 40px;
    opacity: 0.07;
    z-index: -1;
}

.hero-content { z-index: 2; text-align: left; }

h1 {
    font-size: 3rem;
    line-height: 1.1;
    font-weight: 800;
    margin-bottom: 25px;
    letter-spacing: -1px;
    max-width: 1000px;
}

.hero-sub {
    font-size: 1.1rem;
    color: var(--text-dim);
    max-width: 600px;
    margin-bottom: 50px;
    line-height: 1.7;
}

.badge {
    font-family: var(--font-mono);
    color: var(--primary);
    border: 1px solid var(--primary);
    display: inline-block;
    padding: 4px 8px;
    font-size: 0.7rem;
    margin-bottom: 25px;
    letter-spacing: 2px;
}

.stats-row {
    display: flex;
    gap: 60px;
    border-top: 1px solid var(--border);
    padding-top: 30px;
}

.stat { display: flex; flex-direction: column; }
.stat .val { font-size: 2rem; font-weight: bold; font-family: var(--font-mono); line-height: 1; }
.stat .label { font-size: 0.7rem; color: var(--text-dim); letter-spacing: 2px; margin-top: 8px; }

/* SECTIONS */
.section { padding: 100px 0; }
.dark-alt { background: var(--bg-panel); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

.section-header { margin-bottom: 60px; text-align: left; }
.section-title { 
    font-size: 2rem; margin-bottom: 15px; 
    font-weight: 800; letter-spacing: -1px; 
    text-transform: uppercase; line-height: 1.2;
}
.subtitle { font-size: 1.1rem; color: var(--text-dim); max-width: 700px; margin: 0; }

/* GRIDS & CARDS */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }

.card {
    border: 1px solid var(--border);
    padding: 35px;
    background: var(--bg-dark);
    transition: all 0.2s ease;
}
.card:hover { border-color: var(--primary); box-shadow: 0 0 15px rgba(0, 255, 65, 0.1); transform: translateY(-5px); }
.icon-large { font-size: 1.8rem; color: var(--primary); margin-bottom: 20px; display: block; }
.card h3 { margin-bottom: 15px; font-family: var(--font-mono); font-size: 1rem; text-transform: uppercase; letter-spacing: 1px; }
.card p { color: var(--text-dim); font-size: 0.9rem; margin: 0; line-height: 1.6; }

/* TECH STACK */
.tech-stack { display: flex; flex-direction: column; gap: 20px; }
.stack-layer { display: flex; border: 1px solid var(--border); background: var(--bg-dark); min-height: 160px; align-items: stretch; }
.layer-meta {
    width: 140px; min-width: 140px;
    border-right: 1px solid var(--border);
    font-family: var(--font-mono); color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem; font-weight: bold;
}
.layer-content { padding: 35px; flex: 1; display: flex; flex-direction: column; justify-content: center; }
.layer-content p:last-child { margin-bottom: 0; }
.layer-content h3 { font-size: 1.2rem; margin-bottom: 8px; font-family: var(--font-mono); }
.layer-content p { color: var(--text-dim); font-size: 0.95rem; margin: 0; }
.layer-visual {
    width: 180px; min-width: 180px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    border-left: 1px solid var(--border); color: var(--text-dim);
}
.layer-visual i { font-size: 1.5rem; margin-bottom: 10px; }
.layer-visual span { font-size: 0.6rem; font-family: var(--font-mono); letter-spacing: 1px; }

/* PRICING */
.centered { text-align: center; } 
.centered .section-header { text-align: center; margin-left: auto; margin-right: auto; }
.hardware-card { border: 1px solid var(--border); padding: 40px; background: var(--bg-dark); }
.hw-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; }
.hw-header h4 { font-family: var(--font-mono); font-size: 1.1rem; margin: 0; }
.status-live { color: var(--bg-dark); padding: 4px 8px; font-size: 0.7rem; font-weight: bold; font-family: var(--font-mono); }
.hw-desc { color: var(--text-dim); font-size: 0.95rem; margin-bottom: 20px; }
.price-display { font-family: var(--font-mono); font-size: 1.4rem; color: var(--primary); font-weight: bold; border-top: 1px dashed var(--border); padding-top: 20px; }

/* FOOTER */
footer { padding: 80px 0; border-top: 1px solid var(--border); background: var(--bg-panel); }
.footer-content { display: flex; justify-content: space-between; margin-bottom: 40px; }
.f-col h3 { margin-bottom: 15px; font-family: var(--font-mono); font-size: 1rem; }
.f-col p { color: var(--text-dim); font-size: 0.9rem; }
.f-col.right a { display: block; text-align: right; margin-bottom: 10px; color: var(--text-dim); font-family: var(--font-mono); font-size: 0.9rem; transition: 0.2s; }
.f-col.right a:hover { color: var(--primary); }
.copyright { text-align: center; color: #444; font-size: 0.8rem; font-family: var(--font-mono); border-top: 1px solid var(--border); padding-top: 40px; }

/* ========================================= */
/* 2. SIMULATION & OVERLAY STYLES            */
/* ========================================= */

.sim-body {
    background-color: #050505;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(0, 255, 65, 0.03) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(0, 255, 65, 0.03) 0%, transparent 20%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Page Transition Overlay */
#page-transition {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: #000; z-index: 5000; opacity: 0; pointer-events: none;
    transition: opacity 0.8s ease;
}

/* 1. INTRO OVERLAY */
#intro-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: #000; z-index: 3000;
    display: flex; align-items: center; justify-content: center;
    transition: opacity 0.5s ease;
}
.intro-content {
    z-index: 2; text-align: center; background: rgba(0,0,0,0.8);
    padding: 60px; border: 1px solid var(--border);
    backdrop-filter: blur(10px); box-shadow: 0 0 50px rgba(0,0,0,0.8); border-radius: 4px;
}
.intro-grid {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 60px 60px; opacity: 0.1; z-index: 1;
}
#intro-overlay h1 { font-size: 3rem; margin-bottom: 10px; line-height: 1.1; }
#intro-overlay p { color: var(--text-dim); margin-bottom: 40px; font-size: 1.1rem; }
.intro-btn {
    background: transparent; border: 2px solid var(--primary); color: var(--primary);
    padding: 15px 40px; font-family: var(--font-mono); font-size: 1.1rem;
    font-weight: bold; cursor: pointer; text-transform: uppercase; letter-spacing: 2px;
    transition: 0.3s;
}
.intro-btn:hover { background: var(--primary); color: #000; box-shadow: 0 0 20px var(--primary); }

/* 2. LOADING SCREEN */
#loading-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: #000; z-index: 2900;
    display: none; flex-direction: column; align-items: center; justify-content: center;
}
.loader-content { text-align: center; max-width: 600px; padding: 20px; }
#loading-text {
    font-family: var(--font-mono); color: var(--primary);
    font-size: 1rem; margin: 30px 0; text-transform: uppercase; letter-spacing: 1px;
}
.loading-bar { width: 300px; height: 4px; background: #333; margin: 0 auto; border-radius: 2px; overflow: hidden; }
.loading-fill { height: 100%; width: 0%; background: var(--primary); transition: width 2.5s ease-in-out; }

/* 3. SIMULATION LAYOUT (Desktop Default) */
/* Initially hidden to prevent glimpse */
.sim-container-vertical {
    display: flex; flex-direction: column; align-items: center;
    padding: 100px 20px 60px; gap: 40px; 
    width: 100%; max-width: 1400px; margin: 0 auto;
    opacity: 0; pointer-events: none; transition: opacity 1s ease;
}
.sim-container-vertical.visible { opacity: 1; pointer-events: all; }

.sim-row { display: flex; gap: 40px; align-items: center; justify-content: center; width: 100%; position: relative; }

/* 4. PIPES & FLUIDS */
.pipe-vertical { width: 2px; height: 40px; background: #222; position: relative; overflow: hidden; }
.pipe-horizontal { width: 40px; height: 2px; background: #222; position: relative; overflow: hidden; }

/* Fluid Animation - Vertical */
.fluid-v { 
    position: absolute; top: 0; left: 0; width: 100%; height: 0%; 
    background: #00ff41; box-shadow: 0 0 10px #00ff41; 
    transition: height 0.6s linear; 
}
.active-pipe .fluid-v { height: 100%; }

/* Fluid Animation - Horizontal (Desktop Default: Left -> Right) */
.fluid-h { 
    position: absolute; left: 0; top: 0; width: 0%; height: 100%; 
    background: #00ff41; box-shadow: 0 0 10px #00ff41; 
    transition: width 0.6s linear; 
}
.active-pipe .fluid-h { width: 100%; }

/* 5. CARDS */
.sim-stage { width: 280px; flex-shrink: 0; position: relative; z-index: 2; }
.stage-label {
    font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-dim);
    margin-bottom: 10px; letter-spacing: 1px; text-align: center; text-transform: uppercase;
}
.stage-card {
    background: var(--bg-panel); border: 1px solid var(--border); padding: 25px;
    border-radius: 4px; text-align: center;
    height: 380px; 
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
    transition: all 0.3s ease; position: relative; overflow: hidden;
}
.stage-card h3 { margin-top: 15px; margin-bottom: 10px; font-size: 1.1rem; }
.stage-card p { font-size: 0.8rem; color: #888; }
.stage-card.active { border-color: var(--primary); box-shadow: 0 0 30px rgba(0, 255, 65, 0.15); }

/* Icons & Elements */
.icon-circle { width: 80px; height: 80px; border-radius: 50%; background: #111; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 2rem; color: var(--text-dim); margin-bottom: 20px; transition: 0.3s; }
.icon-circle.active { border-color: var(--primary); color: var(--primary); background: rgba(0, 255, 65, 0.1); }

.iot-device { width: 100px; height: 80px; border: 2px solid var(--text-dim); border-radius: 6px; margin-bottom: 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; background: rgba(0,0,0,0.3); transition: 0.3s; }
.chip { width: 30px; height: 30px; background: #333; display: flex; align-items: center; justify-content: center; font-size: 0.6rem; font-family: var(--font-mono); color: #777; border: 1px solid #555; }
.sensor-status { font-family: var(--font-mono); font-size: 0.6rem; color: var(--text-dim); font-weight: bold; }
.iot-device.active { border-color: var(--primary); box-shadow: 0 0 15px rgba(0, 255, 65, 0.2); }
.iot-device.active .chip { background: var(--primary); color: #000; }
.iot-device.active .sensor-status { color: var(--primary); text-shadow: 0 0 5px var(--primary); }

.code-preview { background: #000; border: 1px solid #333; padding: 15px; font-family: var(--font-mono); font-size: 0.65rem; color: #888; width: 100%; text-align: left; white-space: pre-wrap; border-radius: 4px; margin-top: auto; height: 110px; overflow: hidden; }

.network-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.node { width: 12px; height: 12px; background: #333; border-radius: 50%; transition: 0.2s; }
.node.validating { background: #ffd700; box-shadow: 0 0 10px #ffd700; }
.node.verified { background: var(--primary); box-shadow: 0 0 10px var(--primary); }
.progress-bar { width: 100%; height: 4px; background: #333; margin: 10px 0; border-radius: 2px; }
.progress-bar .fill { height: 100%; width: 0%; background: var(--primary); transition: width 0.1s linear; }
.wallet-balance { font-size: 1.5rem; font-family: var(--font-mono); margin-bottom: 10px; }

/* Sim Header */
.sim-header { padding: 15px 0; background: #080808; border-bottom: 1px solid var(--border); }
.sim-status { font-family: var(--font-mono); font-size: 0.75rem; color: var(--primary); display: flex; align-items: center; gap: 8px; border: 1px solid var(--primary); padding: 4px 10px; }
.status-dot { width: 8px; height: 8px; background: var(--primary); border-radius: 50%; animation: pulse 2s infinite; }

/* Buttons */
.btn-sim { background: var(--primary); color: #000; border: none; padding: 10px 20px; font-family: var(--font-mono); font-weight: bold; cursor: pointer; margin: 5px; font-size: 0.8rem; }
.btn-sim:hover { opacity: 0.9; }
.btn-sim.outline { background: transparent; border: 1px solid var(--primary); color: var(--primary); }
.btn-reset { background: transparent; border: 1px solid #333; color: #666; padding: 5px 15px; cursor: not-allowed; font-family: var(--font-mono); font-size: 0.7rem; }
.btn-reset.active { border-color: #ff4757; color: #ff4757; cursor: pointer; }

@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } }
@keyframes blink { 50% { opacity: 0; } }
.cursor-blink { animation: blink 1s step-end infinite; }

/* ========================================= */
/* 4. MOBILE OPTIMIZATION (UPDATED)          */
/* ========================================= */

/* Tablet & Mobile Breakpoint */
@media (max-width: 900px) {
    
    /* --- NAVIGATION --- */
    /* Show the hamburger menu icon */
    .menu-toggle {
        display: block;
        font-size: 1.5rem;
        cursor: pointer;
        color: var(--text-main);
    }

    /* Reset the nav-links to be a slide-out drawer */
    .nav-links {
        position: fixed;
        top: 70px; /* Match header height */
        right: -100%; /* Hide off-screen by default */
        width: 100%;
        height: calc(100vh - 70px);
        background: rgba(5, 5, 5, 0.98);
        backdrop-filter: blur(10px);
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        padding-top: 4rem;
        transition: right 0.3s ease-in-out;
        z-index: 999;
        margin-left: 0; /* Override desktop margin */
        border-top: 1px solid var(--border);
    }

    /* The class added by your script.js to show menu */
    .nav-links.show {
        right: 0;
    }

    /* Style links inside the mobile menu */
    .nav-links a {
        display: block; /* Ensure they are visible */
        margin: 1.5rem 0;
        font-size: 1.2rem;
        width: auto;
    }
    
    /* Don't hide links like the previous code did */
    .nav-links a:not(.btn-primary) {
        display: block;
    }

    /* Adjust the button in mobile menu */
    .btn-primary {
        margin-top: 1rem;
        width: 200px;
        text-align: center;
    }

    /* --- TYPOGRAPHY --- */
    h1 { font-size: 2.2rem; }
    h2 { font-size: 1.8rem; }
    .hero-sub { font-size: 1rem; }
    .section-title { font-size: 1.8rem; }

    /* --- LAYOUTS --- */
    .container { padding: 0 20px; }
    
    /* Stack grids vertically */
    .grid-3, .grid-2, .stats-row, .footer-content {
        display: flex;
        flex-direction: column;
        gap: 30px;
    }
    
    /* Fix specific flex layouts */
    .hw-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    /* --- PAGE SPECIFIC --- */
    
    /* Hero Section */
    #hero {
        height: auto;
        min-height: 100vh;
        padding-top: 100px;
        padding-bottom: 60px;
    }
    
    /* Tech Stack (Index) */
    .stack-layer {
        flex-direction: column;
        height: auto;
    }
    .layer-meta {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 15px;
        justify-content: flex-start;
    }
    .layer-visual {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border);
        padding: 30px;
    }
    
    /* Community & Support Pages padding fix */
    .community-content, .support-content, .docs-content, .wp-container {
        padding-top: 100px; /* Reduced from 120px */
        padding-bottom: 40px;
    }
    
    .community-channels, .support-options, .events-grid {
        grid-template-columns: 1fr; /* Force single column */
    }

    /* Documentation Page */
    .docs-container {
        grid-template-columns: 1fr;
    }
    .docs-sidebar {
        position: relative;
        height: auto;
        margin-bottom: 30px;
        top: 0;
    }
    .code-block {
        font-size: 0.8rem;
        overflow-x: scroll; /* Allow code to scroll */
    }

    /* --- SIMULATION SPECIFIC --- */
    .sim-container-vertical { 
        padding-top: 90px; 
        gap: 30px;
    }
    
    .sim-row { 
        flex-direction: column; 
        gap: 20px; 
    }
    
    /* Transform Pipes for Mobile */
    .pipe-horizontal { width: 4px; height: 40px; margin: 0 auto; }
    .pipe-vertical { width: 4px; height: 40px; margin: 0 auto; }
    
    /* Adjust fluid animation direction for mobile */
    .fluid-h { 
        left: 0 !important; width: 100% !important; 
        top: -100%; height: 100%; 
        transition: top 0.6s linear; 
    }
    .active-pipe .fluid-h { top: 0; }
    
    .stage-card {
        width: 100%;
        max-width: 100%;
        height: auto;
        min-height: 300px;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    h1 { font-size: 1.8rem; }
    .section { padding: 60px 0; }
    .card { padding: 25px; }
}
