/* ============================================
   completengine.net — Styles
   Hand-drawn engine room meets neon lightning
   ============================================ */

/* === CSS Custom Properties === */
:root {
    --void-charcoal: #1a1a24;
    --deep-black: #0d0d12;
    --dark-slate: #3d3d52;
    --slate: #6b6b80;
    --pale-lavender: #e8e4f0;
    --electric-cyan: #00f0ff;
    --neon-rose: #ff2d6f;
    --acid-green: #a8ff04;
    --muted-teal: #5b8a8a;

    --font-display: 'Cormorant Garamond', 'Georgia', serif;
    --font-body: 'EB Garamond', 'Georgia', serif;
    --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
    --font-ui: 'Inter', 'Helvetica Neue', sans-serif;
    --font-label: 'Space Grotesk', 'Helvetica Neue', sans-serif;
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    background-color: var(--deep-black);
    color: var(--pale-lavender);
    font-family: var(--font-body);
    line-height: 1.7;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* === SVG Filters (hidden) === */
.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* === Section Base === */
.section {
    position: relative;
    min-height: 100vh;
    padding: 80px 5vw;
}

/* === Section Headers === */
.section-header {
    text-align: center;
    margin-bottom: 60px;
    position: relative;
}

.section-number {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 300;
    color: var(--electric-cyan);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    display: block;
    margin-bottom: 12px;
}

.section-title {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: clamp(32px, 5vw, 72px);
    letter-spacing: -0.02em;
    color: var(--pale-lavender);
    line-height: 1.1;
}

.section-title em {
    font-style: italic;
    color: var(--electric-cyan);
}

.section-desc {
    font-family: var(--font-body);
    font-size: clamp(14px, 1.5vw, 18px);
    color: var(--slate);
    margin-top: 12px;
    font-style: italic;
}

/* ============================================
   HERO SECTION — The Initialization
   ============================================ */
.section--hero {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 0;
    overflow: hidden;
}

.hero-canvas {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

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

.trace {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: traceDraw 4s ease-out forwards;
}

.trace--cyan { animation-delay: 0.2s; }
.trace--rose { animation-delay: 0.8s; }
.trace--lime { animation-delay: 1.4s; }

@keyframes traceDraw {
    to { stroke-dashoffset: 0; }
}

.node {
    animation: nodePulse 3s ease-in-out infinite;
}
.node--1 { animation-delay: 0s; }
.node--2 { animation-delay: 0.6s; }
.node--3 { animation-delay: 1.2s; }
.node--4 { animation-delay: 1.8s; }
.node--5 { animation-delay: 2.4s; }

@keyframes nodePulse {
    0%, 100% { opacity: 0.3; r: 3; }
    50% { opacity: 0.9; r: 6; }
}

/* Hero Icon */
.hero-icon {
    position: relative;
    z-index: 1;
    width: 120px;
    height: 120px;
    margin-bottom: 40px;
    animation: gearSpin 30s linear infinite;
}

.gear-icon {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 20px rgba(0, 240, 255, 0.3));
}

@keyframes gearSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Hero Content */
.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
}

.hero-label {
    font-family: var(--font-label);
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--muted-teal);
    margin-bottom: 20px;
}

.hero-title {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: clamp(48px, 8vw, 120px);
    line-height: 0.9;
    letter-spacing: -0.03em;
    margin-bottom: 24px;
}

.hero-title__line {
    display: block;
}

.hero-title__line--1 {
    font-style: italic;
    color: var(--electric-cyan);
    text-shadow: 0 0 40px rgba(0, 240, 255, 0.3);
}

.hero-title__line--2 {
    color: var(--pale-lavender);
    font-weight: 600;
}

.hero-subtitle {
    font-family: var(--font-body);
    font-size: clamp(14px, 1.8vw, 20px);
    color: var(--slate);
    font-style: italic;
    line-height: 1.6;
    margin-bottom: 32px;
}

.hero-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--acid-green);
    letter-spacing: 0.05em;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--acid-green);
    animation: statusBlink 1.5s ease-in-out infinite;
    box-shadow: 0 0 8px var(--acid-green);
}

@keyframes statusBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.2; }
}

/* Scroll Indicator */
.scroll-indicator {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
    opacity: 0.6;
    animation: scrollBounce 2s ease-in-out infinite;
}

.scroll-dot {
    animation: scrollDotMove 2s ease-in-out infinite;
}

@keyframes scrollBounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(8px); }
}

@keyframes scrollDotMove {
    0% { cy: 10; opacity: 1; }
    100% { cy: 28; opacity: 0; }
}

/* ============================================
   PROCESS GRID SECTION
   ============================================ */
.section--grid {
    padding-top: 120px;
    padding-bottom: 120px;
}

.bus-svg {
    position: absolute;
    left: 50%;
    top: 0;
    width: 40px;
    height: 100%;
    transform: translateX(-50%);
    z-index: 0;
    pointer-events: none;
}

.bus-pulse {
    animation: busPulseAnim 3s linear infinite;
}

@keyframes busPulseAnim {
    from { stroke-dashoffset: 0; }
    to { stroke-dashoffset: -44; }
}

.grid-container {
    display: grid;
    grid-template-columns: 38% 24% 38%;
    gap: 0;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.grid-col {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.grid-col--left {
    padding-right: 24px;
}

.grid-col--center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-around;
    padding: 40px 0;
}

.grid-col--right {
    padding-left: 24px;
    padding-top: 80px;
}

/* Bus Annotations */
.bus-annotation {
    writing-mode: vertical-rl;
    text-orientation: mixed;
}

.bus-label {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 300;
    color: var(--slate);
    letter-spacing: 0.1em;
    opacity: 0.7;
}

/* Cards */
.card {
    position: relative;
    background: var(--void-charcoal);
    border: 1px solid var(--dark-slate);
    border-radius: 4px;
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1),
                box-shadow 0.4s cubic-bezier(0.23, 1, 0.32, 1),
                border-color 0.3s ease;
    cursor: default;
}

.card:hover {
    transform: translateY(-8px);
    border-color: var(--electric-cyan);
    box-shadow: 0 12px 40px rgba(0, 240, 255, 0.1),
                0 0 1px rgba(0, 240, 255, 0.4);
}

.card-glitch-border {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg,
        var(--electric-cyan) 0%,
        var(--neon-rose) 40%,
        var(--acid-green) 70%,
        var(--electric-cyan) 100%
    );
    background-size: 200% 100%;
    animation: glitchBorderShift 8s linear infinite;
    opacity: 0.6;
}

.card:hover .card-glitch-border {
    opacity: 1;
    animation-duration: 2s;
}

@keyframes glitchBorderShift {
    from { background-position: 0% 0; }
    to { background-position: 200% 0; }
}

.card-inner {
    padding: 28px 24px;
}

.card-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
}

.card-icon svg {
    width: 100%;
    height: 100%;
}

.card-label {
    font-family: var(--font-label);
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--muted-teal);
    display: block;
    margin-bottom: 8px;
}

.card-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(20px, 2.5vw, 28px);
    color: var(--pale-lavender);
    letter-spacing: -0.01em;
    margin-bottom: 12px;
    line-height: 1.2;
}

.card-body {
    font-family: var(--font-body);
    font-size: 15px;
    color: var(--slate);
    line-height: 1.7;
    margin-bottom: 16px;
}

.card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px solid var(--dark-slate);
}

.meta-tag {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 400;
    color: var(--dark-slate);
    letter-spacing: 0.05em;
}

.meta-status {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 2px;
}

.meta-status--active {
    color: var(--acid-green);
    background: rgba(168, 255, 4, 0.1);
    border: 1px solid rgba(168, 255, 4, 0.2);
}

.meta-status--waiting {
    color: var(--electric-cyan);
    background: rgba(0, 240, 255, 0.1);
    border: 1px solid rgba(0, 240, 255, 0.2);
}

.meta-status--complete {
    color: var(--muted-teal);
    background: rgba(91, 138, 138, 0.1);
    border: 1px solid rgba(91, 138, 138, 0.2);
}

/* ============================================
   THREAD VISUALIZATION SECTION
   ============================================ */
.section--threads {
    background: var(--void-charcoal);
    border-top: 1px solid var(--dark-slate);
    border-bottom: 1px solid var(--dark-slate);
}

.thread-canvas {
    position: relative;
    max-width: 1200px;
    margin: 0 auto 48px;
    background: var(--deep-black);
    border: 1px solid var(--dark-slate);
    border-radius: 4px;
    overflow: hidden;
}

#threadCanvas {
    width: 100%;
    height: 400px;
    display: block;
}

.thread-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 48px;
    padding: 20px;
    background: linear-gradient(transparent, rgba(13, 13, 18, 0.9));
}

.thread-stat {
    text-align: center;
}

.stat-value {
    font-family: var(--font-mono);
    font-size: 28px;
    font-weight: 300;
    color: var(--electric-cyan);
    display: block;
    line-height: 1;
}

.stat-label {
    font-family: var(--font-label);
    font-size: 10px;
    font-weight: 400;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--slate);
    margin-top: 4px;
    display: block;
}

/* Process Log */
.process-log {
    max-width: 800px;
    margin: 0 auto;
    background: var(--deep-black);
    border: 1px solid var(--dark-slate);
    border-radius: 4px;
    overflow: hidden;
}

.log-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--void-charcoal);
    border-bottom: 1px solid var(--dark-slate);
}

.log-title {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    color: var(--pale-lavender);
}

.log-status {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 400;
    color: var(--acid-green);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    animation: statusBlink 1.5s ease-in-out infinite;
}

.log-content {
    padding: 12px 16px;
    max-height: 200px;
    overflow-y: auto;
}

.log-line {
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.8;
    color: var(--slate);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.log-time {
    color: var(--dark-slate);
    margin-right: 8px;
}

.log-level {
    font-weight: 500;
    margin-right: 8px;
    padding: 0 4px;
}

.log-level--info { color: var(--electric-cyan); }
.log-level--debug { color: var(--slate); }
.log-level--warn { color: #ffaa00; }
.log-level--error { color: var(--neon-rose); }

/* ============================================
   ARCHITECTURE SECTION
   ============================================ */
.section--architecture {
    background: var(--deep-black);
}

.arch-diagram {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.arch-svg {
    width: 100%;
    height: auto;
}

.arch-text {
    font-family: 'IBM Plex Mono', monospace;
    fill: var(--slate);
}

.arch-text--label {
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.1em;
    fill: var(--muted-teal);
}

.arch-text--node {
    font-size: 13px;
    font-weight: 400;
    fill: var(--pale-lavender);
}

.arch-text--core {
    font-size: 14px;
    font-weight: 500;
    fill: var(--electric-cyan);
}

.arch-text--sub {
    font-size: 11px;
    font-weight: 300;
    fill: var(--slate);
    font-style: italic;
}

.arch-text--annotation {
    font-size: 10px;
    font-weight: 300;
    fill: var(--dark-slate);
    font-style: italic;
}

/* ============================================
   COMPLETION SECTION
   ============================================ */
.section--completion {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
    background: radial-gradient(ellipse at center, rgba(168, 255, 4, 0.03) 0%, var(--deep-black) 70%);
}

.completion-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
}

.completion-icon {
    width: 120px;
    height: 120px;
    margin-bottom: 40px;
    animation: completionPulse 4s ease-in-out infinite;
}

.completion-icon svg {
    width: 100%;
    height: 100%;
}

@keyframes completionPulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.05); opacity: 1; }
}

.completion-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(36px, 5vw, 64px);
    color: var(--acid-green);
    letter-spacing: -0.02em;
    margin-bottom: 16px;
    text-shadow: 0 0 40px rgba(168, 255, 4, 0.2);
}

.completion-text {
    font-family: var(--font-body);
    font-size: clamp(16px, 2vw, 20px);
    color: var(--slate);
    font-style: italic;
    line-height: 1.7;
    margin-bottom: 48px;
}

.completion-stats {
    display: flex;
    gap: 48px;
}

.comp-stat {
    text-align: center;
}

.comp-stat__value {
    font-family: var(--font-mono);
    font-size: 36px;
    font-weight: 300;
    color: var(--pale-lavender);
    display: block;
    line-height: 1;
}

.comp-stat__label {
    font-family: var(--font-label);
    font-size: 10px;
    font-weight: 400;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--dark-slate);
    margin-top: 8px;
    display: block;
}

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
    width: 100%;
    padding: 40px 20px;
    text-align: center;
}

.footer-line {
    width: 60px;
    height: 1px;
    background: var(--dark-slate);
    margin: 0 auto 20px;
}

.footer-text {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 16px;
    color: var(--slate);
    letter-spacing: 0.05em;
}

.footer-sub {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--dark-slate);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-top: 4px;
}

/* ============================================
   SCROLL REVEAL ANIMATIONS
   ============================================ */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s cubic-bezier(0.23, 1, 0.32, 1),
                transform 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

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

/* Stagger children */
.card.reveal:nth-child(2) {
    transition-delay: 0.15s;
}

/* ============================================
   GLITCH ANIMATION (for hover on cards)
   ============================================ */
@keyframes glitchShift {
    0%, 100% { clip-path: inset(0 0 0 0); transform: translate(0); }
    20% { clip-path: inset(20% 0 60% 0); transform: translate(-3px, 0); }
    40% { clip-path: inset(60% 0 10% 0); transform: translate(3px, 0); }
    60% { clip-path: inset(40% 0 30% 0); transform: translate(-2px, 0); }
    80% { clip-path: inset(10% 0 70% 0); transform: translate(2px, 0); }
}

.card:hover .card-icon svg {
    animation: glitchShift 0.3s ease-in-out;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .grid-container {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .grid-col--center {
        display: none;
    }

    .grid-col--left,
    .grid-col--right {
        padding: 0;
    }

    .grid-col--right {
        padding-top: 0;
    }

    .bus-svg {
        display: none;
    }

    .completion-stats {
        flex-direction: column;
        gap: 24px;
    }

    .thread-overlay {
        gap: 24px;
    }

    .section {
        padding: 60px 5vw;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 48px;
    }

    .section-title {
        font-size: 28px;
    }
}
