:root {
    --charcoal-slate: #2B2D33;
    --obsidian-void: #16171B;
    --ash-fog: #3D3F47;
    --bone-white: #E8E6E1;
    --dust-gray: #9B9A97;
    --glitch-cyan: #5EEAD4;
    --signal-magenta: #D4607A;
    --warm-noise: #C8C3B8;
    --aberration-intensity: 0px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    background: var(--charcoal-slate);
    color: var(--bone-white);
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: 1.125rem;
    line-height: 1.75;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Progress Line */
.progress-line {
    position: fixed;
    left: 0;
    top: 0;
    width: 1px;
    height: 100vh;
    z-index: 100;
    background: rgba(94, 234, 212, 0.1);
}

.progress-fill {
    width: 100%;
    height: 0%;
    background: var(--glitch-cyan);
    opacity: 0.4;
    transition: height 0.1s linear;
}

/* Gate Label */
.gate-label {
    position: absolute;
    top: 2rem;
    left: 2rem;
    z-index: 10;
}

.mono-accent {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.8125rem;
    line-height: 1.6;
    letter-spacing: 0.04em;
    color: var(--glitch-cyan);
}

/* Typography */
.display-text {
    font-family: 'Familjen Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(3rem, 10vw, 9rem);
    letter-spacing: 0.08em;
    line-height: 1;
    color: var(--bone-white);
    text-shadow:
        calc(var(--aberration-intensity) * -1) 0 0 rgba(94, 234, 212, 0.6),
        var(--aberration-intensity) 0 0 rgba(212, 96, 122, 0.5);
}

.hero-sub {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 2vw, 1.4rem);
    color: var(--dust-gray);
    margin-top: 1rem;
    letter-spacing: 0.02em;
}

.body-text {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    color: var(--bone-white);
    margin-bottom: 1.5rem;
    max-width: 55ch;
}

.body-text strong {
    font-weight: 500;
}

/* Gates */
.gate {
    min-height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(3rem, 6vw, 6rem);
    contain: layout style;
}

.gate-content {
    position: relative;
    z-index: 5;
    max-width: 800px;
    width: 100%;
}

/* Gate 0: AXIOM */
.gate-0 {
    background: var(--charcoal-slate);
}

.gate-0::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-conic-gradient(var(--warm-noise) 0% 25%, transparent 0% 50%) 50% / 3px 3px;
    opacity: 0.03;
    pointer-events: none;
}

.axiom-content {
    text-align: center;
}

.scanline {
    position: absolute;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--glitch-cyan), var(--signal-magenta), transparent);
    opacity: 0;
    pointer-events: none;
    z-index: 20;
    top: 50%;
}

.scanline.active {
    animation: scanline-sweep 0.3s ease-out forwards;
}

@keyframes scanline-sweep {
    0% { opacity: 0.8; transform: translateX(-100%); }
    100% { opacity: 0; transform: translateX(100%); }
}

/* Gate 1: PREMISE */
.gate-1 {
    min-height: 120vh;
    background: var(--obsidian-void);
}

.gate-1::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-conic-gradient(var(--warm-noise) 0% 25%, transparent 0% 50%) 50% / 3px 3px;
    opacity: 0.04;
    pointer-events: none;
}

.premise-content {
    display: flex;
    gap: 8px;
    max-width: 900px;
}

.premise-col {
    flex: 1;
}

.premise-gutter {
    width: 1px;
    background: var(--dust-gray);
    opacity: 0.3;
    flex-shrink: 0;
}

/* Gate 2: INFERENCE */
.gate-2 {
    min-height: 150vh;
    background: var(--obsidian-void);
}

.gate-2::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-conic-gradient(var(--warm-noise) 0% 25%, transparent 0% 50%) 50% / 3px 3px;
    opacity: 0.05;
    pointer-events: none;
}

.inference-content {
    max-width: 600px;
    margin: 0 auto;
}

.jitter-text {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
    text-shadow:
        calc(var(--aberration-intensity) * -1) 0 0 rgba(94, 234, 212, 0.6),
        var(--aberration-intensity) 0 0 rgba(212, 96, 122, 0.5);
}

.hoverable:hover {
    transform: scale(1.08);
    cursor: default;
}

/* Gate 3: PARADOX */
.gate-3 {
    min-height: 200vh;
    background: var(--charcoal-slate);
}

.gate-3::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-conic-gradient(var(--warm-noise) 0% 25%, transparent 0% 50%) 50% / 3px 3px;
    opacity: 0.07;
    pointer-events: none;
}

.paradox-content {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(8, auto);
    gap: 2rem;
    max-width: 1000px;
}

.paradox-block {
    grid-column-start: calc(var(--block-x) + 1);
    grid-row-start: calc(var(--block-y) + 1);
    grid-column-end: span 2;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: 1rem;
    padding: 1.5rem;
    opacity: var(--block-opacity);
    color: var(--bone-white);
    text-shadow:
        calc(var(--aberration-intensity) * -1.5) 0 0 rgba(94, 234, 212, 0.6),
        calc(var(--aberration-intensity) * 1.5) 0 0 rgba(212, 96, 122, 0.5);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: default;
}

.paradox-block:hover {
    transform: scale(1.12);
}

/* Gate 4: SYNTHESIS */
.gate-4 {
    background: var(--ash-fog);
}

.gate-4::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-conic-gradient(var(--warm-noise) 0% 25%, transparent 0% 50%) 50% / 3px 3px;
    opacity: 0.05;
    pointer-events: none;
}

.synthesis-content {
    text-align: center;
    max-width: 650px;
    margin: 0 auto;
}

.synthesis-text {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 2vw, 1.2rem);
    line-height: 1.8;
    color: var(--bone-white);
    opacity: 0.8;
    text-shadow:
        calc(var(--aberration-intensity) * -1) 0 0 rgba(94, 234, 212, 0.4),
        var(--aberration-intensity) 0 0 rgba(212, 96, 122, 0.3);
    margin-bottom: 3rem;
}

.domain-end {
    font-size: 0.9rem;
    letter-spacing: 0.1em;
    opacity: 0.6;
}

/* Particle Field */
.particle-field {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 3;
}

.particle {
    position: absolute;
    opacity: 0;
    animation: particle-drift linear infinite;
}

@keyframes particle-drift {
    0% {
        transform: translateY(0);
        opacity: 0;
    }
    10% {
        opacity: var(--particle-opacity, 0.3);
    }
    90% {
        opacity: var(--particle-opacity, 0.3);
    }
    100% {
        transform: translateY(-100vh);
        opacity: 0;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .premise-content {
        flex-direction: column;
    }
    .premise-gutter {
        width: 100%;
        height: 1px;
    }
    .paradox-content {
        grid-template-columns: 1fr;
    }
    .paradox-block {
        grid-column-start: auto;
        grid-row-start: auto;
        grid-column-end: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .scanline { animation: none; }
    .particle { animation: none; }
    .jitter-text { text-shadow: none; }
    .display-text { text-shadow: none; }
    .paradox-block { text-shadow: none; transition: none; }
    .hoverable:hover { transform: none; }
    .synthesis-text { text-shadow: none; }
}
