/* concengine.com - Glitch-Fractured Interface */

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

:root {
    --sys-dark: #0F0F14;
    --clean-white: #FFFFFF;
    --sys-light: #E4E4E7;
    --glitch-red: #FF0040;
    --glitch-green: #00FF80;
    --glitch-blue: #4040FF;
    --process-cyan: #22D3EE;
    --process-amber: #FBBF24;
    --body-dark: #27272A;
    --muted: #71717A;
}

body {
    background-color: var(--sys-dark);
    color: var(--sys-light);
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: clamp(0.9rem, 1.1vw, 1rem);
    line-height: 1.75;
    overflow-x: hidden;
}

/* ============================
   HERO: STABLE/UNSTABLE
   ============================ */

#hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-color: var(--sys-dark);
}

.glitch-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(3rem, 8vw, 7rem);
    letter-spacing: 0.04em;
    color: var(--sys-light);
    position: relative;
    text-align: center;
}

/* RGB Channel Split via pseudo-elements */
.glitch-title::before,
.glitch-title::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
}

.glitch-title::before {
    color: var(--glitch-red);
}

.glitch-title::after {
    color: var(--glitch-green);
}

.glitch-title.glitching::before {
    opacity: 0.8;
    transform: translate(3px, -2px);
    animation: glitchR 0.15s step-start;
}

.glitch-title.glitching::after {
    opacity: 0.8;
    transform: translate(-3px, 2px);
    animation: glitchG 0.15s step-start;
}

.glitch-title.glitching {
    color: var(--glitch-blue);
}

@keyframes glitchR {
    0% { transform: translate(3px, -2px); }
    25% { transform: translate(-4px, 1px); }
    50% { transform: translate(5px, -3px); }
    75% { transform: translate(-2px, 3px); }
    100% { transform: translate(3px, -2px); }
}

@keyframes glitchG {
    0% { transform: translate(-3px, 2px); }
    25% { transform: translate(4px, -1px); }
    50% { transform: translate(-5px, 3px); }
    75% { transform: translate(2px, -3px); }
    100% { transform: translate(-3px, 2px); }
}

.hero-sub {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: clamp(0.9rem, 1.2vw, 1.1rem);
    color: var(--muted);
    margin-top: 16px;
    text-align: center;
}

/* Scan Tear */
.scan-tear {
    position: absolute;
    left: 0;
    width: 100%;
    height: 4px;
    background-color: var(--sys-light);
    transform: translateX(12px);
    opacity: 0;
    z-index: 10;
    pointer-events: none;
}

.scan-tear.active {
    opacity: 0.15;
}

/* Process data behind title */
.glitch-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    z-index: 0;
    pointer-events: none;
    transition: opacity 0.05s;
}

.glitch-bg.active {
    opacity: 0.2;
}

.process-data {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: var(--glitch-green);
    white-space: nowrap;
    letter-spacing: 0.05em;
}

/* ============================
   FEATURE SECTIONS (CLEAN)
   ============================ */

.feature-section {
    background-color: var(--clean-white);
    padding: 100px 20px;
}

.feature-content {
    max-width: 65ch;
    margin: 0 auto;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.feature-content.visible {
    opacity: 1;
    transform: translateY(0);
}

.feature-heading {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    color: var(--body-dark);
    margin-bottom: 16px;
}

.feature-section p {
    color: var(--body-dark);
    line-height: 1.75;
}

/* ============================
   PROCESS VISUALIZER
   ============================ */

#process-viz {
    padding: 80px 20px;
    background-color: var(--sys-dark);
    max-width: 900px;
    margin: 0 auto;
}

.viz-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    color: var(--sys-light);
    text-align: center;
    margin-bottom: 48px;
}

.process-bars {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.process-bar-row {
    display: flex;
    align-items: center;
    gap: 16px;
}

.process-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--muted);
    min-width: 100px;
    text-align: right;
}

.bar-track {
    flex: 1;
    height: 8px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    width: 0%;
    border-radius: 4px;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

.bar-fill.running {
    animation-name: barAdvance;
}

.bar-1 { background-color: var(--process-cyan); animation-duration: 3s; }
.bar-2 { background-color: var(--process-amber); animation-duration: 4.5s; }
.bar-3 { background-color: var(--glitch-red); animation-duration: 2.8s; }
.bar-4 { background-color: var(--glitch-green); animation-duration: 5.2s; }
.bar-5 { background-color: var(--glitch-blue); animation-duration: 3.7s; }

@keyframes barAdvance {
    0% { width: 0%; }
    100% { width: 100%; }
}

.bar-fill:hover {
    animation-play-state: paused;
}

/* Collision flash */
.collision-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 2px;
    height: 100vh;
    z-index: 100;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.08s;
}

.collision-flash.active {
    opacity: 1;
}

/* ============================
   CODE SECTION
   ============================ */

#code-section {
    padding: 80px 20px;
    background-color: var(--sys-dark);
    display: flex;
    justify-content: center;
}

.code-panel {
    background-color: #18181B;
    border: 1px solid var(--muted);
    border-radius: 8px;
    max-width: 600px;
    width: 100%;
    overflow: hidden;
    position: relative;
}

.code-header {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: var(--muted);
    padding: 8px 16px;
    background-color: #1E1E22;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.code-content {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    line-height: 1.7;
    padding: 20px;
    color: var(--sys-light);
    overflow-x: auto;
}

.kw { color: var(--process-cyan); }
.fn { color: var(--process-amber); }
.str { color: var(--glitch-green); }
.num { color: var(--glitch-red); }
.cm { color: var(--muted); }
.op { color: var(--sys-light); }

/* Code glitch tear */
.code-panel.torn {
    clip-path: polygon(0 0, 100% 0, 100% 45%, calc(100% + 12px) 45%, calc(100% + 12px) 48%, 100% 48%, 100% 100%, 0 100%);
}

/* ============================
   FRAGMENTED FOOTER
   ============================ */

#fragmented-footer {
    padding: 48px 20px;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    align-items: baseline;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.frag-word {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: clamp(0.85rem, 1vw, 0.95rem);
    color: var(--muted);
    display: inline-block;
}

/* ============================
   RESPONSIVE
   ============================ */

@media (max-width: 768px) {
    .process-label {
        min-width: 70px;
        font-size: 0.65rem;
    }

    #fragmented-footer {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }

    .frag-word {
        margin-right: 0 !important;
    }
}
