/* --- Google Fonts & Global Styles --- */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@700&family=Fira+Code:wght@400;500&display=swap');

:root {
    --dark-navy: #0a192f;
    --light-navy: #112240;
    --lightest-navy: #233554;
    --slate: #8892b0;
    --light-slate: #a8b2d1;
    --lightest-slate: #ccd6f6;
    --white: #e6f1ff;
    --accent-color: #64ffda; /* Neon Cyan/Green */
    --font-sans: 'Fira Code', sans-serif;
    --font-mono: 'Fira Code', monospace;
    --font-heading: 'Orbitron', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background-color: var(--dark-navy);
    color: var(--slate);
    line-height: 1.6;
}

/* --- Reusable Components & Layout --- */
section {
    padding: 100px 15%;
}

.section-heading {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    color: var(--white);
    margin-bottom: 40px;
    text-align: center;
    position: relative;
}
/* Adds a decorative line */
.section-heading::after {
    content: '';
    display: block;
    width: 80px;
    height: 2px;
    background: var(--accent-color);
    margin: 10px auto 0;
}

/* --- Header & Navigation --- */
header {
    background-color: rgba(10, 25, 47, 0.85);
    backdrop-filter: blur(10px);
    padding: 1rem 5%;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    transition: top 0.3s;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

nav .logo {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-color);
}

nav ul {
    list-style: none;
    display: flex;
    gap: 25px;
}

nav a {
    text-decoration: none;
    color: var(--lightest-slate);
    font-family: var(--font-mono);
    transition: color 0.3s ease;
}

nav a:hover, nav a.active {
    color: var(--accent-color);
}


/* --- Hero Section --- */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    text-align: left;
    padding: 0 15%;
    position: relative;
    overflow: hidden;
}

.hero-video-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
    filter: blur(3px);
}

.hero-video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        135deg,
        rgba(10, 25, 47, 0.92) 0%,
        rgba(17, 34, 64, 0.88) 50%,
        rgba(10, 25, 47, 0.92) 100%
    );
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
}

.hero .intro-text {
    color: var(--accent-color);
    font-family: var(--font-mono);
    margin-bottom: 20px;
}

.hero h1 {
    font-family: var(--font-heading);
    font-size: clamp(40px, 8vw, 80px); /* Responsive font size */
    color: var(--white);
    margin-bottom: 10px;
}

.hero .subtitle {
    font-family: var(--font-heading);
    font-size: clamp(30px, 6vw, 60px); /* Responsive font size */
    color: var(--light-slate);
    margin-bottom: 25px;
}

.hero .description {
    max-width: 550px;
    color: var(--slate);
    margin-bottom: 40px;
}

.cta-button {
    background-color: transparent;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    padding: 12px 25px;
    text-decoration: none;
    border-radius: 5px;
    font-family: var(--font-mono);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.cta-button:hover {
    background-color: rgba(100, 255, 218, 0.1);
}


/* --- About Section --- */
.about-container {
    display: flex;
    gap: 40px;
    align-items: flex-start;
    text-align: left;
    max-width: 900px;
    margin: 0 auto;
}
.about-text { flex: 2; }
.skills { flex: 1; }
.skill-tags { display: flex; flex-wrap: wrap; gap: 10px; font-family: var(--font-mono); }
.skill-tags span { background-color: var(--light-navy); color: var(--accent-color); padding: 5px 10px; border-radius: 3px; font-size: 0.9rem; }

/* --- Tech Stack Section --- */
#stack {
    position: relative;
    overflow: hidden;
}

.stack-video-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
    filter: blur(4px);
}

.stack-video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        135deg,
        rgba(10, 25, 47, 0.93) 0%,
        rgba(17, 34, 64, 0.90) 50%,
        rgba(10, 25, 47, 0.93) 100%
    );
    z-index: 1;
}

#stack .section-heading,
#stack .stack-grid {
    position: relative;
    z-index: 2;
}

.stack-subtitle {
    text-align: center;
    margin-bottom: 24px;
    color: var(--light-slate);
    position: relative;
    z-index: 2;
}

.stack-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 14px;
}

.stack-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 10px;
    border-radius: 10px;
    background: rgba(17, 34, 64, 0.75);
    border: 1px solid var(--lightest-navy);
    text-align: center;
}

.stack-item.loading {
    grid-column: 1 / -1;
}

.stack-icon {
    width: 34px;
    height: 34px;
}

.stack-fallback {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    display: grid;
    place-items: center;
    font-family: var(--font-mono);
    font-size: 0.7rem;
}

.stack-item p {
    font-family: var(--font-mono);
    color: var(--lightest-slate);
    font-size: 0.85rem;
}

/* --- Projects Section --- */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}
.project-card {
    background-color: var(--light-navy);
    padding: 25px;
    border-radius: 5px;
    box-shadow: 0 10px 30px -15px rgba(2,12,27,0.7);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-align: left;
}
.project-card:hover {
    transform: translateY(-7px);
    box-shadow: 0 0 15px rgba(100, 255, 218, 0.2);
}
.project-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.project-header .fa-folder-open { font-size: 2.5rem; color: var(--accent-color); }
.project-links a { color: var(--light-slate); margin-left: 15px; font-size: 1.2rem; transition: color 0.3s; }
.project-links a:hover { color: var(--accent-color); }
.project-card h3 { color: var(--white); font-family: var(--font-heading); margin-bottom: 10px; }
.project-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}
.repo-star-badge,
.repo-updated-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    border: 1px solid var(--lightest-navy);
    background: rgba(35, 53, 84, 0.8);
    color: var(--lightest-slate);
}
.project-tech-list { list-style: none; display: flex; flex-wrap: wrap; gap: 15px; margin-top: 15px; font-family: var(--font-mono); font-size: 0.8rem; color: var(--slate); }

/* --- Contact Section --- */
#contact {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
    padding-bottom: 150px;
}
#contact p { margin-bottom: 30px; }
#contact .cta-button { margin: 0 8px 10px; display: inline-block; }
.contact-links {
    margin-top: 40px;
    display: flex;
    justify-content: center;
    gap: 30px;
}
.contact-links a {
    color: var(--light-slate);
    font-size: 1.5rem;
    transition: color 0.3s, transform 0.3s;
}
.contact-links a:hover {
    color: var(--accent-color);
    transform: translateY(-5px);
}

/* --- Footer --- */
footer {
    text-align: center;
    padding: 20px 5% 100px;
    font-family: var(--font-mono);
    color: var(--slate);
    font-size: 0.8rem;
    position: relative;
    z-index: 1;
}

/* --- Video Intro Splash Screen --- */
.video-intro {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--dark-navy);
    z-index: 10000;
    opacity: 1;
    transition: opacity 0.8s ease-out;
}

.video-intro.fade-out {
    opacity: 0;
    pointer-events: none;
}

.intro-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

.intro-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 25, 47, 0.4);
    z-index: 2;
}

.intro-content {
    position: relative;
    z-index: 3;
    text-align: center;
    color: var(--white);
    animation: fadeInUp 1s ease-out 0.5s both;
}

.intro-title {
    font-family: var(--font-heading);
    font-size: clamp(2rem, 8vw, 4rem);
    color: var(--accent-color);
    margin-bottom: 20px;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.intro-subtitle {
    font-family: var(--font-mono);
    font-size: clamp(1rem, 3vw, 1.5rem);
    color: var(--lightest-slate);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    animation: blink 1.5s infinite 1s;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes blink {
    0%, 50%, 100% { opacity: 1; }
    25%, 75% { opacity: 0.7; }
}

/* --- Chatbot --- */
.chatbot-toggle {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 50%;
    background: var(--accent-color);
    color: var(--dark-navy);
    font-size: 1.25rem;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(2, 12, 27, 0.5);
    z-index: 9999;
    transition: transform 0.3s ease;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
}

.chatbot-panel {
    position: fixed;
    right: 20px;
    bottom: 90px;
    left: auto;
    
    /* Use clamp for better fullscreen handling */
    width: clamp(300px, calc(100vw - 60px), 380px);
    
    height: 550px;
    max-height: calc(100vh - 120px);
    background: var(--light-navy);
    border: 1px solid var(--lightest-navy);
    border-radius: 12px;
    box-shadow: 0 14px 35px rgba(2, 12, 27, 0.7);
    overflow: hidden;
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 9998;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.chatbot-panel.open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.chatbot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--lightest-navy);
    padding: 16px 16px;
    flex-shrink: 0;
    box-sizing: border-box;
    width: 100%;
}

.chatbot-header h3 {
    color: var(--white);
    font-size: 1.1rem;
    font-family: var(--font-heading);
    margin: 0;
    flex: 1;
}

.chatbot-mode {
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    background: rgba(100, 255, 218, 0.18);
    color: var(--accent-color);
    border: 1px solid rgba(100, 255, 218, 0.35);
    vertical-align: middle;
}

.chatbot-header button {
    border: none;
    background: transparent;
    color: var(--lightest-slate);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 4px 8px;
    transition: color 0.2s ease;
    flex-shrink: 0;
    box-sizing: border-box;
}

.chatbot-header button:hover {
    color: var(--accent-color);
}

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 350px;
    width: 100%;
    box-sizing: border-box;
}

.chatbot-message {
    max-width: 85%;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 0.95rem;
    line-height: 1.5;
    box-sizing: border-box;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.chatbot-message.bot {
    align-self: flex-start;
    background: rgba(100, 255, 218, 0.12);
    color: var(--lightest-slate);
    border: 1px solid rgba(100, 255, 218, 0.2);
}

.chatbot-message.user {
    align-self: flex-end;
    background: rgba(35, 53, 84, 0.95);
    color: var(--white);
    border: 1px solid var(--lightest-navy);
}

.chatbot-message.pending {
    opacity: 0.75;
    font-style: italic;
}

.chatbot-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    padding: 16px;
    border-top: 1px solid var(--lightest-navy);
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
}

.chatbot-form input {
    background: #0b1b33;
    border: 1px solid var(--lightest-navy);
    color: var(--white);
    border-radius: 6px;
    padding: 12px 14px;
    outline: none;
    font-size: 0.95rem;
    font-family: var(--font-sans);
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
}

.chatbot-form input:focus {
    border-color: var(--accent-color);
}

.chatbot-form button {
    border: 1px solid var(--accent-color);
    background: transparent;
    color: var(--accent-color);
    border-radius: 6px;
    padding: 12px 16px;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    transition: all 0.2s ease;
    box-sizing: border-box;
    white-space: nowrap;
    flex-shrink: 0;
}

.chatbot-form button:hover {
    background: var(--accent-color);
    color: var(--dark-navy);
}

/* --- Animations --- */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Responsive Design --- */
@media (max-width: 768px) {
    section { padding: 80px 10%; }
    nav ul { display: none; } /* On mobile, consider a hamburger menu for a full experience */
    .about-container { flex-direction: column; }
    .hero { text-align: center; }
    .hero .description { margin: 0 auto 40px; }
    .chatbot-toggle {
        right: 16px;
        bottom: 16px;
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
    .chatbot-panel {
        right: 8px;
        left: 8px;
        bottom: 90px;
        width: auto;
        height: 500px;
        max-height: calc(100vh - 110px);
    }
    .chatbot-messages {
        min-height: 300px;
    }
}