/* Layout inspired by jytime.github.io (Jon Barron template), width/research rows by qianqianwang68.github.io */

:root {
    --text-color: #20242b;
    --muted-color: #5b636d;
    --faint-color: #aab0b6;
    --heading-color: #15191f;
    --accent-color: #1772d0;
    --highlight-color: #f09228;
    --bg-color: #ffffff;
    --content-width: 800px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--bg-color);
    color: var(--text-color);
    font-family: "Lato", Verdana, Helvetica, sans-serif;
    font-size: 16px;
    line-height: 1.6;
}

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

a:hover,
a:focus-visible {
    color: var(--highlight-color);
}

::selection {
    background: var(--accent-color);
    color: #fff;
}

.page {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* Hero */

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 200px;
    gap: 40px;
    align-items: start;
    padding: 56px 0 20px;
}

.hero h1 {
    margin: 0 0 18px;
    color: var(--heading-color);
    font-size: clamp(34px, 5vw, 44px);
    font-weight: 700;
    line-height: 1.08;
    letter-spacing: -0.035em;
}

.hero-copy p {
    margin: 0 0 12px;
    color: #414a55;
    line-height: 1.72;
}

.profile-links {
    display: flex;
    flex-wrap: wrap;
    margin-top: 20px;
}

.profile-links a {
    font-size: 15px;
}

.profile-links a:not(:last-child)::after {
    margin: 0 9px;
    color: var(--faint-color);
    content: "/";
}

.portrait {
    display: block;
    /* Offset by the space above the h1's capital letters so the photo's top lines up with them */
    margin-top: calc(clamp(34px, 5vw, 44px) * 0.21);
    width: 200px;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    object-position: 50% 40%;
    border-radius: 6px;
}

/* Sections */

section {
    padding: 12px 0 4px;
}

h2 {
    margin: 0 0 12px;
    color: var(--heading-color);
    font-size: 22px;
    font-weight: 400;
}

ul {
    margin: 0;
    padding-left: 1.25em;
}

li {
    margin-bottom: 6px;
    padding-left: 0.2em;
}

li::marker {
    color: var(--faint-color);
}

.date {
    display: inline-block;
    min-width: 5.5em;
    color: var(--muted-color);
}

/* Older news slides open under a small "More news" / "Less news" text link */

/* Animating grid rows from 0fr to 1fr slides to the list's real height, so opening and closing take the same time */
.older-news {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.3s ease;
}

.older-news.open {
    grid-template-rows: 1fr;
}

.older-news > ul {
    min-height: 0;
    overflow: hidden;
}

.news-toggle {
    /* Block so it sits on its own row with no extra line-box gap; same indent as the list
       (ul 1.25em + li 0.2em) so the label lines up with the dates, and the same bottom gap as a news item */
    display: block;
    margin: 0 0 6px 1.45rem;
    padding: 0;
    border: 0;
    background: none;
    color: var(--accent-color);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
}

.news-toggle:hover {
    color: var(--highlight-color);
}

/* Research rows */

.research-item {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 28px;
    align-items: start;
    padding: 16px 0;
}

.thumb {
    width: 280px;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    border-radius: 6px;
}

.thumb img,
.thumb video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.paper-title {
    font-weight: 700;
}

.research-info p {
    margin: 2px 0;
}

/* Pull the title up by its line-height leading so its cap tops line up with the thumbnail's top edge */
.research-info p:first-child {
    margin-top: -0.45em;
}

.venue {
    font-style: italic;
}

/* Keep multi-word/hyphenated link labels (e.g. model names) from breaking mid-name */
.links a {
    white-space: nowrap;
}

.links a:not(:last-child)::after {
    margin: 0 7px;
    color: var(--faint-color);
    content: "/";
}

/* Mobile: centered photo, name, links, then bio (like the original site) */

@media (max-width: 640px) {
    .hero {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 40px 0 8px;
    }

    .hero-copy {
        display: contents;
    }

    .hero-media {
        order: 1;
        align-self: center;
        width: min(260px, 100%);
        margin-bottom: 7px;
    }

    .hero h1 {
        order: 2;
        margin-bottom: 7px;
        text-align: center;
    }

    .profile-links {
        order: 3;
        justify-content: center;
        margin: 0 0 22px;
    }

    .hero-copy p {
        order: 4;
    }

    .portrait {
        width: 100%;
        aspect-ratio: 13 / 18;
        margin-top: 0;
    }

    .research-item {
        grid-template-columns: 1fr;
        gap: 14px;
        padding: 18px 0;
    }

    .thumb {
        width: 100%;
    }

    .research-info {
        line-height: 1.5;
    }

    .research-info p:first-child {
        margin-top: 0;
    }

    .date {
        min-width: 0;
        margin-right: 4px;
    }
}
