:root {
    --purple: #750f6d;
    --purple-dark: #4e0848;
    --purple-light: #ead8e8;
    --purple-wash: #f8f2f7;
    --ink: #242124;
    --muted: #666066;
    --rule: #eadfe8;
    --page-width: 900px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    margin: 0;
    padding: 0 24px 64px;
    color: var(--ink);
    background: #faf8fa;
    font-family: Arial, "Microsoft YaHei", sans-serif;
    font-size: 18px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

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

p {
    margin: 0.85em 0;
    font-family: Arial, "Microsoft YaHei", sans-serif;
    font-size: 18px;
}

h1,
h2,
h3 {
    padding: 0;
    color: var(--purple-dark);
    font-family: Arial, "Microsoft YaHei", sans-serif;
}

h1 {
    margin: 0;
    font-size: 42px;
    line-height: 1.2;
}

h1 font {
    margin-left: 8px;
    color: var(--purple);
    font-family: "Microsoft YaHei", Arial, sans-serif !important;
    font-size: 26px !important;
    font-weight: 500;
}

h2 {
    margin: 0 0 20px;
    font-size: 26px;
    line-height: 1.3;
}

h3 {
    margin: 0 0 18px;
    font-size: 20px;
    line-height: 1.4;
}

small {
    font-size: 16px;
    font-weight: 400;
}

a,
a:visited {
    color: var(--purple);
    text-decoration: none;
}

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

a:focus-visible {
    outline: 2px solid var(--purple);
    outline-offset: 3px;
}

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

.container,
.container_title,
.title {
    width: min(100%, var(--page-width));
    clear: both;
}

.container {
    margin: 0 auto;
    padding: 34px 30px;
    border: 0;
    border-bottom: 1px solid var(--rule);
    border-radius: 0;
    background: #fff;
    box-shadow: none;
}

.container:nth-of-type(2) {
    border-top: 1px solid var(--rule);
}

.container > br {
    display: none;
}

/* Navigation */
body > .container:first-of-type {
    position: static;
    margin: 0 auto 22px;
    padding: 20px 24px 16px;
    border: 0;
    border-bottom: 2px solid var(--purple);
    background: transparent;
}

body > .container:first-of-type h2 {
    display: block;
    margin: 0;
    color: var(--muted);
    font-family: Arial, "Microsoft YaHei", sans-serif;
    font-size: 22px;
    font-weight: 400;
    line-height: 2;
    text-align: center;
}

body > .container:first-of-type a {
    display: inline;
    padding: 0;
    color: var(--ink);
    font-size: 22px;
    text-decoration: none;
}

body > .container:first-of-type a:hover {
    color: var(--purple);
    text-decoration: underline;
    text-underline-offset: 4px;
}

.page-home > .container:first-of-type a[href="./index.html"],
.page-publications > .container:first-of-type a[href="./publications.html"],
.page-blog > .container:first-of-type a[href="./blog.html"],
.page-talks > .container:first-of-type a[href="./talks.html"],
.page-services > .container:first-of-type a[href="./services.html"],
.page-awards > .container:first-of-type a[href="./awards.html"],
.page-reading > .container:first-of-type a[href="./reading.html"] {
    color: var(--purple);
    font-weight: 700;
}

/* Home introduction */
.page-home > .container:nth-of-type(2) {
    display: grid;
    grid-template-columns: 233px minmax(0, 390px);
    gap: 52px;
    align-items: center;
    justify-content: center;
    min-height: 340px;
    padding-top: 42px;
    padding-bottom: 42px;
}

#sidebar {
    float: none;
    margin: 0;
}

#sidebar::before,
#bio::before,
.page-home > .container:nth-of-type(2)::after,
.book-card::before {
    display: none;
    content: none;
}

#me {
    display: block;
    width: 233px !important;
    height: auto;
    margin: 0;
    border: 0;
    border-radius: 0;
    clip-path: none;
    box-shadow: none;
}

#bio {
    min-width: 0;
    padding: 0;
}

#bio > br {
    display: none;
}

#bio p {
    color: var(--muted);
    font-size: 18px;
    line-height: 1.5 !important;
}

.external {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 20px !important;
}

.external a,
.external a.first {
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    font-size: 18px;
    font-weight: 400;
}

/* Education, experience, and publications */
.publication {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    column-gap: 24px;
    align-items: start;
    clear: both;
    padding: 20px 0;
    border-bottom: 1px solid var(--rule);
}

.publication:last-of-type {
    border-bottom: 0;
}

.publogo {
    grid-column: 1;
    grid-row: 1 / span 2;
    float: none;
    width: 90px !important;
    height: 90px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    object-fit: contain;
    box-shadow: none;
}

.publication p {
    grid-column: 2;
    min-width: 0;
    height: auto !important;
    margin: 0;
    padding: 0 !important;
    font-size: 18px;
    line-height: 1.6;
}

.publication strong a,
.reading-item .title-row strong a {
    color: var(--purple-dark);
}

.publication .links {
    position: static;
    top: auto;
    grid-column: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 12px;
}

.publication .links a {
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    font-size: 18px;
    font-weight: 400;
    text-transform: none;
}

.publication:has(.publogo[style*="256px"]) {
    grid-template-columns: 256px minmax(0, 1fr);
    column-gap: 28px;
    padding: 26px 0;
}

.publication:has(.publogo[style*="256px"]) .publogo {
    width: 256px !important;
    height: auto;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.oral {
    color: #a3204d;
    font-weight: bold;
}

p[style*="text-align: right"] a {
    display: inline;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    font-size: 18px;
    font-weight: 400;
}

/* Reading page */
.books-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px 28px;
}

.book-card {
    padding: 0 0 16px;
    border: 0;
    border-bottom: 1px solid var(--rule);
    border-radius: 0;
    background: transparent;
}

.book-card .title-row {
    margin-bottom: 5px;
}

.book-card .title-row strong {
    color: var(--purple-dark);
    font-size: 18px;
}

.book-card .meta,
.reading-item .meta {
    margin-bottom: 7px;
    color: var(--muted);
    font-size: 16px;
}

.reading-item {
    clear: both;
    padding: 16px 0;
    border-bottom: 1px solid var(--rule);
}

.reading-item:last-child {
    border-bottom: 0;
}

.reading-item .title-row {
    margin-bottom: 5px;
}

.reading-item .title-row strong a {
    font-size: 18px;
}

.tag {
    display: inline-block;
    margin: 2px 6px 2px 0;
    padding: 2px 8px;
    border: 0;
    border-radius: 2px;
    color: var(--purple-dark);
    background: var(--purple-light);
    font-size: 14px;
    line-height: 1.5;
}

.tag.philosophy,
.tag.math {
    color: #725407;
    background: #f8edcc;
}

.tag.life,
.tag.psychology,
.tag.biography {
    color: #80465f;
    background: #f5e4eb;
}

.tag.technology,
.tag.cs,
.tag.physics,
.tag.research,
.tag.phd,
.tag.article,
.tag.economics {
    color: #593a72;
    background: #eae3f3;
}

.iframe_video {
    float: left;
    margin-right: 30px;
}

.codelogo {
    float: left;
    margin-right: 10px;
    border: 0;
}

.code {
    clear: left;
    padding-bottom: 10px;
    vertical-align: middle;
}

.code .download a {
    display: block;
    float: left;
    margin: 0 15px;
}

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

@media (max-width: 760px) {
    body {
        padding: 0 14px 48px;
        font-size: 18px;
    }

    p {
        font-size: 18px;
    }

    .container {
        padding: 28px 20px;
    }

    body > .container:first-of-type {
        margin-bottom: 14px;
        padding: 16px 10px 12px;
    }

    body > .container:first-of-type h2,
    body > .container:first-of-type a {
        font-size: 22px;
        line-height: 2;
    }

    h1 {
        font-size: 38px;
    }

    h2 {
        font-size: 24px;
    }

    h3 {
        font-size: 20px;
    }

    .page-home > .container:nth-of-type(2) {
        grid-template-columns: 1fr;
        gap: 30px;
        padding-top: 32px;
        padding-bottom: 32px;
        text-align: center;
    }

    #sidebar {
        margin: 0 auto;
    }

    #me {
        width: min(233px, 72vw) !important;
        margin: 0 auto;
    }

    .external {
        justify-content: center;
    }

    .publication:has(.publogo[style*="256px"]) {
        grid-template-columns: 1fr;
        row-gap: 16px;
    }

    .publication:has(.publogo[style*="256px"]) .publogo,
    .publication:has(.publogo[style*="256px"]) p,
    .publication:has(.publogo[style*="256px"]) .links {
        grid-column: 1;
    }

    .publication:has(.publogo[style*="256px"]) .publogo {
        grid-row: auto;
        width: min(100%, 420px) !important;
    }
}

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

    .publication {
        grid-template-columns: 72px minmax(0, 1fr);
        column-gap: 16px;
    }

    .publogo {
        width: 68px !important;
        height: 68px;
    }

    .publication p,
    .publication .links {
        grid-column: 2;
    }
}

@media print {
    body {
        padding: 0;
        background: #fff;
    }

    .container {
        break-inside: avoid;
    }
}
