/* M3DSAI - Matrix Protocol (v5.1 Responsive) */
:root {
    --bg-matrix: #000000;
    --neon-green: #0aff0a;
    --neon-cyan: #00f3ff;
    --neon-purple: #bc13fe;
    --text-main: #0aff0a;
    --text-dim: rgba(10, 255, 10, 0.6);
    --font-mono: 'Share Tech Mono', monospace;
    --font-head: 'Orbitron', sans-serif;
}

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Share+Tech+Mono&display=swap');

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

html {
    font-size: 16px;
}

body {
    background-color: var(--bg-matrix);
    color: var(--text-main);
    font-family: var(--font-mono);
    line-height: 1.4;
    overflow-x: hidden;
    text-align: center;
}

/* Matrix Rain Canvas */
#matrix-canvas {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -2;
    opacity: 0.25;
}

/* CRT Scanline Overlay */
.scanline {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.1) 50%), 
                linear-gradient(90deg, rgba(255, 0, 0, 0.02), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.02));
    background-size: 100% 3px, 3px 100%;
    pointer-events: none;
    z-index: 1000;
}

/* Digital Noise / Terminal Glow */
.terminal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    box-shadow: inset 0 0 100px rgba(10, 255, 10, 0.05);
    pointer-events: none;
    z-index: 1001;
}

/* Navigation — PHANTOM Theme */
nav {
    background: linear-gradient(135deg, rgba(5, 5, 25, 0.94), rgba(15, 5, 38, 0.94));
    backdrop-filter: blur(22px) saturate(180%);
    -webkit-backdrop-filter: blur(22px) saturate(180%);
    border-bottom: 1px solid rgba(99, 102, 241, 0.2);
    padding: 0 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1002;
    min-height: 80px;
    box-shadow: 0 4px 40px rgba(99, 102, 241, 0.12), 0 0 60px rgba(0,0,0,0.6);
    transition: transform 0.35s ease, min-height 0.3s ease, box-shadow 0.3s ease;
}

nav.scrolled {
    min-height: 64px;
    box-shadow: 0 4px 50px rgba(99, 102, 241, 0.2), 0 0 80px rgba(0,0,0,0.8);
}

nav.nav-hidden {
    transform: translateY(-100%);
}

nav::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, #6366f1, #a855f7, #06b6d4, #a855f7, #6366f1, transparent);
    background-size: 300% 100%;
    animation: phantom-flow 6s linear infinite;
    opacity: 0.9;
}

@keyframes phantom-flow {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    text-decoration: none;
    flex-shrink: 0;
}

.logo {
    font-family: var(--font-head);
    font-size: 1.15rem;
    background: linear-gradient(135deg, #818cf8, #a855f7, #06b6d4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 3px;
}

.logo-icon {
    height: 38px;
    width: auto;
    filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.7));
    transition: 0.4s ease;
}

.logo-container:hover .logo-icon {
    filter: drop-shadow(0 0 16px rgba(168, 85, 247, 0.9));
    transform: rotate(8deg) scale(1.1);
}

.nav-links {
    display: flex;
    gap: 0.15rem;
    list-style: none;
    align-items: center;
}

.nav-links li {
    position: relative;
}

.nav-links a {
    font-size: 0.72rem;
    font-family: var(--font-mono);
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    text-decoration: none;
    letter-spacing: 1.5px;
    padding: 0.48rem 0.8rem;
    border-radius: 6px;
    transition: all 0.22s ease;
    display: block;
    border: 1px solid transparent;
}

.nav-links a:hover {
    color: #fff;
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.25);
    text-shadow: 0 0 10px rgba(168, 85, 247, 0.7);
    box-shadow: 0 0 14px rgba(99, 102, 241, 0.15);
}

.nav-links a.active-link {
    color: #c4b5fd;
    background: linear-gradient(135deg, rgba(99,102,241,0.18), rgba(168,85,247,0.12));
    border-color: rgba(99, 102, 241, 0.3);
}

.nav-links a::before,
.nav-links a::after {
    display: none;
}

/* CTA Button in Nav */
nav .btn-secondary {
    font-size: 0.72rem;
    padding: 0.52rem 1.3rem;
    background: linear-gradient(135deg, rgba(99,102,241,0.12), rgba(168,85,247,0.08));
    border: 1px solid rgba(99, 102, 241, 0.35);
    color: #a5b4fc;
    border-radius: 6px;
    box-shadow: 0 0 14px rgba(99, 102, 241, 0.08);
    clip-path: none;
    margin-left: 0.5rem;
}

nav .btn-secondary:hover {
    background: linear-gradient(135deg, #6366f1, #a855f7);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 0 28px rgba(99, 102, 241, 0.5);
}

/* Matrix Buttons */
.btn {
    padding: 0.8rem 2rem;
    background: transparent;
    border: 1px solid var(--neon-green);
    color: var(--neon-green);
    font-family: var(--font-mono);
    text-transform: uppercase;
    font-weight: bold;
    clip-path: polygon(10% 0, 100% 0, 100% 70%, 90% 100%, 0 100%, 0 30%);
    transition: 0.2s;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

.btn:hover {
    background: var(--neon-green);
    color: #000;
    box-shadow: 0 0 20px var(--neon-green);
}

.btn-secondary {
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
}
.btn-secondary:hover {
    background: var(--neon-cyan);
    box-shadow: 0 0 20px var(--neon-cyan);
}

/* Hero Section */
.hero {
    min-height: 90vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 2rem 5%;
}

.hero-logo {
    margin-bottom: 2rem;
    text-align: center;
    width: 100%;
}

.hero-logo img {
    max-width: 90px; /* Further reduced by 50% */
    width: 90%;
    height: auto;
    filter: drop-shadow(0 0 15px var(--neon-cyan));
    animation: pulse 4s infinite alternate;
}

@keyframes pulse {
    0% { filter: drop-shadow(0 0 10px var(--neon-cyan)); opacity: 0.9; }
    100% { filter: drop-shadow(0 0 25px var(--neon-cyan)); opacity: 1; }
}

.hero h1 {
    font-family: var(--font-head);
    font-size: clamp(2rem, 8vw, 5rem);
    color: #fff;
    text-shadow: 0 0 20px var(--neon-green);
    margin-bottom: 1rem;
    letter-spacing: 5px;
}

.typing-container {
    font-size: clamp(1rem, 4vw, 1.5rem);
    color: var(--neon-cyan);
    margin-bottom: 3rem;
    min-height: 1.5em;
}

/* Grid & Cards */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    padding: 2rem 5%;
    max-width: 1400px;
    margin: 0 auto;
}

.card {
    background: rgba(0, 20, 0, 0.4);
    border: 1px solid var(--neon-green);
    padding: 2.5rem 1.5rem;
    position: relative;
    backdrop-filter: blur(5px);
    transition: 0.3s;
    height: 100%;
}

.card:hover {
    background: rgba(10, 255, 10, 0.1);
    box-shadow: 0 0 25px rgba(10, 255, 10, 0.2);
    transform: translateY(-5px);
}

.card h3 {
    font-family: var(--font-head);
    color: var(--neon-green);
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(10, 255, 10, 0.3);
    padding-bottom: 0.5rem;
}

.card p { color: var(--text-dim); }

/* Section Spacing */
section {
    padding: 5rem 5%;
}

.section-title {
    font-family: var(--font-head);
    font-size: clamp(1.5rem, 5vw, 3rem);
    color: var(--neon-cyan);
    margin-bottom: 3rem;
}

/* Mobile Toggle — PHANTOM */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 26px;
    height: 18px;
    cursor: pointer;
    z-index: 1010;
    padding: 1px;
}

.nav-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, #6366f1, #a855f7);
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease, width 0.3s ease;
    transform-origin: center;
}

/* Hamburger → X animation */
.nav-toggle.open span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; width: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* Responsive */
@media (max-width: 1100px) {
    .nav-links { gap: 0; }
    .nav-links a { font-size: 0.68rem; padding: 0.45rem 0.6rem; }
}

@media (max-width: 768px) {
    nav { padding: 0 5%; min-height: 68px; }
    .nav-toggle { display: flex; }

    .nav-links {
        position: fixed;
        inset: 0;
        width: 100%;
        height: 100vh;
        background: linear-gradient(160deg, rgba(5,5,28,0.97), rgba(18,5,45,0.97));
        backdrop-filter: blur(28px);
        -webkit-backdrop-filter: blur(28px);
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        z-index: 1005;
        opacity: 0;
        pointer-events: none;
        transform: translateY(-16px);
        transition: opacity 0.3s ease, transform 0.3s ease;
        list-style: none;
    }

    .nav-links.active {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
    }

    .nav-links li {
        opacity: 0;
        transform: translateY(18px);
        transition: opacity 0.3s ease, transform 0.3s ease;
        width: 80%;
        max-width: 320px;
        text-align: center;
    }

    .nav-links.active li { opacity: 1; transform: translateY(0); }
    .nav-links.active li:nth-child(1) { transition-delay: 0.05s; }
    .nav-links.active li:nth-child(2) { transition-delay: 0.1s; }
    .nav-links.active li:nth-child(3) { transition-delay: 0.15s; }
    .nav-links.active li:nth-child(4) { transition-delay: 0.2s; }
    .nav-links.active li:nth-child(5) { transition-delay: 0.25s; }
    .nav-links.active li:nth-child(6) { transition-delay: 0.3s; }
    .nav-links.active li:nth-child(7) { transition-delay: 0.35s; }
    .nav-links.active li:nth-child(8) { transition-delay: 0.4s; }

    .nav-links a {
        font-size: 1rem;
        padding: 0.9rem 1.5rem;
        letter-spacing: 2px;
        width: 100%;
        border-radius: 8px;
    }

    .hero { padding-top: 4rem; }
    .hero-btns { flex-direction: column; gap: 1.5rem; width: 100%; max-width: 300px; }
    .btn { width: 100%; text-align: center; }
    nav > .btn { display: none; }
}

@media (max-width: 480px) {
    .card { padding: 1.5rem 1rem; }
    .section-title { font-size: 1.8rem; }
}

/* Utilities */
.glitch { animation: glitch 5s infinite; }
@keyframes glitch {
    0%, 100% { transform: skew(0deg); }
    2% { transform: skew(10deg); filter: hue-rotate(90deg); }
    4% { transform: skew(-10deg); }
    5% { transform: skew(0deg); }
}

footer {
    border-top: 1px solid var(--neon-green);
    padding: 3rem 5%;
    text-align: center;
    background: #000;
}

footer p { margin-bottom: 0.5rem; }
