/* Minimal Academic Homepage - Clean & Professional */

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-variant-numeric: lining-nums;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: Georgia, 'Times New Roman', serif;
    line-height: 1.6;
    color: #000;
    background: #fff;
    max-width: none;
    margin: 0;
    padding: 0;
    font-variant-numeric: lining-nums;
}

/* Typography - Academic Standard */
h1 {
    font-size: 1.8rem;
    font-weight: normal;
    margin-bottom: 0.3rem;
    color: #000;
}

h2 {
    font-size: 1.3rem;
    font-weight: bold;
    margin: 2.5rem 0 1rem 0;
    color: #000;
    border-bottom: 1px solid #000;
    padding-bottom: 0.2rem;
}

h3 {
    font-size: 1.1rem;
    font-weight: bold;
    margin: 1.5rem 0 0.5rem 0;
    color: #000;
}

h3.bordered-subtitle {
    border-bottom: 1px solid #000;
    padding-bottom: 0.2rem;
}

h4 {
    font-size: 1rem;
    font-weight: bold;
    margin-bottom: 0.3rem;
    color: #000;
}

p {
    margin-bottom: 0.8rem;
    text-align: left;
}

/* Links - Standard Academic Blue */
a {
    color: #0000EE;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

a:visited {
    color: #551A8B;
}

/* Header - Fixed to Top */
.header {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 270px;
    background: #fafafa;
    padding: 2.2rem 1.6rem;
    border-right: 1px solid #e4e4e4;
    z-index: 1000;
    overflow-y: auto;
}

.header .container {
    max-width: none;
    margin: 0;
}

.nav {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1.6rem;
}

.nav-brand {
    padding: 0 0.6rem;
}

.nav-brand h1 {
    font-size: 1.35rem;
    margin: 0;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    list-style: none;
    gap: 0.15rem;
    align-items: stretch;
}

.nav-menu li {
    width: 100%;
}

.nav-menu a {
    display: block;
    width: 100%;
    padding: 0.5rem 0.6rem;
    border-radius: 6px;
    font-size: 1rem;
    color: #333;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.nav-menu a:hover {
    text-decoration: none;
    background: #ececec;
    color: #000;
}

.nav-menu a.active {
    font-weight: 700;
    color: #000;
    background: #e6e6e6;
    text-decoration: none;
}

/* Main Content */
.container {
    max-width: 820px;
    margin: 0 auto;
    padding: 0;
}

.main {
    margin-left: 270px;
    margin-top: 0;
    padding: 48px 56px;
}

.section {
    margin-bottom: 2rem;
}

/* Profile Section - Simple Layout */
.profile-section {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 2rem;
    margin-bottom: 2rem;
    align-items: start;
}

.profile-image {
    text-align: center;
}

.profile-image img {
    display: block;
    width: 150px;
    height: 150px;
    object-fit: cover;
    object-position: center 30%;
    margin-bottom: 0.8rem;
}

.profile-info {
    min-width: 0;
}

.profile-email {
    margin-bottom: 0.8rem;
    font-size: 0.9rem;
    overflow-wrap: anywhere;
}

.profile-info h1 {
    font-size: 1.8rem;
    margin-bottom: 0.2rem;
}

.name-zh {
    font-family: "Noto Serif SC", "Songti SC", SimSun, serif;
    font-size: 0.85em;
    font-weight: 600;
}

.profile-info h2 {
    font-size: 1rem;
    font-weight: normal;
    margin-bottom: 1rem;
    border: none;
    padding: 0;
}

.affiliation {
    margin-bottom: 0.8rem;
    font-size: 1rem;
}

.affiliation i {
    display: none;
}

.research-area {
    margin-bottom: 0.8rem;
    font-size: 0.95rem;
}

.academic-links {
    font-size: 0.95rem;
    margin-top: 0.5rem;
}

.academic-links .separator {
    margin: 0 0.5rem;
    color: #666;
}

/* Social / link icon buttons */
.social-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-top: 1rem;
}

.social-links .social-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.58rem 1.05rem;
    border: 1px solid #d0d0d0;
    border-radius: 999px;
    background: #fff;
    color: #000;
    font-family: 'Source Sans Pro', -apple-system, sans-serif;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.social-links .social-btn:visited {
    color: #000;
}

.social-links .social-btn:hover {
    text-decoration: none;
    background: #000;
    color: #fff;
    border-color: #000;
    transform: translateY(-1px);
}

/* Override the global icon-hiding rule, only inside these buttons */
.social-links .social-btn i.fas,
.social-links .social-btn i.fab {
    display: inline-block;
    font-size: 1.2rem;
}

.social-links .social-icon {
    display: inline-block;
    width: 1.2rem;
    height: 1.2rem;
    object-fit: contain;
}

.social-links .scholar-icon {
    filter: invert(48%) sepia(95%) saturate(1603%) hue-rotate(199deg) brightness(98%) contrast(95%);
}

/* Brand colors at rest */
.social-links .social-btn .fa-github { color: #181717; }
.social-links .social-btn .fa-x-twitter { color: #000; }
.social-links .social-btn .fa-linkedin { color: #0a66c2; }
.social-links .social-btn .fa-graduation-cap { color: #4285f4; }
.social-links .social-btn .fa-file-lines { color: #b31b1b; }

/* On hover, icon turns white with the button */
.social-links .social-btn:hover i.fas,
.social-links .social-btn:hover i.fab {
    color: #fff;
}

.social-links .social-btn:hover .social-icon {
    filter: brightness(0) invert(1);
}

.scholar-profile-link {
    margin: -0.25rem 0 0.75rem;
}

.scholar-profile-link a {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.scholar-profile-link img {
    width: 1.1rem;
    height: 1.1rem;
    filter: invert(48%) sepia(95%) saturate(1603%) hue-rotate(199deg) brightness(98%) contrast(95%);
}

/* Biography */
.bio {
    background: #fff;
    padding: 0;
    margin-top: 1.5rem;
}

.bio h3 {
    font-size: 1.1rem;
    margin-bottom: 0.8rem;
}

.bio p {
    font-size: 1rem;
}

.inline-logo {
    width: 1em;
    height: 1em;
    margin-right: 0.28rem;
    object-fit: contain;
    vertical-align: -0.14em;
}

.education-list-inline p > img.education-logo {
    display: inline-block;
    width: 1.5em !important;
    height: 1.5em !important;
    max-width: 1.5em !important;
    margin-right: 0.55rem;
    object-fit: contain;
    vertical-align: -0.4em;
}

.research-list-inline p > img.internship-logo {
    display: inline-block;
    width: 1.5em !important;
    height: 1.5em !important;
    max-width: 1.5em !important;
    object-fit: contain;
    vertical-align: middle;
    margin-right: 0.55em;
}

.bio p a {
    text-decoration: underline;
}

/* Remove all color styling from inline text */
.bio strong[style],
p strong[style] {
    color: inherit !important;
}

/* Publications */
.publication-item {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: start;
}

.publication-thumb {
    width: 200px;
    height: auto;
    object-fit: cover;
    border: 1px solid #ddd;
    cursor: zoom-in;
}

.publication-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.82);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    cursor: zoom-out;
}

.publication-lightbox.is-open {
    opacity: 1;
    visibility: visible;
}

.publication-lightbox img {
    display: block;
    max-width: calc(100vw - 3rem);
    max-height: calc(100vh - 3rem);
    width: auto;
    height: auto;
    object-fit: contain;
    background: #fff;
    border-radius: 2px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    cursor: zoom-out;
}

body.publication-lightbox-open {
    overflow: hidden;
}

.publications-link {
    background: #fff;
    padding: 0.5rem 0;
    border: none;
    text-align: left;
}

.publications-link i {
    display: none;
}

/* Lists - Academic Style */
.education-list-inline,
.research-list-inline {
    background: #fff;
    padding: 0;
    border: none;
    margin-bottom: 1rem;
}

.education-list-inline p,
.research-list-inline p {
    margin-bottom: 1rem;
    line-height: 1.6;
    font-size: 0.95rem;
}

/* Remove colored text in lists */
.education-list-inline strong[style],
.research-list-inline strong[style] {
    color: inherit !important;
}

/* Highlighted text in blue */
.highlight {
    color: #0000EE;
    font-weight: normal;
}

/* Company names in blue */
.company-name {
    color: #0000EE;
}

/* Projects - Compact List */
.projects-list {
    margin-bottom: 1.5rem;
}

.project-item {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: start;
}

.project-thumb {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border: 1px solid #ddd;
}

.project-details p {
    margin-bottom: 0;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Flag Counter */
.flag-counter {
    text-align: center;
    margin: 2rem 0;
    padding: 1rem;
    background: #f9f9f9;
    border: 1px solid #ddd;
}

.flag-counter img {
    max-width: 100%;
    height: auto;
}

/* Visitor Map */
.real-map-container {
    background: #fff;
    padding: 1rem 0;
    border: none;
    text-align: center;
    max-width: 100%;
    margin: 0;
}

.map-description h4 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.map-description p {
    font-size: 0.95rem;
}

.map-links {
    margin-top: 1rem;
    padding-top: 0.5rem;
    border-top: 1px solid #ccc;
}

.map-links i {
    display: none;
}

/* Footer */
.footer {
    background: #fff;
    color: #000;
    text-align: center;
    padding: 1.5rem 40px;
    margin-top: 3rem;
    margin-left: 270px;
    border-top: 1px solid #000;
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.footer-note {
    font-size: 0.9rem;
    margin: 0;
}

#visitor-location {
    color: inherit;
    font-weight: normal;
}

/* Hide all FontAwesome icons */
i.fas, i.fab {
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .header {
        position: static;
        width: auto;
        bottom: auto;
        border-right: none;
        border-bottom: 1px solid #000;
        padding: 1rem 20px;
        overflow: visible;
    }

    .main {
        margin-left: 0;
        padding: 20px 20px;
    }

    .footer {
        margin-left: 0;
        padding: 1.5rem 20px;
    }

    .nav {
        flex-direction: column;
        align-items: center;
        gap: 0.8rem;
    }

    .nav-menu {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.4rem;
    }

    .nav-menu li {
        width: auto;
    }

    .nav-menu a {
        width: auto;
        display: inline-block;
    }

    .profile-section {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 1.5rem;
    }

    .profile-image img {
        margin: 0 auto 0.8rem auto;
    }

    .project-item {
        grid-template-columns: 60px 1fr;
        gap: 0.8rem;
    }

    .project-thumb {
        width: 60px;
        height: 45px;
    }

    .publication-item {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }

    .publication-thumb {
        width: 120px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 0;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.2rem;
    }
}

/* Research figures and institution identities */
.feature-card,
.publication-item {
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
    padding: 1.1rem 0;
    border-bottom: 1px solid #e5e5e5;
}

.feature-card h3 {
    margin-top: 0;
}

.feature-card p,
.publication-item p {
    margin-bottom: 0.45rem;
}

.figure-link {
    display: block;
    width: 190px;
    border: 1px solid #e1e1e1;
    background: #fff;
}

.figure-link img,
.publication-thumb {
    display: block;
    width: 100%;
    height: 126px;
    object-fit: contain;
    border: 0;
    cursor: pointer;
}

.institution-item {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 1rem;
    align-items: center;
    padding: 0.9rem 0;
    border-bottom: 1px solid #e5e5e5;
}

.institution-item > img {
    display: block;
    width: 52px;
    height: 52px;
    object-fit: contain;
}

.institution-item p:last-child {
    margin-bottom: 0;
}

.company-item {
    grid-template-columns: 112px minmax(0, 1fr);
}

.company-item > img {
    width: 104px;
    height: 36px;
}

.honors-list {
    padding-left: 1.3rem;
    margin-bottom: 1rem;
}

.honors-list li {
    margin-bottom: 0.55rem;
    line-height: 1.5;
}

@media (max-width: 620px) {
    .feature-card,
    .publication-item {
        grid-template-columns: 1fr;
        gap: 0.7rem;
    }

    .figure-link {
        width: min(100%, 260px);
    }

    .company-item {
        grid-template-columns: 1fr;
        gap: 0.4rem;
    }
}

/* Theme switcher */
.theme-toggle {
    align-self: flex-start;
    margin: 0.4rem 0.6rem 0;
    padding: 0.45rem 0.65rem;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    background: #fff;
    color: #333;
    font: 600 0.88rem 'Source Sans Pro', -apple-system, sans-serif;
    cursor: pointer;
}

.theme-toggle:hover {
    background: #ececec;
    color: #000;
}

.theme-toggle:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 3px;
}

html[data-theme="dark"] {
    color-scheme: dark;
}

html[data-theme="dark"] body {
    color: #e7e9ed;
    background: #15191e;
}

html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4 {
    color: #f4f5f7;
}

html[data-theme="dark"] h2,
html[data-theme="dark"] h3.bordered-subtitle {
    border-color: #76808a;
}

html[data-theme="dark"] a,
html[data-theme="dark"] .highlight,
html[data-theme="dark"] .company-name {
    color: #9bc6ff;
}

html[data-theme="dark"] a:visited {
    color: #c6a7ff;
}

html[data-theme="dark"] .header {
    background: #1d232b;
    border-color: #353e49;
}

html[data-theme="dark"] .nav-brand a,
html[data-theme="dark"] .nav-brand a:visited {
    color: #f4f5f7;
}

html[data-theme="dark"] .nav-menu a,
html[data-theme="dark"] .nav-menu a:visited {
    color: #d5dce5;
}

html[data-theme="dark"] .nav-menu a:hover,
html[data-theme="dark"] .nav-menu a.active {
    color: #fff;
    background: #35414e;
}

html[data-theme="dark"] .theme-toggle {
    color: #e7e9ed;
    background: #27313b;
    border-color: #52606e;
}

html[data-theme="dark"] .theme-toggle:hover {
    color: #fff;
    background: #35414e;
}

html[data-theme="dark"] .social-links .social-btn,
html[data-theme="dark"] .social-links .social-btn:visited {
    color: #e7e9ed;
    background: #202730;
    border-color: #56616d;
}

html[data-theme="dark"] .social-links .social-btn:hover {
    color: #15191e;
    background: #e7e9ed;
    border-color: #e7e9ed;
}

html[data-theme="dark"] .social-links .social-btn .fa-github {
    color: #e7e9ed;
}

html[data-theme="dark"] .social-links .social-btn:hover i.fas,
html[data-theme="dark"] .social-links .social-btn:hover i.fab {
    color: #15191e;
}

html[data-theme="dark"] .social-links .social-btn:hover .social-icon {
    filter: brightness(0);
}

html[data-theme="dark"] .bio,
html[data-theme="dark"] .publications-link,
html[data-theme="dark"] .education-list-inline,
html[data-theme="dark"] .research-list-inline,
html[data-theme="dark"] .real-map-container,
html[data-theme="dark"] .footer {
    color: #e7e9ed;
    background: #15191e;
}

html[data-theme="dark"] .publication-item,
html[data-theme="dark"] .feature-card,
html[data-theme="dark"] .institution-item {
    border-color: #353e49;
}

html[data-theme="dark"] .figure-link {
    border-color: #56616d;
}

html[data-theme="dark"] .flag-counter {
    color: #e7e9ed;
    background: #202730;
    border-color: #56616d;
}

html[data-theme="dark"] .map-links,
html[data-theme="dark"] .footer {
    border-color: #76808a;
}

html[data-theme="dark"] .academic-links .separator {
    color: #aab4c1;
}

html[data-theme="dark"] .institution-item > img,
html[data-theme="dark"] .inline-logo {
    background: #fff;
    border-radius: 3px;
}

@media (max-width: 768px) {
    .theme-toggle {
        align-self: center;
        margin: 0;
    }
}
