/* ============================================================
   Hatch Homepage v2 — Dark Theme
   Design system: OKLCH-inspired tokens, Inter + JetBrains Mono
   ============================================================ */

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

/* --- Tokens --- */
:root {
    /* Surface */
    --surface-0: #09090b;          /* deepest bg */
    --surface-1: #111114;          /* cards, sections */
    --surface-2: #1a1a1f;          /* elevated surfaces */
    --surface-3: #232328;          /* borders, subtle dividers */

    /* Brand */
    --brand: #3b82f6;              /* blue-500 */
    --brand-dim: #2563eb;          /* blue-600 hover */
    --brand-glow: rgba(59, 130, 246, 0.15);
    --brand-glow-strong: rgba(59, 130, 246, 0.25);

    /* Text */
    --text-primary: #fafafa;       /* near-white */
    --text-secondary: #a1a1aa;     /* zinc-400 */
    --text-tertiary: #71717a;      /* zinc-500 */
    --text-code: #e879f9;          /* fuchsia-400 for code highlights */

    /* Code */
    --code-bg: #18181b;
    --code-border: #27272a;

    /* Typography */
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;

    /* Spacing scale (4px base) */
    --sp-1: 0.25rem;   /* 4 */
    --sp-2: 0.5rem;    /* 8 */
    --sp-3: 0.75rem;   /* 12 */
    --sp-4: 1rem;      /* 16 */
    --sp-5: 1.25rem;   /* 20 */
    --sp-6: 1.5rem;    /* 24 */
    --sp-8: 2rem;      /* 32 */
    --sp-10: 2.5rem;   /* 40 */
    --sp-12: 3rem;     /* 48 */
    --sp-16: 4rem;     /* 64 */
    --sp-20: 5rem;     /* 80 */
    --sp-24: 6rem;     /* 96 */

    /* Radii */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;

    /* Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --duration-fast: 150ms;
    --duration-normal: 250ms;
}

/* --- Base --- */
html {
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    color: var(--text-primary);
    background-color: var(--surface-0);
    overflow-x: hidden;
}

a {
    color: var(--brand);
    text-decoration: none;
    transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
    color: var(--text-primary);
}

code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    background-color: var(--code-bg);
    border: 1px solid var(--code-border);
    padding: 0.15em 0.4em;
    border-radius: var(--radius-sm);
    color: var(--text-code);
}

/* --- Particle canvas --- */
#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* --- Container --- */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 var(--sp-6);
}

/* --- Header --- */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: var(--sp-4) 0;
    background: rgba(9, 9, 11, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--surface-3);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    letter-spacing: -0.01em;
}

.logo:hover {
    color: var(--text-primary);
}

.logo-mark {
    color: var(--brand);
    font-size: 1.4rem;
}

nav {
    display: flex;
    gap: var(--sp-6);
}

.nav-link {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    transition: color var(--duration-fast) var(--ease-out);
}

.nav-link:hover {
    color: var(--text-primary);
}

/* --- Hero --- */
.hero {
    position: relative;
    z-index: 1;
    padding: calc(var(--sp-24) + 2rem) 0 var(--sp-20);
    text-align: center;
}

.hero-badge {
    display: inline-block;
    padding: var(--sp-1) var(--sp-4);
    background: var(--brand-glow);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--brand);
    letter-spacing: 0.02em;
    margin-bottom: var(--sp-8);
}

.hero h1 {
    font-size: clamp(2.25rem, 5vw, 3.5rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.03em;
    text-wrap: balance;
    margin-bottom: var(--sp-6);
    color: var(--text-primary);
}

.hero-sub {
    font-size: clamp(1rem, 2vw, 1.2rem);
    color: var(--text-secondary);
    max-width: 560px;
    margin: 0 auto var(--sp-8);
    line-height: 1.7;
    text-wrap: pretty;
}

.hero-cta {
    display: flex;
    gap: var(--sp-4);
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: var(--sp-12);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-3) var(--sp-6);
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    font-family: var(--font-body);
    transition: all var(--duration-normal) var(--ease-out);
    cursor: pointer;
    border: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--brand);
    color: #fff;
    box-shadow: 0 0 0 0 var(--brand-glow-strong);
}

.btn-primary:hover {
    background: var(--brand-dim);
    color: #fff;
    box-shadow: 0 0 24px 4px var(--brand-glow-strong);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--surface-2);
    color: var(--text-primary);
    border: 1px solid var(--surface-3);
}

.btn-secondary:hover {
    background: var(--surface-3);
    color: var(--text-primary);
    border-color: var(--text-tertiary);
}

.btn-lg {
    padding: var(--sp-4) var(--sp-8);
    font-size: 1.05rem;
}

/* --- Terminal mock --- */
.hero-terminal {
    max-width: 640px;
    margin: 0 auto;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--surface-3);
    background: var(--code-bg);
    text-align: left;
}

.terminal-bar {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-3) var(--sp-4);
    background: var(--surface-2);
    border-bottom: 1px solid var(--surface-3);
}

.terminal-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--surface-3);
}

.terminal-dot:first-child { background: #ef4444; }
.terminal-dot:nth-child(2) { background: #eab308; }
.terminal-dot:nth-child(3) { background: #22c55e; }

.terminal-title {
    margin-left: var(--sp-2);
    font-size: 0.75rem;
    color: var(--text-tertiary);
    font-family: var(--font-mono);
}

.hero-terminal pre {
    padding: var(--sp-5) var(--sp-5);
    overflow-x: auto;
    font-size: 0.82rem;
    line-height: 1.8;
}

.hero-terminal code {
    background: none;
    border: none;
    padding: 0;
    color: var(--text-secondary);
    font-size: inherit;
}

.t-prompt { color: var(--brand); font-weight: 600; }
.t-cmd { color: var(--text-primary); }
.t-output { color: #22c55e; }

/* --- Features --- */
.features {
    position: relative;
    z-index: 1;
    padding: var(--sp-24) 0;
}

.features h2 {
    text-align: center;
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: var(--sp-12);
    color: var(--text-primary);
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sp-6);
}

.feature {
    padding: var(--sp-8);
    background: var(--surface-1);
    border: 1px solid var(--surface-3);
    border-radius: var(--radius-lg);
    transition: border-color var(--duration-normal) var(--ease-out),
                box-shadow var(--duration-normal) var(--ease-out);
}

.feature:hover {
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: 0 0 32px -8px var(--brand-glow);
}

.feature-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-glow);
    border-radius: var(--radius-md);
    margin-bottom: var(--sp-5);
    color: var(--brand);
}

.feature h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: var(--sp-3);
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.feature p {
    color: var(--text-secondary);
    font-size: 0.92rem;
    line-height: 1.65;
}

/* --- Why --- */
.why {
    position: relative;
    z-index: 1;
    padding: var(--sp-24) 0;
    background: var(--surface-1);
    border-top: 1px solid var(--surface-3);
    border-bottom: 1px solid var(--surface-3);
}

.why h2 {
    text-align: center;
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: var(--sp-12);
    color: var(--text-primary);
}

.why-grid {
    display: flex;
    flex-direction: column;
    gap: var(--sp-8);
    max-width: 700px;
    margin: 0 auto;
}

.why-item {
    display: flex;
    gap: var(--sp-6);
    align-items: flex-start;
}

.why-number {
    flex-shrink: 0;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--brand);
    padding-top: 0.15em;
    min-width: 2rem;
}

.why-content h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: var(--sp-2);
    color: var(--text-primary);
}

.why-content p {
    color: var(--text-secondary);
    font-size: 0.92rem;
    line-height: 1.65;
}

/* --- Final CTA --- */
.final-cta {
    position: relative;
    z-index: 1;
    padding: var(--sp-24) 0;
    text-align: center;
}

.final-cta h2 {
    font-size: clamp(1.5rem, 3vw, 2.25rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: var(--sp-4);
    color: var(--text-primary);
}

.final-cta p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: var(--sp-8);
}

/* --- Footer --- */
footer {
    position: relative;
    z-index: 1;
    padding: var(--sp-8) 0;
    border-top: 1px solid var(--surface-3);
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-logo {
    font-weight: 700;
    color: var(--text-tertiary);
    font-size: 0.9rem;
}

footer p {
    color: var(--text-tertiary);
    font-size: 0.85rem;
}

footer a {
    color: var(--text-secondary);
}

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

/* --- Animation states (set by anime.js) --- */
[data-animate] {
    opacity: 0;
    transform: translateY(20px);
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
    [data-animate] {
        opacity: 1;
        transform: none;
    }

    .btn-primary:hover {
        transform: none;
    }

    #particle-canvas {
        display: none;
    }
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .container {
        padding: 0 var(--sp-4);
    }

    .hero {
        padding: calc(var(--sp-20) + 1rem) 0 var(--sp-16);
    }

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

    .hero-sub br {
        display: none;
    }

    .feature-grid {
        grid-template-columns: 1fr;
        gap: var(--sp-4);
    }

    .feature {
        padding: var(--sp-6);
    }

    .why-item {
        flex-direction: column;
        gap: var(--sp-2);
    }

    .why-number {
        padding-top: 0;
    }

    .footer-inner {
        flex-direction: column;
        gap: var(--sp-4);
        text-align: center;
    }

    .hero-terminal {
        border-radius: var(--radius-md);
    }

    .hero-terminal pre {
        font-size: 0.75rem;
        padding: var(--sp-4);
    }
}

@media (max-width: 480px) {
    .hero-cta {
        flex-direction: column;
        align-items: stretch;
    }

    .btn {
        justify-content: center;
    }
}
