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

body {
    font-family: "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #333;
    background: #f7f7f7;
}

a {
    color: #4a6fa5;
    text-decoration: underline;
}

a:hover {
    color: #2d4a6f;
}

/* Navigation - full width */
nav {
    padding: 32px 4vw;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.site-title {
    font-size: 1.8rem;
    color: #333;
    text-decoration: none;
    font-weight: normal;
}

.site-title:hover {
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 32px;
}

.nav-links a {
    color: #333;
    text-decoration: none;
}

.nav-links a:hover,
.nav-links a.active {
    text-decoration: underline;
}

/* Legacy nav-container support */
.nav-container {
    display: flex;
    gap: 24px;
}

nav .nav-container a {
    color: #333;
    text-decoration: none;
}

nav .nav-container a:hover {
    text-decoration: underline;
}

/* Main container - centered */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 4vw 80px;
}

/* Hero section - two column layout */
.hero {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 60px;
    margin-bottom: 64px;
    align-items: start;
}

.hero-image {
    width: 200px;
    aspect-ratio: 1 / 1;
    overflow: hidden;
}

.hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 50%;
}

.hero-content p {
    margin-bottom: 16px;
}

.hero-links {
    margin-top: 24px;
}

.hero-links a {
    margin-right: 8px;
}

.hero-links a:after {
    content: " /";
    color: #999;
    text-decoration: none;
    margin-left: 8px;
}

.hero-links a:last-child:after {
    content: "";
}

/* Sections - align with hero content (not photo) */
section {
    margin-bottom: 48px;
    margin-left: 260px; /* 200px photo + 60px gap */
}

header {
    margin-bottom: 48px;
}

h1 {
    font-size: 1.8rem;
    font-weight: normal;
    margin-bottom: 16px;
    color: #333;
}

h2 {
    font-size: 1.5rem;
    font-weight: normal;
    margin-bottom: 24px;
    color: #333;
}

.intro p {
    margin-bottom: 12px;
}

.links {
    margin-top: 16px;
}

.links a {
    margin-right: 8px;
}

.links a:after {
    content: " /";
    color: #999;
    text-decoration: none;
    margin-left: 8px;
}

.links a:last-child:after {
    content: "";
}

/* Research/Paper entries - table style */
.papers-list {
    display: table;
    width: 100%;
}

.paper {
    display: table-row;
}

.paper-date {
    display: table-cell;
    color: #888;
    font-size: 0.95rem;
    padding-right: 24px;
    padding-bottom: 8px;
    white-space: nowrap;
    vertical-align: top;
}

.paper-info {
    display: table-cell;
    padding-bottom: 8px;
    vertical-align: top;
}

.paper-title {
    color: #333;
    margin-bottom: 4px;
}

.paper-title a {
    color: #4a6fa5;
}

.paper-authors {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.paper-desc {
    color: #555;
    font-size: 0.95rem;
    margin-top: 4px;
}

/* Legacy paper structure */
.paper-content .paper-title {
    font-weight: normal;
    color: #333;
    margin-bottom: 4px;
}

.paper-content .paper-authors {
    color: #888;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.paper-content .paper-desc {
    color: #555;
    font-size: 0.95rem;
}

/* Experience/Education items */
.item {
    margin-bottom: 16px;
}

.item p {
    margin-bottom: 4px;
}

.item-desc {
    color: #555;
    font-size: 0.95rem;
}

.date {
    color: #888;
    font-size: 0.9rem;
}

/* Projects page */
.projects-page section {
    margin-left: 0;
}

/* Projects */
.project {
    margin-bottom: 24px;
}

.project-title {
    font-weight: normal;
    color: #333;
    margin-bottom: 6px;
}

.project-desc {
    color: #555;
    font-size: 0.95rem;
    margin-bottom: 6px;
}

.project-links {
    font-size: 0.95rem;
}

/* Projects Grid (Catalog) */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 32px;
}

.project-card {
    display: block;
    text-decoration: none;
    color: inherit;
}

.project-card:hover {
    text-decoration: none;
}

.project-card-image {
    aspect-ratio: 16 / 10;
    background: #fff;
    border: 1px solid #ddd;
    overflow: hidden;
    margin-bottom: 12px;
}

.project-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.project-card-image.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 0.9rem;
}

.project-card-image.placeholder::after {
    content: "Coming soon";
}

.project-card-title {
    font-size: 1rem;
    font-weight: normal;
    color: #333;
    margin: 0;
}

.project-card:hover .project-card-title {
    color: #4a6fa5;
}

/* Blog Post Styles */
.blog-post {
    max-width: 720px;
}

.blog-post header {
    margin-bottom: 40px;
}

.blog-post h1 {
    margin-bottom: 12px;
}

.post-meta {
    color: #666;
    font-size: 0.95rem;
}

.post-links {
    margin-top: 8px;
    font-size: 0.95rem;
}

.blog-post section {
    margin-bottom: 36px;
    margin-left: 0;
}

.blog-post h2 {
    font-size: 1.3rem;
    margin-top: 36px;
    margin-bottom: 16px;
}

.blog-post h3 {
    font-size: 1.1rem;
    font-weight: normal;
    color: #333;
    margin-top: 24px;
    margin-bottom: 12px;
    font-style: italic;
}

.blog-post p {
    margin-bottom: 16px;
    color: #333;
}

.blog-post ul {
    margin-bottom: 16px;
    padding-left: 24px;
}

.blog-post li {
    margin-bottom: 8px;
    color: #333;
}

.blog-post table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.blog-post th,
.blog-post td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.blog-post th {
    font-weight: normal;
    font-style: italic;
    color: #333;
}

.blog-post td {
    color: #333;
}

.blog-post code {
    font-family: "Courier New", Courier, monospace;
    background: #fff;
    padding: 2px 6px;
    font-size: 0.9rem;
}

.blog-post pre {
    background: #fff;
    padding: 16px;
    overflow-x: auto;
    margin-bottom: 20px;
    border: 1px solid #ddd;
}

.blog-post pre code {
    padding: 0;
    background: none;
}

.blog-post figure {
    margin: 24px 0;
}

.blog-post figure img {
    width: 100%;
    border: 1px solid #ddd;
}

.blog-post figcaption {
    margin-top: 8px;
    font-size: 0.85rem;
    color: #666;
    text-align: center;
    font-style: italic;
}

.back-link {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid #ddd;
}

.coming-soon {
    color: #888;
    font-style: italic;
}

/* Video */
.video-container {
    margin: 24px 0;
}

.video-container video {
    width: 100%;
    max-width: 100%;
    background: #000;
}

/* Responsive */
@media (max-width: 768px) {
    nav {
        padding: 24px;
        flex-direction: column;
        gap: 16px;
    }

    .nav-links {
        gap: 24px;
    }

    .container {
        padding: 32px 24px 60px;
    }

    .hero {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .hero-image {
        max-width: 200px;
    }

    section {
        margin-left: 0;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.3rem;
    }

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

    .paper {
        display: block;
        margin-bottom: 20px;
    }

    .paper-date {
        display: block;
        padding-bottom: 4px;
    }

    .paper-info {
        display: block;
    }
}

/* Theme toggle button */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 4px 8px;
    color: #666;
    transition: color 0.2s;
}

.theme-toggle:hover {
    color: #333;
}

/* Dark mode styles */
html[data-theme="dark"] {
    background: #1a1a1a;
    color: #e0e0e0;
}

html[data-theme="dark"] body {
    background: #1a1a1a;
    color: #e0e0e0;
}

html[data-theme="dark"] a {
    color: #7aa2d4;
}

html[data-theme="dark"] a:hover {
    color: #a3c1e8;
}

html[data-theme="dark"] .site-title,
html[data-theme="dark"] .nav-links a,
html[data-theme="dark"] nav .nav-container a,
html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] .paper-title,
html[data-theme="dark"] .project-title,
html[data-theme="dark"] .project-card-title,
html[data-theme="dark"] .blog-post h3,
html[data-theme="dark"] .blog-post p,
html[data-theme="dark"] .blog-post li,
html[data-theme="dark"] .blog-post th,
html[data-theme="dark"] .blog-post td {
    color: #e0e0e0;
}

html[data-theme="dark"] .paper-date,
html[data-theme="dark"] .date,
html[data-theme="dark"] .paper-content .paper-authors {
    color: #999;
}

html[data-theme="dark"] .paper-authors,
html[data-theme="dark"] .post-meta,
html[data-theme="dark"] .blog-post figcaption {
    color: #aaa;
}

html[data-theme="dark"] .paper-desc,
html[data-theme="dark"] .item-desc,
html[data-theme="dark"] .project-desc,
html[data-theme="dark"] .paper-content .paper-desc {
    color: #bbb;
}

html[data-theme="dark"] .hero-links a:after,
html[data-theme="dark"] .links a:after {
    color: #666;
}

html[data-theme="dark"] .project-card-image,
html[data-theme="dark"] .blog-post pre,
html[data-theme="dark"] .blog-post figure img {
    background: #2a2a2a;
    border-color: #444;
}

html[data-theme="dark"] .blog-post code {
    background: #2a2a2a;
}

html[data-theme="dark"] .blog-post th,
html[data-theme="dark"] .blog-post td {
    border-bottom-color: #444;
}

html[data-theme="dark"] .back-link {
    border-top-color: #444;
}

html[data-theme="dark"] .project-card-image.placeholder {
    color: #777;
}

html[data-theme="dark"] .coming-soon {
    color: #777;
}

html[data-theme="dark"] .theme-toggle {
    color: #999;
}

html[data-theme="dark"] .theme-toggle:hover {
    color: #e0e0e0;
}
