/* CSS Design System & Variables */
:root {
    --bg-color: #030a05;
    --terminal-bg: rgba(3, 10, 5, 0.95);
    --primary-color: #00ff66; /* Bright phosphor green */
    --primary-dim: #00aa44;
    --primary-dark: #003311;
    --primary-glow: rgba(0, 255, 102, 0.35);
    --primary-glow-heavy: rgba(0, 255, 102, 0.7);
    --scanline-color: rgba(0, 255, 102, 0.015);
    --crt-flicker-speed: 0.2s;
    --font-mono: 'Share Tech Mono', 'Courier New', Courier, monospace;
    --font-crt: 'VT323', monospace;
    --border-style: 1px solid var(--primary-dim);
}

/* Reset & Core Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--primary-color);
    font-family: var(--font-mono);
    font-size: 16px;
    line-height: 1.5;
    overflow-x: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--primary-dark);
}
::-webkit-scrollbar-thumb {
    background: var(--primary-dim);
    border-radius: 2px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* HTML5 Canvas Background */
#matrix-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.35; /* Subtle background matrix code rain */
    transition: opacity 0.5s ease;
    pointer-events: none;
}

/* CRT Screen Effect Overlays */
.crt-scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        var(--scanline-color) 50%, 
        rgba(0, 0, 0, 0.08) 50%
    ), linear-gradient(
        90deg, 
        rgba(255, 0, 0, 0.01), 
        rgba(0, 255, 0, 0.005), 
        rgba(0, 0, 255, 0.01)
    );
    background-size: 100% 4px, 6px 100%;
    z-index: 9999;
    pointer-events: none;
}

.crt-vignette {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        circle, 
        transparent 50%, 
        rgba(0, 0, 0, 0.75) 150%
    );
    z-index: 9998;
    pointer-events: none;
    box-shadow: inset 0 0 100px rgba(0, 255, 102, 0.1);
}

/* Phosphor Glow and Flicker Animations */
.crt-glow {
    text-shadow: 0 0 4px var(--primary-glow), 0 0 10px rgba(0, 255, 102, 0.15);
}

.crt-glow-heavy {
    text-shadow: 0 0 8px var(--primary-glow-heavy), 0 0 20px rgba(0, 255, 102, 0.3);
}

.crt-flicker {
    animation: crt-flicker-anim var(--crt-flicker-speed) infinite;
}

@keyframes crt-flicker-anim {
    0% { opacity: 0.985; }
    25% { opacity: 0.995; }
    50% { opacity: 0.978; }
    75% { opacity: 1; }
    100% { opacity: 0.985; }
}

/* Nav Header */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background-color: var(--primary-dark);
    border-bottom: var(--border-style);
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.nav-brand {
    font-family: var(--font-crt);
    font-size: 24px;
    letter-spacing: 2px;
    color: var(--primary-color);
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-btn {
    background: transparent;
    border: 1px solid var(--primary-dim);
    color: var(--primary-dim);
    font-family: var(--font-mono);
    font-size: 14px;
    padding: 6px 14px;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.nav-btn:hover {
    background-color: var(--primary-dark);
    color: var(--primary-color);
    box-shadow: 0 0 8px var(--primary-glow);
}

.nav-btn.active {
    background-color: var(--primary-dim);
    color: var(--bg-color);
    font-weight: bold;
    box-shadow: 0 0 10px var(--primary-glow);
}

.nav-divider {
    color: var(--primary-dim);
    margin: 0 4px;
}

/* Layout container */
.content-container {
    flex: 1;
    display: flex;
    position: relative;
    overflow: hidden;
}

/* Interface Pane Base */
.interface-pane {
    display: none;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    padding: 24px;
    position: absolute;
    top: 0;
    left: 0;
}

.interface-pane.active {
    display: flex;
    flex-direction: column;
}

/* --- TERMINAL INTERFACE STYLES --- */
#terminal-interface {
    background-color: var(--terminal-bg);
}

#terminal-interface.active {
    width: 92%;
    max-width: 900px;
    height: 85%;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(0, 255, 102, 0.15), inset 0 0 20px rgba(0, 255, 102, 0.05);
    border: var(--border-style);
    overflow: hidden;
}

.terminal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    font-size: 16px;
    overflow-y: auto;
    margin-bottom: 12px;
    border: var(--border-style);
    background-color: rgba(0, 0, 0, 0.4);
    padding: 20px;
    border-radius: 4px;
    box-shadow: inset 0 0 20px rgba(0, 255, 68, 0.05);
}

.terminal-output {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

/* Output messages */
.terminal-line {
    white-space: pre-wrap;
    word-break: break-all;
}

.terminal-line.system {
    color: var(--primary-dim);
}

.terminal-line.error {
    color: #ff3333;
    text-shadow: 0 0 4px rgba(255, 51, 51, 0.4);
}

.terminal-line.input-echo {
    color: #ffffff;
    text-shadow: 0 0 4px rgba(255, 255, 255, 0.4);
    font-weight: bold;
}

/* Terminal Title Banners & Formatting */
.ascii-banner {
    font-family: var(--font-crt);
    font-size: 14px;
    line-height: 1.1;
    color: var(--primary-color);
    white-space: pre;
    margin-bottom: 16px;
    display: block;
    overflow-x: auto;
}

.highlight {
    color: #ffffff;
    font-weight: bold;
    text-shadow: 0 0 4px rgba(255, 255, 255, 0.4);
}

.terminal-accent {
    color: var(--primary-color);
    background-color: var(--primary-dark);
    padding: 2px 6px;
    border-radius: 2px;
}

/* Terminal Interactive Input */
.terminal-input-line {
    display: flex;
    align-items: center;
    border-top: 1px dashed var(--primary-dark);
    padding-top: 12px;
}

.terminal-prompt {
    color: var(--primary-dim);
    margin-right: 10px;
    user-select: none;
}

.input-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}

#terminal-input {
    position: absolute;
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: transparent;
    caret-color: transparent;
    font-family: var(--font-mono);
    font-size: 16px;
    z-index: 10;
}

.input-buffer {
    color: var(--primary-color);
    white-space: pre-wrap;
    word-break: break-all;
    min-height: 20px;
    display: inline-block;
}

.terminal-cursor {
    display: inline-block;
    width: 8px;
    height: 15px;
    background-color: var(--primary-color);
    animation: cursor-blink 1s infinite step-end;
    margin-left: 2px;
}

@keyframes cursor-blink {
    from, to { background-color: transparent; }
    50% { background-color: var(--primary-color); box-shadow: 0 0 5px var(--primary-color); }
}

/* Terminal Footer / Quick Commands */
.terminal-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border: var(--border-style);
    background-color: rgba(0, 33, 17, 0.2);
    border-radius: 4px;
}

.footer-hint {
    font-size: 13px;
    color: var(--primary-dim);
}

.quick-commands {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.quick-cmd-btn {
    background-color: var(--primary-dark);
    border: 1px solid var(--primary-dim);
    color: var(--primary-color);
    padding: 4px 10px;
    font-family: var(--font-mono);
    font-size: 12px;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.15s ease;
}

.quick-cmd-btn:hover {
    background-color: var(--primary-color);
    color: var(--bg-color);
    box-shadow: 0 0 6px var(--primary-glow);
}

/* --- READER MODE STYLES --- */
#reader-interface {
    background-color: #0b110e;
    color: #d1ebd8;
}

.cv-document {
    max-width: 960px;
    margin: 0 auto;
    background-color: rgba(3, 10, 5, 0.8);
    border: 1px solid var(--primary-dim);
    border-radius: 6px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
}

.cv-header {
    border-bottom: 2px solid var(--primary-dim);
    padding-bottom: 24px;
    margin-bottom: 30px;
    text-align: center;
}

.cv-header h1 {
    font-family: var(--font-crt);
    font-size: 42px;
    color: var(--primary-color);
    letter-spacing: 1px;
    margin-bottom: 12px;
    text-shadow: 0 0 6px var(--primary-glow);
}

.cv-header .subtitle {
    font-size: 16px;
    color: var(--primary-dim);
}

.cv-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 40px;
}

.cv-section {
    margin-bottom: 35px;
}

.cv-section h2 {
    font-family: var(--font-crt);
    font-size: 26px;
    color: var(--primary-color);
    border-bottom: 1px solid var(--primary-dark);
    padding-bottom: 6px;
    margin-bottom: 16px;
    letter-spacing: 1px;
}

/* Sidebar lists */
.skills-list {
    list-style: none;
}

.skills-list li {
    padding: 6px 0;
    border-bottom: 1px solid rgba(0, 255, 102, 0.08);
    font-size: 14px;
}

.skills-list li::before {
    content: "> ";
    color: var(--primary-color);
    font-weight: bold;
}

/* Main CV column */
.job-block {
    margin-bottom: 28px;
    border-left: 2px solid var(--primary-dim);
    padding-left: 16px;
}

.job-header {
    display: flex;
    flex-direction: column;
    margin-bottom: 10px;
}

.job-header .company {
    font-size: 18px;
    font-weight: bold;
    color: #ffffff;
}

.job-header .title {
    font-size: 15px;
    color: var(--primary-color);
    font-style: italic;
}

.job-header .dates {
    font-size: 13px;
    color: var(--primary-dim);
    margin-top: 2px;
}

.job-bullets {
    list-style-type: square;
    padding-left: 20px;
    font-size: 14px;
}

.job-bullets li {
    margin-bottom: 6px;
}

.highlight-block {
    margin-bottom: 20px;
}

.highlight-block h3 {
    font-size: 16px;
    color: #ffffff;
    margin-bottom: 6px;
}

.highlight-block p {
    font-size: 14px;
}

.compact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    font-size: 13px;
    margin-bottom: 20px;
}

.education-block {
    font-size: 14px;
    border-top: 1px dashed var(--primary-dark);
    padding-top: 12px;
}

.reader-footer {
    display: flex;
    justify-content: center;
    margin-top: 40px;
    border-top: 1px solid var(--primary-dark);
    padding-top: 24px;
}

.print-btn {
    background-color: var(--primary-dim);
    border: none;
    color: var(--bg-color);
    padding: 12px 30px;
    font-family: var(--font-mono);
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(0, 255, 102, 0.2);
}

.print-btn:hover {
    background-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--primary-glow);
}

/* Command Styling in CV Text */
.cmd-help {
    background: var(--primary-dark);
    color: var(--primary-color);
    padding: 2px 6px;
    font-size: 0.9em;
    border-radius: 3px;
    border: 1px solid var(--primary-dim);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }

    .top-nav {
        flex-direction: column;
        gap: 10px;
        padding: 12px;
    }

    .nav-controls {
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
        gap: 8px;
    }

    .nav-btn {
        font-size: 12px;
        padding: 4px 10px;
    }

    .content-container {
        padding: 0;
    }

    .interface-pane {
        padding: 12px;
    }

    .terminal-body {
        padding: 12px;
    }

    .cv-document {
        padding: 20px;
    }

    .cv-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

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

.cv-contact-info {
    margin-top: 15px;
    font-size: 14px;
    color: var(--primary-dim);
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
}

.cv-contact-info a {
    color: var(--primary-color);
    text-decoration: none;
}

.cv-contact-info a:hover {
    text-decoration: underline;
    text-shadow: 0 0 5px var(--primary-glow);
}

/* Print Overrides */
@media print {
    .cv-contact-info {
        color: #000000 !important;
        margin-top: 10px;
    }
    
    .cv-contact-info a {
        color: #000000 !important;
        text-decoration: none !important;
    }

    .top-nav, .crt-scanlines, .crt-vignette, #matrix-canvas, .terminal-footer, .reader-footer {
        display: none !important;
    }

    body {
        background-color: #ffffff !important;
        color: #000000 !important;
        height: auto !important;
        overflow: visible !important;
    }

    #reader-interface {
        display: block !important;
        position: static !important;
        background-color: #ffffff !important;
        color: #000000 !important;
        padding: 0 !important;
    }

    .cv-document {
        border: none !important;
        background-color: #ffffff !important;
        color: #000000 !important;
        box-shadow: none !important;
        padding: 0 !important;
    }

    .cv-header h1 {
        color: #000000 !important;
        text-shadow: none !important;
    }

    .cv-section h2 {
        color: #000000 !important;
        border-bottom: 2px solid #000000 !important;
    }

    .job-block {
        border-left: 2px solid #000000 !important;
    }

    .job-header .company, .job-header .title, .highlight-block h3 {
        color: #000000 !important;
    }

    .skills-list li::before {
        content: "• " !important;
        color: #000000 !important;
    }
}
