/* --- 0. LOADING STYLES --- */

/* PRELOADER CSS */
#loader {
    position: fixed;
    inset: 0;
    background-color: #020617;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease-out;
}
.loader-content { text-align: center; width: 300px; }
.loader-logo {
    font-family: 'Inter', sans-serif;
    font-weight: 900;
    font-size: 2rem;
    color: white;
    margin-bottom: 20px;
    letter-spacing: 2px;
}
.loader-bar {
    width: 100%;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}
.loader-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    background: #FF5722; /* Ensure this matches your primary color */
    animation: loadProgress 2s infinite;
    transform-origin: left;
}
.loader-text {
    font-family: 'Courier Prime', monospace;
    color: #FF5722;
    font-size: 0.7rem;
    margin-top: 10px;
    opacity: 0.7;
}
@keyframes loadProgress {
    0% { transform: scaleX(0); }
    50% { transform: scaleX(0.7); }
    100% { transform: scaleX(1); }
}

/* --- 1. VARIABLES (STEALTH NAVY THEME) --- */
:root {
    /* BRAND COLORS */
    --primary-color: #FF5722;   /* Safety Orange (Highlights) */
    
    /* DARK MODE PALETTE */
    --bg-body: #020617;         /* Almost Black (Main Background) */
    --bg-card: #0F172A;         /* Deep Slate (Card Background) */
    --bg-nav:  rgba(2, 6, 23, 0.95); /* Semi-transparent Nav */
    
    /* TEXT COLORS */
    --text-main: #F8FAFC;       /* White (Headings) */
    --text-muted: #94A3B8;      /* Grey (Paragraphs) */
    
    /* BORDERS */
    --border-color: rgba(255, 255, 255, 0.1); /* Subtle white lines */

    /* FONTS */
    --font-body: 'Inter', sans-serif;
}

/* --- 2. RESET & BASE --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

/* SCROLL LOCK CLASS (Added by JS during animation) */
body.noscroll {
    overflow: hidden;
}

h1, h2, h3, h4 {
    color: var(--text-main);
}

/* --- 3. UTILITIES --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --- 4. NAVIGATION (DARK GLASS) --- */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 5%;
    background-color: var(--bg-nav);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
}

nav .logo {
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--text-main);
    letter-spacing: -1px;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 30px;
}

nav a {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.95rem;
    transition: color 0.3s;
}

nav a:hover, nav a.active {
    color: var(--primary-color);
}

nav .btn-nav {
    background-color: var(--primary-color);
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
}

nav .btn-nav:hover {
    background-color: #e64a19;
}

/* Hamburger Icon (White) */
.hamburger {
    display: none;
    cursor: pointer;
    flex-direction: column;
    gap: 5px;
}
.hamburger span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: var(--text-main);
    border-radius: 3px;
}

/* --- 5. HERO SECTIONS --- */
header.hero, header.hero-home {
    background-image: linear-gradient(rgba(2, 6, 23, 0.85), rgba(2, 6, 23, 0.7)), url('../assets/img/hero.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    color: white;
    padding: 120px 20px;
    text-align: center;
    border-bottom: none; /* REMOVED BORDER */
}

/* Fullscreen Hero specific */
header.hero-home {
    /* Reduced height so the next section peeks through */
    min-height: 70vh; 
    height: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    text-shadow: 0 4px 15px rgba(0,0,0,0.8);
    padding-top: 100px;
    padding-bottom: 100px;
}

header.hero h1, header.hero-home h1 {
    font-size: 3.5rem;
    line-height: 1.1;
    margin-bottom: 20px;
    font-weight: 800;
    color: white;
}

header.hero p, header.hero-home p {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 40px;
    color: #cbd5e1;
}

.hero-btns {
    display: flex;
    justify-content: center;
    gap: 15px;
}

/* --- SCROLL INDICATOR (BOUNCING) --- */
.scroll-indicator {
    position: absolute;
    bottom: 100px; /* Moved up slightly */
    left: 50%;
    transform: translateX(-50%);
    
    font-family: 'Courier Prime', monospace;
    font-size: 1.1rem; /* Larger font */
    font-weight: 700;  /* Bolder */
    color: var(--primary-color);
    
    opacity: 0; /* JS fades this in */
    cursor: pointer;
    text-shadow: 0 2px 10px rgba(0,0,0,0.8);
    letter-spacing: 1px;
    
    z-index: 100;
    pointer-events: auto;
    
    /* Bounce Animation */
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {transform: translateX(-50%) translateY(0);}
    40% {transform: translateX(-50%) translateY(-15px);} /* Higher jump */
    60% {transform: translateX(-50%) translateY(-7px);}
}

.hero-label {
    position: absolute;
    bottom: 20px;
    right: 30px;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* --- 6. BUTTONS --- */
.btn {
    display: inline-block;
    padding: 14px 35px;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: bold;
    border: 1px solid var(--primary-color);
    transition: all 0.2s ease;
}
.btn:hover { background-color: #e64a19; }

.btn-outline {
    background-color: transparent;
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
}
.btn-outline:hover {
    border-color: white;
    background-color: rgba(255,255,255,0.05);
}

/* --- 7. SECTIONS (ALL DARK) --- */
section {
    padding: 100px 0;
    border-bottom: none; /* REMOVED BORDER */
}

/* Alternating dark shades */
section:nth-child(odd) { background-color: var(--bg-body); }
section:nth-child(even) { background-color: #050b1d; }

section h2 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: var(--text-main);
}

p.lead {
    font-size: 1.2rem;
    color: var(--text-muted);
    max-width: 700px;
    margin-bottom: 50px;
}

/* --- 8. CARDS (DARK UI) --- */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-top: 40px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-top: 40px;
}

.card, .feature, .product-card {
    background: var(--bg-card);
    padding: 30px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    box-shadow: 0 4px 20px rgba(0,0,0,0.2); /* Dark shadow */
}

.feature h3, .card h3 {
    margin-bottom: 15px;
    color: var(--text-main);
    font-size: 1.3rem;
}

/* --- 9. FOOTER --- */
footer {
    background-color: #020617;
    color: var(--text-muted);
    text-align: center;
    padding: 60px 20px;
    font-size: 0.9rem;
    border-top: none; /* REMOVED BORDER */
}

/* --- 10. TABLES (DARK MODE) --- */
.comparison-table, .software-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 30px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.comparison-table th, .software-table th {
    background-color: #1e293b;
    color: white;
    padding: 15px 20px;
    text-align: left;
    font-weight: 600;
}

.comparison-table td, .software-table td {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-muted);
}

/* --- 11. ANIMATIONS --- */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease-out;
}
.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* --- 12. SPECIFIC OVERRIDES --- */

/* Fix Product Card Images for Dark Mode */
.product-img-container, .product-img-placeholder {
    background-color: #0f172a !important;
    border-bottom: 1px solid var(--border-color) !important;
}

/* Ensure Global Impact stays dark */
#impact {
    background-color: var(--bg-body) !important;
    border-top: none; /* REMOVED BORDER */
}

/* --- 13. MOBILE RESPONSIVENESS --- */
@media (max-width: 768px) {
    /* Menu Fixes */
    .hamburger { display: flex; }
    
    nav ul {
        display: none; 
        flex-direction: column;
        width: 100%;
        position: absolute;
        top: 70px;
        left: 0;
        background-color: var(--bg-card); /* Dark menu background */
        padding: 20px;
        box-shadow: 0 10px 20px rgba(0,0,0,0.5);
        border-top: 1px solid var(--border-color);
        border-bottom: 1px solid var(--border-color);
    }
    nav ul.active { display: flex; }

    /* Text Sizing */
    header.hero h1, header.hero-home h1 { 
        font-size: 2.5rem !important;
        line-height: 1.2 !important;
    }
    
    /* Layout */
    .grid-2, .features-grid { grid-template-columns: 1fr; }
    section { padding: 60px 0; }
    
    /* Tables & Code Blocks (Prevent Overflow) */
    .comparison-table, .software-table { min-width: 600px; }
    div[style*="overflow-x: auto"] { 
        width: 100%; 
        overflow-x: auto; 
    }
    .code-block, .tech-diagram, .tech-compare {
        max-width: 100vw;
        overflow-x: auto !important;
        white-space: nowrap; 
    }
    .code-block { white-space: pre-wrap !important; }

    /* Hiding Elements */
    .hero-label, .scroll-indicator { display: none !important; }
}


/* =========================================================================
   14. NEW AEGIS ANIMATION STYLES (Fixed: Direct to Map + Spacing)
========================================================================= */

header.aegis-intro {
    height: 100vh; 
    width: 100vw;
    position: relative; 
    background-color: #020617;
    border-bottom: none; /* REMOVED BORDER */
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Stage: Forces 16:9 ratio but scales up to COVER the viewport */
#hero-stage {
    position: absolute;
    width: 100vw;
    height: 56.25vw; /* Base 16:9 */
    min-height: 100vh;
    min-width: 177.78vh; /* 16:9 ratio relative to height */
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
}

/* Background Map */
.bg-map-container { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 0; }
#city-map {
    width: 100%; height: 100%; 
    object-fit: cover; 
    transform: scale(3);
    filter: blur(4px) invert(1) hue-rotate(180deg) brightness(0.8);
    opacity: 0.5;
}

/* --- Device Wrappers (Animated by GSAP) --- */
.device {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    will-change: transform, opacity;
    z-index: 10; 
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Hero Node Specific Wrapper - Increased size to 48vw */
#hero-node-wrapper { 
    width: 48vw; 
    z-index: 15; 
    top: 38%; 
    left: 51%;
}

/* Secondary Device Wrappers */
.secondary-device {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0);
}

/* Wrapper Sizing */
#hub-wrapper { width: 13vw; } 
.std-node-wrapper { width: 9.6vw; }
.repeater-wrapper { width: 6.5vw; } 
.handheld-wrapper { width: 6.75vw; }

/* --- Inner Images & PERMANENT OFFSETS (Your Config) --- */
.device-img {
    width: 100%;
    height: auto;
    display: block;
    filter: drop-shadow(0px 0px 15px rgba(255, 255, 255, 0.3));
}

.offset-rep { transform: translate(15%, 20%); }
.offset-hub { transform: translate(-5%, 10%); }
.offset-node { transform: translate(0, 0); }
#hero-node-wrapper .device-img { transform: translate(0, 0%); }
.offset-hand { transform: translate(-15%, -10%); }


/* SVG Lines */
#mesh-lines-svg {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 5; 
    pointer-events: none;
    filter: drop-shadow(0px 0px 8px rgba(255, 255, 255, 0.6));
}
.mesh-line {
    fill: none; stroke: var(--primary-color); stroke-width: 2px;
    vector-effect: non-scaling-stroke;
    opacity: 0;
}

/* Animation Text Typography */
#hero-text-container {
    position: absolute;
    top: 72%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 20; 
    text-align: center; pointer-events: none;
    width: 100%; max-width: 1400px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
}

#hero-text-container h1 {
    color: #F8FAFC; font-weight: 700; font-size: 2.5vw; 
    margin-bottom: 0px; text-transform: uppercase; letter-spacing: 0.8em; 
    margin-left: 0.8em; text-shadow: 0 4px 20px rgba(0,0,0,0.9);
    line-height: 1; white-space: nowrap; 
}

#hero-text-container h2 {
    color: #F8FAFC; font-weight: 900; font-size: 13vw; 
    line-height: 0.85; margin-top: 0px; margin-bottom: 15px;
    text-transform: uppercase; letter-spacing: -0.02em;
    text-shadow: 0 4px 40px rgba(0,0,0,1);
}

#hero-text-container h3 {
    color: var(--primary-color); 
    font-weight: 700; font-size: 2vw;
    margin-top: 0; text-transform: uppercase;
    letter-spacing: 0.15em;
    text-shadow: 0 2px 10px rgba(0,0,0,0.8);
    opacity: 0.9;
    white-space: nowrap;
}

/* Animation Mobile Overrides */
@media (max-width: 768px) {
    #hero-node-wrapper { width: 60vw; }
    #hub-wrapper { width: 25vw; } 
    .std-node-wrapper { width: 18vw; } 
    .repeater-wrapper { width: 14vw; } 
    .handheld-wrapper { width: 12vw; }
    
    #hero-text-container h1 { font-size: 4vw; letter-spacing: 0.5em; margin-left: 0.5em; }
    #hero-text-container h2 { font-size: 18vw; }
    #hero-text-container h3 { font-size: 3.5vw; }
}
