/* =========================================
   CSS VARIABLES & THEMING
   ========================================= */
:root {
    /* Light Theme Defaults */
    --bg-color: #f0f4f8;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --nav-bg: rgba(255, 255, 255, 0.85);
    --card-bg: rgba(255, 255, 255, 0.6);
    --card-border: rgba(200, 200, 200, 0.4);
    --grid-color: rgba(0, 0, 0, 0.04);
    
    /* Vibrant bright blue for accents */
    --accent-blue: #2563eb; 
    --accent-cyan: #06b6d4;
    
    --mouse-glow: rgba(37, 99, 235, 0.08);
    --terminal-bg: #f8fafc;
    --terminal-header: #e2e8f0;
}

html.dark {
    /* Dark Theme Overrides */
    --bg-color: #0b0d12;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --nav-bg: rgba(11, 13, 18, 0.85);
    --card-bg: rgba(20, 24, 30, 0.5);
    --card-border: rgba(255, 255, 255, 0.1);
    --grid-color: rgba(255, 255, 255, 0.03);
    
    /* Bright, readable blue in dark mode */
    --accent-blue: #60a5fa; 
    
    --accent-cyan: #22d3ee;
    --mouse-glow: rgba(59, 130, 246, 0.12);
    --terminal-bg: #0d1117;
    --terminal-header: #161b22;
}

/* =========================================
   BASE RESET & TYPOGRAPHY
   ========================================= */
* { box-sizing: border-box; margin: 0; padding: 0; }

html {
    /* Smooth motion fix for all anchor navigation */
    scroll-behavior: smooth !important;
}

/* The color variable dynamically flips text to black/white perfectly */
body {
    font-family: 'Space Grotesk', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main); 
    transition: background-color 0.5s ease, color 0.5s ease;
    overflow-x: hidden;
    line-height: 1.6;
}

/* Ensure ALL headings inherit the adaptive color */
h1, h2, h3, h4, p, span, strong {
    color: inherit; 
}

/* WebGL-Inspired Grid & Mouse Glow */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background-image: 
        linear-gradient(to right, var(--grid-color) 1px, transparent 1px),
        linear-gradient(to bottom, var(--grid-color) 1px, transparent 1px);
    background-size: 40px 40px;
    background-position: center center;
    mask-image: radial-gradient(ellipse at center, black 40%, transparent 100%);
    -webkit-mask-image: radial-gradient(ellipse at center, black 40%, transparent 100%);
    z-index: -2;
    pointer-events: none;
}

body::after {
    content: '';
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: radial-gradient(circle 600px at var(--mouse-x, 50%) var(--mouse-y, 50%), var(--mouse-glow), transparent 80%);
    z-index: -1;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }
button { border: none; background: none; cursor: pointer; color: inherit; font: inherit; }

.font-mono { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace; }
.gradient-text {
    background: linear-gradient(to right, var(--accent-blue), var(--accent-cyan));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* =========================================
   LAYOUT & UTILITIES
   ========================================= */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Base styling for all reveal sections */
section[id] {
    /* Prevents semi-transparent fixed navbar from overlapping section headers */
    scroll-margin-top: 120px; 
}

.glass {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
}

.reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 1s cubic-bezier(0.16, 1, 0.3, 1), transform 1s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.visible { opacity: 1; transform: translateY(0); }
.delay-100 { transition-delay: 100ms; }
.delay-200 { transition-delay: 200ms; }
.delay-300 { transition-delay: 300ms; }

/* =========================================
   COMPONENTS
   ========================================= */
/* Navbar */
nav {
    position: fixed; top: 0; width: 100%; height: 80px;
    z-index: 50; display: flex; align-items: center;
    border-bottom: 1px solid var(--card-border);
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.nav-content { display: flex; justify-content: space-between; align-items: center; width: 100%; }

.logo-wrap { display: flex; align-items: center; gap: 16px; cursor: pointer; }
.logo-box {
    width: 48px; height: 48px; flex-shrink: 0; border-radius: 50%;
    background: var(--card-border); border: 1px solid var(--card-border);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; transition: transform 0.3s ease; box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.logo-wrap:hover .logo-box { transform: scale(1.05); }
.logo-box img { width: 100%; height: 100%; object-fit: cover; }
.logo-text { display: flex; flex-direction: column; justify-content: center; }
.logo-title { font-size: 24px; font-weight: 500; letter-spacing: 0.1em; line-height: 1; }
.logo-subtitle { font-size: 12px; letter-spacing: 0.2em; color: var(--accent-blue); margin-top: 4px; text-transform: uppercase; line-height: 1; }

.nav-links { display: flex; align-items: center; gap: 32px; font-size: 14px; }
.nav-links a { transition: color 0.2s ease; }
.nav-links a:hover { color: var(--accent-blue); }
.nav-divider { width: 1px; height: 24px; background: var(--card-border); }
.icon-btn { padding: 8px; border-radius: 50%; transition: background 0.2s ease; display: flex; align-items: center; justify-content: center; }
.icon-btn:hover { background: var(--card-border); }

/* PILL THEME TOGGLE SWITCH */
.pill-toggle {
    width: 56px; 
    height: 28px;
    border-radius: 30px;
    background: #cbd5e1; /* Light mode background */
    border: 1px solid var(--card-border);
    position: relative;
    cursor: pointer;
    transition: background 0.4s ease;
    display: flex;
    align-items: center;
    padding: 2px;
}

html.dark .pill-toggle {
    background: #334155; /* Dark mode background */
}

.pill-thumb {
    width: 22px; 
    height: 22px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1), background 0.4s ease;
    transform: translateX(0); /* Light mode position */
}

html.dark .pill-thumb {
    transform: translateX(28px); /* Slides to the right in dark mode */
    background: #0f172a;
}

.pill-thumb .sun-icon { display: block; color: #f59e0b; }
.pill-thumb .moon-icon { display: none; color: #e2e8f0; }

html.dark .pill-thumb .sun-icon { display: none; }
html.dark .pill-thumb .moon-icon { display: block; }


.mobile-menu-btn { display: none; }
.mobile-menu {
    display: none; position: absolute; top: 80px; left: 0; width: 100%;
    background: var(--bg-color); border-bottom: 1px solid var(--card-border);
    padding: 20px 24px; flex-direction: column; gap: 16px; box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}
.mobile-menu.active { display: flex; }

/* Main Content Spacing */
main { padding-top: 200px; padding-bottom: 80px; display: flex; flex-direction: column; gap: 120px; }

/* Hero Section */
.hero { display: flex; align-items: center; gap: 64px; margin-top: 150px;}

.hero-text { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    gap: 24px; 
    text-align: center; /* Center the entire section */
    align-items: center; 
}
.hero-title-container { 
    position: relative; 
    font-size: clamp(2.5rem, 4.5vw, 4.5rem); 
    font-weight: 700; 
    line-height: 1.2; 
    letter-spacing: -0.02em; 
    z-index: 10; 
    display: inline-block; /* Magic fix 1 to stop center expansion wobble */
    text-align: center ; /* Magic fix 2 to type perfectly left-to-right */
}

/* Typing Sequencer CSS */
.invisible-placeholder { visibility: hidden; display: block; }
.typing-layer { position: absolute; top: 0; left: 0; width: 100%; }
.cursor { display: inline-block; width: 4px; height: 0.8em; background-color: var(--text-main); margin-left: 4px; vertical-align: middle; animation: blink 1s step-end infinite; }
.cursor.blue { background-color: var(--accent-blue); }
.cursor.cyan { background-color: var(--accent-cyan); }
.cursor.hidden { display: none; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

.hero-desc { font-size: 1.125rem; color: var(--text-muted); max-width: 600px; margin: 0 auto; }

/* =========================================
   HOLLOW TO GLASS-FILL BUTTON ANIMATION
   ========================================= */
.btn-primary, .btn-connect, .btn-portfolio {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 500;
    cursor: pointer;
    overflow: hidden; 
    z-index: 1;
    
    background: transparent; 
    color: var(--text-main); 
    border: 1px solid var(--text-main); 
    border-radius: 8px; /* Standardize button shape */
    
    transition: color 0.3s ease, border-color 0.3s ease, transform 0.2s ease;
}

.btn-connect {
    width: fit-content;
    padding: 10px 48px; /* Makes the connect button noticeably longer */
    margin-top: 16px;
}

.btn-primary {
    padding: 12px 24px;
    width: fit-content;
}

.btn-portfolio {
    padding: 10px 16px; /* Specifically shorter padding */
    font-size: 0.875rem;
    margin-top: 0px; 
    width: fit-content; 
}

/* NEW DARK BLUE GLASS FILL */
.btn-primary::before, .btn-connect::before, .btn-portfolio::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0%; 
    height: 100%;
    
    background: rgba(11, 30, 89, 0.85); /* Deep Dark Navy Blue */
    backdrop-filter: blur(8px); /* Strong Blur Effect */
    -webkit-backdrop-filter: blur(8px);
    
    z-index: -1; 
    transition: width 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.btn-primary:hover, .btn-connect:hover, .btn-portfolio:hover {
    color: #ffffff !important; /* Force text white over dark background */
    border-color: transparent; 
    transform: translateY(-2px);
}

.btn-primary:hover::before, .btn-connect:hover::before, .btn-portfolio:hover::before {
    width: 100%; 
}

.btn-primary svg, .btn-connect svg, .btn-portfolio svg {
    z-index: 2;
    transition: transform 0.2s ease, color 0.3s ease;
}

/* 3D Tilt Card Base */
.tilt-wrapper { flex: 1; width: 100%; perspective: 1000px; }
.tilt-card {
    will-change: transform;
    transform-style: preserve-3d;
    transition: transform 0.1s ease-out;
    border-radius: 16px;
}
.tilt-card.resetting { transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1); }

/* Terminal */
.terminal { background: var(--terminal-bg); border: 1px solid var(--card-border); overflow: hidden; box-shadow: 0 20px 40px rgba(0,0,0,0.2); }
.terminal-header { height: 40px; background: var(--terminal-header); border-bottom: 1px solid var(--card-border); display: flex; align-items: center; padding: 0 16px; gap: 8px; }
.dot { width: 12px; height: 12px; border-radius: 50%; }
.dot.r { background: #ef4444; } .dot.y { background: #eab308; } .dot.g { background: #22c55e; }
.terminal-title { margin-left: 16px; font-size: 12px; color: var(--text-muted); }
.terminal-body { padding: 24px; height: 260px; font-size: 14px; display: flex; flex-direction: column; gap: 8px; }
.term-prompt { color: var(--accent-blue); }
.term-arrow { color: #22c55e; }
.term-user { color: var(--text-muted); }

/* Sections General */
.section-header { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 16px; margin-bottom: 48px; }

/* Guaranteed adaptive text */
.badge { 
    padding: 6px 16px; 
    border-radius: 999px; 
    border: 1px solid var(--text-main); 
    background: transparent; 
    color: var(--text-main); /* Flips natively */
    font-size: 14px; 
}

.section-title { font-size: 3rem; font-weight: 700; color: var(--text-main); }
.section-desc { font-size: 1.125rem; color: var(--text-muted); max-width: 800px; text-align: center; }

/* Vision Section */
.vision-box { padding: 32px; border-radius: 16px; position: relative; overflow: hidden; margin-top: 24px; text-align: left; }
.vision-box::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 4px; background: linear-gradient(to right, var(--accent-blue), var(--accent-cyan)); }

/* Agents Grid */
.agents-header { text-align: left; align-items: flex-start; }
.agents-title { display: flex; align-items: center; gap: 12px; font-size: 2.5rem; font-weight: 700; color: var(--text-main); }
.slash { color: var(--accent-blue); }
.grid { display: grid; grid-template-columns: repeat(1, 1fr); gap: 32px; }

/* Flagship Card */
.flagship-wrap { padding: 2px; border-radius: 18px; background: linear-gradient(135deg, rgba(37,99,235,0.4), rgba(168,85,247,0.4)); height: 100%; }
.flagship-card { background: var(--terminal-bg); height: 100%; border-radius: 16px; padding: 32px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.glow-blob { position: absolute; top: -50px; right: -50px; width: 250px; height: 250px; background: var(--accent-blue); filter: blur(80px); opacity: 0.15; border-radius: 50%; pointer-events: none; }
.flagship-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; position: relative; z-index: 2; }

/* Guaranteed adaptive text */
.flagship-badge { 
    padding: 4px 12px; 
    background: transparent; 
    border: 1px solid var(--text-main);
    color: var(--text-main); /* Flips natively */
    font-size: 12px; 
    font-weight: 700; 
    text-transform: uppercase; 
    border-radius: 6px; 
    letter-spacing: 0.05em; 
}

.flagship-icon { width: 48px; height: 48px; border-radius: 50%; background: var(--card-border); display: flex; align-items: center; justify-content: center; font-family: serif; font-size: 24px; font-weight: bold; }
.flagship-title { font-size: 2rem; font-weight: 700; margin-bottom: 16px; position: relative; z-index: 2; color: var(--text-main); }
.flagship-desc { color: var(--text-muted); font-size: 1.125rem; margin-bottom: 32px; position: relative; z-index: 2; }
.flagship-btn { display: inline-flex; align-items: center; justify-content: space-between; padding: 16px 24px; background: var(--text-main); color: var(--bg-color); border-radius: 8px; font-weight: 600; width: 100%; max-width: 300px; transition: transform 0.2s ease, box-shadow 0.2s ease; position: relative; z-index: 2; }
.flagship-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 25px rgba(0,0,0,0.2); }
.flagship-btn svg { transition: transform 0.2s ease; }
.flagship-btn:hover svg { transform: translateX(4px); }

/* Genesis Card */
.genesis-card { border: 1px dashed var(--card-border); border-radius: 16px; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px; text-align: center; opacity: 0.6; transition: opacity 0.3s ease; }
.genesis-card:hover { opacity: 1; }
.spinner { width: 24px; height: 24px; border: 2px solid var(--text-muted); border-top-color: transparent; border-radius: 50%; animation: spin 1s linear infinite; margin-bottom: 16px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Founder Section */
.founder-sec { display: flex; align-items: center; gap: 64px; }
.founder-text { flex: 1; display: flex; flex-direction: column; gap: 24px; }
.social-row { display: flex; gap: 16px; margin-top: 16px; }
.social-btn { width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--card-border); display: flex; align-items: center; justify-content: center; transition: background 0.2s ease; }
.social-btn:hover { background: var(--card-border); }

/* Profile Card */
.profile-wrap { width: 100%; max-width: 380px; }

.profile-card { 
    border-radius: 16px; 
    overflow: hidden; 
    border: 1px solid var(--card-border); 
    background: var(--card-bg); 
    color: var(--text-main);   
    box-shadow: 0 20px 40px rgba(0,0,0,0.15); 
}

.profile-banner { height: 96px; background: linear-gradient(to right, #0a1637, #0f172a); position: relative; }

/* Perfect Avatar alignment and scaling */
.profile-img {
    position: absolute;
    bottom: -48px; 
    left: 24px;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    border: 4px solid var(--card-bg); 
    background: var(--card-border);
    display: block; 
    overflow: hidden;
    z-index: 5; 
}

.profile-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block; 
    border-radius: 50%;
}

.profile-body { padding: 56px 24px 24px; display: flex; flex-direction: column; gap: 12px; }
.profile-name { font-size: 1.25rem; font-weight: 700; display: flex; align-items: center; gap: 8px; color: var(--text-main); }
.verify-icon { color: var(--accent-blue); width: 20px; height: 20px; }

.profile-headline { color: var(--text-muted); font-size: 0.875rem; font-weight: 500; }

.profile-loc { font-size: 0.75rem; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }
.profile-conn { display: flex; align-items: center; gap: 8px; font-size: 0.75rem; font-weight: 500; color: var(--accent-blue); }
.conn-avatars { display: flex; margin-right: 4px; }
.conn-avatars div { width: 20px; height: 20px; border-radius: 50%; background: var(--text-muted); border: 1px solid var(--terminal-bg); margin-left: -8px; }
.conn-avatars div:first-child { margin-left: 0; }

/* Align buttons side-by-side on desktop */
@media (min-width: 600px) {
    .btn-connect, .btn-portfolio {
        width: auto;
    }
}

/* Footer */
footer { border-top: 1px solid var(--card-border); background: var(--nav-bg); padding: 48px 0 24px; margin-top: 80px; }
.footer-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 32px; flex-wrap: wrap; }
.footer-col { max-width: 400px; display: flex; flex-direction: column; gap: 16px; }
.footer-col p { font-size: 0.875rem; color: var(--text-muted); }
.footer-col-right { align-items: flex-end; text-align: right; }
.footer-bottom { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--card-border); display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--text-muted); flex-wrap: wrap; gap: 16px; }

/* Responsive */
@media (max-width: 1024px) {
    .hero { flex-direction: column; gap: 48px; }
    /* Mobile retains center alignment safely */
}

@media (min-width: 768px) {
    .grid { grid-template-columns: repeat(3, 1fr); }
    .col-span-2 { grid-column: span 2; }
}

@media (max-width: 768px) {
    .nav-links { display: none; }
    
    /* MOBILE FIX: Force flex row layout for side-by-side toggle and menu */
    .mobile-menu-btn { 
        display: flex !important; 
        flex-direction: row !important;
        align-items: center; 
        justify-content: flex-end;
    }
    
    /* NEW: Shrink logo text and spacing to fit perfectly on one line */
    .logo-wrap { gap: 10px; }
    .logo-title { font-size: 18px; letter-spacing: 0.05em; }
    .logo-subtitle { font-size: 10px; }
    
    .founder-sec { flex-direction: column; }
    .founder-text { text-align: center; align-items: center; }
    
    .section-desc { text-align: center; }
    .footer-col-right { align-items: flex-start; text-align: left; }
}