/* CSS Variables */
:root {
    --color-bg: #0a0a0a;
    --color-bg-secondary: #171717;
    --color-bg-card: #1f1f1f;
    --color-text: #fafafa;
    --color-text-muted: #a3a3a3;
    --color-primary: #ffffff;
    --color-primary-hover: #d4d4d4;
    --color-accent: #737373;
    --color-border: #2e2e2e;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --transition: 0.3s ease;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.2);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
}

h1 { font-size: clamp(2.5rem, 5vw, 4rem); }
h2 { font-size: clamp(1.75rem, 3vw, 2.5rem); }
h3 { font-size: clamp(1.25rem, 2vw, 1.5rem); }

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

a:hover {
    color: var(--color-accent);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(10, 10, 10, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

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

.nav-links a {
    color: var(--color-text-muted);
    font-weight: 500;
    transition: color var(--transition);
}

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

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

.nav-toggle span {
    display: block;
    width: 25px;
    height: 2px;
    background: var(--color-text);
    transition: var(--transition);
}

/* Language Switcher */
.lang-switcher {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 1.5rem;
}

.lang-switcher button {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all var(--transition);
}

.lang-switcher button:hover {
    color: var(--color-text);
}

.lang-switcher button.active {
    color: var(--color-primary);
    background: rgba(255, 255, 255, 0.1);
}

.lang-divider {
    color: var(--color-border);
    font-size: 0.85rem;
}

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

.hero-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.hero-text h1 {
    margin-bottom: 0.5rem;
}

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

.tagline {
    font-size: 1.5rem;
    color: var(--color-accent);
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.intro {
    color: var(--color-text-muted);
    font-size: 1.1rem;
    margin-bottom: 2rem;
    max-width: 500px;
}

.hero-cta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 8px;
    transition: all var(--transition);
    cursor: pointer;
    border: none;
}

.btn-primary {
    background: var(--color-primary);
    color: var(--color-bg);
}

.btn-primary:hover {
    background: var(--color-primary-hover);
    color: var(--color-bg);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: transparent;
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover {
    background: var(--color-bg-card);
    color: var(--color-text);
    border-color: var(--color-text-muted);
}

/* Hero Image */
.hero-image {
    display: flex;
    justify-content: center;
    align-items: center;
}

.profile-photo {
    width: 350px;
    height: 350px;
    border-radius: 50%;
    border: 2px solid var(--color-border);
    object-fit: cover;
}

.hero-image img {
    width: 350px;
    height: 350px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--color-border);
}

/* Sections */
section {
    padding: 6rem 0;
}

section h2 {
    margin-bottom: 3rem;
    text-align: center;
    position: relative;
}

section h2::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background: var(--color-primary);
    margin: 1rem auto 0;
    border-radius: 2px;
}

/* About Section */
.about {
    background: var(--color-bg-secondary);
}

.about p {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 1.1rem;
}

/* Projects Grid */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
}

.project-card {
    background: var(--color-bg-card);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--color-border);
    transition: all var(--transition);
    display: block;
    color: inherit;
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--color-primary);
    color: inherit;
}

.project-image {
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--color-bg-secondary);
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition);
}

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

.placeholder-image {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    font-size: 1.5rem;
    font-weight: 600;
}

.project-info {
    padding: 1.5rem;
}

.project-info h3 {
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

.project-info p {
    color: var(--color-text-muted);
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.project-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-primary);
    border-radius: 20px;
    font-size: 0.8rem;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

/* Experience + Projects Layout (index page) */
.experience {
    background: var(--color-bg-secondary);
}

.experience-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: start;
}

.experience-left h2,
.experience-right h2 {
    text-align: left;
}

.experience-left h2::after,
.experience-right h2::after {
    margin: 1rem 0 0;
}

.experience-intro {
    color: var(--color-text-muted);
    font-size: 1rem;
    margin-bottom: 2rem;
}

/* Timeline strip (left-aligned, no zigzag) */
.timeline-strip {
    position: relative;
    padding: 0.5rem 0;
}

.timeline-group {
    position: relative;
    padding: 1.5rem 0;
}

.timeline-group::before {
    content: '';
    position: absolute;
    left: 0.35rem;
    top: 3rem;
    bottom: 0.5rem;
    width: 2px;
    background: var(--color-border);
}

.timeline-group + .timeline-group {
    margin-top: 0.5rem;
}

.timeline-group-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--color-accent);
    margin-bottom: 1.25rem;
    padding-left: 1.75rem;
}

.timeline-group-label::before {
    content: '';
    display: inline-block;
    width: 1.25rem;
    height: 1px;
    background: var(--color-border);
    vertical-align: middle;
    margin-right: 0.5rem;
}

.timeline-node {
    position: relative;
    padding-left: 1.75rem;
    margin-bottom: 1.75rem;
}

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

.timeline-dot {
    position: absolute;
    left: 0;
    top: 0.25rem;
    width: 12px;
    height: 12px;
    background: var(--color-bg-secondary);
    border: 2px solid var(--color-primary);
    border-radius: 50%;
    z-index: 1;
}

.timeline-node:hover .timeline-dot {
    background: var(--color-primary);
}

.timeline-date {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--color-accent);
    margin-bottom: 0.15rem;
}

.timeline-label {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.15rem;
}

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

.timeline-cta {
    margin-top: 2rem;
}

/* Projects grid in right column */
.experience-right .project-grid {
    grid-template-columns: 1fr;
}

@media (max-width: 968px) {
    .experience-layout {
        grid-template-columns: 1fr;
        gap: 3rem;
    }

    .experience-left h2,
    .experience-right h2 {
        text-align: center;
    }

    .experience-left h2::after,
    .experience-right h2::after {
        margin: 1rem auto 0;
    }

    .experience-right .project-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

/* Biped Project Timeline (detail page) */
.project-timeline {
    position: relative;
    max-width: 900px;
    margin: 0 auto;
    padding: 1rem 0 1rem 2.5rem;
}

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

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

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

.timeline-era::before {
    content: '';
    position: absolute;
    left: -2.25rem;
    top: 0.5rem;
    width: 12px;
    height: 12px;
    background: var(--color-bg);
    border: 2px solid var(--color-primary);
    border-radius: 50%;
}

.era-header {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.era-period {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--color-accent);
    white-space: nowrap;
}

.era-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.era-features {
    color: var(--color-text-muted);
    padding-left: 1.25rem;
    margin: 0;
}

.era-features li {
    margin-bottom: 0.35rem;
    font-size: 0.95rem;
}

.era-features strong {
    color: var(--color-text);
}

.project-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1.5rem;
    max-width: 900px;
    margin: 0 auto 3rem;
    padding: 0 1.5rem;
}

.stat-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    display: block;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

@media (max-width: 480px) {
    .project-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Publications (inside experience-left column) */
.publications-heading {
    margin-top: 3rem;
}

.publication-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.publication-item {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    padding: 1.25rem 1.5rem;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    text-decoration: none;
    color: var(--color-text);
    transition: var(--transition);
}

.publication-item:hover {
    border-color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.publication-affiliations {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex-shrink: 0;
    min-width: 140px;
}

.affiliation-badge {
    display: block;
    width: 140px;
    padding: 0.25rem 0.6rem;
    background: rgba(100, 255, 218, 0.08);
    border: 1px solid var(--color-primary);
    border-radius: 6px;
    font-size: 0.75rem;
    color: var(--color-primary);
    white-space: nowrap;
    text-align: center;
    box-sizing: border-box;
}

.publication-body {
    flex: 1;
    min-width: 0;
}

.publication-body h3 {
    font-size: 1rem;
    margin-bottom: 0.35rem;
    line-height: 1.4;
}

.publication-authors {
    color: var(--color-text-muted);
    font-size: 0.875rem;
    margin-bottom: 0.2rem;
}

.publication-venue {
    color: var(--color-primary);
    font-size: 0.8rem;
    font-family: var(--font-mono);
}

.publication-link-icon {
    flex-shrink: 0;
    color: var(--color-text-muted);
    margin-top: 0.25rem;
    transition: var(--transition);
}

.publication-item:hover .publication-link-icon {
    color: var(--color-primary);
}

/* Contact Section */
.contact {
    background: var(--color-bg-secondary);
    text-align: center;
}

.contact p {
    color: var(--color-text-muted);
    margin-bottom: 2rem;
}

.contact-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.contact-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--color-text);
    padding: 0.75rem 1.5rem;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    transition: all var(--transition);
}

.contact-link:hover {
    background: var(--color-bg-card);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.contact-link svg {
    width: 20px;
    height: 20px;
}

/* Footer */
.footer {
    background: var(--color-bg);
    padding: 2rem 0;
    text-align: center;
    border-top: 1px solid var(--color-border);
}

.footer p {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

/* Project Page Styles */
.project-page {
    padding-top: 100px;
    min-height: 100vh;
}

.project-header {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    text-align: center;
}

.project-header h1 {
    margin-bottom: 1rem;
}

.project-meta {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--color-text-muted);
    margin-bottom: 2rem;
}

.back-link:hover {
    color: var(--color-primary);
}

/* Rerun Viewer Container */
.rerun-container {
    width: 100%;
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

.rerun-viewer {
    width: 100%;
    height: 600px;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    background: var(--color-bg-secondary);
}

.rerun-placeholder {
    width: 100%;
    height: 600px;
    border: 2px dashed var(--color-border);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    background: var(--color-bg-secondary);
}

.rerun-placeholder p {
    margin-bottom: 0.5rem;
}

.rerun-placeholder code {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--color-accent);
}

.project-hero-image {
    display: block;
    max-width: 100%;
    height: 600px;
    object-fit: contain;
    margin: 0 auto;
    border-radius: 12px;
}

/* Project Content */
.project-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

.project-content h2 {
    text-align: left;
    margin-top: 3rem;
    margin-bottom: 1.5rem;
}

.project-content h2::after {
    display: none;
}

.project-content p {
    color: var(--color-text-muted);
    margin-bottom: 1.5rem;
}

.project-content ul, .project-content ol {
    color: var(--color-text-muted);
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.project-content li {
    margin-bottom: 0.5rem;
}

.project-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1.5rem 0;
}

.project-content video {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1.5rem 0;
}

.project-content figure {
    margin: 2rem 0;
    text-align: center;
}

.project-content figcaption {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin-top: 0.5rem;
    font-style: italic;
}

/* Responsive Design */
@media (max-width: 968px) {
    .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 2rem;
    }

    .hero-text {
        order: 2;
    }

    .hero-image {
        order: 1;
    }

    .intro {
        margin: 0 auto 2rem;
    }

    .hero-cta {
        justify-content: center;
    }

    .profile-photo,
    .hero-image img {
        width: 250px;
        height: 250px;
    }
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        background: var(--color-bg);
        padding: 1rem;
        border-bottom: 1px solid var(--color-border);
        gap: 0;
    }

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

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

    .nav-links li:last-child {
        border-bottom: none;
    }

    .nav-toggle {
        display: flex;
    }

    .lang-switcher {
        margin-left: auto;
        margin-right: 1rem;
    }

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

    .publication-item {
        flex-direction: column;
        gap: 0.75rem;
    }

    .publication-affiliations {
        flex-direction: row;
        flex-wrap: wrap;
        min-width: 0;
    }

    section {
        padding: 4rem 0;
    }

    .rerun-viewer,
    .rerun-placeholder,
    .project-hero-image {
        height: 400px;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 2rem;
    }

    .tagline {
        font-size: 1.25rem;
    }

    .hero-cta {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .contact-links {
        flex-direction: column;
        align-items: center;
    }

    .contact-link {
        width: 100%;
        max-width: 250px;
        justify-content: center;
    }
}
