:root {
    --primary-bg: #0a0e17;
    --secondary-bg: #111827;
    --accent: #3b82f6;
    --accent-soft: #60a5fa;
    --text-primary: #e5e7eb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --border: #1f2937;
    --spacing: clamp(1rem, 3vw, 2rem);
}

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

body {
    font-family: 'Crimson Pro', serif;
    background: var(--primary-bg);
    color: var(--text-primary);
    line-height: 1.7;
    overflow-x: hidden;
}

/* Grid background effect */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(59, 130, 246, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(59, 130, 246, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: 0;
}

/* Navigation Bar */
nav {
    position: relative;
    z-index: 10;
    background: var(--secondary-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

.nav-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 1.5rem var(--spacing);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-name {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s;
}

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

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-links a {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
    position: relative;
}

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

.nav-links a.active {
    color: var(--accent);
}

.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--accent);
}

/* Theme Toggle */
.theme-toggle-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toggle-title {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 400;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.theme-toggle {
    background: var(--primary-bg);
    border: 1px solid var(--border);
    border-radius: 999px;
    width: 44px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 2px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.theme-toggle:hover {
    border-color: var(--accent);
}

.toggle-track {
    position: absolute;
    left: 0;
    top: 0;
    width: 44px;
    height: 22px;
    background: rgba(59,130,246,0.10);
    border-radius: 999px;
    z-index: 0;
}

.toggle-slider {
    position: absolute;
    left: 2px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    background: var(--accent);
    border-radius: 50%;
    display: inline-block;
    transition: transform 0.3s;
    box-shadow: 0 1px 3px 0 rgba(59,130,246,0.2);
    z-index: 1;
}

.toggle-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: var(--spacing);
    position: relative;
    z-index: 1;
}

/* Header area */
header {
    padding: 5rem 0 4rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4rem;
    animation: fadeInUp 0.8s ease-out;
    display: flex;
    gap: 3rem;
    align-items: center;
}

.header-content {
    flex: 1;
}

.profile-photo {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.profile-photo:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.4);
}

h1 {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 300;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-soft) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 300;
    letter-spacing: 0.05em;
    margin-bottom: 2rem;
}

.bio {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 800px;
    line-height: 1.8;
}

/* Section styles */
section {
    margin-bottom: 5rem;
    animation: fadeInUp 0.8s ease-out;
    animation-fill-mode: both;
}

section:nth-child(2) { animation-delay: 0.1s; }
section:nth-child(3) { animation-delay: 0.2s; }
section:nth-child(4) { animation-delay: 0.3s; }
section:nth-child(5) { animation-delay: 0.4s; }

h2 {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--accent);
    margin-bottom: 2.5rem;
    font-weight: 500;
    position: relative;
    display: inline-block;
}

h2::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 40px;
    height: 1px;
    background: var(--accent);
}

/* Research Areas */
.research-areas {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-top: 2rem;
}

.research-card {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: var(--accent-soft);
    transition: all 0.3s ease;
    position: relative;
}

.research-card:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

/* Timeline styles */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 6.5px;
    top: 8px;
    bottom: 0;
    width: 1px;
    background: linear-gradient(180deg, var(--accent) 0%, transparent 100%);
}

.timeline-item {
    margin-bottom: 3rem;
    position: relative;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -2rem;
    top: 8px;
    width: 9px;
    height: 9px;
    background: var(--accent);
    border-radius: 50%;
    border: 2px solid var(--primary-bg);
    box-shadow: 0 0 0 2px var(--accent);
}

.timeline-year {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
    color: var(--accent-soft);
    margin-bottom: 0.5rem;
}

.timeline-title {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
    font-weight: 600;
}

.timeline-org {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.timeline-org a {
    color: inherit;
    text-decoration: underline;
    transition: opacity 0.2s;
}

.timeline-org a:hover {
    opacity: 0.7;
}

.timeline-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Publications */
.publication-list {
    list-style: none;
}

.publication-list.two-column {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
}

.publication-item {
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border);
    transition: all 0.2s ease;
}

.publication-item:last-child {
    border-bottom: none;
}

.publication-list.two-column .publication-item:nth-last-child(-n+2) {
    border-bottom: none;
}

.publication-item:hover {
    padding-left: 1rem;
}

.pub-title {
    font-size: 1.05rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.pub-authors {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}

.pub-venue {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
    color: var(--accent-soft);
}

.pub-link {
    display: inline-block;
    margin-top: 0.5rem;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.pub-link:hover {
    border-bottom-color: var(--accent);
}

/* Contact */
.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.2rem;
    background: var(--secondary-bg);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.contact-item:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.contact-icon {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1.2rem;
    color: var(--accent);
}

.contact-info {
    flex: 1;
}

.contact-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.2rem;
}

.contact-value {
    font-size: 0.95rem;
    color: var(--text-primary);
}

.contact-value a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s;
}

.contact-value a:hover {
    color: var(--accent-soft);
}

/* Skills */
.skills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-top: 2rem;
}

.skill-tag {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: var(--accent-soft);
    transition: all 0.3s ease;
}

.skill-tag:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: var(--accent);
    transform: translateY(-2px);
}

/* Footer */
footer {
    text-align: center;
    padding: 3rem 0;
    border-top: 1px solid var(--border);
    margin-top: 6rem;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem var(--spacing);
    }

    .nav-left {
        flex-direction: column;
        gap: 1rem;
        width: 100%;
    }

    .nav-links {
        gap: 1.5rem;
    }

    .theme-toggle-container {
        justify-content: center;
    }

    header {
        padding: 3rem 0 2rem;
        margin-bottom: 3rem;
        flex-direction: column;
        text-align: center;
    }

    .profile-photo {
        width: 150px;
        height: 150px;
    }

    .timeline {
        padding-left: 1.5rem;
    }

    .timeline::before {
        left: 4.5px;
    }

    .timeline-item::before {
        left: -1.5rem;
    }

    .research-areas {
        grid-template-columns: 1fr;
    }

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

    .publication-list.two-column {
        grid-template-columns: 1fr;
    }
    /* fix mobile publication-item border display logic */
    .publication-list.two-column .publication-item {
        border-bottom: 1px solid var(--border) !important;
    }
    .publication-list.two-column .publication-item:last-child {
        border-bottom: none !important;
    }
}
