/* ConcEngine — Design System */
/* Colors as CSS Custom Properties */
:root {
    --engine-orange: #bf5700;
    --magma-amber: #8a3a00;
    --copper-glow: #e88a3c;
    --obsidian: #0f0e0d;
    --volcanic-ash: #1c1a18;
    --calcium-white: #f5e6d3;
    --sandstone: #c4a882;
    --phosphor-cyan: #4ecdc4;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--obsidian);
    color: var(--calcium-white);
    font-family: 'Varela Round', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    line-height: 1.72;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Scan-line overlay */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(
        transparent,
        transparent 2px,
        rgba(15, 14, 13, 0.03) 2px,
        rgba(15, 14, 13, 0.03) 4px
    );
}

/* Stratum Sections */
.stratum {
    position: relative;
    width: 100%;
    min-height: 100vh;
    overflow: hidden;
}

/* Gradient Mesh Layers */
.gradient-mesh {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    will-change: background-position;
}

.mesh-0 {
    background:
        radial-gradient(ellipse at 30% 40%, rgba(191, 87, 0, 0.15) 0%, transparent 70%),
        radial-gradient(ellipse at 70% 60%, rgba(138, 58, 0, 0.12) 0%, transparent 60%),
        radial-gradient(ellipse at 50% 80%, rgba(78, 205, 196, 0.05) 0%, transparent 50%);
    animation: meshShift0 15s ease-in-out infinite;
}

.mesh-1 {
    background:
        radial-gradient(ellipse at 25% 30%, rgba(191, 87, 0, 0.2) 0%, transparent 50%),
        radial-gradient(ellipse at 65% 50%, rgba(232, 138, 60, 0.18) 0%, transparent 45%),
        radial-gradient(ellipse at 80% 75%, rgba(138, 58, 0, 0.15) 0%, transparent 40%);
    animation: meshShift1 12s ease-in-out infinite;
}

.mesh-2 {
    background:
        radial-gradient(ellipse at 20% 35%, rgba(191, 87, 0, 0.25) 0%, transparent 45%),
        radial-gradient(ellipse at 60% 45%, rgba(78, 205, 196, 0.15) 0%, transparent 40%),
        radial-gradient(ellipse at 75% 70%, rgba(232, 138, 60, 0.2) 0%, transparent 35%),
        radial-gradient(ellipse at 40% 80%, rgba(138, 58, 0, 0.18) 0%, transparent 50%);
    animation: meshShift2 12s ease-in-out infinite;
}

.mesh-3 {
    background:
        radial-gradient(ellipse at 35% 30%, rgba(191, 87, 0, 0.35) 0%, transparent 25%),
        radial-gradient(ellipse at 50% 50%, rgba(78, 205, 196, 0.2) 0%, transparent 30%),
        radial-gradient(ellipse at 65% 40%, rgba(232, 138, 60, 0.3) 0%, transparent 25%),
        radial-gradient(ellipse at 30% 70%, rgba(138, 58, 0, 0.25) 0%, transparent 30%),
        conic-gradient(from 0deg at 50% 50%, rgba(191, 87, 0, 0.1), rgba(232, 138, 60, 0.08), rgba(78, 205, 196, 0.06), rgba(191, 87, 0, 0.1));
    animation: meshShift3 12s ease-in-out infinite, meshRotate 720s linear infinite;
}

/* Mesh Shift Keyframes */
@keyframes meshShift0 {
    0%, 100% { background-position: 30% 40%, 70% 60%, 50% 80%; }
    50% { background-position: 40% 30%, 60% 70%, 45% 75%; }
}

@keyframes meshShift1 {
    0%, 100% { background-position: 25% 30%, 65% 50%, 80% 75%; }
    50% { background-position: 35% 25%, 55% 55%, 70% 70%; }
}

@keyframes meshShift2 {
    0%, 100% { background-position: 20% 35%, 60% 45%, 75% 70%, 40% 80%; }
    50% { background-position: 30% 25%, 50% 55%, 65% 65%, 35% 75%; }
}

@keyframes meshShift3 {
    0%, 100% { background-position: 35% 30%, 50% 50%, 65% 40%, 30% 70%, 50% 50%; }
    50% { background-position: 45% 25%, 40% 55%, 55% 35%, 25% 65%, 50% 50%; }
}

@keyframes meshRotate {
    to { filter: hue-rotate(5deg); }
}

/* ==================== STRATUM 0 ==================== */
.stratum-0 {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--obsidian);
}

.stratum-0-content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 2rem;
}

.title-main {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: clamp(3.5rem, 8vw, 7rem);
    color: var(--calcium-white);
    letter-spacing: 0.02em;
    opacity: 0;
    animation: fadeInTitle 800ms ease-out 1.5s forwards;
}

.subtitle-main {
    font-family: 'Varela Round', sans-serif;
    font-size: clamp(1rem, 2vw, 1.3rem);
    color: var(--sandstone);
    opacity: 0;
    margin-top: 1.5rem;
    animation: fadeInTitle 800ms ease-out 2.1s forwards;
}

@keyframes fadeInTitle {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==================== STRATUM 1 ==================== */
.stratum-1 {
    background-color: var(--obsidian);
}

.stratum-1-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 28% 44% 28%;
    min-height: 100vh;
    align-items: start;
}

.column-left {
    padding: 15vh 2rem 4rem 4rem;
    display: flex;
    flex-direction: column;
    gap: 4rem;
}

.text-block p {
    color: rgba(196, 168, 130, 0.9);
    font-size: clamp(0.95rem, 1.6vw, 1.15rem);
    line-height: 1.72;
}

.code-accent {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.9em;
    color: var(--engine-orange);
}

.cyan-accent {
    color: var(--phosphor-cyan);
}

.column-spine {
    display: flex;
    align-items: stretch;
    justify-content: center;
    position: relative;
}

.spine-svg {
    width: 4px;
    height: 100%;
    position: absolute;
    top: 0;
}

.spine-line {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 0.1s linear;
}

.column-right {
    position: relative;
    height: 100vh;
}

.mesh-panel {
    position: sticky;
    top: 0;
    width: 100%;
    height: 100vh;
}

.mesh-1-panel {
    background:
        radial-gradient(ellipse at 40% 35%, rgba(232, 138, 60, 0.25) 0%, transparent 45%),
        radial-gradient(ellipse at 60% 65%, rgba(191, 87, 0, 0.2) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(138, 58, 0, 0.15) 0%, transparent 60%);
    animation: meshPanelShift 10s ease-in-out infinite;
}

@keyframes meshPanelShift {
    0%, 100% { background-position: 40% 35%, 60% 65%, 50% 50%; }
    50% { background-position: 50% 40%, 50% 60%, 45% 55%; }
}

/* ==================== STRATUM 2 ==================== */
.stratum-2 {
    background-color: var(--obsidian);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stratum-2-content {
    position: relative;
    z-index: 1;
    max-width: 720px;
    margin: 0 auto;
    padding: 10vh 2rem;
}

.monologue p {
    font-family: 'Varela Round', sans-serif;
    font-size: 1.15rem;
    line-height: 1.85;
    color: var(--sandstone);
    background: linear-gradient(
        to right,
        rgba(191, 87, 0, 0.12) 0%,
        rgba(191, 87, 0, 0.06) 100%
    );
    padding: 3rem 2.5rem;
    border-left: 2px solid rgba(191, 87, 0, 0.2);
}

/* Increase scan-line intensity in stratum 2 via a local overlay */
.stratum-2::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    background: repeating-linear-gradient(
        transparent,
        transparent 2px,
        rgba(15, 14, 13, 0.06) 2px,
        rgba(15, 14, 13, 0.06) 4px
    );
}

/* ==================== STRATUM 3 ==================== */
.stratum-3 {
    background-color: var(--obsidian);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stratum-3-content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 2rem;
}

.resolution-text {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: clamp(2rem, 4vw, 3.5rem);
    color: var(--calcium-white);
    letter-spacing: 0.02em;
}

.domain-text {
    color: rgba(196, 168, 130, 0.3);
    font-family: 'Varela Round', sans-serif;
    font-size: 0.9rem;
    margin-top: 3rem;
    letter-spacing: 0.05em;
}

/* ==================== Circuit Lines ==================== */
.circuit-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.circuit-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 0.1s linear;
}

/* ==================== Fade-in Animation ==================== */
.fade-in {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 600ms ease-out, transform 600ms ease-out;
}

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

/* ==================== Engine Core ==================== */
.engine-core {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    width: 64px;
    height: 64px;
    border-radius: 50%;
    z-index: 10000;
    cursor: pointer;
    animation: pulseAttention 4s ease-in-out infinite;
}

.core-inner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(from 0deg, #bf5700, #e88a3c, #4ecdc4, #bf5700);
    animation: coreRotate 45s linear infinite;
}

.core-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: 50%;
    box-shadow:
        0 0 20px #bf5700,
        0 0 60px rgba(191, 87, 0, 0.3),
        0 0 120px rgba(191, 87, 0, 0.1);
    pointer-events: none;
}

@keyframes pulseAttention {
    0%, 100% { transform: translateX(-50%) scale(0.95); opacity: 0.7; }
    50% { transform: translateX(-50%) scale(1.05); opacity: 1; }
}

@keyframes coreRotate {
    to { transform: rotate(360deg); }
}

/* Core Navigation */
.core-nav {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 300ms ease;
}

.engine-core.expanded .core-nav {
    pointer-events: auto;
    opacity: 1;
}

.nav-node {
    position: absolute;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--volcanic-ash);
    border: 1px solid var(--engine-orange);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transform: translate(-50%, -50%) translate(0, 0);
    transition: transform 500ms cubic-bezier(0.34, 1.56, 0.64, 1), background 200ms ease;
    cursor: pointer;
}

.engine-core.expanded .nav-node {
    transform: translate(-50%, -50%)
        translate(
            calc(cos(var(--angle)) * 80px),
            calc(sin(var(--angle)) * -80px)
        );
}

.nav-node:hover {
    background: var(--engine-orange);
}

.nav-label {
    position: absolute;
    bottom: -20px;
    font-size: 0.6rem;
    color: var(--sandstone);
    white-space: nowrap;
    font-family: 'IBM Plex Mono', monospace;
    letter-spacing: 0.05em;
    opacity: 0;
    transition: opacity 200ms ease;
}

.engine-core.expanded .nav-label {
    opacity: 1;
}

/* ==================== Stratum 3 Core Scale (scroll-driven) ==================== */
.engine-core.at-core {
    animation: none;
    opacity: 1;
}

/* ==================== Responsive ==================== */
@media (max-width: 768px) {
    .stratum-1-grid {
        grid-template-columns: 1fr;
    }

    .column-left {
        padding: 8vh 1.5rem 4rem 1.5rem;
    }

    .column-spine {
        display: none;
    }

    .column-right {
        height: 50vh;
    }

    .mesh-panel {
        position: relative;
        height: 50vh;
    }

    .stratum-2-content {
        padding: 8vh 1.5rem;
    }

    .monologue p {
        padding: 2rem 1.5rem;
        font-size: 1rem;
    }

    .engine-core.expanded .nav-node {
        transform: translate(-50%, -50%)
            translate(
                calc(cos(var(--angle)) * 60px),
                calc(sin(var(--angle)) * -60px)
            );
    }
}
