:root {
    --gray: #333;
    --light-gray: #888;
    --lighter-gray: #ccc;
    --lightest-gray: #eee;
}

html {
    scrollbar-gutter: stable;
}

* {
    transition: all 0.2s ease-in-out;
}

body, h1, h2, h3, ul, li, p {
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Computer Modern Serif', serif;
    color: var(--gray);
    margin: 0 auto;
    max-width: 960px;
    padding: 24px 16px;
}

section {
    margin: 24px 0;
}

header {
    margin: 8px 0;
}

h1 {
    font-size: 1em;
    font-weight: bold;
}

h2 {
    font-size: 1em;
    font-weight: normal;
    margin: 48px 0 8px;
    color: var(--light-gray);
    display: flex;
    align-items: baseline;
    gap: 8px;
}

p {
    margin: 16px 0;
}

.contact {
    color: var(--light-gray);
    font-style: italic;
    margin: 0;
}

.contact-break {
    display: none;
}

.paper-title {
    font-weight: bold;
    margin: 8px 0 0;
}

.paper-authors {
    color: var(--light-gray);
    font-style: italic;
    margin: 0;
}

.me {
    color: var(--gray);
}

.paper-conference {
    margin: 0;
}

.paper-links {
    color: var(--light-gray);
    margin: 8px 0 0 0;
}

.section-rule {
    flex: 1;
    border-top: 1px solid var(--lighter-gray);
}

.paper-highlight {
    color: red;
}

a {
    color: var(--gray);
    text-decoration: underline var(--light-gray) 1px;
    text-underline-offset: 2px;
    white-space: nowrap;
}

a:hover {
    color: blue;
    text-decoration-color: blue;
}

img, video {
    display: block;
    width: 100%;
    object-fit: cover;
    box-sizing: border-box;
    border-radius: 4px;
}

video {
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

video.video-loaded {
    opacity: 1;
}

.entry {
    margin: 16px 0;
}

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

#about {
    display: grid;
    grid-template-columns: 1fr 4fr;
    grid-template-areas:
        "img header"
        "img bio";
    column-gap: 32px;
    row-gap: 0;
}

#about img {
    grid-area: img;
}

#about header {
    grid-area: header;
    align-self: center;
}

#about .about-bio {
    grid-area: bio;
}

.video-container {
    display: block;
    width: 100%;
    aspect-ratio: 1/1;
    align-self: start;
    border-radius: 4px;
    background: var(--lightest-gray);
}

#research-list-view .video-container {
    overflow: hidden;
}

#sticky-video {
    display: none;
    cursor: pointer;
    background: var(--lightest-gray);
    border-radius: 4px;
    background-clip: content-box;
}

#sticky-video video {
    grid-area: 1 / 1;
    aspect-ratio: 1/1;
}

.grid-videos {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-gap: 8px;
    margin: 16px 0;
}

.grid-videos .video-container:hover,
#research-list-view .video-container:hover {
    cursor: pointer;
}

.grid-videos:has(.video-container:hover) .video-container:not(:hover),
#research-list-view:has(.entry-active) .entry:not(.entry-active) .video-container {
    opacity: 0.5;
}

.scroll-toggle {
    color: var(--light-gray);
    cursor: pointer;
    width: fit-content;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0;
}

.scroll-toggle.ready {
    animation: fadeIn 0.6s ease-in-out 0.6s forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.scroll-toggle:hover {
    color: var(--gray);
}

.scroll-toggle p {
    font-style: italic;
    margin: 0;
}

.scroll-toggle * {
    transition: none;
}

@media (max-width: 1024px) {
    body {
        padding: 16px;
    }

    h2 {
        margin: 24px 0 16px;
    }

    .entry {
        margin: 0 0 24px;
    }

    .columns {
        grid-gap: 16px;
    }

    #about {
        grid-template-columns: auto 1fr;
        grid-template-areas:
            "img header"
            "bio bio";
        grid-gap: 16px;
        margin-bottom: 0;
    }

    #about img {
        width: 120px;
        height: 120px;
        object-position: center 30%;
    }

    .contact-break {
        display: block;
    }
}

@media (max-width: 640px) {
    .columns {
        grid-template-columns: 1fr;
        grid-gap: 16px;
    }

    #research-list-view .entry .video-container {
        display: none;
    }

    #research-grid-view {
        display: none;
    }

    #sticky-video {
        display: grid;
        position: sticky;
        top: 0;
        z-index: 10;
        background: white;
        padding: 16px 32px;
        margin: 0 -32px;
    }

    #sticky-video::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 8px;
        background: linear-gradient(to bottom, white, transparent);
        transform: translateY(100%);
        pointer-events: none;
    }

    #sticky-video video {
        aspect-ratio: 1/1;
        max-height: calc(50vh - 32px);
    }

    section#research {
        margin-top: 0;
    }

    h2 {
        margin-bottom: 0;
    }
}

@media (min-width: 641px) {
    body {
        min-height: calc(100vh + 50px);
    }
}

footer {
    margin: 96px 0 24px;
    display: flex;
    justify-content: flex-end;
}

footer p {
    color: var(--light-gray);
    margin: 0;
    text-align: right;
}
