:root {
    --bg: #0a0a0b;
    --bg-elevated: #111113;
    --bg-card: #161618;
    --border: #232326;
    --text: #e4e4e7;
    --text-muted: #8b8b8e;
    --text-dim: #555558;
    --accent: #6dc589;
    --accent-soft: rgba(109, 197, 137, 0.12);
    --accent-glow: rgba(109, 197, 137, 0.25);
    --radius: 10px;
    --radius-sm: 6px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 20px;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: #8ddb8d;
}

nav {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 220px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2rem 1.5rem;
    background: rgba(10, 10, 11, 0.9);
    backdrop-filter: blur(16px);
    border-right: 1px solid var(--border);
}

.nav-logo {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--accent) !important;
    letter-spacing: 0.5px;
    margin-bottom: 2rem;
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.nav-links a {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.2s;
    position: relative;
    padding-left: 1rem;
}

.nav-links a::after {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 0;
    background: var(--accent);
    transition: height 0.2s;
    border-radius: 1px;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text);
}

.nav-links a:hover::after,
.nav-links a.active::after {
    height: 100%;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: all 0.3s;
}

main {
    max-width: 820px;
    margin: 0 auto;
    padding: 0 1.5rem 0 1.5rem;
    margin-left: 220px;
}

section {
    padding: 5rem 0;
}

.hero {
    padding-top: 2rem;
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
}

.hero-content {
    display: grid;
    gap: 3rem;
}

.hero-greeting {
    font-size: 1rem;
    color: var(--accent);
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -1.5px;
    margin-bottom: 0.5rem;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-bottom: 1.5rem;
}

.hero-bio {
    font-size: 1rem;
    color: var(--text-muted);
    max-width: 560px;
    line-height: 1.8;
    margin-bottom: 2rem;
}

.hero-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.link-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
}

.link-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

.link-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.hero-details {
    display: grid;
    grid-template-columns: 1.5fr 1fr; /* make Research wider than Languages */
    gap: 1.5rem;
}

.detail-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.detail-card h3 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.detail-card ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.detail-card li {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.detail-card li strong {
    color: var(--text);
}

.tech-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.tech-tags span {
    font-size: 0.8rem; /* match language tags for visual balance */
    padding: 0.25rem 0.6rem;
    background: var(--accent-soft);
    border: 1px solid rgba(109, 197, 137, 0.15);
    border-radius: 100px;
    color: var(--accent);
    font-weight: 500;
    font-family: var(--font-mono);
}

/* Language tags override: larger, neutral color, proper flags */
.lang-tag {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    background: var(--accent-soft);
    border: 1px solid rgba(109, 197, 137, 0.15);
    color: var(--accent);
    border-radius: 100px;
    width: 100%; /* take full row */
}

/* Remove inner pill styling for language text */
.lang-tag span {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    font-family: var(--font);
}

/* Languages layout: one per line */
.languages {
    flex-direction: column;
    gap: 0.5rem;
}

/* Circular cropped icons */
.lang-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.lang-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* center-cropped circle */
    display: block;
}

.flag {
    width: 28px;
    height: 18px; /* rectangular ratio */
    border-radius: 3px;
    overflow: hidden;
    flex-shrink: 0;
}

.flag img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* prevents weird stretching */
    display: block;
}

.section-title {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 2.5rem;
    position: relative;
    padding-left: 1rem;
}

.section-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.3em;
    bottom: 0.3em;
    width: 3px;
    background: var(--accent);
    border-radius: 2px;
}

.section-content .extra {
    display: none;
}

.section-content.expanded .extra {
    display: contents;
}

.see-more {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 1.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.see-more:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.see-more svg {
    width: 14px;
    height: 14px;
    transition: transform 0.3s;
}

.section-content.expanded ~ .see-more svg {
    transform: rotate(180deg);
}

.timeline {
    position: relative;
    padding-left: 3.25rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 16px;
    top: 8px;
    bottom: 8px;
    width: 1px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    padding-bottom: 2.5rem;
}

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

.timeline-marker {
    position: absolute;
    left: -3rem;
    top: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--border);
    z-index: 1;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.timeline-marker img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.timeline-item:first-child .timeline-marker {
    border-color: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}

.timeline-date {
    font-size: 0.8rem;
    font-family: var(--font-mono);
    color: var(--accent);
    font-weight: 500;
}

.timeline-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0.25rem 0;
    letter-spacing: -0.2px;
}

.timeline-institution {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.timeline-detail {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-style: italic;
}

.timeline-content ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.timeline-content li {
    font-size: 0.9rem;
    color: var(--text-muted);
    padding-left: 1rem;
    position: relative;
}

.timeline-content li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--text-dim);
}

.timeline-projects {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

.thesis-block {
    margin-top: 0.75rem;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.thesis-block p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.papers-grid {
    display: grid;
    gap: 1.5rem;
}

.paper-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: border-color 0.2s, transform 0.2s;
}

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

.paper-venue {
    font-size: 0.75rem;
    font-family: var(--font-mono);
    color: var(--accent);
    font-weight: 500;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.paper-card h3 {
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 0.35rem;
    letter-spacing: -0.2px;
}

.paper-authors {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.paper-abstract {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 1rem;
}

.paper-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.paper-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s;
}

.paper-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

.paper-btn svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.paper-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.paper-tag {
    font-size: 0.7rem;
    padding: 0.2rem 0.55rem;
    background: var(--accent-soft);
    border-radius: 100px;
    color: var(--accent);
    font-weight: 500;
    font-family: var(--font-mono);
}

a.paper-tag:hover {
    background: var(--accent);
    color: var(--bg);
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

.project-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    transition: border-color 0.2s, transform 0.2s;
}

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

.project-card-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.35rem;
}

.project-icon {
    color: var(--accent);
    flex-shrink: 0;
}

.project-icon svg {
    width: 20px;
    height: 20px;
}

.project-card h3 {
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: -0.2px;
}

.project-card p {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.5rem;
}

.project-tags span {
    font-size: 0.65rem;
    padding: 0.15rem 0.45rem;
    background: var(--accent-soft);
    border-radius: 100px;
    color: var(--accent);
    font-weight: 500;
    font-family: var(--font-mono);
}

.project-card.achievement {
    border-style: dashed;
}

footer {
    text-align: center;
    padding: 3rem 1.5rem;
    border-top: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 0.8rem;
}

@media (max-width: 768px) {
    nav {
        top: 0;
        bottom: auto;
        left: 0;
        right: 0;
        width: 100%;
        height: 60px;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 0 1rem;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .nav-logo {
        margin-bottom: 0;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        flex-direction: column;
        background: rgba(10, 10, 11, 0.95);
        backdrop-filter: blur(16px);
        border-bottom: 1px solid var(--border);
        padding: 1rem;
        gap: 0;
    }

    .nav-links.open {
        display: flex;
    }

    .nav-links a {
        padding: 0.75rem 0 0.75rem 0;
        border-bottom: 1px solid var(--border);
    }

    .nav-links a::after {
        display: none;
    }

    .nav-toggle {
        display: flex;
    }

    main {
        margin-left: 0;
    }

    .hero {
        padding-top: 6rem;
        min-height: auto;
    }

    .hero h1 {
        font-size: 2.5rem;
    }

    .hero-details {
        grid-template-columns: 1fr;
    }

    .hero-links {
        gap: 0.5rem;
    }

    .link-btn span {
        display: none;
    }

    .link-btn {
        padding: 0.6rem;
    }

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

    .timeline-projects {
        grid-template-columns: 1fr;
    }

    section {
        padding: 3rem 0;
    }
}

.fade-in {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

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