/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Smooth Scroll */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px; /* Offset for sticky header */
}

::selection {
    background: rgba(204, 0, 0, 0.2);
    color: inherit;
}

::-moz-selection {
    background: rgba(204, 0, 0, 0.2);
    color: inherit;
}

body {
    font-family: 'Lato', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 18px;
    line-height: 1.7;
    color: #222;
    background:
        url('voronoi-pattern.svg') repeat-x top,
        radial-gradient(circle, #d8d8d8 1px, transparent 1px) 0 300px,
        linear-gradient(to bottom, #fafafa 0%, #ffffff 300px);
    background-size:
        2400px 300px,
        24px 24px,
        100% 100%;
}

/* Navigation */
nav {
    background: #ffffff;
    border-bottom: 1px solid #e8eef3;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.nav-container {
    max-width: min(90%, 1200px);
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

nav a {
    color: #444;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    transition: color 0.2s;
    position: relative;
}

nav a:hover {
    color: #CC0000;
    text-decoration: none;
}

nav a.active {
    color: #CC0000;
}

/* Header */
header {
    max-width: min(90%, 1200px);
    margin: 0 auto;
    padding: 3.5rem 2rem 2.5rem;
    border-bottom: 3px solid #e8eef3;
}

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

h1 {
    font-family: 'Noto Serif', Georgia, 'Times New Roman', serif;
    font-size: 2.8rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #0a1929;
    letter-spacing: -0.02em;
}

.cursor {
    display: inline-block;
    width: 3px;
    height: 0.7em;
    background-color: #CC0000;
    margin-left: 4px;
    animation: blink 1s step-end infinite;
    vertical-align: baseline;
    position: relative;
    top: 0.05em;
}

@keyframes blink {
    0%, 50% {
        opacity: 1;
    }
    51%, 100% {
        opacity: 0;
    }
}

.tagline {
    font-size: 1.15rem;
    color: #556677;
    line-height: 1.5;
    white-space: nowrap;
}

/* Header photo - subtle styling */
.header-photo {
    flex-shrink: 0;
    margin-left: 2rem;
}

.header-photo img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e8eef3;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    opacity: 0.9;
}

/* Main Content */
main {
    max-width: min(90%, 1200px);
    margin: 0 auto;
    padding: 0 2rem 4rem;
}

section {
    margin-top: 1.5rem;
    padding: 1rem 0;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease-out forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stagger animation for sections */
section:nth-child(1) { animation-delay: 0.1s; }
section:nth-child(2) { animation-delay: 0.2s; }
section:nth-child(3) { animation-delay: 0.3s; }
section:nth-child(4) { animation-delay: 0.4s; }
section:nth-child(5) { animation-delay: 0.5s; }
section:nth-child(6) { animation-delay: 0.6s; }
section:nth-child(7) { animation-delay: 0.7s; }
section:nth-child(8) { animation-delay: 0.8s; }

/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    section {
        animation: none;
        opacity: 1;
        transform: none;
    }
}

h2 {
    font-family: 'Noto Serif', Georgia, 'Times New Roman', serif;
    font-size: 1.9rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #0a1929;
    padding-bottom: 0.5rem;
    position: relative;
}

h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: #e1e8ed;
}

h3 {
    font-family: 'Noto Serif', Georgia, 'Times New Roman', serif;
    font-size: 1.35rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    color: #1a2a3a;
}

section > h3:first-of-type {
    margin-top: 0.5rem;
}

h4 {
    font-family: 'Noto Serif', Georgia, 'Times New Roman', serif;
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: #0a1929;
}

p {
    margin-bottom: 1rem;
}

/* Links - Subtle by default, visible on hover */
a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: #CC0000;
    text-decoration: none;
}

/* Meta Information */
.meta {
    color: #667788;
    font-size: 0.95rem;
    margin-bottom: 0.8rem;
    font-style: italic;
}

/* Job Entries */
.job {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
    border-left: 3px solid transparent;
    transition: border-color 0.2s;
}

.job:hover {
    border-left-color: #CC0000;
}

.job:hover a {
    color: #CC0000;
}

.job h3 {
    margin-top: 0;
    color: #0a1929;
}

.job p:last-child {
    margin-bottom: 0;
}

/* Collaborators */
.collaborator-list {
    list-style: none;
    margin-bottom: 1rem;
    line-height: 1.8;
    padding-left: 1.5rem;
    position: relative;
}

.collaborator-list::before {
    content: "▸";
    position: absolute;
    left: 0;
    color: #CC0000;
    font-size: 1rem;
}

.collaborator-list li {
    display: inline;
}

.collaborator-list li::after {
    content: ", ";
}

.collaborator-list li:last-child::after {
    content: "";
}

.collaborator-list a:hover {
    text-decoration: none;
}

/* Publications */
.publications-list {
    list-style: none;
    margin-bottom: 1rem;
}

.publications-list li {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
    position: relative;
    border-left: 3px solid transparent;
    transition: border-color 0.2s;
}

.publications-list li:hover {
    border-left-color: #CC0000;
}

.publications-list li:hover a {
    color: #CC0000;
}

.pub-title {
    font-size: 1.05rem;
    font-weight: 500;
    color: #0a1929;
    margin-bottom: 0.3rem;
    line-height: 1.4;
}

.pub-authors {
    font-size: 0.9rem;
    color: #667788;
    margin-bottom: 0.25rem;
    font-style: italic;
}

.pub-venue {
    font-size: 1rem;
    margin-bottom: 0.3rem;
    margin-top: 0.1rem;
}

.pub-venue a {
    color: #1a2a3a;
    font-weight: 500;
    padding: 0.05rem 0.25rem;
    background: #f5f7fa;
    border-radius: 2px;
    display: inline-block;
    transition: all 0.2s;
}

.pub-venue a:hover {
    color: #CC0000;
    background: #fff0f0;
    text-decoration: none;
}

.report-links {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.9rem;
}

.report-links a {
    color: #667788;
}

.report-links a:hover {
    color: #CC0000;
    text-decoration: none;
}

.scholar-link {
    margin-top: 1.5rem;
    margin-bottom: 0;
    font-size: 0.95rem;
    padding-left: 1.5rem;
    border-left: 3px solid transparent;
    transition: border-color 0.2s;
}

.scholar-link:hover {
    border-left-color: #CC0000;
}

.scholar-link a {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: #f5f5f5;
    border-left: 3px solid #444;
    color: #444;
    transition: all 0.2s;
}

.scholar-link a:hover {
    background: #fff0f0;
    border-left-color: #CC0000;
    color: #CC0000;
    text-decoration: none;
}

.scholar-link:hover a {
    border-left-color: #CC0000;
    color: #CC0000;
}

/* Projects */
.project {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
    border-left: 3px solid transparent;
    transition: border-color 0.2s;
}

.project:hover {
    border-left-color: #CC0000;
}

.project:hover a {
    color: #CC0000;
}

.project:hover .project-link a {
    border-left-color: #CC0000;
}

.project h3 {
    margin-top: 0;
    color: #0a1929;
}

.tech {
    color: #667788;
    font-size: 0.9rem;
    margin-top: 0.5rem;
    font-style: italic;
}

.project-link {
    margin-top: 0.8rem;
    font-size: 0.95rem;
}

.project-link a {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    background: #f5f5f5;
    border-left: 3px solid #444;
    color: #444;
    transition: all 0.2s;
}

.project-link a:hover {
    background: #fff0f0;
    border-left-color: #CC0000;
    color: #CC0000;
    text-decoration: none;
}

/* Contact */
#contact p {
    margin-bottom: 0.8rem;
    font-size: 1.05rem;
}

.social-badges {
    display: flex;
    gap: 0.8rem;
    margin-top: 1rem;
    align-items: center;
}

.social-badges a {
    display: inline-block;
    transition: opacity 0.2s;
}

.social-badges a:hover {
    opacity: 0.8;
    text-decoration: none;
}

.social-badges img {
    height: 20px;
    display: block;
}

/* Scroll Progress Bar */
#scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    background: linear-gradient(90deg, #CC0000 0%, #ff4444 100%);
    width: 0%;
    z-index: 1000;
    transition: width 0.1s ease-out;
}

/* Footer */
footer {
    max-width: min(90%, 1200px);
    margin: 3rem auto 0;
    padding: 2rem 2rem 3rem;
    border-top: 2px solid #e8eef3;
    text-align: center;
    color: #889;
    font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 960px) {
    body {
        font-size: 17px;
    }

    .nav-container {
        max-width: 100%;
    }

    header, main, footer {
        max-width: 100%;
    }

    section {
        padding: 2rem;
    }
}

@media (max-width: 768px) {
    body {
        font-size: 16px;
        background:
            url('voronoi-pattern.svg') repeat-x top,
            radial-gradient(circle, rgba(216, 216, 216, 0.3) 1px, transparent 1px) 0 300px,
            linear-gradient(to bottom, #fafafa 0%, #ffffff 300px);
        background-size:
            2400px 300px,
            24px 24px,
            100% 100%;
    }

    h1 {
        font-size: 1.75rem;
        line-height: 1.2;
    }

    h2 {
        font-size: 1.6rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    .nav-container {
        padding: 1rem;
        gap: 1.5rem;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE and Edge */
    }

    .nav-container::-webkit-scrollbar {
        display: none; /* Chrome, Safari, Opera */
    }

    nav a {
        white-space: nowrap;
    }

    #scroll-progress {
        height: 3px; /* Thicker on mobile for better visibility */
    }

    header {
        padding: 2.5rem 1rem 2rem;
    }

    main {
        padding: 0 1rem 3rem;
    }

    section {
        padding: 1.5rem;
        margin-top: 2rem;
    }

    footer {
        padding: 2rem 1rem 3rem;
    }

    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-photo {
        margin-left: 0;
        margin-top: 1rem;
    }

    .header-photo img {
        width: 100px;
        height: 100px;
    }

    .tagline {
        font-size: 0.9rem;
        white-space: normal;
        line-height: 1.3;
    }

    .job, .project {
        padding: 1.2rem;
    }
}

/* Print Styles */
@media print {
    nav {
        display: none;
    }

    body {
        font-size: 12pt;
        line-height: 1.5;
        background: white;
    }

    section {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }

    a {
        color: #000;
        text-decoration: underline;
    }

    a[href^="http"]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }
}
