:root {
    /* Light Theme */
    --bg-color: #f8fafc;
    --text-color: #0f172a;
    --text-secondary: #475569;
    --primary-color: #3b82f6;
    --card-bg: rgba(255, 255, 255, 0.7);
    --card-border: rgba(255, 255, 255, 0.5);
    --nav-bg: rgba(248, 250, 252, 0.8);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --line-color: #e2e8f0;
}

[data-theme="dark"] {
    /* Dark Theme */
    --bg-color: #0f172a;
    --text-color: #f8fafc;
    --text-secondary: #94a3b8;
    --primary-color: #60a5fa;
    --card-bg: rgba(30, 41, 59, 0.7);
    --card-border: rgba(255, 255, 255, 0.05);
    --nav-bg: rgba(15, 23, 42, 0.8);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --line-color: #334155;
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

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

/* Typography */
h1, h2, h3, h4 {
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.4rem;
}

h1 { font-size: 3rem; letter-spacing: -0.02em; }
h2 { font-size: 2rem; margin-bottom: 1.5rem; } /* Tighter margins */
h3 { font-size: 1.25rem; }
h4 { font-size: 1rem; color: var(--text-secondary); font-weight: 500; }
p { color: var(--text-secondary); }

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--card-border);
    transition: padding 0.3s ease;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.8rem 2rem; /* 20% smaller padding */
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    font-weight: 700;
    font-size: 1.15rem;
    text-decoration: none;
    color: var(--text-color);
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 1.5rem; /* Closer links */
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    transition: color 0.2s ease;
}

.nav-links a:hover {
    color: var(--primary-color);
}

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.theme-toggle:hover {
    background-color: var(--line-color);
}

.hidden {
    display: none;
}

/* Utility Classes */
.section {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 2rem; /* Reduced from 4rem to halve the space between sections */
}

#about {
    padding-top: 0;
}

.section-title {
    text-align: left;
    position: relative;
    padding-bottom: 0.4rem;
}

.section-title::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    width: 60px;
    background-color: var(--primary-color);
    border-radius: 2px;
}

.subsection-title {
    font-size: 1.5rem;
    color: var(--text-color);
    margin-top: 2rem;
    margin-bottom: 1.25rem;
    font-weight: 600;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 12px; /* Slightly less rounded */
    padding: 1.25rem 1.5rem; /* Reduced padding from 2rem */
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Hero Section */
.hero {
    min-height: auto;
    display: flex;
    align-items: center;
    padding-top: 6rem; /* Reduced from 8rem */
    padding-bottom: 0.5rem; /* Reduced from 1.5rem */
}

.hero-content {
    display: flex;
    align-items: center;
    gap: 3rem; /* Tighter gap */
    width: 100%;
}

.hero-text {
    flex: 1;
}

.subtitle {
    color: var(--primary-color);
    font-size: 1.35rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.primary-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.9rem;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    margin-top: 1rem; /* Reduced from 1.5rem */
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.primary-btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.hero-image-container {
    flex-shrink: 0;
}

.hero-image {
    width: 260px; /* Reduced from 300px */
    height: 260px;
    object-fit: cover;
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    box-shadow: var(--shadow);
    animation: blob-bounce 8s infinite alternate;
}

@keyframes blob-bounce {
    0% { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; }
    100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
}

/* Timeline (Education & Experience) */
.timeline {
    position: relative;
    padding-left: 1.5rem; /* Reduced */
}

.timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: var(--line-color);
}

.timeline-item {
    position: relative;
    margin-bottom: 1.5rem; /* Reduced from 3rem. Major compacting! */
}

.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: -1.5rem;
    top: 1.25rem;
    width: 14px; /* Reduced */
    height: 14px;
    border-radius: 50%;
    background-color: var(--primary-color);
    border: 3px solid var(--bg-color);
    box-shadow: 0 0 0 2px var(--primary-color);
}

.timeline-content {
    position: relative;
}

.timeline-content .date {
    position: absolute;
    top: -0.75rem;
    right: 1.5rem;
    background-color: var(--primary-color);
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 99px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Card Grid (Research & Presentations) */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); /* slightly narrower min width */
    gap: 1.25rem; /* Reduced from 2rem */
}

.interactive-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 12px -3px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .interactive-card:hover {
    box-shadow: 0 8px 12px -3px rgba(0, 0, 0, 0.8);
}

.card-tag {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    background-color: var(--primary-color);
    color: white;
    border-radius: 6px;
    font-size: 0.70rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.text-link {
    display: inline-block;
    margin-top: 0.75rem;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
}

.text-link:hover {
    text-decoration: underline;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 1rem;
    border-top: 1px solid var(--line-color);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Animations */
.fade-in {
    opacity: 0;
    transform: translateY(20px); /* Lower translate distance */
    transition: opacity 0.6s ease-out, transform 0.6s ease-out; /* Faster transitions */
}

.fade-in.appear {
    opacity: 1;
    transform: translateY(0);
}

/* Responsive Design */
@media (max-width: 768px) {
    .section { padding: 3rem 1.5rem; }
    
    .hero-content {
        flex-direction: column-reverse;
        text-align: center;
        gap: 1.5rem;
    }
    
    .hero-image {
        width: 220px;
        height: 220px;
    }
    
    .nav-links {
        display: none;
    }
    
    .timeline-content .date {
        position: static;
        display: inline-block;
        margin-top: 0.75rem;
    }
    
    h1 { font-size: 2.5rem; }
    h2 { font-size: 1.75rem; }
}
