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

:root {
    --blue-primary: #4a6cf7;
    --blue-deep: #3a5ce7;
    --blue-light: #7b8cde;
    --blue-bright: #5a7cff;
    --gold: #c4a35a;
    --gray-text: #8a8fb0;
    --gray-light: #d4d7e8;
    --dark-bg: #0d0d24;
    --dark-lattice: #1a1a3e;
    --font-headline: 'Zilla Slab', serif;
    --font-body: 'Source Sans 3', sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--dark-bg);
    color: var(--gray-light);
    font-family: var(--font-body);
    font-weight: 300;
    line-height: 1.7;
    overflow-x: hidden;
}

#lattice-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* Left Rail Navigation */
#left-rail {
    position: fixed;
    left: 0;
    top: 0;
    width: 38%;
    max-width: 280px;
    height: 100vh;
    z-index: 100;
    display: flex;
    align-items: center;
    padding: 2rem;
    transition: opacity 0.6s ease, transform 0.6s ease;
}

#left-rail.hidden {
    opacity: 0;
    transform: translateX(-20px);
    pointer-events: none;
}

.rail-inner {
    width: 100%;
}

.rail-title {
    font-family: var(--font-headline);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--gold);
    letter-spacing: 0.1em;
    margin-bottom: 2rem;
}

#left-rail ul {
    list-style: none;
}

#left-rail li {
    margin-bottom: 1rem;
}

#left-rail a {
    color: var(--gray-text);
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    letter-spacing: 0.03em;
    transition: color 0.3s ease;
    position: relative;
    padding-left: 1rem;
}

#left-rail a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--gray-text);
    transform: translateY(-50%);
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

#left-rail a.active {
    color: var(--gold);
}

#left-rail a.active::before {
    background: var(--gold);
    box-shadow: 0 0 8px var(--gold);
}

.depth-indicator {
    margin-top: 2rem;
    width: 2px;
    height: 120px;
    background: var(--dark-lattice);
    margin-left: 0.5rem;
    border-radius: 1px;
}

.depth-bar {
    width: 100%;
    height: 20%;
    background: var(--gold);
    border-radius: 1px;
    transition: height 0.4s ease;
}

/* Main Content */
main {
    position: relative;
    z-index: 1;
}

.stratum {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    padding-left: 20%;
}

.stratum-content {
    max-width: 700px;
    width: 100%;
    padding: 3rem;
    background: rgba(13, 13, 36, 0.85);
    border: 1px solid var(--dark-lattice);
    border-radius: 2px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.1s ease-out;
}

.stratum-label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--gold);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    display: block;
    margin-bottom: 1.5rem;
}

h1, h2 {
    font-family: var(--font-headline);
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.15;
    color: var(--gray-light);
    margin-bottom: 1.5rem;
}

h1 {
    font-size: clamp(1.6rem, 3.5vw, 3rem);
}

h2 {
    font-size: clamp(1.1rem, 2vw, 1.6rem);
}

p {
    margin-bottom: 1.5rem;
    color: var(--gray-text);
}

.lead {
    font-size: 1.15rem;
    line-height: 1.8;
    color: var(--gray-light);
}

.gold-accent {
    width: 60px;
    height: 2px;
    background: var(--gold);
    margin-top: 2rem;
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-top: 2rem;
}

.info-cell {
    text-align: center;
    padding: 1.2rem 0.5rem;
    border: 1px solid var(--dark-lattice);
}

.cell-value {
    display: block;
    font-family: var(--font-headline);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--blue-primary);
    margin-bottom: 0.4rem;
}

.cell-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--gray-text);
    letter-spacing: 0.05em;
}

/* Code Block */
.code-block {
    background: rgba(26, 26, 62, 0.8);
    border: 1px solid var(--dark-lattice);
    padding: 1.5rem;
    border-radius: 2px;
    overflow-x: auto;
}

.code-block code {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.8;
    color: var(--gray-light);
    white-space: pre;
}

.code-keyword { color: var(--blue-primary); }
.code-type { color: var(--gold); }

/* Channel Diagram */
.channel-diagram {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
    padding: 2rem 0;
}

.channel-node {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--blue-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-weight: 500;
    color: var(--blue-light);
}

.channel-line {
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, var(--blue-primary), var(--blue-bright));
    position: relative;
}

.channel-line::after {
    content: '';
    position: absolute;
    top: -3px;
    left: 0;
    width: 100%;
    height: 8px;
    background: linear-gradient(90deg, transparent, var(--blue-bright), transparent);
    opacity: 0.4;
    animation: pulse-line 2s infinite;
}

@keyframes pulse-line {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 0.6; }
}

.channel-state {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--gold);
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--gold);
    border-radius: 2px;
}

/* Future Nodes */
.future-nodes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-top: 2rem;
}

.f-node {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--blue-light);
    padding: 0.6rem 1rem;
    border: 1px solid var(--dark-lattice);
    border-radius: 2px;
    opacity: 0;
    animation: fade-in 0.6s ease forwards;
    animation-delay: var(--delay);
}

@keyframes fade-in {
    to { opacity: 1; }
}

/* Responsive */
@media (max-width: 768px) {
    .stratum {
        padding-left: 2rem;
    }

    #left-rail {
        display: none;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .channel-diagram {
        flex-wrap: wrap;
    }
}
