:root {
    --bg-dark: #050505;
    --card-bg: rgba(20, 20, 25, 0.7);
    --neon-red: #ff3e3e;
    --neon-cyan: #00f2ff;
    --neon-green: #39ff14;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --border-color: rgba(255, 255, 255, 0.1);
    --font-main: 'Inter', sans-serif;
    --font-heading: 'Outfit', sans-serif;
}

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

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

/* Background Effects */
.stars-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #1a1a2e 0%, #050505 100%);
    z-index: -2;
}

.grid-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(0, 242, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 242, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: -1;
    perspective: 1000px;
    transform: rotateX(60deg) translateY(-200px);
    opacity: 0.5;
}

/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    padding: 1.5rem 5%;
    background: rgba(5, 5, 5, 0.8);
    backdrop-filter: blur(10px);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-family: var(--font-heading);
    font-weight: 900;
    font-size: 1.5rem;
    letter-spacing: -1px;
}

.logo span span {
    color: var(--neon-red);
}

.neon-icon {
    color: var(--neon-cyan);
    filter: drop-shadow(0 0 5px var(--neon-cyan));
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    margin-left: 2rem;
    font-weight: 600;
    transition: color 0.3s;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 1px;
}

.nav-links a:hover {
    color: var(--neon-cyan);
    text-shadow: 0 0 8px var(--neon-cyan);
}

/* Hero Section */
.hero {
    height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding-top: 80px;
}

.hero-content {
    max-width: 900px;
}

.glitch {
    font-family: var(--font-heading);
    font-size: 4.5rem;
    font-weight: 900;
    color: white;
    position: relative;
    line-height: 1.1;
    margin-bottom: 1.5rem;
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.hero-badges {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.badge {
    padding: 0.5rem 1rem;
    border: 1px solid var(--neon-cyan);
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--neon-cyan);
    background: rgba(0, 242, 255, 0.05);
    letter-spacing: 1px;
}

/* Sections */
.section {
    padding: 5rem 10%;
}

.section-header {
    margin-bottom: 3rem;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 800;
    text-transform: uppercase;
}

.title-underline {
    width: 60px;
    height: 4px;
    background: var(--neon-red);
    margin-top: 0.5rem;
}

/* Cards */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    padding: 2rem;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--neon-cyan), transparent);
}

.main-vision p {
    font-size: 1.3rem;
    line-height: 1.8;
}

.module-group h3 {
    font-family: var(--font-heading);
    color: var(--neon-cyan);
    margin: 3rem 0 1.5rem;
    font-size: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Topology Tree */
.topology-container {
    margin-bottom: 3rem;
    width: 100%;
}

.topology-card {
    padding: 3rem;
    background: rgba(10, 10, 15, 0.8);
    border: 1px solid rgba(0, 242, 255, 0.2);
}

.topology-tree {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-top: 3rem;
    position: relative;
    padding: 0 1rem;
}

.topo-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    z-index: 2;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    width: 140px;
    flex-shrink: 0;
}

.topo-node:hover {
    transform: translateY(-10px);
}

.node-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #0f172a 0%, #020617 100%);
    border: 2px solid var(--neon-cyan);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    color: var(--neon-cyan);
    box-shadow: 0 0 20px rgba(0, 242, 255, 0.3);
    position: relative;
}

.topo-node:hover .node-icon {
    background: var(--neon-cyan);
    color: black;
    box-shadow: 0 0 30px var(--neon-cyan);
}

.node-label {
    font-weight: 800;
    font-family: var(--font-heading);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.3rem;
    min-height: 1.2rem;
}

.node-sub {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.topo-connector {
    flex: 1;
    height: 2px;
    background: var(--neon-cyan);
    margin: 30px -40px 0; /* Aligned with center of 60px icon */
    opacity: 0.2;
    z-index: 1;
}

.topo-connector::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--neon-cyan);
    filter: blur(4px);
    opacity: 0.5;
}

/* Architecture Details Grid */
.architecture-details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    align-items: stretch; /* Ensures equal height */
}

.architecture-details .glass-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding-top: 2.5rem; /* Space for accent */
}

.card-accent {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--neon-cyan);
    box-shadow: 0 0 15px var(--neon-cyan);
}

.card-accent.red {
    background: var(--neon-red);
    box-shadow: 0 0 15px var(--neon-red);
}

.card-accent.green {
    background: var(--neon-green);
    box-shadow: 0 0 15px var(--neon-green);
}

@media (max-width: 1024px) {
    .topology-tree {
        flex-direction: column;
        gap: 3rem;
    }

    .topo-connector {
        width: 2px;
        height: 50px;
        top: 0;
    }

    .architecture-details {
        grid-template-columns: 1fr;
    }
}

/* Grid Images */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 3rem;
}

.image-card {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    height: 480px;
    /* Increased height to accommodate dedicated text area */
    border: 1px solid var(--border-color);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    background: #050505;
    display: flex;
    flex-direction: column;
    /* Stack image on top of text */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.image-container {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #020617 100%);
    overflow: hidden;
    padding: 10px;
}

.image-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    z-index: 2;
    filter: drop-shadow(0 0 15px rgba(0, 0, 0, 0.8));
    transition: transform 0.5s;
}

/* Scanning Line Animation restricted to container */
.image-container::after {
    content: '';
    position: absolute;
    top: -100%;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, transparent, rgba(0, 242, 255, 0.2), transparent);
    animation: scan 4s linear infinite;
    pointer-events: none;
    z-index: 3;
}

@keyframes scan {
    0% {
        top: -100%;
    }

    100% {
        top: 100%;
    }
}

.image-card:hover {
    transform: translateY(-8px);
    border-color: var(--neon-cyan);
    box-shadow: 0 20px 40px rgba(0, 242, 255, 0.25);
}

.image-card:hover .image-container img {
    transform: scale(1.05);
    /* Subtle zoom inside container */
}

/* NEW: Dedicated Text Area (Better Visibility) */
.image-info {
    padding: 1.5rem;
    background: linear-gradient(to bottom, #0a0a0a, #050505);
    border-top: 1px solid rgba(0, 242, 255, 0.2);
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

.image-info::before {
    content: '';
    position: absolute;
    top: 0;
    left: 1.5rem;
    width: 40px;
    height: 2px;
    background: var(--neon-cyan);
    box-shadow: 0 0 10px var(--neon-cyan);
}

.image-info h4 {
    color: var(--neon-cyan);
    font-family: var(--font-heading);
    margin-bottom: 0.5rem;
    font-size: 1.15rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 8px rgba(0, 242, 255, 0.3);
}

.image-info p {
    font-size: 0.9rem;
    color: #a0aec0;
    line-height: 1.6;
    font-weight: 300;
}

/* Background "Code" Decors to fill empty spaces */
.bg-decor-text {
    position: absolute;
    font-family: 'monospace';
    font-size: 0.7rem;
    color: rgba(0, 242, 255, 0.08);
    /* Slightly more visible */
    white-space: nowrap;
    pointer-events: none;
    user-select: none;
    z-index: -1;
    animation: float 10s ease-in-out infinite alternate;
}

@keyframes float {
    from {
        transform: translateY(0) translateX(0);
    }

    to {
        transform: translateY(-20px) translateX(10px);
    }
}

/* Workflow Steps */
.workflow-container {
    display: flex;
    flex-direction: column;
    gap: 4rem;
    margin-top: 4rem;
}

.workflow-step {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

@media (max-width: 900px) {
    .workflow-step {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

.step-number {
    font-family: var(--font-heading);
    font-size: 4rem;
    font-weight: 900;
    color: rgba(255, 62, 62, 0.1);
    line-height: 1;
    position: absolute;
    top: -20px;
    left: -20px;
}

.step-content {
    position: relative;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.02);
    border-left: 2px solid var(--neon-red);
    border-radius: 0 12px 12px 0;
}

.step-content h4 {
    font-size: 1.5rem;
    color: var(--neon-red);
    margin-bottom: 1rem;
    text-transform: uppercase;
}

.step-image {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.step-image img {
    width: 100%;
    display: block;
}

.image-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 2.5rem 1.5rem 1.5rem;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.95));
    opacity: 1;
    /* Always visible for accessibility and readability */
    transform: translateY(0);
}

.image-overlay h4 {
    color: var(--neon-cyan);
    font-family: var(--font-heading);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.image-overlay p {
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.4;
}

/* Section Text Enrichment */
.section-description {
    max-width: 800px;
    margin-bottom: 3rem;
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1.8;
}

/* Wide Card for Dashboard */
.wide-card {
    display: grid;
    grid-template-columns: 2fr 1fr;
    background: var(--card-bg);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    margin-bottom: 4rem;
}

@media (max-width: 1200px) {
    .wide-card {
        grid-template-columns: 1fr;
    }
}

.wide-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    min-height: 400px;
}

.card-info {
    padding: 2rem;
}

.card-info h4 {
    font-size: 1.8rem;
    color: var(--neon-cyan);
    margin-bottom: 0.5rem;
}

/* Tech Grid */
.tech-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.tech-card {
    text-align: center;
    transition: transform 0.3s;
}

.tech-card:hover {
    transform: scale(1.05);
}

.tech-card .neon-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 1.5rem;
}

.tech-card h3 {
    margin-bottom: 1rem;
    color: white;
}

/* Footer */
.footer {
    padding: 3rem;
    text-align: center;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Responsiveness */
.menu-toggle {
    display: none;
    cursor: pointer;
    color: var(--text-primary);
}

@media (max-width: 1024px) {
    .glitch {
        font-size: 3.5rem;
    }

    .topology-tree {
        flex-direction: column;
        gap: 2rem;
        align-items: center;
        padding-top: 1rem;
    }

    .topo-connector {
        width: 2px;
        height: 30px;
        margin: 0;
        background: var(--neon-cyan);
        opacity: 0.3;
        top: auto;
        left: auto;
    }

    .topo-node {
        width: auto;
    }

    .architecture-details {
        grid-template-columns: 1fr;
    }

    .grid-container {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
}

@media (max-width: 768px) {
    .section {
        padding: 4rem 5%;
    }

    .section-title {
        font-size: 2rem;
    }

    .hero {
        height: auto;
        min-height: 80vh;
        padding-top: 120px;
        padding-bottom: 60px;
    }

    .glitch {
        font-size: 2.5rem;
    }

    .hero-badges {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .menu-toggle {
        display: block;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: rgba(5, 5, 5, 0.95);
        flex-direction: column;
        padding: 2rem;
        border-bottom: 1px solid var(--border-color);
        text-align: center;
        z-index: 1000;
    }

    .nav-links.active {
        display: flex;
    }

    .nav-links a {
        margin: 1rem 0;
        font-size: 1rem;
        margin-left: 0;
    }

    .wide-card {
        grid-template-columns: 1fr;
    }

    .wide-card img {
        height: 250px;
        min-height: auto;
    }

    .image-card {
        height: auto;
        min-height: 300px;
    }

    .workflow-step {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .workflow-step:nth-child(even) .step-image {
        order: 2;
    }
    .workflow-step:nth-child(even) .step-content {
        order: 1;
    }
}

@media (max-width: 480px) {
    .glitch {
        font-size: 2rem;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .main-vision p {
        font-size: 1.1rem;
    }

    .grid-container {
        grid-template-columns: 1fr;
    }

    .image-card {
        min-height: 350px;
    }
}