/* ================================================================
   Engramatic / Cortex — Landing Page Styles
   Dark theme, Inter font, engineer-friendly
   ================================================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #040410;
    color: #e2e8f0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* --- Tokens --- */
:root {
    --bg: #040410;
    --bg-card: #0a0a1c;
    --bg-card-hover: #0f0f2a;
    --border: rgba(129, 140, 248, 0.12);
    --border-hover: rgba(129, 140, 248, 0.3);
    --accent: #818cf8;
    --accent-glow: rgba(129, 140, 248, 0.15);
    --text: #e2e8f0;
    --text-dim: #94a3b8;
    --text-muted: #64748b;
    --white: #ffffff;
    --danger: #ef4444;
    --radius: 12px;
    --radius-sm: 8px;
    --max-width: 1200px;
    --nav-height: 64px;
}

/* --- Typography --- */
h1, h2, h3, h4 {
    color: var(--white);
    font-weight: 700;
    line-height: 1.2;
}

h1 { font-size: clamp(2.2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.6rem, 3.5vw, 2.4rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

p {
    color: var(--text-dim);
    line-height: 1.7;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}
a:hover { color: var(--white); }

.mono {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.9em;
    background: rgba(129, 140, 248, 0.1);
    padding: 0.15em 0.5em;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.optional {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.85em;
}

/* --- Layout --- */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
}

.section {
    padding: 100px 0;
}

.section-title {
    text-align: center;
    margin-bottom: 12px;
}

.section-sub {
    text-align: center;
    max-width: 600px;
    margin: 0 auto 60px;
    font-size: 1.1rem;
}

/* --- Scroll Animations --- */
.animate-in {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}
.animate-in.delay-1 { transition-delay: 0.12s; }
.animate-in.delay-2 { transition-delay: 0.24s; }
.animate-in.delay-3 { transition-delay: 0.36s; }

.animate-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Navigation --- */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: var(--nav-height);
    transition: background 0.3s, box-shadow 0.3s;
}

.nav.scrolled {
    background: rgba(4, 4, 16, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 1px 0 var(--border);
}

.nav-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.nav-logo { display: flex; align-items: center; }

.logo-text {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--white);
    letter-spacing: -0.03em;
}

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

.nav-links a {
    color: var(--text-dim);
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
}
.nav-links a:hover { color: var(--white); }

.nav-cta {
    background: var(--accent) !important;
    color: var(--bg) !important;
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600 !important;
    transition: background 0.2s, transform 0.15s !important;
}
.nav-cta:hover {
    background: #a5b4fc !important;
    color: var(--bg) !important;
    transform: translateY(-1px);
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}
.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-dim);
    border-radius: 2px;
    transition: transform 0.3s, opacity 0.3s;
}

/* --- Hero --- */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding-top: var(--nav-height);
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.hero-bg-img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 110%;
    max-width: 1400px;
    height: auto;
    opacity: 0.7;
    mask-image: radial-gradient(ellipse 75% 75% at 50% 45%, black 35%, transparent 80%);
    -webkit-mask-image: radial-gradient(ellipse 75% 75% at 50% 45%, black 35%, transparent 80%);
}

@keyframes heroFloat {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -51%) scale(1.02); }
}

.hero-content {
    max-width: 780px;
    padding: 60px 0;
}

.hero-headline {
    font-size: clamp(2.4rem, 5.5vw, 3.8rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 24px;
}

.hero-sub {
    font-size: clamp(1.05rem, 2vw, 1.25rem);
    color: var(--text-dim);
    max-width: 640px;
    margin-bottom: 40px;
    line-height: 1.7;
}

.hero-ctas {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 40px;
}

.hero-stats {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.hero-stat-sep {
    color: var(--text-muted);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 32px;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: var(--bg);
}
.btn-primary:hover {
    background: #a5b4fc;
    color: var(--bg);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(129, 140, 248, 0.25);
}

.btn-secondary {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border-hover);
}
.btn-secondary:hover {
    background: rgba(129, 140, 248, 0.08);
    color: var(--white);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.btn-full {
    width: 100%;
}

/* --- Problem Section --- */
.problem {
    border-top: 1px solid var(--border);
}

.problem-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
}

.problem-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 36px 28px;
    transition: border-color 0.3s, transform 0.2s;
}
.problem-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-4px);
}

.problem-icon {
    color: var(--accent);
    margin-bottom: 20px;
}

.problem-card h3 {
    margin-bottom: 12px;
}

/* --- Flow (How It Works) --- */
.how-it-works {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.flow {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 16px;
}

.flow-step {
    flex: 1;
    min-width: 160px;
    text-align: center;
    padding: 20px 12px;
}

.flow-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--bg);
    font-weight: 700;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.flow-step h4 {
    margin-bottom: 8px;
}

.flow-step p {
    font-size: 0.88rem;
    line-height: 1.6;
}

.flow-arrow {
    color: var(--text-muted);
    font-size: 1.5rem;
    padding-top: 24px;
    flex-shrink: 0;
    user-select: none;
}

/* --- Features --- */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 36px 32px;
    transition: border-color 0.3s, transform 0.2s, box-shadow 0.3s;
}
.feature-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(129, 140, 248, 0.06);
}

.feature-icon {
    margin-bottom: 20px;
}

.feature-card h3 {
    margin-bottom: 12px;
    color: var(--accent);
}

.feature-card p {
    font-size: 0.95rem;
}

/* --- Numbers Bar --- */
.numbers-bar {
    background: linear-gradient(135deg, rgba(129, 140, 248, 0.08) 0%, rgba(99, 102, 241, 0.04) 100%);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 48px 0;
}

.numbers-grid {
    display: flex;
    justify-content: center;
    gap: 64px;
    flex-wrap: wrap;
}

.number-item {
    text-align: center;
}

.number-value {
    display: block;
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.number-label {
    font-size: 0.9rem;
    color: var(--text-dim);
    font-weight: 500;
}

/* --- Demo --- */
.demo-container {
    text-align: center;
}

.demo-screen {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 32px;
    aspect-ratio: 16 / 9;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.demo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse 50% 50% at 50% 50%, rgba(129, 140, 248, 0.06) 0%, transparent 70%);
}

.demo-placeholder-inner {
    text-align: center;
}

.demo-placeholder-inner p {
    margin-top: 16px;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.demo-cta {
    margin-top: 24px;
}

.demo-note {
    margin-top: 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* --- Timeline --- */
.timeline {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.timeline-track {
    position: relative;
    max-width: 700px;
    margin: 0 auto;
    padding-left: 40px;
}

.timeline-line {
    position: absolute;
    left: 15px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: linear-gradient(180deg, var(--accent) 0%, var(--border) 100%);
}

.timeline-item {
    position: relative;
    padding-bottom: 40px;
}
.timeline-item:last-child { padding-bottom: 0; }

.timeline-marker {
    position: absolute;
    left: -33px;
    top: 4px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    border: 3px solid var(--bg-card);
    box-shadow: 0 0 0 2px var(--accent);
}

.timeline-label {
    display: inline-block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--accent);
    background: rgba(129, 140, 248, 0.1);
    padding: 2px 10px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.timeline-content h4 {
    margin-bottom: 6px;
}

.timeline-content p {
    font-size: 0.9rem;
}

/* --- Integrations --- */
.integrations-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
}

.integration-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px 28px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-dim);
    transition: border-color 0.2s, color 0.2s;
}
.integration-item:hover {
    border-color: var(--border-hover);
    color: var(--white);
}

/* --- Contact --- */
.contact {
    border-top: 1px solid var(--border);
}

.contact-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 64px;
    align-items: start;
}

.contact-info .section-title {
    text-align: left;
    margin-bottom: 20px;
}

.contact-info p {
    font-size: 1.05rem;
    line-height: 1.7;
    margin-bottom: 32px;
}

.contact-email {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--accent) !important;
    font-weight: 500;
}

.contact-form {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 36px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-dim);
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2394a3b8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

/* --- Footer --- */
.footer {
    border-top: 1px solid var(--border);
    padding: 60px 0 40px;
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    gap: 48px;
}

.footer-brand {
    max-width: 320px;
}

.footer-brand .logo-text {
    display: inline-block;
    margin-bottom: 12px;
}

.footer-tagline {
    font-size: 0.9rem;
    color: var(--text-dim);
    margin-bottom: 16px;
}

.footer-legal {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.footer-links {
    display: flex;
    gap: 56px;
}

.footer-col h4 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 16px;
}

.footer-col a {
    display: block;
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 4px 0;
    transition: color 0.2s;
}
.footer-col a:hover {
    color: var(--text);
}

/* ================================================================
   Responsive
   ================================================================ */

/* Tablet */
@media (max-width: 1024px) {
    .feature-grid {
        grid-template-columns: 1fr 1fr;
    }

    .contact-wrapper {
        gap: 40px;
    }

    .footer-links {
        gap: 36px;
    }
}

/* Tablet portrait */
@media (max-width: 768px) {
    .section { padding: 72px 0; }

    /* Nav */
    .nav-toggle { display: flex; }
    .nav-links {
        display: none;
        position: absolute;
        top: var(--nav-height);
        left: 0;
        right: 0;
        flex-direction: column;
        background: rgba(4, 4, 16, 0.97);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        padding: 20px 24px;
        gap: 16px;
        border-bottom: 1px solid var(--border);
    }
    .nav-links.open { display: flex; }
    .nav-cta { text-align: center; }

    /* Problem */
    .problem-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    /* Flow */
    .flow {
        flex-direction: column;
        align-items: stretch;
    }
    .flow-arrow {
        text-align: center;
        padding: 4px 0;
        transform: rotate(90deg);
    }
    .flow-step {
        text-align: left;
        display: flex;
        gap: 16px;
        align-items: flex-start;
        min-width: auto;
        padding: 12px 0;
    }
    .flow-step .flow-number {
        margin: 0;
        flex-shrink: 0;
    }

    /* Features */
    .feature-grid {
        grid-template-columns: 1fr;
    }

    /* Numbers */
    .numbers-grid {
        gap: 32px;
    }

    /* Contact */
    .contact-wrapper {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    .contact-info .section-title {
        text-align: center;
    }
    .contact-info p {
        text-align: center;
    }
    .contact-email {
        justify-content: center;
    }

    /* Footer */
    .footer-inner {
        flex-direction: column;
        gap: 36px;
    }
    .footer-brand {
        max-width: none;
        text-align: center;
    }
    .footer-links {
        justify-content: center;
        flex-wrap: wrap;
        gap: 32px;
    }
    .footer-col {
        text-align: center;
        min-width: 120px;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .container { padding: 0 16px; }
    .section { padding: 56px 0; }

    .hero-headline {
        font-size: 2rem;
    }

    .hero-ctas {
        flex-direction: column;
    }
    .hero-ctas .btn {
        width: 100%;
    }

    .hero-stats {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .hero-stat-sep { display: none; }

    .numbers-grid {
        flex-direction: column;
        gap: 24px;
        align-items: center;
    }

    .contact-form {
        padding: 24px 20px;
    }

    .integrations-grid {
        gap: 10px;
    }
    .integration-item {
        padding: 12px 18px;
        font-size: 0.85rem;
    }
}
