/* layer2.quest — Skeuomorphic Arcade Timeline */

:root {
    --plasma-cyan: #00F5FF;
    --reactor-magenta: #FF00E5;
    --rollup-amber: #FFB800;
    --proof-violet: #9D4EDD;
    --cabinet-black: #0A0A14;
    --panel-gunmetal: #1A1A2E;
    --bezel-chrome: #2A2A3E;
    --display-white: #E8E8F0;
    --dim-phosphor: #6B6B80;
}

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

body {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 300;
    color: var(--display-white);
    background: var(--cabinet-black);
    line-height: 1.7;
    letter-spacing: 0.01em;
    overflow-x: hidden;
}

/* ---- Circuit trace background ---- */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.06;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 128h64l16-16h32l16 16h128M128 0v64l-16 16v32l16 16v128M64 64h32l16 16M192 192h-32l-16-16M32 192h48l8-8h16M224 64h-48l-8 8h-16' fill='none' stroke='%2300F5FF' stroke-width='1'/%3E%3C/svg%3E");
    background-size: 256px 256px;
}

/* ---- Depth gauge ---- */
.depth-gauge {
    position: fixed;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.gauge-track {
    width: 4px;
    height: 120px;
    background: var(--panel-gunmetal);
    border: 1px solid var(--bezel-chrome);
    border-radius: 2px;
    position: relative;
    box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.6);
}

.gauge-needle {
    position: absolute;
    top: 0;
    left: -3px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--plasma-cyan);
    box-shadow: 0 0 6px var(--plasma-cyan), 0 0 12px rgba(0, 245, 255, 0.3);
    transition: top 0.15s linear;
}

.gauge-label {
    font-family: 'Jost', sans-serif;
    font-size: 0.6rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    color: var(--dim-phosphor);
    text-transform: uppercase;
}

/* ---- Zones ---- */
.zone {
    position: relative;
    z-index: 1;
}

/* ============ ZONE 1: THE CABINET ============ */
.zone-cabinet {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4vh 4vw;
}

.cabinet-frame {
    width: 100%;
    max-width: 700px;
    background: var(--panel-gunmetal);
    border: 3px solid var(--bezel-chrome);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.cabinet-header {
    text-align: center;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--bezel-chrome);
    margin-bottom: 1.5rem;
}

.cabinet-title {
    font-family: 'Jost', sans-serif;
    font-weight: 700;
    font-size: clamp(3rem, 10vw, 8rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--display-white);
    text-shadow: 0 0 4px var(--plasma-cyan), 0 0 12px rgba(0, 245, 255, 0.4), 0 0 24px rgba(0, 245, 255, 0.15);
}

.crt-viewport {
    position: relative;
    background: var(--cabinet-black);
    border-radius: 8%;
    padding: 4rem 2rem;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.8), 0 0 15px rgba(0, 245, 255, 0.1);
}

.scanlines {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.15) 2px,
        rgba(0, 0, 0, 0.15) 3px
    );
    pointer-events: none;
    z-index: 2;
}

.crt-vignette {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 50%, rgba(0, 0, 0, 0.6) 100%);
    pointer-events: none;
    z-index: 3;
}

.crt-content {
    position: relative;
    z-index: 4;
    text-align: center;
}

.crt-prompt {
    font-family: 'Jost', sans-serif;
    font-weight: 700;
    font-size: clamp(1.2rem, 3vw, 2rem);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--reactor-magenta);
    text-shadow: 0 0 4px var(--reactor-magenta), 0 0 12px rgba(255, 0, 229, 0.4);
    min-height: 2em;
}

.crt-sub {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.85rem;
    color: var(--dim-phosphor);
    margin-top: 1rem;
    letter-spacing: 0.04em;
}

/* ============ CONDUIT ============ */
.conduit {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    transform: translateX(-50%);
    width: 24px;
    z-index: 0;
}

.conduit-pipe {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, var(--panel-gunmetal), var(--bezel-chrome), var(--panel-gunmetal));
    border-left: 1px solid rgba(0, 245, 255, 0.2);
    border-right: 1px solid rgba(0, 245, 255, 0.2);
}

.conduit-glow {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 245, 255, 0.05), rgba(157, 78, 221, 0.05));
    filter: blur(8px);
}

/* ============ TIMELINE NODES ============ */
.timeline-node {
    position: relative;
    padding: 8vh 4vw;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1rem;
    align-items: center;
}

.node-left .panel { grid-column: 1 / 6; }
.node-left .junction-box { grid-column: 6 / 8; justify-self: center; }
.node-right .panel { grid-column: 8 / 13; }
.node-right .junction-box { grid-column: 6 / 8; justify-self: center; }

/* ---- Junction boxes ---- */
.junction-box {
    width: 64px;
    height: 64px;
    background: var(--panel-gunmetal);
    border: 1px solid var(--bezel-chrome);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
}

.junction-large {
    width: 80px;
    height: 80px;
}

.junction-terminal {
    width: 96px;
    height: 96px;
}

.junction-indicator {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--plasma-cyan);
    box-shadow: 0 0 6px var(--plasma-cyan), 0 0 16px rgba(0, 245, 255, 0.4);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.junction-box.active .junction-indicator {
    opacity: 1;
    animation: junctionPulse 2s ease-in-out infinite;
}

.indicator-amber {
    background: var(--rollup-amber);
    box-shadow: 0 0 6px var(--rollup-amber), 0 0 16px rgba(255, 184, 0, 0.4);
}

.indicator-violet {
    background: var(--proof-violet);
    box-shadow: 0 0 6px var(--proof-violet), 0 0 16px rgba(157, 78, 221, 0.4);
}

@keyframes junctionPulse {
    0%, 100% { box-shadow: 0 0 4px currentColor, 0 0 8px currentColor; }
    50% { box-shadow: 0 0 8px currentColor, 0 0 20px currentColor; }
}

/* ---- Connectors ---- */
.connector {
    display: none;
}

/* ---- Panels ---- */
.panel {
    background: var(--panel-gunmetal);
    border: 3px solid var(--cabinet-black);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.6), 0 0 1px var(--bezel-chrome);
    padding: 2rem;
    position: relative;
    z-index: 2;
    border-top: 2px solid rgba(0, 245, 255, 0.3);
}

.panel-amber {
    border-top-color: rgba(255, 184, 0, 0.4);
}

.panel-violet {
    border-top-color: rgba(157, 78, 221, 0.4);
}

.panel-holographic {
    border-top-color: rgba(255, 0, 229, 0.3);
    border-image: linear-gradient(90deg, var(--plasma-cyan), var(--reactor-magenta), var(--proof-violet)) 1;
    border-image-slice: 1;
    border-top: 2px solid;
    max-width: 600px;
    margin: 0 auto;
}

/* ---- Zoom-focus reveal ---- */
[data-zoom] {
    opacity: 0;
    transform: scale(0.85);
    filter: blur(3px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out, filter 0.6s ease-out;
}

[data-zoom].focused {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
}

/* ---- Panel content ---- */
.panel-header {
    margin-bottom: 1rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--bezel-chrome);
}

.panel-era {
    font-family: 'Jost', sans-serif;
    font-size: clamp(0.9rem, 2vw, 1.2rem);
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--plasma-cyan);
    text-shadow: 0 0 4px rgba(0, 245, 255, 0.3);
}

.panel-title {
    font-family: 'Jost', sans-serif;
    font-weight: 700;
    font-size: clamp(1.8rem, 4vw, 3rem);
    letter-spacing: 0.06em;
    color: var(--display-white);
    margin-top: 0.3rem;
}

.panel-body {
    font-size: clamp(1rem, 1.5vw, 1.15rem);
    line-height: 1.7;
    color: var(--display-white);
    margin-bottom: 1.5rem;
}

.led-readout {
    background: var(--cabinet-black);
    border: 1px solid var(--bezel-chrome);
    padding: 0.8rem 1rem;
    box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.6);
    position: relative;
    overflow: hidden;
}

.led-readout::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent 1px,
        rgba(0, 0, 0, 0.12) 1px,
        rgba(0, 0, 0, 0.12) 2px
    );
    pointer-events: none;
}

.led-readout code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    line-height: 1.5;
    color: var(--plasma-cyan);
    text-shadow: 0 0 4px var(--plasma-cyan), 0 0 8px rgba(0, 245, 255, 0.3);
}

.led-amber code {
    color: var(--rollup-amber);
    text-shadow: 0 0 4px var(--rollup-amber), 0 0 8px rgba(255, 184, 0, 0.3);
}

.led-violet code {
    color: var(--proof-violet);
    text-shadow: 0 0 4px var(--proof-violet), 0 0 8px rgba(157, 78, 221, 0.3);
}

/* ---- Convergence ---- */
.convergence-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10vh 4vw;
    gap: 3rem;
    position: relative;
    z-index: 2;
}

.pulse-ring {
    position: absolute;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 1px solid rgba(0, 245, 255, 0.3);
    animation: pulseExpand 3s ease-out infinite;
}

.pulse-ring-2 {
    animation-delay: 1.5s;
}

@keyframes pulseExpand {
    0% {
        transform: scale(0.5);
        opacity: 0.6;
    }
    100% {
        transform: scale(3);
        opacity: 0;
    }
}

/* ---- Mobile ---- */
@media (max-width: 767px) {
    .timeline-node {
        display: flex;
        flex-direction: column;
        padding: 4vh 5%;
    }

    .junction-box {
        width: 48px;
        height: 48px;
        margin-bottom: 1rem;
    }

    .junction-large {
        width: 56px;
        height: 56px;
    }

    .conduit {
        left: 16px;
        transform: none;
        width: 4px;
    }

    .conduit-pipe {
        background: linear-gradient(180deg, var(--panel-gunmetal), var(--bezel-chrome));
    }

    .node-left .panel,
    .node-right .panel {
        grid-column: auto;
    }

    .depth-gauge {
        display: none;
    }

    .cabinet-title {
        font-size: clamp(2rem, 8vw, 4rem);
    }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    [data-zoom] {
        opacity: 1;
        transform: scale(1);
        filter: blur(0);
    }

    .junction-indicator {
        opacity: 1;
    }
}
