/* === RESET & BASE === */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg-primary: #0e0e12;
    --bg-secondary: #1b1b1f;
    --accent-a: #ff5c39;
    --accent-b: #3d5afe;
    --accent-c: #00e676;
    --text-primary: #e8e5df;
    --text-secondary: #6b6b76;
    --gradient: linear-gradient(135deg, #ff5c39 0%, #3d5afe 50%, #00e676 100%);
}

html { scroll-behavior: smooth; }

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Source Sans 3', sans-serif;
    font-size: clamp(0.95rem, 1.2vw, 1.15rem);
    font-weight: 400;
    line-height: 1.65;
    letter-spacing: 0.01em;
    overflow-x: hidden;
}

/* === SIDE NAVIGATION === */
.side-nav {
    position: fixed;
    left: 0;
    top: 0;
    width: 48px;
    height: 100vh;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    background: var(--bg-secondary);
    border-right: 1px solid rgba(255,255,255,0.05);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.nav-label {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.6rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
    transition: color 0.3s;
}

.nav-item.active .nav-label { color: var(--text-primary); }

.nav-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-secondary);
    transition: background 0.3s, box-shadow 0.3s;
}

.nav-item.active .nav-dot {
    background: var(--gradient);
    box-shadow: 0 0 8px rgba(61,90,254,0.6);
    animation: pulse-dot 2s ease-in-out infinite;
}

.nav-progress {
    position: absolute;
    bottom: 20px;
    width: 3px;
    height: 60px;
    background: var(--bg-primary);
    border-radius: 2px;
}

.nav-progress-fill {
    width: 100%;
    height: 20%;
    background: var(--gradient);
    border-radius: 2px;
    transition: height 0.3s;
}

/* === PANELS === */
.panel {
    width: 100%;
    min-height: 100vh;
    position: relative;
    padding-left: 48px;
    overflow: hidden;
}

/* === BENTO GRID === */
.bento-grid {
    width: 100%;
    height: 100vh;
    display: grid;
    gap: 8px;
    padding: 8px;
    background-image: radial-gradient(circle, rgba(255,92,57,0.15) 1px, transparent 1px);
    background-size: 8px 8px;
}

.bento-cell {
    background: var(--bg-primary);
    border: 3px solid var(--bg-secondary);
    box-shadow: 4px 4px 0px var(--accent-a);
    padding: 20px;
    position: relative;
    transition: box-shadow 0.15s, transform 0.15s;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
}

.bento-cell.alt { background: var(--bg-secondary); }

.bento-cell:hover {
    box-shadow: 2px 2px 0px var(--accent-a);
    transform: translate(2px, 2px);
}

.cell-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.65rem;
    color: var(--text-secondary);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
}

.label-dot {
    width: 6px;
    height: 6px;
    display: inline-block;
}

/* === PANEL 1: IDENTIFY === */
.bento-identify {
    grid-template-columns: 4fr 1fr;
    grid-template-rows: 1fr auto auto auto;
    grid-template-areas:
        "main version"
        "main date"
        "main coord";
}

.cell-main { grid-area: main; justify-content: center; }
.cell-version { grid-area: version; }
.cell-date { grid-area: date; }
.cell-coord { grid-area: coord; }

.engine-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(2rem, 5vw, 4.5rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    text-transform: uppercase;
    text-shadow: 3px 3px 0px var(--accent-a);
    color: var(--text-primary);
    margin-bottom: 12px;
}

.engine-tagline {
    font-family: 'Source Sans 3', sans-serif;
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 20px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-c);
    animation: pulse-dot 2s ease-in-out infinite;
}

.cell-data {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-a);
    opacity: 0.7;
    animation: hud-pulse 2s ease-in-out infinite;
}

/* === PANEL 2: ENUMERATE === */
.bento-enumerate {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
}

.cell-word {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(1.2rem, 2.5vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    text-transform: uppercase;
    text-shadow: 3px 3px 0px var(--accent-a);
    margin-top: auto;
}

.data-bar {
    width: 100%;
    height: 4px;
    background: var(--bg-secondary);
    margin-top: 12px;
    overflow: hidden;
}

.data-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--accent-a);
    animation: bar-fill 3s ease-in-out infinite;
}

.bento-enumerate .bento-cell:nth-child(2) .data-bar-fill { animation-delay: 0.4s; }
.bento-enumerate .bento-cell:nth-child(3) .data-bar-fill { animation-delay: 0.8s; }
.bento-enumerate .bento-cell:nth-child(4) .data-bar-fill { animation-delay: 1.2s; }
.bento-enumerate .bento-cell:nth-child(5) .data-bar-fill { animation-delay: 1.6s; }
.bento-enumerate .bento-cell:nth-child(6) .data-bar-fill { animation-delay: 2.0s; }
.bento-enumerate .bento-cell:nth-child(7) .data-bar-fill { animation-delay: 2.4s; }
.bento-enumerate .bento-cell:nth-child(8) .data-bar-fill { animation-delay: 2.8s; }
.bento-enumerate .bento-cell:nth-child(9) .data-bar-fill { animation-delay: 3.2s; }

.panel-enumerate .bento-cell {
    box-shadow: 4px 4px 0px var(--accent-a);
}

/* === PANEL 3: SIGNAL === */
.panel-signal {
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.hud-scanlines {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 3px,
        rgba(61,90,254,0.04) 3px,
        rgba(61,90,254,0.04) 4px
    );
    pointer-events: none;
}

.hud-corner { position: absolute; z-index: 10; }
.hud-tl { top: 20px; left: 68px; }
.hud-tr { top: 20px; right: 20px; }
.hud-bl { bottom: 20px; left: 68px; }
.hud-br { bottom: 20px; right: 20px; }

.hud-reticle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: rotate 15s linear infinite;
}

.lens-flare {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 400px;
    height: 400px;
    transform: translate(-50%, -50%) scale(0.3);
    opacity: 0.2;
    border-radius: 50%;
    background:
        radial-gradient(circle, #ffffff 0%, transparent 8%),
        radial-gradient(circle, rgba(255,92,57,0.05) 20%, transparent 40%),
        radial-gradient(circle, rgba(61,90,254,0.03) 40%, transparent 60%),
        radial-gradient(circle, rgba(0,230,118,0.01) 60%, transparent 80%);
    transition: transform 0.6s ease-out, opacity 0.6s ease-out;
    pointer-events: none;
}

.lens-flare::before {
    content: '';
    position: absolute;
    inset: -50%;
    background: conic-gradient(
        from 0deg,
        transparent 0deg, rgba(255,255,255,0.1) 2deg, transparent 4deg,
        transparent 60deg, rgba(255,255,255,0.08) 62deg, transparent 64deg,
        transparent 120deg, rgba(255,255,255,0.06) 122deg, transparent 124deg,
        transparent 180deg, rgba(255,255,255,0.1) 182deg, transparent 184deg,
        transparent 240deg, rgba(255,255,255,0.08) 242deg, transparent 244deg,
        transparent 300deg, rgba(255,255,255,0.06) 302deg, transparent 304deg
    );
    animation: rotate 30s linear infinite;
}

.lens-flare.active {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.8;
}

.hud-data-left, .hud-data-right {
    position: absolute;
    top: 0;
    width: 120px;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.hud-data-left { left: 68px; }
.hud-data-right { right: 20px; text-align: right; }

.data-scroll {
    animation: scroll-up 20s linear infinite;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-b);
    opacity: 0.7;
}

.data-scroll p { margin-bottom: 12px; }

.data-scroll-slow { animation-duration: 28s; }

.crosshair-h, .crosshair-v {
    position: absolute;
    pointer-events: none;
    background: rgba(0,230,118,0.15);
    opacity: 0;
    transition: opacity 0.2s;
}

.crosshair-h {
    left: 48px;
    right: 0;
    height: 1px;
    top: 50%;
}

.crosshair-v {
    top: 0;
    bottom: 0;
    width: 1px;
    left: 50%;
}

.panel-signal:hover .crosshair-h,
.panel-signal:hover .crosshair-v {
    opacity: 1;
}

/* === PANEL 4: ARCHITECT === */
.panel-architect {
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.schematic {
    position: relative;
    width: 80%;
    max-width: 800px;
    height: 60vh;
}

.schematic-component {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.8s;
    opacity: 0;
}

.schematic-component.visible { opacity: 1; }

.comp-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-c);
    opacity: 0.8;
}

.comp-box {
    width: 120px;
    height: 80px;
    border: 2px solid var(--accent-b);
    box-shadow: 4px 4px 0px var(--accent-c);
    background: var(--bg-secondary);
}

.comp-box.small {
    width: 80px;
    height: 50px;
}

.comp-core { top: 50%; left: 50%; transform: translate(-50%, -50%) translateY(-40px); }
.comp-core.visible { transform: translate(-50%, -50%); }

.comp-parser { top: 15%; left: 10%; transform: translateX(-60px); }
.comp-parser.visible { transform: translateX(0); }

.comp-compiler { top: 15%; right: 10%; transform: translateX(60px); }
.comp-compiler.visible { transform: translateX(0); }

.comp-runtime { bottom: 15%; left: 10%; transform: translateX(-60px); }
.comp-runtime.visible { transform: translateX(0); }

.comp-output { bottom: 15%; right: 10%; transform: translateX(60px); }
.comp-output.visible { transform: translateX(0); }

.comp-memory { top: 50%; left: 10%; transform: translate(-60px, -50%); }
.comp-memory.visible { transform: translate(0, -50%); }

.schematic-line {
    position: absolute;
    background: var(--accent-b);
    opacity: 0.3;
}

.line-1 { top: 28%; left: 22%; width: 28%; height: 1px; }
.line-2 { top: 28%; right: 22%; width: 28%; height: 1px; }
.line-3 { bottom: 28%; left: 22%; width: 28%; height: 1px; }
.line-4 { bottom: 28%; right: 22%; width: 28%; height: 1px; }
.line-5 { top: 50%; left: 22%; width: 28%; height: 1px; }

/* === PANEL 5: TERMINAL === */
.panel-terminal {
    background: var(--bg-primary);
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding-top: 60px;
    padding-left: 80px;
}

.terminal-container {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    color: var(--accent-c);
    max-width: 700px;
    line-height: 1.8;
}

.terminal-output span {
    display: block;
}

.terminal-cursor {
    animation: blink-cursor 530ms steps(1) infinite;
}

/* === BORDER GRADIENT (3 locations) === */
.bento-border-gradient {
    position: absolute;
    bottom: 0;
    left: 48px;
    right: 0;
    height: 2px;
    background: var(--gradient);
}

/* === KEYFRAMES === */
@keyframes pulse-dot {
    0%, 100% { opacity: 1; box-shadow: 0 0 4px currentColor; }
    50% { opacity: 0.6; box-shadow: 0 0 8px currentColor; }
}

@keyframes hud-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@keyframes bar-fill {
    0% { width: 0%; }
    50% { width: 100%; }
    100% { width: 0%; }
}

@keyframes rotate {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes scroll-up {
    0% { transform: translateY(0); }
    100% { transform: translateY(-50%); }
}

@keyframes blink-cursor {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

/* === REDUCED MOTION === */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
    }
    .lens-flare { transform: translate(-50%, -50%) scale(1); opacity: 0.8; }
    .schematic-component { opacity: 1; transform: none !important; }
    .comp-core { transform: translate(-50%, -50%) !important; }
    .comp-memory { transform: translate(0, -50%) !important; }
}
