:root {
    --bg-color: #000000;
    --text-color: #00ff66;
    --accent-color: #00ff66;
    --secondary-bg: #030a03;
    --card-bg: #010601;
    --border-color: #004411;
    --glow-color: rgba(0, 255, 102, 0.4);
    --terminal-dim: #00aa44;

    --font-mono: 'JetBrains Mono', monospace;
    --font-display: 'JetBrains Mono', monospace;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-mono);
    line-height: 1.6;
    overflow-x: hidden;
    text-shadow: 0 0 2px rgba(0, 255, 102, 0.3);
}

/* --- CRT Monitor Simulation Overlay --- */
.crt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.18),
        rgba(0, 0, 0, 0.18) 1px,
        transparent 1px,
        transparent 3px
    );
    z-index: 9999;
    pointer-events: none;
    opacity: 0.85;
}

.crt-vignette {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    box-shadow: inset 0 0 100px rgba(0, 30, 0, 0.4), inset 0 0 200px rgba(0, 0, 0, 0.95);
    z-index: 9998;
    pointer-events: none;
}

.crt-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle, rgba(0, 255, 102, 0.025) 0%, rgba(0, 0, 0, 0) 80%);
    z-index: 9997;
    pointer-events: none;
}

/* Subtle CRT Monitor Scanline Flicker */
@keyframes crt-flicker {
    0% { opacity: 0.985; }
    50% { opacity: 1; }
    100% { opacity: 0.985; }
}

body.crt-screen {
    animation: crt-flicker 0.18s infinite;
}

/* Three.js Canvas Container */
#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
    opacity: 0.4; /* Slightly dimmed for matrix background effect */
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: 1px;
}

a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #fff;
    text-shadow: 0 0 5px var(--glow-color);
}

/* Navigation - Styled as Terminal Tabs */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 5%;
    z-index: 100;
    background: #000000;
    border-bottom: 2px solid var(--border-color);
    box-shadow: 0 4px 20px rgba(0, 255, 102, 0.1);
}

.logo {
    display: flex;
    flex-direction: column;
}

.logo-text {
    font-family: var(--font-mono);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent-color);
    text-shadow: 0 0 6px var(--glow-color);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.2rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: var(--accent-color);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--accent-color);
    animation: blink-dot 1.5s infinite;
}

@keyframes blink-dot {
    0%, 100% { opacity: 1; box-shadow: 0 0 10px var(--accent-color); }
    50% { opacity: 0.3; box-shadow: none; }
}

.status-text {
    font-size: 0.7rem;
    color: var(--terminal-dim);
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 0;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.nav-links li {
    border-right: 1px solid var(--border-color);
}

.nav-links li:last-child {
    border-right: none;
}

.nav-links a {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    padding: 0.5rem 1.2rem;
    display: block;
    background: #010601;
    color: var(--terminal-dim);
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
}

.nav-links a:hover {
    color: var(--accent-color);
    background: #021102;
    text-shadow: 0 0 5px var(--glow-color);
}

/* Sections */
.section {
    padding: 6rem 5%;
    max-width: 1400px;
    margin: 0 auto;
}

.section-title {
    font-size: 2.2rem;
    margin-bottom: 3rem;
    position: relative;
    display: block;
    font-family: var(--font-mono);
    border-bottom: 2px dashed var(--border-color);
    padding-bottom: 0.8rem;
    color: var(--accent-color);
    text-shadow: 0 0 8px var(--glow-color);
}

.section-title::before {
    content: '$ cat ';
    color: #fff;
    font-weight: normal;
}

.section-title::after {
    content: '.md';
    color: var(--terminal-dim);
    font-size: 1.5rem;
    font-weight: normal;
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding-top: 80px;
}

.hero-content {
    text-align: center;
    width: 100%;
    max-width: 1200px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.hero-title {
    font-size: clamp(3.5rem, 8vw, 7.5rem);
    line-height: 1;
    color: var(--accent-color);
    margin: 0;
    text-shadow: 0 0 8px var(--glow-color), 0 0 20px var(--glow-color);
    transition: transform 0.1s ease-out;
    cursor: default;
    font-family: var(--font-mono);
    letter-spacing: -2px;
}

.hero-middle {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 300px;
}

.avatar-container {
    position: relative;
    width: 180px;
    height: 180px;
    z-index: 5;
}

.avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    position: relative;
    z-index: 2;
    filter: grayscale(100%) contrast(1.5) brightness(0.9);
    border: 2px solid var(--accent-color);
}

.avatar-frame {
    position: absolute;
    top: 5px;
    left: 5px;
    width: 100%;
    height: 100%;
    background-color: transparent;
    border: 2px solid var(--accent-color);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    z-index: 1;
    opacity: 0.8;
    box-shadow: 0 0 15px var(--glow-color);
}

#hero-orbit-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 500px;
    height: 500px;
    z-index: 1;
    pointer-events: none;
}

/* --- Interactive Terminal Widget --- */
.terminal-widget {
    background-color: #000000;
    border-radius: 4px;
    border: 2px solid var(--border-color);
    width: 100%;
    max-width: 700px;
    text-align: left;
    overflow: hidden;
    box-shadow: 0 0 25px rgba(0, 255, 102, 0.25);
    margin-top: -10px;
    z-index: 10;
    position: relative;
}

.terminal-header {
    background-color: #020a02;
    border-bottom: 2px solid var(--border-color);
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.terminal-header .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dot.red { background-color: #551111; border: 1px solid #ff3333; }
.dot.yellow { background-color: #554411; border: 1px solid #ffcc33; }
.dot.green { background-color: #115511; border: 1px solid #33ff33; }

.terminal-title {
    margin-left: auto;
    margin-right: auto;
    font-size: 0.85rem;
    color: var(--accent-color);
    font-family: var(--font-mono);
    text-shadow: 0 0 5px var(--glow-color);
}

.terminal-body {
    padding: 20px;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-color);
    height: 350px;
    overflow-y: auto;
    background-color: #000000;
    scroll-behavior: smooth;
}

/* Custom scrollbar for terminal screen */
.terminal-body::-webkit-scrollbar {
    width: 8px;
}
.terminal-body::-webkit-scrollbar-track {
    background: #000;
    border-left: 1px solid var(--border-color);
}
.terminal-body::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}
.terminal-body::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

.terminal-body .prompt {
    color: #fff;
    font-weight: bold;
}

.terminal-body .cursor {
    animation: blink-cursor 1s infinite;
    display: inline-block;
    color: var(--accent-color);
    font-weight: bold;
}

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

.terminal-output {
    margin-top: 5px;
    margin-bottom: 15px;
    white-space: pre-wrap;
    font-size: 0.85rem;
    color: #88ffaa;
    line-height: 1.4;
}

.terminal-output.hidden {
    display: none;
}

.terminal-input-line {
    display: flex;
    align-items: center;
    width: 100%;
    margin-top: 5px;
}

.terminal-input-element {
    background: transparent !important;
    border: none !important;
    outline: none !important;
    color: var(--accent-color) !important;
    font-family: var(--font-mono) !important;
    font-size: 0.9rem !important;
    flex-grow: 1;
    caret-color: var(--accent-color);
    padding: 0;
    margin-left: 8px;
    text-shadow: 0 0 5px var(--glow-color);
}

.terminal-legend {
    font-size: 0.75rem;
    color: var(--terminal-dim);
    padding: 6px 15px;
    border-top: 1px dashed var(--border-color);
    background: #000;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--terminal-dim);
    letter-spacing: 2px;
    margin-top: 1rem;
}

/* Scrolling Syslog Ticker */
.ticker-wrap {
    width: 100%;
    overflow: hidden;
    background-color: #010601;
    padding: 0.6rem 0;
    border-top: 2px solid var(--border-color);
    border-bottom: 2px solid var(--border-color);
}

.ticker {
    display: inline-flex;
    white-space: nowrap;
    animation: ticker-scroll 25s linear infinite;
}

.ticker-item {
    display: inline-block;
    padding: 0 2rem;
    font-family: var(--font-mono);
    font-size: 1rem;
    color: var(--accent-color);
    text-shadow: 0 0 4px var(--glow-color);
}

.ticker-dot {
    color: #fff;
    font-size: 1rem;
}

@keyframes ticker-scroll {
    0% { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(-50%, 0, 0); }
}

/* --- Skills Cards Redesigned as Terminal Code Windows --- */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    gap: 2rem;
    perspective: 1000px;
}

.skill-card {
    background-color: transparent;
    height: 220px;
    perspective: 1000px;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
    cursor: pointer;
}

.skill-card:hover .card-inner {
    transform: rotateY(180deg);
}

.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    background: #000500;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.skill-card:hover .card-front,
.skill-card:hover .card-back {
    border-color: var(--accent-color);
    box-shadow: 0 0 15px var(--glow-color);
}

.card-front {
    background: linear-gradient(135deg, #000000, #020f02);
    border-bottom: 4px solid var(--accent-color);
}

.card-front h3 {
    font-family: var(--font-mono);
    color: #fff;
    font-size: 1.25rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
    text-shadow: 0 0 4px var(--glow-color);
}

.card-front h3::before {
    content: '[+]';
    color: var(--accent-color);
}

.card-back {
    background: #010601;
    transform: rotateY(180deg);
    border-top: 4px solid var(--accent-color);
}

.card-back ul {
    list-style: none;
    text-align: left;
    width: 100%;
}

.card-back li {
    margin-bottom: 0.5rem;
    position: relative;
    padding-left: 1.5rem;
    color: var(--terminal-dim);
    font-size: 0.95rem;
    transition: color 0.2s ease;
}

.card-back li:hover {
    color: var(--accent-color);
    text-shadow: 0 0 4px var(--glow-color);
}

.card-back li::before {
    content: '>>';
    position: absolute;
    left: 0;
    color: var(--accent-color);
}

/* --- Projects Section Styled as Hex Nodes --- */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr));
    gap: 2rem;
}

.project-card {
    position: relative;
    background: #000000;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 2.5rem;
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
    z-index: 1;
    overflow: hidden;
}

.project-card::before {
    content: 'NODE_ID: ' attr(data-id);
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 0.65rem;
    color: var(--terminal-dim);
    font-family: var(--font-mono);
}

.project-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% -20%, var(--accent-color), transparent 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.project-card:hover {
    transform: translateY(-10px);
    border-color: var(--accent-color);
    box-shadow: 0 10px 30px rgba(0, 255, 102, 0.15);
}

.project-card:hover .project-glow {
    opacity: 0.15;
}

.project-content h3 {
    font-family: var(--font-mono);
    font-size: 1.8rem;
    color: #fff;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.project-content h3::before {
    content: '📂';
    font-size: 1.4rem;
}

.tech-stack {
    color: var(--accent-color);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    font-family: var(--font-display);
    background: #020a02;
    padding: 4px 10px;
    border-radius: 2px;
    border: 1px dashed var(--border-color);
    display: inline-block;
}

.project-content p {
    color: var(--terminal-dim);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* --- Experience Timeline as Sequence Log --- */
.timeline {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}

.timeline-line {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    transform: translateX(-50%);
    border-left: 2px dashed var(--border-color);
}

.timeline-item {
    display: flex;
    justify-content: flex-end;
    padding-right: 50%;
    position: relative;
    margin-bottom: 3.5rem;
    opacity: 1; /* Make visible by default and let JS trigger animate optionally */
    transform: none;
}

.timeline-item:nth-child(even) {
    justify-content: flex-start;
    padding-right: 0;
    padding-left: 50%;
}

.timeline-dot {
    position: absolute;
    left: 50%;
    top: 6px;
    transform: translateX(-50%);
    width: 14px;
    height: 14px;
    background: var(--accent-color);
    border: 3px solid #000;
    border-radius: 50%;
    z-index: 2;
    box-shadow: 0 0 10px var(--accent-color);
}

.timeline-content {
    width: 90%;
    background: #000500;
    padding: 1.5rem;
    border-radius: 4px;
    border: 2px solid var(--border-color);
    position: relative;
    transition: all 0.3s ease;
}

.timeline-content:hover {
    border-color: var(--accent-color);
    box-shadow: 0 0 15px var(--glow-color);
}

.timeline-item:nth-child(odd) .timeline-content {
    text-align: right;
}

.timeline-date {
    color: var(--accent-color);
    font-family: var(--font-mono);
    font-size: 1.05rem;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.timeline-content h3 {
    font-family: var(--font-mono);
    color: #fff;
    font-size: 1.25rem;
}

.timeline-content h4 {
    color: var(--terminal-dim);
    margin-bottom: 1rem;
    font-family: var(--font-mono);
    font-weight: normal;
    font-size: 0.9rem;
}

.timeline-content p {
    color: var(--terminal-dim);
    font-size: 0.85rem;
    line-height: 1.5;
}

/* --- Certifications Section --- */
.certs-container {
    width: 100%;
    height: 400px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.certs-labels {
    display: flex;
    justify-content: space-around;
    max-width: 800px;
    margin: 1.5rem auto 0 auto;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.95rem;
    color: var(--accent-color);
    text-shadow: 0 0 5px var(--glow-color);
}

.cert-label {
    flex: 1;
    padding: 0 10px;
}

/* --- Contact Section --- */
.contact-section {
    text-align: center;
    padding-bottom: 8rem;
}

.contact-title {
    font-size: clamp(2rem, 5vw, 4.5rem);
    margin-bottom: 4rem;
    color: #fff;
    font-family: var(--font-mono);
    text-shadow: 0 0 10px var(--glow-color);
}

.contact-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.contact-link {
    font-size: 1.1rem;
    font-family: var(--font-mono);
    padding: 0.8rem 1.8rem;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    background: #000500;
    color: var(--accent-color);
    transition: all 0.3s ease;
}

.contact-link:hover {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: #000;
    font-weight: bold;
    box-shadow: 0 0 15px var(--glow-color);
    transform: translateY(-5px);
}

/* --- Responsive CSS --- */
@media (max-width: 900px) {
    .navbar {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.8rem 5%;
    }

    .nav-links {
        width: 100%;
        justify-content: center;
    }

    .nav-links a {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 768px) {
    .timeline-line {
        left: 20px;
    }

    .timeline-item,
    .timeline-item:nth-child(even) {
        justify-content: flex-start;
        padding-left: 50px;
        padding-right: 0;
        margin-bottom: 2.5rem;
    }

    .timeline-dot {
        left: 20px;
    }

    .timeline-item:nth-child(odd) .timeline-content {
        text-align: left;
    }

    .certs-labels {
        flex-direction: column;
        gap: 1rem;
    }

    /* Responsive Hero & 3D Elements */
    #hero-orbit-container {
        width: 350px;
        height: 350px;
    }
    .hero-middle {
        height: 240px;
    }
    .avatar-container {
        width: 140px;
        height: 140px;
    }
    .hero-title {
        font-size: clamp(2.2rem, 7vw, 5rem);
    }
    .certs-container {
        height: 300px;
    }
}

@media (max-width: 600px) {
    .section {
        padding: 4rem 4%;
    }
    .section-title {
        font-size: 1.5rem;
    }
    .section-title::after {
        font-size: 1.1rem;
    }
    .terminal-widget {
        margin-top: 10px;
    }
    .terminal-body {
        padding: 12px;
        height: 280px;
        font-size: 0.8rem;
    }
    .terminal-input-element {
        font-size: 0.8rem !important;
    }
    .terminal-legend {
        font-size: 0.7rem;
        padding: 8px 12px;
    }
}

@media (max-width: 480px) {
    /* Hide Host on narrow screens to make room for terminal inputs */
    .prompt-host {
        display: none;
    }
    #hero-orbit-container {
        width: 260px;
        height: 260px;
    }
    .hero-middle {
        height: 190px;
    }
    .avatar-container {
        width: 110px;
        height: 110px;
    }
    .contact-links {
        gap: 1rem;
    }
    .contact-link {
        font-size: 0.95rem;
        padding: 0.6rem 1.2rem;
        width: 100%;
        text-align: center;
    }
}