/* ============================================
   historical.quest - Cyberpunk Archaeology
   ============================================ */

/* CSS Custom Properties */
:root {
    --void-black: #0a0a0f;
    --deep-indigo: #0d0d14;
    --acid-green: #00ff9f;
    --electric-cyan: #00e5ff;
    --hot-magenta: #ff006e;
    --neon-blue: #00b8ff;
    --ghost-white: #e0e8ff;
    --slate-mist: #7a7a9e;
    --charcoal-indigo: #1a1a2e;
    --gutter-slate: #3a3a5c;
    --amber-pulse: #ffb800;

    --font-display: 'Orbitron', sans-serif;
    --font-body: 'Space Grotesk', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--void-black);
    color: var(--ghost-white);
    font-family: var(--font-body);
    font-size: clamp(0.95rem, 1.8vw, 1.15rem);
    line-height: 1.72;
    letter-spacing: 0.01em;
    overflow-x: hidden;
}

/* ============================================
   Scan Line Overlay
   ============================================ */
#scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.08) 2px,
        rgba(0, 0, 0, 0.08) 4px
    );
    pointer-events: none;
    z-index: 9999;
}

/* ============================================
   Scroll Progress Bar
   ============================================ */
#scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    z-index: 10000;
    background: transparent;
    opacity: 0;
    transition: opacity 0.4s ease;
}

#scroll-progress.visible {
    opacity: 1;
}

#scroll-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--neon-blue);
    box-shadow: 0 0 8px var(--neon-blue), 0 0 20px rgba(0, 184, 255, 0.4);
    transition: width 0.1s linear;
}

#epoch-ticks {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.epoch-tick {
    position: absolute;
    top: 0;
    width: 2px;
    height: 6px;
    background: var(--hot-magenta);
    box-shadow: 0 0 4px var(--hot-magenta);
}

/* ============================================
   Boot Screen
   ============================================ */
#boot-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--void-black);
    z-index: 5000;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding-top: 15vh;
    padding-left: 8vw;
    transition: opacity 0.6s ease;
}

#boot-screen.fade-out {
    opacity: 0.2;
}

#boot-screen.hidden {
    display: none;
}

#boot-content {
    font-family: var(--font-mono);
    font-size: clamp(0.85rem, 1.5vw, 1rem);
    font-weight: 400;
    color: var(--ghost-white);
    line-height: 1.8;
    white-space: pre-wrap;
}

#cursor {
    display: inline-block;
    width: 12px;
    height: 20px;
    background: var(--acid-green);
    animation: blink 0.53s step-end infinite;
    vertical-align: middle;
    box-shadow: 0 0 7px var(--acid-green), 0 0 20px rgba(0, 255, 159, 0.4);
}

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

.boot-ok {
    color: var(--acid-green);
    text-shadow: 0 0 7px var(--acid-green), 0 0 20px rgba(0, 255, 159, 0.4);
}

/* ============================================
   Main Interface
   ============================================ */
#main-interface {
    position: relative;
    min-height: 100vh;
    transform: translateY(100vh);
    opacity: 0;
    transition: none;
}

#main-interface.visible {
    transform: translateY(0);
    opacity: 1;
}

/* ============================================
   Navigation Bar
   ============================================ */
#top-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 48px;
    background: rgba(10, 10, 15, 0.95);
    border-bottom: 1px solid var(--charcoal-indigo);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 1000;
    backdrop-filter: blur(12px);
}

#nav-domain {
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--acid-green);
    text-shadow: 0 0 7px var(--acid-green), 0 0 20px rgba(0, 255, 159, 0.4);
}

#epoch-tabs {
    display: flex;
    gap: 4px;
}

.epoch-tab {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--slate-mist);
    background: none;
    border: none;
    padding: 8px 16px;
    cursor: pointer;
    position: relative;
    transition: color 0.2s ease;
}

.epoch-tab::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--acid-green);
    box-shadow: 0 2px 8px rgba(0, 255, 159, 0.6);
    transition: width 0.3s ease, left 0.3s ease;
}

.epoch-tab:hover {
    color: var(--ghost-white);
}

.epoch-tab.active {
    color: var(--acid-green);
    text-shadow: 0 0 7px rgba(0, 255, 159, 0.5);
}

.epoch-tab.active::after {
    width: 100%;
    left: 0;
}

/* ============================================
   Split Container
   ============================================ */
#split-container {
    display: grid;
    grid-template-columns: 1fr 2px 1fr;
    min-height: 100vh;
    padding-top: 48px;
}

/* ============================================
   Center Divider
   ============================================ */
#center-divider {
    width: 2px;
    min-height: 100%;
    background: linear-gradient(
        180deg,
        var(--acid-green) 0%,
        var(--neon-blue) 50%,
        var(--hot-magenta) 100%
    );
    background-size: 100% 300%;
    animation: divider-pulse 4s ease-in-out infinite, divider-breathe 20s ease-in-out infinite;
    box-shadow: 0 0 10px rgba(0, 255, 159, 0.4), 0 0 30px rgba(0, 184, 255, 0.2);
}

@keyframes divider-pulse {
    0% { background-position: 0% 0%; }
    50% { background-position: 0% 100%; }
    100% { background-position: 0% 0%; }
}

@keyframes divider-breathe {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* ============================================
   Source Panel (Left)
   ============================================ */
#source-panel {
    background: var(--void-black);
    padding: 24px 20px;
    overflow-y: auto;
    position: relative;
}

#compile-panel {
    background: var(--deep-indigo);
    padding: 24px 20px;
    overflow-y: auto;
    position: relative;
}

/* Panel Headers */
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 16px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--charcoal-indigo);
}

.panel-label {
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--electric-cyan);
    text-shadow: 0 0 7px rgba(0, 229, 255, 0.5);
}

.panel-status {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    color: var(--acid-green);
    padding: 2px 8px;
    border: 1px solid rgba(0, 255, 159, 0.3);
    border-radius: 2px;
    animation: status-pulse 2s ease-in-out infinite;
}

.compile-status {
    color: var(--neon-blue);
    border-color: rgba(0, 184, 255, 0.3);
}

@keyframes status-pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* ============================================
   Epoch Markers
   ============================================ */
.epoch-section {
    margin-bottom: 48px;
}

.epoch-marker {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    margin-bottom: 24px;
    background: rgba(26, 26, 46, 0.5);
    border-left: 3px solid var(--hot-magenta);
    border-radius: 0 4px 4px 0;
}

.epoch-label {
    font-family: var(--font-display);
    font-size: clamp(1.4rem, 3.5vw, 2.6rem);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--hot-magenta);
    text-shadow: 0 0 7px var(--hot-magenta), 0 0 20px rgba(255, 0, 110, 0.4);
    transition: text-shadow 0.2s ease-out;
}

.epoch-label:hover {
    text-shadow: 0 0 7px var(--hot-magenta), 0 0 20px rgba(255, 0, 110, 0.4), 0 0 40px rgba(255, 0, 110, 0.15);
}

.epoch-range {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--slate-mist);
    letter-spacing: 0.05em;
}

/* ============================================
   Code Blocks
   ============================================ */
.code-block {
    display: flex;
    background: var(--charcoal-indigo);
    border-radius: 4px;
    margin-bottom: 16px;
    overflow: hidden;
    position: relative;
}

/* Scan line texture on code blocks */
.code-block::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        transparent,
        transparent 1px,
        rgba(255, 255, 255, 0.02) 1px,
        rgba(255, 255, 255, 0.02) 2px
    );
    pointer-events: none;
}

.code-block[data-accent="magenta"] {
    border-left: 2px solid var(--hot-magenta);
}

.code-block[data-accent="cyan"] {
    border-left: 2px solid var(--electric-cyan);
}

.code-block[data-accent="green"] {
    border-left: 2px solid var(--acid-green);
}

.code-block[data-accent="amber"] {
    border-left: 2px solid var(--amber-pulse);
}

.code-gutter {
    display: flex;
    flex-direction: column;
    padding: 12px 10px;
    background: rgba(10, 10, 15, 0.4);
    border-right: 1px solid rgba(58, 58, 92, 0.5);
    min-width: 36px;
    text-align: right;
}

.code-gutter span {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    line-height: 1.6;
    color: #3a3a5c;
}

.code-content {
    flex: 1;
    padding: 12px 16px;
    overflow-x: auto;
}

.code-line {
    font-family: var(--font-mono);
    font-size: clamp(0.8rem, 1.4vw, 0.95rem);
    line-height: 1.6;
    font-feature-settings: "liga" 1;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(-12px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.code-line.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Syntax Highlighting */
.comment {
    color: var(--slate-mist);
    font-style: italic;
}

.keyword {
    color: var(--neon-blue);
    font-weight: 700;
}

.variable {
    color: var(--ghost-white);
}

.property {
    color: var(--electric-cyan);
}

.string {
    color: var(--acid-green);
}

.date {
    color: var(--hot-magenta);
    text-shadow: 0 0 5px rgba(255, 0, 110, 0.3);
}

.number {
    color: var(--amber-pulse);
}

.method {
    color: var(--electric-cyan);
}

.classname {
    color: var(--amber-pulse);
    font-weight: 700;
}

.accent-green {
    color: var(--acid-green);
    text-shadow: 0 0 5px rgba(0, 255, 159, 0.3);
}

.accent-cyan {
    color: var(--electric-cyan);
    text-shadow: 0 0 5px rgba(0, 229, 255, 0.3);
}

.amber {
    color: var(--amber-pulse);
    text-shadow: 0 0 5px rgba(255, 184, 0, 0.3);
}

/* ============================================
   Circuit Traces
   ============================================ */
.circuit-trace {
    width: 100%;
    height: 40px;
    margin: 8px 0;
}

.trace-path {
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    transition: stroke-dashoffset 1.2s ease-out;
}

.trace-path.animated {
    stroke-dashoffset: 0;
}

.trace-node {
    fill: none;
    stroke-width: 2;
    transform-origin: center;
    animation: node-pulse 2s ease-in-out infinite;
}

.node-green {
    stroke: var(--acid-green);
    filter: drop-shadow(0 0 4px rgba(0, 255, 159, 0.6));
}

.node-cyan {
    stroke: var(--electric-cyan);
    filter: drop-shadow(0 0 4px rgba(0, 229, 255, 0.6));
}

.node-magenta {
    stroke: var(--hot-magenta);
    filter: drop-shadow(0 0 4px rgba(255, 0, 110, 0.6));
}

.node-blue {
    stroke: var(--neon-blue);
    filter: drop-shadow(0 0 4px rgba(0, 184, 255, 0.6));
}

@keyframes node-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.4); }
}

/* ============================================
   Compile Panel Styles
   ============================================ */
.compile-section {
    margin-bottom: 48px;
}

.compile-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--charcoal-indigo);
}

.compile-icon {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--acid-green);
    text-shadow: 0 0 7px var(--acid-green);
}

.compile-title {
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--neon-blue);
    text-shadow: 0 0 5px rgba(0, 184, 255, 0.4);
}

/* Terminal Blocks */
.terminal-block {
    background: rgba(10, 10, 15, 0.6);
    border: 1px solid var(--charcoal-indigo);
    border-radius: 4px;
    padding: 16px;
    margin-bottom: 16px;
}

.terminal-line {
    font-family: var(--font-mono);
    font-size: clamp(0.8rem, 1.4vw, 0.95rem);
    line-height: 1.6;
    color: var(--electric-cyan);
    margin-bottom: 8px;
}

.terminal-line .prompt {
    color: var(--acid-green);
    text-shadow: 0 0 5px rgba(0, 255, 159, 0.4);
    margin-right: 4px;
}

.terminal-line.output {
    font-family: var(--font-body);
    font-size: clamp(0.9rem, 1.6vw, 1.05rem);
    color: var(--ghost-white);
    padding-left: 16px;
    border-left: 1px solid var(--charcoal-indigo);
    margin-left: 8px;
    line-height: 1.72;
}

.terminal-line.output.error {
    border-left-color: var(--hot-magenta);
    color: rgba(224, 232, 255, 0.9);
}

.terminal-line.cursor-blink .prompt {
    color: var(--acid-green);
}

.terminal-line.cursor-blink {
    color: var(--acid-green);
    animation: blink 0.53s step-end infinite;
}

/* ============================================
   Timeline Strip
   ============================================ */
.timeline-strip {
    position: relative;
    height: 80px;
    margin: 24px 0;
    padding: 0 10px;
}

.timeline-line {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--neon-blue);
    box-shadow: 0 0 8px rgba(0, 184, 255, 0.4);
    transform: translateY(-50%);
}

.timeline-line::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, var(--neon-blue), transparent);
    animation: timeline-flow 3s linear infinite;
}

@keyframes timeline-flow {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.timeline-node {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
}

.node-dot {
    display: block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--neon-blue);
    border: 2px solid var(--electric-cyan);
    box-shadow: 0 0 8px var(--neon-blue), 0 0 20px rgba(0, 184, 255, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.timeline-node:hover .node-dot {
    transform: scale(1.6);
    box-shadow: 0 0 12px var(--neon-blue), 0 0 30px rgba(0, 184, 255, 0.5);
}

.node-label {
    position: absolute;
    top: 20px;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--slate-mist);
    white-space: nowrap;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    opacity: 0.7;
    transition: opacity 0.2s ease, color 0.2s ease;
}

.timeline-node:hover .node-label {
    opacity: 1;
    color: var(--electric-cyan);
}

/* ============================================
   Data Cards
   ============================================ */
.data-card {
    background: rgba(26, 26, 46, 0.6);
    border: 1px solid var(--charcoal-indigo);
    border-radius: 4px;
    margin-bottom: 16px;
    overflow: hidden;
}

.data-card-header {
    font-family: var(--font-display);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--amber-pulse);
    text-shadow: 0 0 5px rgba(255, 184, 0, 0.4);
    padding: 10px 16px;
    background: rgba(255, 184, 0, 0.05);
    border-bottom: 1px solid rgba(255, 184, 0, 0.15);
}

.data-card-body {
    padding: 12px 16px;
}

.data-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid rgba(26, 26, 46, 0.8);
}

.data-row:last-child {
    border-bottom: none;
}

.data-key {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--slate-mist);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-value {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--ghost-white);
}

.data-value.date {
    color: var(--hot-magenta);
}

.data-value.amber {
    color: var(--amber-pulse);
}

/* ============================================
   Glitch Overlay
   ============================================ */
#glitch-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 8000;
    pointer-events: none;
    opacity: 0;
}

#glitch-overlay.active {
    opacity: 1;
}

.glitch-slice {
    position: absolute;
    left: 0;
    width: 100%;
    background: var(--void-black);
    overflow: hidden;
}

/* ============================================
   Final Message
   ============================================ */
.final-message {
    border: 1px solid var(--acid-green);
    box-shadow: 0 0 10px rgba(0, 255, 159, 0.15), 0 0 30px rgba(0, 255, 159, 0.05);
}

/* ============================================
   Heading Glow Hover
   ============================================ */
.epoch-label,
.compile-title,
#nav-domain {
    transition: text-shadow 0.2s ease-out;
}

/* ============================================
   Scrollbar Styling
   ============================================ */
#source-panel::-webkit-scrollbar,
#compile-panel::-webkit-scrollbar {
    width: 4px;
}

#source-panel::-webkit-scrollbar-track,
#compile-panel::-webkit-scrollbar-track {
    background: transparent;
}

#source-panel::-webkit-scrollbar-thumb,
#compile-panel::-webkit-scrollbar-thumb {
    background: var(--charcoal-indigo);
    border-radius: 2px;
}

#source-panel::-webkit-scrollbar-thumb:hover,
#compile-panel::-webkit-scrollbar-thumb:hover {
    background: var(--slate-mist);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    #split-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto 2px auto;
    }

    #center-divider {
        width: 100%;
        height: 2px;
        min-height: 2px;
        background: linear-gradient(
            90deg,
            var(--acid-green) 0%,
            var(--neon-blue) 50%,
            var(--hot-magenta) 100%
        );
        background-size: 300% 100%;
        animation: divider-pulse-h 4s ease-in-out infinite, divider-breathe 20s ease-in-out infinite;
    }

    @keyframes divider-pulse-h {
        0% { background-position: 0% 0%; }
        50% { background-position: 100% 0%; }
        100% { background-position: 0% 0%; }
    }

    #source-panel,
    #compile-panel {
        overflow-y: visible;
    }

    .epoch-tab {
        padding: 8px 10px;
        font-size: 0.6rem;
    }

    .epoch-label {
        font-size: clamp(1rem, 3vw, 1.6rem);
    }

    .code-line {
        font-size: 0.75rem;
    }
}

/* ============================================
   Selection
   ============================================ */
::selection {
    background: rgba(0, 255, 159, 0.25);
    color: var(--ghost-white);
}
