/* ══════════════════════════════════════════════
   XAGI Labs — Immersive 3D Scroll Experience
   ══════════════════════════════════════════════ */

:root {
    --primary: #4F8CFF;
    --secondary: #7B61FF;
    --accent: #FF6B6B;
    --dark: #050510;
    --dark-surface: #0a0a1e;
    --dark-card: rgba(255,255,255,0.03);
    --dark-border: rgba(255,255,255,0.06);
    --text-bright: #ffffff;
    --text-muted: rgba(255,255,255,0.5);
    --text-dim: rgba(255,255,255,0.25);
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--dark);
    color: var(--text-bright);
    overflow-x: hidden;
    line-height: 1.6;
}

h1, h2, h3, h4, h5 { font-family: 'Sora', sans-serif; font-weight: 700; line-height: 1.1; }

a { color: inherit; text-decoration: none; }

/* ── Scroll Progress Bar ──────────────────── */
.scroll-progress {
    position: fixed;
    top: 0; left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--secondary), var(--accent));
    z-index: 10000;
    width: 0%;
    will-change: width;
}

/* ── Three.js Canvas ──────────────────────── */
#bg-canvas {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* ── Noise Overlay ────────────────────────── */
.noise-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
    z-index: 1;
    pointer-events: none;
    mix-blend-mode: overlay;
}

/* ── Custom Cursor ────────────────────────── */
.cursor-dot {
    position: fixed;
    width: 6px; height: 6px;
    background: var(--primary);
    border-radius: 50%;
    pointer-events: none;
    z-index: 10001;
    mix-blend-mode: difference;
    will-change: transform;
}

.cursor-ring {
    position: fixed;
    width: 44px; height: 44px;
    border: 1px solid rgba(79,140,255,0.3);
    border-radius: 50%;
    pointer-events: none;
    z-index: 10000;
    will-change: transform;
    transition: width 0.3s, height 0.3s, border-color 0.3s, background 0.3s;
}

.cursor-ring.hovering {
    width: 64px; height: 64px;
    border-color: var(--secondary);
    background: rgba(123,97,255,0.08);
}

/* ── Navigation ───────────────────────────── */
nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 48px;
    mix-blend-mode: difference;
    transition: padding 0.4s, background 0.4s;
}

nav.scrolled {
    padding: 16px 48px;
    mix-blend-mode: normal;
    background: rgba(5,5,16,0.85);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--dark-border);
}

.logo {
    font-family: 'Sora', sans-serif;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 3px;
    color: var(--text-bright);
}

.logo em {
    font-style: normal;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 40px;
}

.nav-links a {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-bright);
    letter-spacing: 0.5px;
    opacity: 0.6;
    transition: opacity 0.3s;
}

.nav-links a:hover { opacity: 1; }

/* ── Buttons ──────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 16px 36px;
    border-radius: 60px;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    border: none;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 0 40px rgba(79,140,255,0.2);
}

.btn-primary:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 0 60px rgba(79,140,255,0.35);
}

.btn-outline {
    background: transparent;
    color: var(--text-bright);
    border: 1px solid rgba(255,255,255,0.15);
}

.btn-outline:hover {
    border-color: var(--primary);
    background: rgba(79,140,255,0.05);
}

/* ── Panel / Card Stack Sections ──────────── */
.panel {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 120px 48px;
    will-change: transform, opacity;
}

.panel-inner {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

/* ── Sticky Card Stack ────────────────────── */
.stack-container {
    position: relative;
    z-index: 2;
    perspective: 1200px;
}

.stack-card {
    position: sticky;
    top: 10vh;
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    border-radius: 32px;
    background: var(--dark-surface);
    border: 1px solid var(--dark-border);
    margin-bottom: 60px;
    will-change: transform, filter, opacity;
    transform-style: preserve-3d;
    transform-origin: top center;
    overflow: hidden;
}

.stack-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(ellipse at 30% 20%, rgba(79,140,255,0.05), transparent 60%);
    pointer-events: none;
}

/* ── Hero ──────────────────────────────────── */
.hero-section {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 140px 48px 100px;
    perspective: 1200px;
}

.hero-section h1 {
    font-size: clamp(3rem, 8vw, 7rem);
    letter-spacing: -3px;
    margin-bottom: 28px;
}

.hero-section h1 .line {
    display: block;
    overflow: hidden;
}

.hero-section h1 .line-inner {
    display: block;
    transform: translateY(110%);
}

.hero-section .desc {
    font-size: clamp(1rem, 2vw, 1.3rem);
    color: var(--text-muted);
    max-width: 560px;
    line-height: 1.7;
    margin-bottom: 48px;
    font-weight: 300;
}

.hero-buttons {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
}

/* ── Section Headers ──────────────────────── */
.section-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 4px;
    color: var(--primary);
    margin-bottom: 16px;
}

.section-title {
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    letter-spacing: -1.5px;
    margin-bottom: 20px;
}

.section-desc {
    font-size: 18px;
    color: var(--text-muted);
    max-width: 560px;
    line-height: 1.7;
}

/* ── Gradient Text ────────────────────────── */
.text-gradient {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.text-gradient-warm {
    background: linear-gradient(135deg, var(--accent), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.text-shimmer {
    background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 30%, var(--accent) 50%, var(--secondary) 70%, var(--primary) 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 6s linear infinite;
}

@keyframes shimmer {
    to { background-position: 200% center; }
}

/* ── Marquee ──────────────────────────────── */
.marquee-wrap {
    overflow: hidden;
    padding: 32px 0;
    border-top: 1px solid var(--dark-border);
    border-bottom: 1px solid var(--dark-border);
    position: relative;
    z-index: 2;
}

.marquee-track {
    display: flex;
    gap: 48px;
    width: max-content;
    animation: marqueeScroll 40s linear infinite;
}

.marquee-track span {
    font-family: 'Sora', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-dim);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 4px;
}

.marquee-track .sep {
    color: var(--primary);
    opacity: 0.5;
}

@keyframes marqueeScroll {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

/* ── Card Grid ────────────────────────────── */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.glass-card {
    padding: 40px 32px;
    background: var(--dark-card);
    border: 1px solid var(--dark-border);
    border-radius: 24px;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.glass-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    opacity: 0;
    transition: opacity 0.5s;
}

.glass-card:hover {
    transform: translateY(-4px);
    border-color: rgba(79,140,255,0.15);
    background: rgba(79,140,255,0.03);
}

.glass-card:hover::after { opacity: 1; }

.glass-card h3 {
    font-size: 20px;
    margin-bottom: 12px;
}

.glass-card p {
    font-size: 15px;
    color: var(--text-muted);
    line-height: 1.7;
}

/* ── Feature Strip ────────────────────────── */
.feature-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border: 1px solid var(--dark-border);
    border-radius: 24px;
    overflow: hidden;
}

.feature-cell {
    padding: 40px 24px;
    text-align: center;
    border-right: 1px solid var(--dark-border);
    transition: background 0.4s;
    position: relative;
    overflow: hidden;
}

.feature-cell::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(79,140,255,0.08), transparent 60%);
    opacity: 0;
    transition: opacity 0.4s;
    pointer-events: none;
}

.feature-cell:hover::after {
    opacity: 1;
}

.feature-cell:last-child { border-right: none; }
.feature-cell:hover { background: rgba(79,140,255,0.03); }

.feature-cell .icon {
    font-size: 32px;
    display: block;
    margin-bottom: 16px;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.feature-cell:hover .icon { transform: scale(1.3) translateY(-4px); }

.feature-cell h4 { font-size: 15px; margin-bottom: 6px; }
.feature-cell p { font-size: 13px; color: var(--text-dim); }

/* ── Stats ────────────────────────────────── */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    border: 1px solid var(--dark-border);
    border-radius: 24px;
    overflow: hidden;
    margin: 48px 0;
}

.stat-cell {
    padding: 40px 24px;
    text-align: center;
    border-right: 1px solid var(--dark-border);
}

.stat-cell:last-child { border-right: none; }

.stat-cell .num {
    font-family: 'Sora', sans-serif;
    font-size: 36px;
    font-weight: 800;
    margin-bottom: 4px;
}

.stat-cell .label {
    font-size: 13px;
    color: var(--text-dim);
    letter-spacing: 0.5px;
}

/* ── Quote Section ────────────────────────── */
.quote-block {
    position: relative;
    z-index: 2;
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
    padding: 120px 48px;
}

.quote-block blockquote {
    font-family: 'Sora', sans-serif;
    font-size: clamp(1.5rem, 3.5vw, 2.5rem);
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: -0.5px;
    position: relative;
}

.quote-block blockquote::before {
    content: '\201C';
    font-size: 10rem;
    position: absolute;
    top: -60px; left: -30px;
    color: rgba(79,140,255,0.07);
    font-family: Georgia, serif;
    line-height: 1;
}

/* ── CTA Banner ───────────────────────────── */
.cta-banner {
    position: relative;
    z-index: 2;
    margin: 0 48px 80px;
    max-width: 1104px;
    margin-left: auto;
    margin-right: auto;
    padding: 80px 60px;
    border-radius: 32px;
    text-align: center;
    background: linear-gradient(135deg, rgba(79,140,255,0.06), rgba(123,97,255,0.06));
    border: 1px solid rgba(79,140,255,0.1);
}

.cta-banner h2 {
    font-size: clamp(2rem, 4vw, 3rem);
    letter-spacing: -1px;
    margin-bottom: 16px;
}

.cta-banner p {
    font-size: 18px;
    color: var(--text-muted);
    margin-bottom: 32px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

/* ── Footer ───────────────────────────────── */
footer {
    position: relative;
    z-index: 2;
    padding: 48px;
    border-top: 1px solid var(--dark-border);
    text-align: center;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 16px;
}

.footer-links a {
    font-size: 14px;
    color: var(--text-dim);
    transition: color 0.3s;
}

.footer-links a:hover { color: var(--primary); }

footer .copy {
    font-size: 13px;
    color: var(--text-dim);
}

/* ── Hamburger ────────────────────────────── */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    z-index: 9001;
    padding: 10px;
    -webkit-tap-highlight-color: transparent;
}

.hamburger div {
    width: 24px; height: 2px;
    background: var(--text-bright);
    transition: transform 0.3s, opacity 0.3s;
    transform-origin: center;
}

.hamburger.active div:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.hamburger.active div:nth-child(2) {
    opacity: 0;
}

.hamburger.active div:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ── Accessibility ────────────────────────── */
.skip-link {
    position: absolute;
    top: -60px; left: 0;
    background: var(--primary);
    color: white;
    padding: 10px 20px;
    z-index: 100000;
    font-size: 14px;
    border-radius: 0 0 8px 0;
    transition: top 0.3s;
}

.skip-link:focus { top: 0; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
    .marquee-track { animation: none; }
}

/* ── Touch device resets ─────────────────── */
@media (hover: none) and (pointer: coarse) {
    /* Disable hover-only effects on touch */
    .glass-card:hover { transform: none; }
    .feature-cell:hover { background: transparent; }
    .feature-cell:hover .icon { transform: none; }
    .feature-cell:hover::after { opacity: 0; }
    .glass-card:hover::after { opacity: 0; }
}

/* ── Responsive ───────────────────────────── */
@media (max-width: 860px) {
    /* Global touch resets */
    * { -webkit-tap-highlight-color: transparent; }
    body { touch-action: pan-y; }

    nav { padding: 16px 24px; }
    nav.scrolled { padding: 12px 24px; }
    .hamburger { display: flex; }
    .nav-links {
        display: none;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: var(--dark);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 32px;
        z-index: 9000;
    }
    .nav-links.active { display: flex; }
    .nav-links a {
        font-size: 24px;
        opacity: 1;
        padding: 12px 24px;
        min-height: 48px;
        display: flex;
        align-items: center;
    }

    .hero-section {
        padding: 100px 20px 60px;
        min-height: calc(100vh - 60px);
        min-height: calc(100dvh - 60px);
    }
    .hero-section h1 { letter-spacing: -1.5px; }
    .hero-section .desc { font-size: 1rem; margin-bottom: 36px; }

    .panel { padding: 60px 20px; }
    .stack-container { padding-left: 20px !important; padding-right: 20px !important; }
    .stack-card {
        padding: 40px 24px;
        border-radius: 20px;
        min-height: auto;
        min-height: unset;
    }

    .feature-strip { grid-template-columns: 1fr 1fr; }
    .feature-cell {
        border-bottom: 1px solid var(--dark-border);
        padding: 32px 20px;
    }
    .stats-row { grid-template-columns: 1fr 1fr; }
    .stat-cell {
        border-bottom: 1px solid var(--dark-border);
        padding: 32px 20px;
    }

    .section-title { font-size: clamp(1.8rem, 5vw, 2.5rem); }
    .section-desc { font-size: 16px; }

    /* Buttons: ensure touch-friendly size */
    .btn {
        padding: 14px 28px;
        font-size: 15px;
        min-height: 48px;
    }

    .cta-banner {
        margin: 0 16px 48px;
        padding: 48px 24px;
        border-radius: 24px;
    }
    .cta-banner h2 { font-size: clamp(1.6rem, 4vw, 2.2rem); }
    .cta-banner p { font-size: 16px; }

    .quote-block { padding: 60px 20px; }
    .quote-block blockquote { font-size: clamp(1.2rem, 3vw, 1.8rem); }
    .quote-block blockquote::before { font-size: 6rem; top: -40px; left: -10px; }

    .marquee-track span { font-size: 13px; letter-spacing: 3px; }

    footer { padding: 36px 20px; }
    .footer-links { gap: 20px; flex-wrap: wrap; }
    .footer-links a { padding: 8px 4px; min-height: 44px; display: inline-flex; align-items: center; }

    .cursor-dot, .cursor-ring { display: none !important; }
}

@media (max-width: 480px) {
    .hero-section { padding: 90px 16px 48px; }
    .hero-section h1 { font-size: clamp(2.2rem, 10vw, 3.5rem); letter-spacing: -1px; }
    .hero-section .desc { font-size: 0.95rem; }

    .panel { padding: 48px 16px; }
    .stack-container { padding-left: 16px !important; padding-right: 16px !important; }
    .stack-card { padding: 32px 20px; }

    .feature-strip, .stats-row { grid-template-columns: 1fr; }
    .card-grid { grid-template-columns: 1fr; }
    .hero-buttons { flex-direction: column; align-items: stretch; }
    .hero-buttons .btn { justify-content: center; }

    .cta-banner { margin: 0 12px 40px; padding: 40px 20px; }

    .section-title { font-size: clamp(1.5rem, 6vw, 2rem); }

    .quote-block { padding: 48px 16px; }
    .quote-block blockquote::before { display: none; }

    footer { padding: 32px 16px; }
    .footer-links { flex-direction: column; gap: 12px; align-items: center; }
}
