/* Shared styles for index.html and pubs.html. Self-contained: no Bootstrap / Font Awesome needed. */

:root {
    --bg: #fdfdfc;
    --text: #1f2328;
    --muted: #5c6370;
    --line: #e6e4df;
    --accent: #1a5fb4;
    --shade: rgba(0, 0, 0, 0.05);
    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #16181c;
        --text: #e4e6ea;
        --muted: #9aa1ac;
        --line: #2c3037;
        --accent: #7ab3f5;
        --shade: rgba(0, 0, 0, 0.35);
    }
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.6 Georgia, "Times New Roman", "Songti SC", "Noto Serif CJK SC", serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

::selection {
    background: color-mix(in srgb, var(--accent) 22%, transparent);
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 2px;
}

.container {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 24px;
}

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

a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

p {
    margin: 0 0 12px;
    text-wrap: pretty;
}

/* inside the list, <hr> separates years */
hr {
    margin: 22px 0;
    border: 0;
    border-top: 1px solid var(--line);
}

body > hr {
    max-width: 1092px;
    margin: 48px auto 0;
}

/* ---------- header ---------- */

h3 {
    margin: 56px 0 16px;
    font-size: 30px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.01em;
}

h3 a {
    color: inherit;
}

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

.note {
    color: var(--muted);
    font-size: 14px;
}

/* small page navigation, fixed in the right margin near the bottom (wide screens only) */
.sidenav {
    display: none;
}

@media (min-width: 1380px) {
    .sidenav {
        position: fixed;
        bottom: 72px;
        left: calc(50% + 570px);
        display: flex;
        flex-direction: column;
        border-left: 1px solid var(--line);
        font-size: 12.5px;
        line-height: 22px;
    }

    .sidenav a {
        margin-left: -1px;
        padding-left: 10px;
        border-left: 1px solid transparent;
        color: var(--muted);
        white-space: nowrap;
    }

    .sidenav a.sub {
        padding-left: 18px;
        font-size: 12px;
    }

    .sidenav a.top {
        margin-top: 6px;
    }

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

    .sidenav a.active {
        border-left-color: var(--accent);
        color: var(--accent);
    }
}

/* ---------- sections ---------- */

h4 {
    margin: 44px 0 18px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    scroll-margin-top: 16px;
}

/* one rule per major section, directly under its heading; the <hr class="section">
   above a heading is kept in the markup but only adds white space */
hr.section {
    margin: 48px 0 0;
    border: 0;
}

hr.section + h4 {
    margin-top: 0;
}

/* hairline with a short accent segment under the heading */
hr.section-below {
    height: 1px;
    margin: -8px 0 20px;
    border: 0;
    background: linear-gradient(to right, var(--accent) 0, var(--accent) 36px, var(--line) 36px);
}

/* faint watermark year in the top-right corner of each year block of the list;
   zero height so it takes no space, and it sits behind the entries */
.year-mark {
    position: relative;
    z-index: -1;
    top: -8px;
    height: 0;
    scroll-margin-top: 24px;
    color: var(--line);
    font-size: 38px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.02em;
    text-align: right;
    pointer-events: none;
    user-select: none;
}

/* ---------- entries ---------- */

.media {
    margin: 0 0 6px -22px;
    padding: 8px 0 8px 20px;
    border-left: 2px solid transparent;
    transition: border-color 0.15s;
}

.media:hover {
    border-left-color: var(--accent);
}

.media-heading {
    position: relative;
    margin: 0;
    color: var(--muted);
    /* 14px + the 1140px container keep every author list on a single line on desktop */
    font-size: 14px;
    line-height: 1.6;
}

/* paper title */
.media-heading > strong:first-child {
    color: var(--text);
    font-size: 16.5px;
    font-weight: 700;
    line-height: 1.4;
}

/* marker for papers where I am first / co-first author, corresponding author or project lead:
   a small accent flag hanging in the left margin, so that all titles share one left edge */
.lead .media-heading > strong:first-child::before {
    content: "";
    position: absolute;
    top: 6px;
    left: -17px;
    width: 0.72em;
    height: 0.72em;
    background: var(--accent);
    --flag: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 1h2.6v22H4zM8 2.5h13l-4 5.25 4 5.25H8z'/%3E%3C/svg%3E");
    -webkit-mask: var(--flag) center / contain no-repeat;
    mask: var(--flag) center / contain no-repeat;
}

/* own name in the author list */
.media-heading > strong {
    color: var(--text);
    font-weight: 700;
}

/* "..." in a shortened author list: click to reveal the hidden authors (assets/js/pubs.js) */
.et-al-toggle {
    margin: 0;
    padding: 0 3px;
    border: 0;
    border-radius: 3px;
    background: none;
    color: var(--accent);
    font: inherit;
    cursor: pointer;
}

.et-al-toggle:hover,
.et-al-toggle:focus-visible {
    background: var(--line);
}

.et-al-names {
    cursor: pointer;
}

/* research-area tag after the title (LLM, VLM, UMM, T2I, T2V, LM, IE, GNN, DM) */
.tag {
    display: inline-block;
    margin-left: 5px;
    padding: 0 5px;
    border: 1px solid var(--line);
    border-radius: 3px;
    color: var(--muted);
    font: 600 10.5px/15px -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    letter-spacing: 0.04em;
    vertical-align: 2px;
    cursor: default;
}

/* venue line */
.media-heading em {
    font-size: 13.5px;
}

.media-heading em strong {
    color: var(--accent);
    font-weight: 700;
}

sup {
    font-size: 0.7em;
    line-height: 0;
}

/* ---------- icons (drop-in for the few Font Awesome glyphs used here) ---------- */

.fa {
    display: inline-block;
    width: 1em;
    height: 1em;
    vertical-align: -0.14em;
    background: currentColor;
    -webkit-mask: var(--icon) center / contain no-repeat;
    mask: var(--icon) center / contain no-repeat;
}

.fa-file-pdf-o {
    --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2zm7 1.8V9h5.2L13 3.8zM8 12.5h8V14H8v-1.5zm0 3.5h8v1.5H8V16z'/%3E%3C/svg%3E");
}

.fa-university {
    --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2 2 7v2h20V7L12 2zM4 11h3v7H4v-7zm6.5 0h3v7h-3v-7zm6.5 0h3v7h-3v-7zM2 20h20v2H2v-2z'/%3E%3C/svg%3E");
    color: var(--muted);
}

.media-heading a {
    margin-left: 2px;
    opacity: 0.8;
}

.media-heading a:hover {
    opacity: 1;
    text-decoration: none;
}

/* paper icon next to the research-area tags: the drawn sheet fills 20/24 of its box, so an
   18px box gives a 15px sheet whose top is level with the tags and whose foot rests on the
   text baseline instead of hanging below it */
.media-heading a .fa {
    margin: 0 -1px;
    font-size: 18px;
    vertical-align: -2.5px;
}

.fa-map-marker {
    --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M12 2a7 7 0 0 0-7 7c0 5.2 7 13 7 13s7-7.8 7-13a7 7 0 0 0-7-7zm0 9.5a2.5 2.5 0 1 1 0-5 2.5 2.5 0 0 1 0 5z'/%3E%3C/svg%3E");
}

.fa-envelope {
    --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M2 6a1 1 0 0 1 1-1h18a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V6zm2 1.9V17h16V7.9l-8 6-8-6zM5.3 7l6.7 5 6.7-5H5.3z'/%3E%3C/svg%3E");
}

/* ---------- index.html: header ---------- */

h3 .sep {
    margin: 0 4px;
    color: var(--muted);
    font-weight: 400;
}

/* name.jpg is black calligraphy on a white background: blend the white away */
.name-cjk {
    width: auto;
    height: 1.2em;
    vertical-align: -0.28em;
    mix-blend-mode: multiply;
}

@media (prefers-color-scheme: dark) {
    .name-cjk {
        filter: invert(1) hue-rotate(180deg);
        mix-blend-mode: screen;
    }
}

.tagline {
    margin: -6px 0 18px;
    color: var(--muted);
    font-size: 17px;
    font-style: italic;
}

.contact {
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 15px;
}

.contact li {
    margin: 0 0 6px;
}

.contact .fa {
    margin-right: 6px;
    color: var(--muted);
}

/* prose (biography, intro on the publication page): justified. The wording is tuned so that,
   in Georgia at the full 1092px column, every line is well filled and the last line is not a
   short leftover; "pretty" keeps a lone word off the last line at other widths. */
.researchInt p,
p.intro {
    text-align: justify;
    text-wrap: pretty;
}

/* ---------- index.html: sections ---------- */

h4 .more {
    float: right;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
}

ul {
    margin: 0 0 12px;
    padding-left: 20px;
}

li {
    margin-bottom: 4px;
}

/* long lists (news, awards) scroll inside a box that always shows whole rows:
   assets/js/pubs.js sets max-height to exactly data-rows rows (also when rows wrap);
   the values here are the no-JS fallback for single-line rows (28px per row, no gap after the last) */
.scroll {
    max-height: 192px;
    overflow-y: auto;
    padding-right: 8px;
    overscroll-behavior: contain;
    scroll-snap-type: y proximity;
    scrollbar-width: thin;
    scrollbar-color: var(--line) transparent;
    /* soft shadow at the top / bottom edge only while more rows are hidden there */
    background:
        linear-gradient(var(--bg), var(--bg)) top / 100% 12px no-repeat local,
        linear-gradient(var(--bg), var(--bg)) bottom / 100% 12px no-repeat local,
        linear-gradient(var(--shade), transparent) top / 100% 6px no-repeat scroll,
        linear-gradient(transparent, var(--shade)) bottom / 100% 6px no-repeat scroll;
}

.scroll[data-rows="6"] {
    max-height: 172px;
}

.scroll li {
    scroll-snap-align: start;
}

.scroll::-webkit-scrollbar {
    width: 6px;
}

.scroll::-webkit-scrollbar-thumb {
    border-radius: 3px;
    background: var(--line);
}

/* lists with a date column: news, awards, work experiences */
.dated ul,
ul.dated {
    margin: 0;
    padding: 0;
    list-style: none;
}

.dated li {
    position: relative;
    margin: 0 0 4px;
    padding-left: var(--date-w, 72px);
    font-size: 15px;
    line-height: 24px;
}

.dated li:last-child {
    margin-bottom: 0;
}

.dated .date {
    position: absolute;
    left: 0;
    color: var(--muted);
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}

/* lists whose left column holds a date range or a role */
ul.dated.wide {
    --date-w: 150px;
    margin-bottom: 12px;
}

/* ---------- footer ---------- */

.footer {
    padding: 16px 0 40px;
    color: var(--muted);
    font-size: 13px;
}

.footer p {
    margin: 0;
}

/* ---------- small screens ---------- */

@media (max-width: 600px) {
    body {
        font-size: 15px;
    }

    .container {
        padding: 0 18px;
    }

    h3 {
        margin-top: 32px;
        font-size: 26px;
    }

    .year-mark {
        font-size: 28px;
    }

    .media {
        margin-left: 0;
        padding-left: 0;
        border-left: 0;
    }

    /* no margin to hang the flag in: keep it inline before the title */
    .lead .media-heading > strong:first-child::before {
        position: static;
        display: inline-block;
        margin-right: 7px;
        vertical-align: -0.02em;
    }

    ul.dated.wide {
        --date-w: 118px;
    }
}
