:root {
    --bg-dark: #050507;
    --accent-primary: #6366f1; /* Indigo */
    --accent-secondary: #ec4899; /* Pink */
    --accent-glow: rgba(99, 102, 241, 0.15);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-bg: rgba(255, 255, 255, 0.03);
    --font-heading: 'Space Grotesk', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --content-max-width: 1200px;
}

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

html { scroll-behavior: smooth; }

body {
    background-color: var(--bg-dark);
    color: #e2e8f0;
    font-family: var(--font-heading);
    overflow-x: hidden;
    min-height: 100vh;
}

.ambient-noise {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.05'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: -1;
}

body::before {
    content: '';
    position: fixed;
    top: -20%; right: -10%;
    width: 60vw; height: 60vw;
    background: radial-gradient(circle, var(--accent-primary) 0%, transparent 70%);
    opacity: 0.15;
    filter: blur(100px);
    z-index: -2;
}

body::after {
    content: '';
    position: fixed;
    bottom: -20%; left: -10%;
    width: 60vw; height: 60vw;
    background: radial-gradient(circle, var(--accent-secondary) 0%, transparent 70%);
    opacity: 0.1;
    filter: blur(100px);
    z-index: -2;
}

/* --- HEADER --- */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 6%;
    max-width: var(--content-max-width);
    margin: 0 auto;
    position: relative;
    z-index: 100;
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.brand {
    font-weight: 700;
    font-size: 20px;
    letter-spacing: -0.5px;
}

.version {
    font-family: var(--font-mono);
    font-size: 10px;
    background: var(--glass-bg);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    color: rgba(255,255,255,0.5);
    vertical-align: middle;
}

.top-nav { display: flex; align-items: center; gap: 24px; }

.nav-link {
    text-decoration: none;
    color: rgba(255,255,255,0.6);
    font-size: 14px;
    transition: color 0.2s;
}
.nav-link:hover { color: white; }

.cta-button {
    text-decoration: none;
    background: white;
    color: black;
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 700;
    transition: transform 0.2s, box-shadow 0.2s;
    white-space: nowrap;
}
.cta-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

/* --- MOBILE NAV TOGGLE (hidden by default on desktop) --- */
.nav-toggle {
    display: none;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    padding: 0;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s;
    z-index: 110;
}

.nav-toggle:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
}

.nav-toggle-bars {
    position: relative;
    width: 18px;
    height: 14px;
    display: block;
}

.nav-toggle-bars::before,
.nav-toggle-bars::after,
.nav-toggle-bars span {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 1.5px;
    background: white;
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.2s ease, top 0.3s ease;
}

.nav-toggle-bars::before { top: 0; }
.nav-toggle-bars span    { top: 50%; transform: translateY(-50%); }
.nav-toggle-bars::after  { top: 100%; transform: translateY(-100%); }

/* Open state — morph into an X */
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before {
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bars span {
    opacity: 0;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after {
    top: 50%;
    transform: translateY(-50%) rotate(-45deg);
}

/* --- HERO etc --- */
.hero {
    text-align: center;
    padding: 80px 20px 60px;
    max-width: 800px;
    margin: 0 auto;
}

.hero-badge {
    display: inline-block;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    color: var(--accent-secondary);
    margin-bottom: 24px;
    font-family: var(--font-mono);
}

.hero h1 {
    font-size: clamp(40px, 8vw, 80px);
    line-height: 1;
    margin-bottom: 24px;
    letter-spacing: -2px;
}

.gradient-text {
    background: linear-gradient(135deg, #fff 30%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p {
    font-size: 18px;
    color: #94a3b8;
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.6;
}

.app-stage {
    margin-bottom: 100px;
    perspective: 1000px;
}

.app-window {
    max-width: var(--content-max-width);
    margin: 0 auto;
    background: #0e0e11;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.05),
        0 50px 100px -20px rgba(0,0,0,0.7),
        0 0 80px -40px var(--accent-glow);
    overflow: hidden;
    animation: floatUp 1s ease-out;
}

.window-header {
    background: #18181b;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.window-controls { display: flex; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.close { background: #ff5f56; }
.minimize { background: #ffbd2e; }
.maximize { background: #27c93f; }

.window-title {
    flex-grow: 1;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 12px;
    color: rgba(255,255,255,0.3);
    margin: 0 50px;
}

.window-content {
    height: 80vh;
    min-height: 400px;
    position: relative;
    background: #000;
}

#root {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.keyboard-hint {
    text-align: center;
    margin-top: 20px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: rgba(255,255,255,0.4);
}
.key {
    background: rgba(255,255,255,0.1);
    padding: 2px 6px;
    border-radius: 4px;
    color: white;
}

.features-section {
    max-width: var(--content-max-width);
    margin: 0 auto 100px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    padding: 0 6%;
}

.feature-card {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05);
    padding: 24px;
    border-radius: 12px;
    transition: 0.3s;
}

.feature-card:hover {
    background: rgba(255,255,255,0.04);
    transform: translateY(-5px);
}

.feature-card h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: white;
}

.feature-card p {
    font-size: 14px;
    color: #94a3b8;
    line-height: 1.5;
}

.main-page {
    padding: 0 6%;
    margin: 0 auto;
}

.info-section {
    max-width: 1000px;
    margin: 0 auto;
}

.info-section h2 {
    font-size: clamp(28px, 4vw, 40px);
    margin-bottom: 20px;
    text-align: center;
    color: white;
}

.section-desc {
    text-align: center;
    color: #94a3b8;
    margin-bottom: 60px;
    font-size: 17px;
}

/* How It Works Grid */
.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.step-card {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--glass-border);
    padding: 30px;
    border-radius: 12px;
}

.step-card h3 {
    font-size: 18px;
    color: var(--accent-primary);
    margin-bottom: 10px;
}

.step-card p {
    font-size: 14px;
    color: #94a3b8;
}

.code-sample {
    background: #18181b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 20px;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
    color: #60a5fa;
    margin-top: 30px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* API Grid */
.api-ref-section {
    padding-top: 50px;
}

.api-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.api-card {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--glass-border);
    padding: 20px;
    border-radius: 8px;
    transition: transform 0.2s;
}

.api-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-primary);
}

.api-card h3 {
    font-size: 16px;
    margin-bottom: 15px;
    color: white;
}

.api-list {
    list-style: none;
    padding: 0;
    font-family: var(--font-mono);
    font-size: 12px;
}

.api-list li {
    margin-bottom: 8px;
    color: var(--accent-primary);
}

.api-list li .dim {
    color: #94a3b8;
    opacity: 0.8;
}

.footer {
    text-align: center;
    padding: 40px;
    border-top: 1px solid rgba(255,255,255,0.05);
    font-size: 14px;
    color: rgba(255,255,255,0.4);
    max-width: var(--content-max-width);
    margin: 0 auto;
}

.author-link { color: var(--accent-primary); text-decoration: none; }

@keyframes floatUp {
    from { opacity: 0; transform: translateY(40px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* =========================================================
   ADAPTIVE NAVBAR
   - >= 861px: full inline nav (default)
   - 720–860px: tighten gaps, slightly smaller links
   - <  720px: collapse links into a hamburger drawer,
               keep brand + CTA inline
   ========================================================= */

/* Medium screens: tighten the inline nav before collapsing */
@media (max-width: 860px) {
    .top-bar { padding: 20px 5%; }
    .top-nav { gap: 16px; }
    .nav-link { font-size: 13px; }
    .cta-button { padding: 7px 14px; font-size: 13px; }
}

/* Compact screens: hamburger drawer */
@media (max-width: 720px) {
    .top-bar { padding: 18px 5%; }

    .nav-toggle { display: inline-flex; }

    /* The nav becomes a panel that slides down */
    .top-nav {
        position: absolute;
        top: calc(100% - 4px);
        right: 5%;
        left: 5%;
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        padding: 10px;
        background: rgba(14, 14, 17, 0.85);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border: 1px solid var(--glass-border);
        border-radius: 14px;
        box-shadow:
            0 20px 50px -10px rgba(0, 0, 0, 0.6),
            0 0 60px -20px var(--accent-glow);

        /* Hidden by default; toggled via aria-hidden */
        opacity: 0;
        transform: translateY(-8px) scale(0.98);
        pointer-events: none;
        transform-origin: top right;
        transition: opacity 0.2s ease, transform 0.2s ease;
    }

    .top-nav[aria-hidden="false"] {
        opacity: 1;
        transform: translateY(0) scale(1);
        pointer-events: auto;
    }

    .top-nav .nav-link {
        padding: 12px 14px;
        font-size: 15px;
        color: rgba(255, 255, 255, 0.8);
        border-radius: 8px;
        transition: background 0.15s, color 0.15s;
    }
    .top-nav .nav-link:hover {
        background: rgba(255, 255, 255, 0.05);
        color: white;
    }

    .top-nav .cta-button {
        margin-top: 6px;
        padding: 12px 16px;
        font-size: 14px;
        text-align: center;
        border-radius: 10px;
    }
}

/* Existing small-screen tweaks */
@media (max-width: 768px) {
    .hero h1 { font-size: 40px; }
    .app-window { border-radius: 0; border: none; }
    .window-content { height: 50vh; }
}

/* Very small phones */
@media (max-width: 380px) {
    .brand { font-size: 17px; }
    .version { font-size: 9px; }
    .top-bar { padding: 16px 4%; }
}