/* Academic Personal Website — refined Wowchemy-style layout */

/* ===== Fonts (self-hosted, latin + latin-ext subsets) ===== */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('fonts/inter-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('fonts/inter-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Source Serif 4';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    font-optical-sizing: auto;
    src: url('fonts/source-serif-4-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'Source Serif 4';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    font-optical-sizing: auto;
    src: url('fonts/source-serif-4-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ===== Design Tokens ===== */
:root {
    color-scheme: light;

    --ink: #1a1d24;
    --text: #3d4351;
    --text-muted: #5f6b7a;
    --bg: #ffffff;
    --bg-tint: #f6f8fb;
    --border: #e3e8ee;
    --primary: #1d4fd8;
    --primary-soft: rgba(29, 79, 216, 0.08);
    --on-primary: #ffffff;
    --selection: rgba(29, 79, 216, 0.15);
    --nav-bg: rgba(255, 255, 255, 0.88);
    --shadow-sm: 0 1px 2px rgba(26, 29, 36, 0.05);
    --shadow-md: 0 8px 24px rgba(26, 29, 36, 0.08);

    --font-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

    --text-sm: 0.9375rem;
    --text-xs: 0.8125rem;

    --max-width: 960px;
    --nav-height: 60px;
}

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

    --ink: #f1f5f9;
    --text: #c3ccd9;
    --text-muted: #919ca9;
    --bg: #0f1620;
    --bg-tint: #151e2b;
    --border: #263243;
    --primary: #7da7f4;
    --primary-soft: rgba(125, 167, 244, 0.13);
    --on-primary: #0f1620;
    --selection: rgba(125, 167, 244, 0.3);
    --nav-bg: rgba(15, 22, 32, 0.88);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
}

/* ===== Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-padding-top: calc(var(--nav-height) + 14px);
}

@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

body {
    font-family: var(--font-sans);
    color: var(--text);
    background: var(--bg);
    line-height: 1.65;
    font-size: 16px;
}

::selection {
    background: var(--selection);
}

a:focus-visible,
button:focus-visible,
summary:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 2px;
}

.icon {
    width: 1em;
    height: 1em;
    fill: currentColor;
    vertical-align: -0.125em;
}

.skip-link {
    position: absolute;
    top: -100px;
    left: 1rem;
    z-index: 2000;
    padding: 0.5rem 1rem;
    background: var(--primary);
    color: var(--on-primary);
    border-radius: 0 0 6px 6px;
    text-decoration: none;
    font-size: var(--text-sm);
}

.skip-link:focus {
    top: 0;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 2rem;
}

/* ===== Top Navigation ===== */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: var(--nav-bg);
    -webkit-backdrop-filter: saturate(180%) blur(10px);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    display: flex;
    align-items: center;
}

.nav-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--ink);
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.2s;
}

.nav-brand:hover {
    color: var(--primary);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-links a {
    color: var(--text);
    text-decoration: none;
    font-size: var(--text-sm);
    font-weight: 500;
    padding: 0.3rem 0;
    transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a:focus-visible {
    color: var(--primary);
}

.nav-links a.active {
    color: var(--primary);
    box-shadow: inset 0 -2px 0 var(--primary);
}

.theme-toggle,
.nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    font-size: 1rem;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.theme-toggle:hover,
.nav-toggle:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--primary-soft);
}

.icon-sun,
html[data-theme='dark'] .icon-moon {
    display: none;
}

html[data-theme='dark'] .icon-sun {
    display: inline;
}

.nav-toggle {
    display: none;
}

.icon-xmark,
.nav-links.open ~ .nav-toggle .icon-bars {
    display: none;
}

.nav-links.open ~ .nav-toggle .icon-xmark {
    display: inline;
}

/* ===== Hero / About Section ===== */
.hero-section {
    padding: calc(var(--nav-height) + 4rem) 0 4rem;
    background: linear-gradient(180deg, var(--bg-tint) 0%, var(--bg) 100%);
    border-bottom: 1px solid var(--border);
}

.hero-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    gap: 3.5rem;
    align-items: flex-start;
}

.hero-left {
    flex-shrink: 0;
    width: 220px;
    text-align: center;
}

.profile-photo {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 1.25rem;
    border: 4px solid var(--bg);
    box-shadow: var(--shadow-md), 0 0 0 1px var(--border);
}

.profile-name {
    font-family: var(--font-serif);
    font-size: 2rem;
    font-weight: 700;
    color: var(--ink);
    line-height: 1.2;
    margin-bottom: 0.15rem;
}

.profile-name-zh {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.profile-title {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.2rem;
}

.profile-affiliation {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.social-icons {
    display: flex;
    justify-content: center;
    gap: 0.8rem;
}

.social-icons a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: var(--primary);
    font-size: 1rem;
    transition: background 0.2s, color 0.2s, transform 0.2s;
    background: var(--primary-soft);
}

.social-icons a:hover,
.social-icons a:focus-visible {
    background: var(--primary);
    color: var(--on-primary);
    transform: translateY(-2px);
}

.hero-right {
    flex: 1;
    min-width: 0;
}

.bio-title {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--ink);
    margin-bottom: 1rem;
}

.hero-right > p {
    margin-bottom: 0.9rem;
    max-width: 68ch;
    color: var(--text);
}

.hero-right strong {
    color: var(--ink);
}

/* Interests + Education columns */
.hero-columns {
    display: flex;
    gap: 2.5rem;
    margin-top: 1.5rem;
}

.hero-col {
    flex: 1;
    min-width: 0;
}

.subsection-title {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 0.6rem;
}

.interest-list {
    list-style: none;
    padding: 0;
}

.interest-list li {
    padding: 0.3rem 0;
    font-size: var(--text-sm);
    color: var(--text);
    display: flex;
    align-items: baseline;
    gap: 0.55rem;
}

.interest-list li::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
    position: relative;
    top: -2px;
}

.edu-list {
    list-style: none;
    padding: 0;
}

.edu-list li {
    padding: 0.3rem 0;
    font-size: var(--text-sm);
    color: var(--text);
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
}

.edu-icon {
    color: var(--primary);
    flex-shrink: 0;
    margin-top: 5px;
}

.edu-note {
    color: var(--text-muted);
}

/* ===== Sections ===== */
.section {
    padding: 4rem 0;
}

.section-tint {
    background: var(--bg-tint);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.section-title {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--ink);
    margin-bottom: 1.5rem;
}

.section-title::before {
    content: '';
    display: block;
    width: 2.5rem;
    height: 3px;
    border-radius: 2px;
    background: var(--primary);
    margin-bottom: 0.75rem;
}

/* ===== News ===== */
.news-list {
    list-style: none;
    padding: 0;
}

.news-list li {
    display: flex;
    gap: 1rem;
    padding: 0.45rem 0;
    font-size: var(--text-sm);
}

.news-date {
    flex-shrink: 0;
    min-width: 5.5rem;
    color: var(--text-muted);
    font-size: var(--text-xs);
    font-variant-numeric: tabular-nums;
    padding-top: 0.1rem;
}

.news-text {
    color: var(--text);
    max-width: 68ch;
}

.news-text a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.news-text a:hover,
.news-text a:focus-visible {
    text-decoration: underline;
}

/* ===== Publications ===== */
.pub-group-title {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--ink);
    margin: 1.5rem 0 0.25rem;
}

.pub-group-title:first-of-type {
    margin-top: 0;
}

.pub-item {
    padding: 1.1rem 0;
    border-bottom: 1px solid var(--border);
}

.pub-item:last-child {
    border-bottom: none;
}

.pub-venue {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.3rem;
}

.pub-status {
    color: var(--text-muted);
    text-transform: none;
    font-weight: 500;
}

.pub-entry {
    font-size: var(--text-sm);
    color: var(--text);
    line-height: 1.6;
    max-width: 78ch;
}

.pub-entry strong {
    color: var(--ink);
}

.pub-title {
    color: var(--ink);
    font-weight: 600;
}

/* ===== Projects ===== */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.project-card {
    display: flex;
    flex-direction: column;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
}

.project-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.project-card h3 {
    font-family: var(--font-serif);
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 0.5rem;
}

.project-summary {
    font-size: var(--text-sm);
    color: var(--text);
    line-height: 1.6;
    margin-bottom: 0.8rem;
}

.project-detail {
    padding-left: 1.2rem;
    margin-bottom: 1rem;
}

.project-detail li {
    font-size: var(--text-xs);
    margin-bottom: 0.4rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.project-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: auto;
    align-self: flex-start;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: var(--text-xs);
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}

.project-link:hover,
.project-link:focus-visible {
    background: var(--primary);
    color: var(--on-primary);
}

/* ===== Experience (native disclosure) ===== */
.exp-list {
    display: flex;
    flex-direction: column;
}

.exp-item {
    border-bottom: 1px solid var(--border);
}

.exp-item:last-child {
    border-bottom: none;
}

.exp-item summary {
    list-style: none;
    cursor: pointer;
    padding: 1.2rem 0.75rem;
    margin: 0 -0.75rem;
    border-radius: 8px;
    transition: background 0.2s;
}

.exp-item summary::-webkit-details-marker {
    display: none;
}

.exp-item summary:hover {
    background: var(--primary-soft);
}

.exp-item summary .exp-header {
    margin-bottom: 0;
}

.exp-item > .exp-summary {
    margin-top: -0.35rem;
    padding-bottom: 1.1rem;
}

.exp-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.4rem;
}

.exp-left {
    display: flex;
    flex-direction: column;
}

.exp-role {
    font-size: 1.0625rem;
    color: var(--ink);
    font-weight: 600;
    line-height: 1.4;
}

h3.exp-role {
    font-family: var(--font-sans);
}

.exp-company {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.exp-right {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
    text-align: right;
}

.exp-date {
    font-size: var(--text-xs);
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.exp-chevron {
    color: var(--text-muted);
    font-size: var(--text-xs);
    transition: transform 0.25s;
}

.exp-item[open] .exp-chevron {
    transform: rotate(180deg);
}

.exp-summary {
    display: block;
    font-size: var(--text-sm);
    color: var(--text);
    line-height: 1.6;
    max-width: 68ch;
}

.exp-detail {
    padding: 0 0.75rem 1.2rem 0;
}

.exp-detail ul {
    padding-left: 1.2rem;
}

.exp-detail li {
    font-size: var(--text-sm);
    margin-bottom: 0.5rem;
    color: var(--text);
    line-height: 1.6;
    max-width: 68ch;
}

.exp-detail strong {
    color: var(--ink);
}

.exp-detail a {
    color: var(--primary);
    text-decoration: none;
}

.exp-detail a:hover,
.exp-detail a:focus-visible {
    text-decoration: underline;
}

/* ===== Service ===== */
.service-list {
    display: flex;
    flex-direction: column;
}

.service-entry {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.9rem 0;
    border-bottom: 1px solid var(--border);
}

.service-entry:last-child {
    border-bottom: none;
}

.service-role {
    display: block;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 0.1rem;
}

.service-org {
    display: block;
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.service-date {
    flex-shrink: 0;
    font-size: var(--text-xs);
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    padding-top: 0.2rem;
}

/* ===== Teaching ===== */
.teaching-list {
    display: flex;
    flex-direction: column;
}

.teaching-item {
    padding: 1.2rem 0;
    border-bottom: 1px solid var(--border);
}

.teaching-item:last-child {
    border-bottom: none;
}

.teaching-item .exp-summary {
    margin-top: 0.4rem;
}

/* ===== Footer ===== */
footer {
    padding: 2rem 0;
    background: var(--bg-tint);
    text-align: center;
}

footer p {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition: none !important;
        animation: none !important;
    }
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .nav-toggle {
        display: inline-flex;
    }

    .theme-toggle,
    .nav-toggle {
        width: 44px;
        height: 44px;
    }

    .social-icons a {
        width: 44px;
        height: 44px;
    }

    .nav-links {
        display: none;
        position: fixed;
        top: var(--nav-height);
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        background: var(--bg);
        border-bottom: 1px solid var(--border);
        padding: 0.5rem 1.5rem;
        box-shadow: var(--shadow-md);
    }

    .nav-links.open {
        display: flex;
    }

    .nav-links a {
        padding: 0.85rem 0;
        font-size: 1rem;
        border-bottom: 1px solid var(--border);
    }

    .nav-links a:last-child {
        border-bottom: none;
    }

    .nav-links a.active {
        box-shadow: none;
    }

    .hero-section {
        padding: calc(var(--nav-height) + 2.5rem) 0 3rem;
    }

    .hero-container {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 2rem;
        padding: 0 1rem;
    }

    .hero-left {
        width: 100%;
    }

    .profile-photo {
        width: 150px;
        height: 150px;
    }

    .hero-right {
        text-align: left;
    }

    .hero-right .bio-title {
        text-align: center;
    }

    .hero-columns {
        flex-direction: column;
        gap: 1.5rem;
    }

    .container {
        padding: 0 1rem;
    }

    .section {
        padding: 3rem 0;
    }

    .exp-header {
        flex-direction: column;
        gap: 0.2rem;
    }

    .exp-right {
        text-align: left;
    }

    .service-entry {
        flex-direction: column;
        gap: 0.2rem;
    }

    .service-date {
        padding-top: 0;
    }

    .project-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .nav-container {
        padding: 0 1rem;
    }

    .section-title,
    .bio-title {
        font-size: 1.35rem;
    }

    .profile-name {
        font-size: 1.75rem;
    }
}

/* ===== Print ===== */
@media print {
    :root,
    html[data-theme='dark'] {
        --ink: #000000;
        --text: #1a1d24;
        --text-muted: #444444;
        --bg: #ffffff;
        --bg-tint: #ffffff;
        --border: #bbbbbb;
        --primary: #1d4fd8;
    }

    .top-nav,
    .theme-toggle,
    .nav-toggle,
    .skip-link {
        display: none;
    }

    .hero-section {
        padding-top: 1rem;
    }

    .hero-section,
    .section,
    .section-tint,
    footer {
        background: none;
        border: none;
        padding: 1.5rem 0;
    }

    .exp-item .exp-chevron {
        display: none;
    }
}
