/* ============================================
   completengine.com - Swiss Typography + Concurrent Systems
   Colors: #0c0c14, #16161e, #252530, #4a9eff, #00d68f, #ff4757, #e8e8f0, #6b6b80
   Fonts: Space Grotesk, Inter, JetBrains Mono
   ============================================ */

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

html {
    scroll-snap-type: y proximity;
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Inter', 'Helvetica', sans-serif;
    font-size: 0.95rem;
    line-height: 1.7;
    font-weight: 400;
    color: #e8e8f0;
    background-color: #0c0c14;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* --- Grid Overlay (persistent Swiss 12-column reference) --- */
#grid-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 24px;
    padding: 0 48px;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.03;
}

.grid-col {
    border-left: 1px solid #e8e8f0;
    border-right: 1px solid #e8e8f0;
}

/* --- Ambient Thread Lines Background --- */
#thread-lines-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.04;
}

.ambient-line {
    stroke: #4a9eff;
    stroke-width: 1;
    stroke-dasharray: 600 400;
    animation: ambient-flow 25s linear infinite;
}

.ambient-line:nth-child(2n) {
    stroke: #4a9eff;
    opacity: 0.6;
    animation-duration: 30s;
}

.ambient-line:nth-child(3n) {
    stroke: #00d68f;
    opacity: 0.4;
    animation-duration: 35s;
}

@keyframes ambient-flow {
    from { stroke-dashoffset: 1000; }
    to { stroke-dashoffset: 0; }
}

/* --- Swiss Grid Layout --- */
.swiss-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 24px;
    max-width: 1344px;
    margin: 0 auto;
    padding: 0 48px;
    position: relative;
    z-index: 1;
}

/* --- Sections --- */
.section {
    scroll-snap-align: start;
    padding: 96px 0;
    position: relative;
}

.section-main {
    grid-column: 1 / 9;
}

.section-sidebar {
    grid-column: 9 / 13;
    position: sticky;
    top: 96px;
    align-self: start;
}

.section-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 700;
    color: #e8e8f0;
    margin-bottom: 24px;
    letter-spacing: -0.02em;
}

.section-intro {
    color: #6b6b80;
    font-size: 1.05rem;
    line-height: 1.8;
    margin-bottom: 48px;
    max-width: 640px;
}

/* --- Fade Reveal (scroll animation) --- */
.fade-reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 400ms ease, transform 400ms ease;
}

.fade-reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Hero Section --- */
#hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    padding: 0;
}

.hero-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

#hero-threads {
    width: 100%;
    height: 100%;
}

.thread-line {
    stroke: #4a9eff;
    stroke-width: 1;
    stroke-dasharray: 400 200;
    opacity: 0.3;
    animation: flow 15s linear infinite;
}

.thread-line.t1 { animation-duration: 12s; opacity: 0.5; }
.thread-line.t2 { animation-duration: 14s; opacity: 0.25; }
.thread-line.t3 { animation-duration: 16s; opacity: 0.4; stroke: #4a9eff; }
.thread-line.t4 { animation-duration: 11s; opacity: 0.2; }
.thread-line.t5 { animation-duration: 18s; opacity: 0.35; }
.thread-line.t6 { animation-duration: 13s; opacity: 0.45; stroke: #4a9eff; }
.thread-line.t7 { animation-duration: 20s; opacity: 0.3; }
.thread-line.t8 { animation-duration: 15s; opacity: 0.25; }
.thread-line.t9 { animation-duration: 17s; opacity: 0.4; }
.thread-line.t10 { animation-duration: 10s; opacity: 0.2; }
.thread-line.t11 { animation-duration: 19s; opacity: 0.35; }
.thread-line.t12 { animation-duration: 14s; opacity: 0.3; }
.thread-line.t13 { animation-duration: 16s; opacity: 0.25; }

@keyframes flow {
    from { stroke-dashoffset: 1000; }
    to { stroke-dashoffset: 0; }
}

/* Synchronization Barriers */
.sync-barrier {
    stroke: #00d68f;
    stroke-width: 1;
    stroke-dasharray: 8 8;
    opacity: 0.3;
    animation: pulse 2s ease-in-out infinite;
}

.sync-barrier:nth-child(2) { animation-delay: 0.5s; }
.sync-barrier:nth-child(3) { animation-delay: 1.0s; }
.sync-barrier:nth-child(4) { animation-delay: 1.5s; }

@keyframes pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}

/* Process Nodes */
.process-node {
    fill: #4a9eff;
    opacity: 0;
    transition: opacity 300ms ease, filter 300ms ease;
}

.process-node.glow {
    opacity: 1;
    filter: drop-shadow(0 0 6px #4a9eff) drop-shadow(0 0 12px #4a9eff);
}

/* Hero Content */
.hero-content {
    position: relative;
    z-index: 1;
    align-items: end;
    min-height: 100vh;
    padding-top: 120px;
    padding-bottom: 96px;
}

.hero-text {
    grid-column: 1 / 8;
}

.wordmark {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(2.5rem, 6vw, 5rem);
    font-weight: 700;
    color: #e8e8f0;
    letter-spacing: -0.03em;
    margin-bottom: 16px;
    line-height: 1.1;
}

.hero-subtitle {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    color: #4a9eff;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 24px;
}

.hero-description {
    color: #6b6b80;
    font-size: 1.1rem;
    line-height: 1.8;
    max-width: 520px;
}

.hero-meta {
    grid-column: 9 / 13;
    display: flex;
    flex-direction: column;
    gap: 24px;
    align-self: end;
}

.meta-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 12px 0;
    border-bottom: 1px solid #252530;
}

.meta-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: #6b6b80;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.meta-value {
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    color: #e8e8f0;
    font-variant-numeric: tabular-nums;
}

.status-active {
    color: #00d68f;
}

/* --- Architecture Cards --- */
.arch-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.arch-card {
    background: #16161e;
    border: 1px solid #252530;
    padding: 32px 24px;
    position: relative;
}

.card-indicator {
    width: 32px;
    height: 3px;
    background: #4a9eff;
    margin-bottom: 24px;
}

.card-indicator.indicator-green {
    background: #00d68f;
}

.card-indicator.indicator-red {
    background: #ff4757;
}

.card-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: #e8e8f0;
    margin-bottom: 12px;
}

.card-body {
    color: #6b6b80;
    font-size: 0.875rem;
    line-height: 1.7;
    margin-bottom: 16px;
}

.card-code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: #4a9eff;
    background: #0c0c14;
    padding: 8px 12px;
    display: block;
    border-left: 2px solid #252530;
}

/* --- Sidebar --- */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 48px;
}

.sidebar-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: #6b6b80;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 8px;
    display: block;
}

.sidebar-link {
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    color: #6b6b80;
    text-decoration: none;
    padding: 4px 0;
    border-left: 2px solid transparent;
    padding-left: 12px;
    transition: color 200ms ease, border-color 200ms ease;
}

.sidebar-link:hover {
    color: #e8e8f0;
}

.sidebar-link.active {
    color: #4a9eff;
    border-left-color: #4a9eff;
}

.sidebar-meta {
    margin-bottom: 24px;
}

.sidebar-value {
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    color: #e8e8f0;
    display: block;
    margin-top: 4px;
}

/* --- Benchmark Panel --- */
.benchmark-panel {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.benchmark-item {
    padding: 16px 0;
    border-bottom: 1px solid #252530;
}

.bench-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 12px;
}

.bench-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    color: #6b6b80;
}

.bench-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    color: #e8e8f0;
    font-weight: 400;
    font-variant-numeric: tabular-nums;
}

.bench-bar-track {
    width: 100%;
    height: 4px;
    background: #252530;
    position: relative;
}

.bench-bar {
    height: 100%;
    background: #4a9eff;
    width: 0%;
    transition: width 1000ms cubic-bezier(0.22, 1, 0.36, 1);
}

.bench-bar.bar-green {
    background: #00d68f;
}

.bench-bar.bar-red {
    background: #ff4757;
}

/* --- API Reference --- */
.api-block {
    background: #16161e;
    border: 1px solid #252530;
    padding: 32px;
    margin-bottom: 24px;
}

.api-signature {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.api-keyword {
    color: #ff4757;
}

.api-name {
    color: #4a9eff;
    font-weight: 400;
}

.api-param {
    color: #e8e8f0;
}

.api-return {
    color: #00d68f;
}

.api-desc {
    color: #6b6b80;
    font-size: 0.875rem;
    line-height: 1.7;
    margin-bottom: 16px;
}

.api-code {
    background: #0c0c14;
    border-left: 2px solid #252530;
    padding: 16px 20px;
    overflow-x: auto;
    margin: 0;
}

.api-code code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: #e8e8f0;
    line-height: 1.6;
}

/* --- Quick Start Steps --- */
.steps {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.step {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    padding: 24px 0;
    border-bottom: 1px solid #252530;
}

.step-number {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: #252530;
    flex-shrink: 0;
    width: 48px;
    line-height: 1;
}

.step-content {
    flex: 1;
}

.step-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: #e8e8f0;
    margin-bottom: 12px;
}

.step-code {
    background: #16161e;
    border: 1px solid #252530;
    border-left: 2px solid #4a9eff;
    padding: 16px 20px;
    overflow-x: auto;
    margin: 0;
}

.step-code code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: #e8e8f0;
    line-height: 1.6;
}

/* --- Footer --- */
#footer {
    padding: 48px 0;
    border-top: 1px solid #252530;
}

#footer .swiss-grid {
    align-items: center;
}

.footer-content {
    grid-column: 1 / 8;
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.footer-wordmark {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: #e8e8f0;
}

.footer-sep {
    color: #252530;
}

.footer-text {
    font-size: 0.8rem;
    color: #6b6b80;
}

.footer-links {
    grid-column: 9 / 13;
    display: flex;
    gap: 24px;
    justify-content: flex-end;
}

.footer-link {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: #6b6b80;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: color 200ms ease;
}

.footer-link:hover {
    color: #4a9eff;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .swiss-grid {
        padding: 0 24px;
    }

    #grid-overlay {
        padding: 0 24px;
    }

    .section-main {
        grid-column: 1 / -1;
    }

    .section-sidebar {
        grid-column: 1 / -1;
        position: static;
        margin-top: 48px;
    }

    .hero-text {
        grid-column: 1 / -1;
    }

    .hero-meta {
        grid-column: 1 / -1;
        margin-top: 48px;
    }

    .arch-cards {
        grid-template-columns: 1fr;
    }

    .footer-content {
        grid-column: 1 / -1;
    }

    .footer-links {
        grid-column: 1 / -1;
        justify-content: flex-start;
        margin-top: 24px;
    }

    .hero-content {
        padding-top: 72px;
    }
}
