/* ============================================
   Design tokens
   ============================================ */

:root {
    --ink: #1f2a33;          /* main text */
    --ink-soft: #4a5a66;     /* secondary text */
    --ink-faint: #75838e;    /* captions, meta */
    --accent: #1e5a8c;       /* links, highlights */
    --accent-dark: #153f63;
    --accent-tint: #eaf1f7;
    --bg: #fbfbf8;
    --surface: #ffffff;
    --rule: #e3e6e8;
    --radius: 8px;
    --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
    --sans: "Inter", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
    --measure: 880px;        /* max content width */
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px; /* keep anchored headings clear of the sticky nav */
}

body {
    font-family: var(--sans);
    font-size: 17px;
    line-height: 1.65;
    color: var(--ink);
    background-color: var(--bg);
    -webkit-font-smoothing: antialiased;
}

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

a:hover {
    color: var(--accent-dark);
    text-decoration: underline;
}

h1, h2, h3 {
    font-family: var(--serif);
    font-weight: 600;
    line-height: 1.25;
    color: var(--ink);
}

p + p {
    margin-top: 1em;
}

/* ============================================
   Navigation
   ============================================ */

.navbar {
    background-color: rgba(251, 251, 248, 0.94);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--rule);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: var(--measure);
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.logo {
    font-family: var(--serif);
    font-size: 1.25rem;
    font-weight: 600;
}

.logo a {
    color: var(--ink);
}

.logo a:hover {
    color: var(--accent);
    text-decoration: none;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 26px;
    font-size: 0.95rem;
}

.nav-menu a {
    color: var(--ink-soft);
    font-weight: 500;
    padding-bottom: 3px;
    border-bottom: 2px solid transparent;
}

.nav-menu a:hover,
.nav-menu a.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    text-decoration: none;
}

/* ============================================
   Layout
   ============================================ */

.container {
    max-width: var(--measure);
    margin: 0 auto;
    padding: 48px 24px 24px;
}

section + section {
    margin-top: 56px;
}

.section-title {
    font-size: 1.6rem;
    margin-bottom: 20px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--rule);
}

.page-intro {
    max-width: var(--measure);
    margin: 0 auto;
    padding: 48px 24px 0;
}

.page-intro h1 {
    font-size: 2.3rem;
    margin-bottom: 12px;
}

.page-intro p {
    color: var(--ink-soft);
    font-size: 1.05rem;
    max-width: 680px;
}

/* ============================================
   Home: hero
   ============================================ */

.hero {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 40px;
    align-items: start;
}

.profile-image {
    width: 220px;
    height: 220px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 4px 16px rgba(31, 42, 51, 0.12);
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 4px;
}

.hero .subtitle {
    font-size: 1.1rem;
    color: var(--ink-soft);
    margin-bottom: 20px;
}

.hero-text p {
    font-size: 1.02rem;
}

.hero-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}

.btn {
    display: inline-block;
    padding: 8px 18px;
    border: 1px solid var(--accent);
    border-radius: 999px;
    color: var(--accent);
    font-size: 0.92rem;
    font-weight: 500;
    background: var(--surface);
    transition: background-color 0.15s ease, color 0.15s ease;
}

.btn:hover {
    background: var(--accent);
    color: #fff;
    text-decoration: none;
}

.btn.primary {
    background: var(--accent);
    color: #fff;
}

.btn.primary:hover {
    background: var(--accent-dark);
    border-color: var(--accent-dark);
}

/* ============================================
   Home: research highlight cards
   ============================================ */

.highlights {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

.highlight-card {
    display: block;
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    padding: 20px;
    color: var(--ink);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.highlight-card:hover {
    border-color: var(--accent);
    box-shadow: 0 6px 18px rgba(30, 90, 140, 0.1);
    transform: translateY(-2px);
    text-decoration: none;
    color: var(--ink);
}

.highlight-card h3 {
    font-size: 1.12rem;
    margin-bottom: 8px;
    color: var(--accent);
}

.highlight-card p {
    font-size: 0.93rem;
    color: var(--ink-soft);
    line-height: 1.55;
}

.card-more {
    display: inline-block;
    margin-top: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--accent);
}

/* ============================================
   Home: education
   ============================================ */

.entry-list {
    list-style: none;
}

.entry {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid var(--rule);
}

.entry:last-child {
    border-bottom: 0;
}

.entry-title {
    font-weight: 600;
}

.entry-where {
    color: var(--ink-soft);
}

.entry-date {
    color: var(--ink-faint);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* ============================================
   Research page
   ============================================ */

.research-toc {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.research-section h2 {
    font-size: 1.6rem;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--rule);
}

.research-body {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 32px;
    align-items: start;
}

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

.research-body.stacked .figure {
    max-width: 100%;
}

.key-results {
    margin: 16px 0 16px 1.2em;
}

.key-results li + li {
    margin-top: 6px;
}

.figure {
    margin: 0;
}

.figure-stack .figure + .figure {
    margin-top: 28px;
}

.figure img {
    width: 100%;
    border-radius: var(--radius);
    border: 1px solid var(--rule);
    background: var(--surface);
}

/* Shown until a real image is added; see comments in research.html. */
.figure-placeholder {
    aspect-ratio: 4 / 3;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 16px;
    border: 1.5px dashed #b9c4cc;
    border-radius: var(--radius);
    background: repeating-linear-gradient(45deg, #f4f6f7, #f4f6f7 10px, #eef1f3 10px, #eef1f3 20px);
    color: var(--ink-faint);
    font-size: 0.85rem;
    line-height: 1.45;
}

.figure-placeholder code {
    font-size: 0.78rem;
    word-break: break-all;
}

.figure figcaption {
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--ink-faint);
    line-height: 1.5;
}

.paper-links {
    margin-top: 20px;
    padding: 14px 18px;
    background: var(--accent-tint);
    border-radius: var(--radius);
    font-size: 0.93rem;
}

.paper-links h3 {
    font-family: var(--sans);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin-bottom: 6px;
}

.paper-links ul {
    list-style: none;
}

.paper-links li + li {
    margin-top: 4px;
}

.paper-links .links {
    white-space: nowrap;
    font-size: 0.88rem;
}

.see-all {
    margin-top: 48px;
    font-weight: 600;
}

.video-card {
    display: block;
    margin-top: 28px;
    color: var(--ink);
}

.video-card:hover {
    text-decoration: none;
    color: var(--ink);
}

.video-thumb {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--rule);
}

.video-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.2s ease;
}

.video-card:hover .video-thumb img {
    transform: scale(1.03);
}

/* Play button: dark circle with a white triangle. */
.play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 56px;
    height: 56px;
    margin: -28px 0 0 -28px;
    border-radius: 50%;
    background: rgba(20, 30, 40, 0.75);
    transition: background-color 0.15s ease;
}

.play-icon::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    margin: -10px 0 0 -6px;
    border-style: solid;
    border-width: 10px 0 10px 17px;
    border-color: transparent transparent transparent #fff;
}

.video-card:hover .play-icon {
    background: #c4302b;
}

.video-text {
    display: block;
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--ink-faint);
    line-height: 1.5;
}

.video-text strong {
    display: block;
    color: var(--accent);
    font-size: 0.92rem;
}

/* ============================================
   Publications page
   ============================================ */

.pub-summary {
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 36px;
    color: var(--ink-soft);
}

.pub-summary p + p {
    margin-top: 4px;
}

.publication-group + .publication-group {
    margin-top: 40px;
}

.publication-group h2 {
    font-size: 1.35rem;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--rule);
}

.publications {
    counter-reset: pub; /* numbering continues across publication groups */
}

.publication-list {
    list-style: none;
}

.publication-list li {
    counter-increment: pub;
    position: relative;
    padding: 16px 0 16px 42px;
    border-bottom: 1px solid var(--rule);
}

.publication-list li:last-child {
    border-bottom: 0;
}

.publication-list li::before {
    content: counter(pub);
    position: absolute;
    left: 0;
    top: 16px;
    width: 28px;
    text-align: right;
    font-weight: 700;
    color: var(--ink-faint);
    font-variant-numeric: tabular-nums;
}

.publication-list li:target {
    background: var(--accent-tint);
    border-radius: var(--radius);
}

.pub-title {
    font-family: var(--serif);
    font-size: 1.08rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 4px;
}

.authors {
    color: var(--ink-soft);
    font-size: 0.95rem;
}

.authors strong {
    color: var(--ink);
}

.publication-info {
    color: var(--ink-faint);
    font-size: 0.9rem;
    margin-top: 2px;
}

.publication-info .links a + a::before {
    content: "·";
    color: var(--ink-faint);
    margin: 0 6px;
}

/* ============================================
   Footer
   ============================================ */

.footer {
    max-width: var(--measure);
    margin: 64px auto 0;
    padding: 24px;
    border-top: 1px solid var(--rule);
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.88rem;
    color: var(--ink-faint);
}

.footer-links {
    display: flex;
    gap: 18px;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 800px) {
    .highlights {
        grid-template-columns: 1fr;
    }

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

    .figure {
        max-width: 420px;
    }
}

@media (max-width: 640px) {
    body {
        font-size: 16px;
    }

    .nav-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .nav-menu {
        gap: 18px;
    }

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

    .profile-image {
        width: 160px;
        height: 160px;
    }

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

    .page-intro h1 {
        font-size: 1.9rem;
    }

    .entry {
        flex-direction: column;
        gap: 0;
    }
}
