/* Homepage styles, layered on top of main.css. */

:root {
    --global-theme-color: #1d4fc4;
    --global-hover-color: #1d4fc4;
    --global-code-bg-color: rgba(29, 79, 196, 0.05);
    --global-text-color: #141416;
    --home-sans: "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    --home-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
    --home-muted: #474b52;
    --home-tint: rgba(29, 79, 196, 0.1);
    --home-tint-strong: rgba(29, 79, 196, 0.18);
    --home-border: rgba(0, 0, 0, 0.16);
}

html[data-theme='dark'] {
    --global-theme-color: #f27fc2;
    --global-hover-color: #f27fc2;
    --global-text-color: #f1f1f2;
    --home-muted: #bcc0c6;
    --home-tint: rgba(242, 127, 194, 0.13);
    --home-tint-strong: rgba(242, 127, 194, 0.26);
    --home-border: rgba(255, 255, 255, 0.2);
}

html {
    scroll-behavior: smooth;
}

body {
    padding-bottom: 0;
    font-family: var(--home-sans);
    font-size: 1.0625rem;
    font-weight: 400;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
.navbar,
.btn,
table,
button {
    font-family: var(--home-sans);
}

.post article b,
.post article strong {
    font-weight: 600;
}

.navbar .nav-link {
    font-size: 1rem;
    font-weight: 400;
}

/* Avoid one-word last lines. */

.post article p,
.post article li,
.post article td,
.talk-title,
.publications ol.bibliography li .title,
.publications ol.bibliography li .author,
.publications ol.bibliography li .periodical {
    text-wrap: pretty;
}

.nb {
    color: inherit;
    white-space: nowrap;
}

@supports not (text-wrap: pretty) {
    .publications ol.bibliography li .title,
    .publications ol.bibliography li .author {
        text-wrap: balance;
    }
}

.post article p {
    margin-bottom: 0.75rem;
}

/* Header */

.post .post-header {
    margin-bottom: 1.25rem;
}

.post .post-header .post-title {
    font-family: var(--home-serif);
    font-size: 2.6rem;
    font-weight: 600;
    letter-spacing: -0.015em;
    line-height: 1.15;
}

.profile.float-right {
    width: 30%;
    margin: 0.25rem 0 1rem 1.75rem;
}

.profile figure {
    margin: 0;
}

.profile img {
    height: auto;
    border-radius: 10px !important;
}

/* Section headings */

.post article h2 .count {
    margin-left: 0.4rem;
    color: var(--home-muted);
    font-family: var(--home-sans);
    font-size: 0.94rem;
    font-weight: 400;
    letter-spacing: 0;
}

.post article h2 {
    font-family: var(--home-serif);
    font-size: 1.55rem;
    font-weight: 600;
    letter-spacing: -0.005em;
    margin: 0 0 0.9rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--home-border);
    scroll-margin-top: 72px;
}

.home-section,
.publications {
    margin-top: 2.5rem;
}

.section-note {
    color: var(--home-muted);
    font-size: 0.94rem;
    margin: -0.2rem 0 1.15rem !important;
}

/* Research threads */

.research-more {
    margin-top: 1.1rem;
    scroll-margin-top: 72px;
}

.research-more summary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--global-theme-color);
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.research-more summary::-webkit-details-marker {
    display: none;
}

.research-more summary::after {
    content: "";
    width: 0.45em;
    height: 0.45em;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-0.12em) rotate(45deg);
    transition: transform 0.15s ease;
}

.research-more[open] summary::after {
    transform: translateY(0.1em) rotate(-135deg);
}

.research-more summary:hover {
    text-decoration: underline;
}

.research-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 1.1rem;
    row-gap: 0;
    margin-top: 1rem;
}

/* Each box spans four shared rows (heading, summary, first project, second project)
   so the two boxes line up row for row. */

.research-card {
    display: grid;
    grid-row: span 4;
    grid-template-rows: subgrid;
    border: 1px solid var(--home-border);
    border-top: 2px solid var(--global-theme-color);
    border-radius: 8px;
    padding: 1.1rem 1.3rem 1.2rem;
}

.post article h3.thread {
    font-family: var(--home-serif);
    font-size: 1.18rem;
    font-weight: 600;
    margin: 0 0 0.3rem;
}

.research-lead {
    color: var(--home-muted);
    font-size: 1rem;
    line-height: 1.45;
    margin: 0 0 1rem !important;
}

.research-lead b {
    color: var(--global-text-color);
}

.research-item {
    padding: 0.9rem 0 0.95rem;
    border-top: 1px solid var(--home-border);
}

.research-item:last-child {
    padding-bottom: 0;
}

.research-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 0.9rem;
    align-items: baseline;
}

.research-name {
    font-weight: 600;
    line-height: 1.35;
}

.research-head .num {
    color: var(--global-theme-color);
    font-size: 1.4rem;
    font-weight: 600;
    line-height: 1.2;
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.research-head .num small {
    color: var(--home-muted);
    font-size: 0.86rem;
    font-weight: 400;
}

.research-tag,
.research-head .label {
    color: var(--home-muted);
    font-size: 0.9rem;
    line-height: 1.35;
}

.research-tag {
    font-style: italic;
}

.research-head .label {
    text-align: right;
    white-space: nowrap;
}

@media (prefers-reduced-motion: no-preference) {
    .research-more[open] .research-grid {
        animation: research-in 0.22s ease-out;
    }
}

@keyframes research-in {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.research-item p {
    margin: 0.55rem 0 0 !important;
    font-size: 1rem;
    line-height: 1.5;
}

/* Scrollable panels */

.scroll-panel {
    max-height: min(82vh, 860px);
    overflow-y: auto;
    overscroll-behavior: auto;
    padding-right: 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: var(--home-border) transparent;
}

.news.scroll-panel,
.timeline.scroll-panel {
    max-height: 310px;
}

.scroll-panel.compact {
    max-height: 372px;
}

.scroll-panel.medium {
    max-height: 508px;
}

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

.scroll-panel::-webkit-scrollbar-thumb {
    background: var(--home-border);
    border-radius: 6px;
}

.scroll-panel.can-scroll:not(.expanded) {
    --fade-top: 28px;
    --fade-bottom: 56px;
    -webkit-mask-image: linear-gradient(to bottom, transparent, #000 var(--fade-top), #000 calc(100% - var(--fade-bottom)), transparent);
    mask-image: linear-gradient(to bottom, transparent, #000 var(--fade-top), #000 calc(100% - var(--fade-bottom)), transparent);
}

.scroll-panel.can-scroll.at-start {
    --fade-top: 0px;
}

.scroll-panel.can-scroll.at-end {
    --fade-bottom: 0px;
}

.scroll-panel.expanded {
    max-height: none !important;
    overflow: visible;
    padding-right: 0;
}

.panel-toggle {
    display: block;
    margin: 0.6rem 0 0;
    padding: 0;
    background: none;
    border: 0;
    color: var(--global-theme-color);
    font-family: var(--home-sans);
    font-size: 0.94rem;
    font-weight: 600;
    cursor: pointer;
}

.panel-toggle:hover,
.panel-toggle:focus-visible {
    text-decoration: underline;
}

/* Publications */

.publications ol.bibliography {
    margin-bottom: 0;
}

.publications ol.bibliography li {
    margin-bottom: 1.15rem;
}

.publications ol.bibliography li:last-child {
    margin-bottom: 0.25rem;
}

.publications ol.bibliography li .abbr {
    height: auto;
    margin-bottom: 0.35rem;
    padding-top: 0.15rem;
}

.publications ol.bibliography li .abbr abbr.badge {
    display: block;
    background: var(--home-tint);
    color: var(--global-theme-color) !important;
    box-shadow: none;
    border-radius: 6px;
    padding: 0.32rem 0.15rem;
    font-family: var(--home-sans);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
    cursor: default;
}

.publications ol.bibliography li .title {
    font-size: 1.0625rem;
    font-weight: 600;
    line-height: 1.35;
}

.publications ol.bibliography li .author {
    color: var(--home-muted);
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.45;
    margin-top: 0.2rem;
}

.publications ol.bibliography li .author sup {
    color: inherit;
}

.publications ol.bibliography li .author>em {
    border-bottom: 0;
    font-style: normal;
}

.publications ol.bibliography li .author>em strong {
    font-weight: 600;
    color: var(--global-text-color);
}

.publications ol.bibliography li .periodical {
    font-size: 0.94rem;
    line-height: 1.45;
    margin-top: 0.15rem;
}

.publications ol.bibliography li .periodical em {
    color: var(--home-muted);
}

.award {
    margin-left: 0.55rem;
    color: var(--global-theme-color);
    font-size: 0.94rem;
    font-style: normal;
    font-weight: 600;
    white-space: nowrap;
}

.award::before {
    content: "\2605";
    margin-right: 0.28em;
    font-size: 0.85em;
}

.publications ol.bibliography li .links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.45rem;
}

.pub-link {
    display: inline-block;
    padding: 0.1rem 0.7rem;
    border: 1px solid var(--home-border);
    border-radius: 999px;
    color: var(--global-text-color) !important;
    font-size: 0.86rem;
    line-height: 1.5rem;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.pub-link:hover,
.pub-link:focus-visible {
    border-color: var(--global-theme-color);
    background: var(--home-tint);
    color: var(--global-theme-color) !important;
    text-decoration: none;
}

.publications ol.bibliography li div.abstract.hidden {
    border: 0;
    border-left: 2px solid var(--home-tint-strong);
    margin-top: 0;
    text-align: left;
    transition: max-height 0.2s ease, margin-top 0.2s ease;
}

.publications ol.bibliography li div.abstract.hidden.open {
    margin-top: 0.6rem;
    border-color: var(--home-tint-strong);
}

.publications ol.bibliography li .hidden p {
    margin: 0 0 0 0.8rem;
    color: var(--home-muted);
    line-height: 1.55;
}

/* News and talks */

.news table,
.timeline table {
    margin-bottom: 0;
}

.news table.table th,
.timeline table.table th {
    width: 5.6rem;
    padding: 0.3rem 1rem 0.3rem 0;
    color: var(--home-muted);
    font-size: 0.94rem;
    font-weight: 400;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    vertical-align: top;
}

.news table.table td,
.timeline table.table td {
    font-weight: 400;
    padding: 0.3rem 0;
    font-size: 1rem;
    line-height: 1.5;
}

.news th,
.timeline th {
    line-height: 1.6;
}

.news .emoji {
    display: inline-block;
    margin-right: 0.4rem;
    font-size: 0.95em;
}

.news .news-icon {
    display: inline-block;
    width: 1.15em;
    margin-right: 0.4rem;
    font-size: 0.95em;
    text-align: center;
}

.news .news-icon.google {
    color: #4285f4;
}

.news svg.news-icon {
    height: 0.9em;
    vertical-align: -0.06em;
}

.news .news-icon.adobe {
    fill: #fa0f00;
}

.news table.table td.milestone {
    font-weight: 600;
}

.talk-title {
    display: block;
}

.talk-venue {
    display: block;
    color: var(--home-muted);
    font-size: 0.94rem;
}

.talk-venue sup {
    color: inherit;
}

.plain-list {
    margin: 0;
    padding-left: 1.15rem;
}

.plain-list li {
    margin-bottom: 0.3rem;
    font-size: 1rem;
}

/* Contact and footer */

.post article>.social {
    margin-top: 3rem;
}

.site-footer {
    margin-top: 2.5rem;
    padding: 1.1rem 0;
    border-top: 1px solid var(--home-border);
    color: var(--home-muted);
    font-size: 0.86rem;
    text-align: center;
}

.site-footer .container {
    color: inherit;
}

@media (min-width: 576px) {
    .publications ol.bibliography li .row>.col-sm-2 {
        flex: 0 0 7.7rem;
        max-width: 7.7rem;
    }

    .publications ol.bibliography li .row>.col-sm-8 {
        flex: 1 1 0;
        max-width: none;
        min-width: 0;
        padding-left: 0.25rem;
    }
}

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

    .research-card+.research-card {
        margin-top: 1rem;
    }
}

@media (max-width: 575.98px) {
    .post .post-header .post-title {
        font-size: 2.15rem;
    }

    .profile.float-right {
        float: none !important;
        width: 48%;
        max-width: 190px;
        margin: 0 0 1.25rem;
    }

    .publications ol.bibliography li .abbr abbr.badge {
        display: inline-block;
        padding: 0.25rem 0.6rem;
    }

    .scroll-panel {
        max-height: 70vh;
    }

    .scroll-panel.compact {
        max-height: 420px;
    }

    .news.scroll-panel,
    .timeline.scroll-panel {
        max-height: 300px;
    }

    .news table.table th,
    .timeline table.table th {
        width: 5.1rem;
        padding-right: 0.6rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

/* Projects page */

.navbar .navbar-brand.title {
    font-family: var(--home-serif);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--global-text-color);
}

.projects-container {
    margin-top: 0.5rem;
}

.project-tile {
    padding: 1rem 0 1.05rem;
    border-top: 1px solid var(--home-border);
}

.project-tile:first-child {
    border-top: 0;
    padding-top: 0;
}

.project-tile h4 {
    font-family: var(--home-sans);
    font-size: 1.0625rem;
    font-weight: 600;
    line-height: 1.35;
    margin: 0;
}

.project-tile .brief-description {
    display: block;
    margin-top: 0.1rem;
    color: var(--home-muted);
    font-size: 0.94rem;
    font-style: italic;
}

.project-tile .full-description {
    margin: 0.35rem 0 0 !important;
    font-size: 1rem;
    line-height: 1.5;
    text-wrap: pretty;
}

.projects-container h2 {
    margin-top: 2.2rem;
}

.projects-container h2:first-child {
    margin-top: 0.4rem;
}

.projects-intro {
    color: var(--home-muted);
    font-size: 0.94rem;
    margin: -0.2rem 0 1rem !important;
}
