:root {
    /* Darcula / JetBrains Dark Theme Inspired */
    --bg-color: #2b2b2b;
    --card-bg: #3c3f41;
    --text-primary: #a9b7c6;
    --text-secondary: #808080;

    /* Accents */
    --accent: #cc7832;
    /* Orange (Keywords in Darcula) */
    --link-color: #287bde;
    /* Blue */
    --string-color: #6a8759;
    /* Green */
    --number-color: #6897bb;
    /* Light Blue */
    --keyword-color: #cc7832;
    /* Orange */

    --accent-glow: rgba(204, 120, 50, 0.15);
    --nav-bg: rgba(43, 43, 43, 0.95);

    --font-sans: 'Inter', -apple-system, system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --easing: cubic-bezier(0.645, 0.045, 0.355, 1);
    --transition: all 0.25s var(--easing);
}

body.light-mode {
    /* IntelliJ Light Theme Inspired */
    --bg-color: #ffffff;
    --card-bg: #f2f2f2;
    --text-primary: #000000;
    --text-secondary: #5f5f5f;
    --accent: #0033cc;
    /* Dark Blue */
    --link-color: #0066cc;
    --accent-glow: rgba(0, 51, 204, 0.1);
    --nav-bg: rgba(255, 255, 255, 0.95);
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color 0.3s var(--easing), color 0.3s var(--easing);
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    display: block;
}

/* Background Canvas */
#background-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.4;
    pointer-events: none;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-primary);
    font-weight: 700;
}

.highlight {
    color: var(--accent);
}

.section-title {
    font-family: var(--font-mono);
    font-size: clamp(20px, 4vw, 32px);
    margin-bottom: 40px;
    display: flex;
    align-items: center;
    gap: 15px;
    white-space: nowrap;
}

.section-title::after {
    content: "";
    display: block;
    height: 1px;
    width: 100%;
    background-color: var(--text-secondary);
    opacity: 0.3;
}

p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 100;
    padding: 15px 0;
    background: var(--nav-bg);
    border-bottom: 1px solid rgba(128, 128, 128, 0.2);
    transition: transform 0.3s var(--easing);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    font-family: var(--font-mono);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent);
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 30px;
}

.nav-list {
    display: flex;
    gap: 25px;
}

.nav-link {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-primary);
}

.nav-link:hover {
    color: var(--accent);
}

.theme-toggle {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 5px;
    transition: var(--transition);
}

.sun-icon {
    display: block;
}

.moon-icon {
    display: none;
}

body.light-mode .sun-icon {
    display: none;
}

body.light-mode .moon-icon {
    display: block;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 6px;
    cursor: pointer;
}

.nav-toggle span {
    width: 25px;
    height: 2px;
    background-color: var(--accent);
}

/* Container */
.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Sections */
.section {
    padding: 60px 0;
}

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

.hero-container {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 40px;
    align-items: center;
}

.hero-left {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hero-right {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.hero-bottom {
    grid-column: 1 / -1;
    margin-top: 40px;
}

.glitch-text {
    font-size: clamp(36px, 6vw, 64px);
    line-height: 1.1;
    margin-bottom: 20px;
    color: var(--accent);
}

.hero-bio {
    text-align: justify;
    max-width: 600px;
}

/* Typing Animation */
.typing-container {
    font-family: var(--font-mono);
    font-size: 1rem;
    color: var(--string-color);
    /* Green string style */
    margin-top: 20px;
    height: 1.5em;
    width: 100%;
    text-align: center;
}

.cursor {
    animation: blink 1s infinite step-end;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

/* Tech Chips Full Width */
.tech-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.tech-chip {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-primary);
    background: var(--card-bg);
    border: 1px solid var(--text-secondary);
    padding: 5px 10px;
    border-radius: 4px;
    transition: var(--transition);
}

.tech-chip:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Hero Image B&W to Color */
.image-wrapper-clean {
    width: 250px;
    height: 250px;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid var(--card-bg);
    /* Subtle border */
    transition: border-color 0.3s;
}

.image-wrapper-clean:hover {
    border-color: var(--accent);
}

.profile-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(100%);
    /* Black and White by default */
    transition: filter 0.4s ease-in-out;
}

.profile-img:hover {
    filter: grayscale(0%);
    /* Color on hover */
}

/* Scrollable Widgets */
.scrollable-widget {
    max-height: 500px;
    overflow-y: auto;
    padding-right: 10px;
    scrollbar-width: thin;
    scrollbar-color: var(--accent) var(--bg-color);
}

.scrollable-widget::-webkit-scrollbar {
    width: 6px;
}

.scrollable-widget::-webkit-scrollbar-track {
    background: var(--bg-color);
}

.scrollable-widget::-webkit-scrollbar-thumb {
    background-color: var(--text-secondary);
    border-radius: 6px;
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: 4px;
    /* More rectangular */
    padding: 20px;
    transition: var(--transition);
    border: 1px solid transparent;
    /* Subtle border for shape validation */
}

.card:hover {
    /* transform: translateY(-5px); reduced motion */
    border-color: var(--text-secondary);
}

.card-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.card-title {
    font-size: 1.05rem;
    color: var(--accent);
}

.card-subtitle {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Education Grid (Horizontal) */
.education-grid {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding-bottom: 15px;
}

.edu-card-small {
    min-width: 260px;
    flex: 0 0 auto;
    background: var(--card-bg);
    padding: 15px;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.edu-card-small:hover {
    background-color: #45494a;
    border-color: var(--text-secondary);
}

.edu-click-hint {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 8px;
    font-style: italic;
    opacity: 0.5;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 200;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    display: none;
    /* Initially hidden */
}

.modal[style*="display: block"] {
    /* Correction for JS display handling */
    display: flex !important;
}

.modal-content {
    background-color: var(--card-bg);
    padding: 25px;
    border: 1px solid var(--text-secondary);
    width: 90%;
    max-width: 600px;
    border-radius: 4px;
    position: relative;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    max-height: 80vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.close-modal {
    color: var(--text-secondary);
    align-self: flex-end;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    margin-bottom: 5px;
}

.close-modal:hover {
    color: var(--accent);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--text-secondary);
    padding-bottom: 5px;
    overflow-x: auto;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 5px 10px;
    position: relative;
    white-space: nowrap;
    border-radius: 4px 4px 0 0;
}

.tab-btn:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    color: var(--accent);
    background-color: var(--card-bg);
    border-top: 2px solid var(--accent);
}

/* New Skills (Simple Static Grid) */
.skills-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
}

.skill-category h3 {
    text-align: left;
    margin-bottom: 15px;
    color: var(--accent);
    font-size: 1rem;
    font-family: var(--font-mono);
    padding-left: 5px;
}

.skill-box {
    display: flex;
    flex-wrap: wrap;
    /* Wraps to next line */
    gap: 12px;
    /* Tightly packed but breathable */
    padding: 5px 0;
}

/* Removed .skill-track and @keyframes scroll for simplicity */

.skill-chip-small {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-primary);
    background: var(--card-bg);
    /* Adaptive background */
    border: 1px solid var(--text-secondary);
    /* Adaptive border */
    padding: 6px 14px;
    border-radius: 4px;
    transition: var(--transition);
    white-space: nowrap;
    display: inline-block;
}

.skill-chip-small:hover {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Publications */
.publications-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.pub-item {
    background: var(--card-bg);
    padding: 15px;
    border-radius: 2px;
    border-left: 2px solid var(--accent);
}

/* Projects & Blog Cards */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.project-card {
    background: var(--card-bg);
    border-radius: 2px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    margin-bottom: 5px;
}

.project-img-wrapper {
    height: 160px;
    overflow: hidden;
}

.project-img-wrapper img {
    height: 100%;
    width: 100%;
    object-fit: cover;
    transition: 0.3s;
}

.project-card:hover img {
    transform: scale(1.05);
}

.project-content {
    padding: 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.project-tech-stack {
    margin-top: auto;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Talks Grid */
.talks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* Footer & Contacts */
#footer {
    padding: 40px 0 20px;
    background: var(--nav-bg);
    margin-top: 50px;
    text-align: center;
    border-top: 1px solid rgba(128, 128, 128, 0.2);
}

.footer-contacts {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.social-links-footer {
    display: flex;
    gap: 25px;
    font-size: 1.8rem;
}

.social-icon {
    color: var(--text-secondary);
    transition: var(--transition);
}

.social-icon:hover {
    color: var(--accent);
    transform: translateY(-2px);
}

.email-link {
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

.email-link:hover {
    color: var(--accent);
}

/* Responsive */
@media (max-width: 768px) {
    .hero-container {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-bio {
        text-align: left;
    }

    .hero-right {
        order: -1;
        margin-bottom: 30px;
    }

    .tech-stack {
        justify-content: center;
    }

    .nav-list {
        display: none;
    }

    .nav-toggle {
        display: flex;
    }

    .active .nav-list {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 60px;
        right: 0;
        width: 100%;
        background: var(--nav-bg);
        padding: 20px;
        border-bottom: 1px solid var(--accent);
    }
}