@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,700;1,400&display=swap');
/* 1. 引入 Google Fonts 的 霞鹜文楷 (400正体) */
@import url('https://fonts.googleapis.com/css2?family=LXGW+WenKai+TC&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@500&family=Noto+Serif+TC:wght@500&family=Noto+Serif:ital,wght@0,100..900;1,100..900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Charis+SIL:ital,wght@0,400;0,700;1,400;1,700&family=Noto+Serif+SC:wght@500&family=Noto+Serif+TC:wght@500&display=swap');


:root {
--primary-color: #1B3144; /* 靛青：微调明度，增加矿物深邃感，压住暖色大底 */
--accent-color: #962A1F; /* 朱砂：略微提亮，使其如印章般在宣纸上“跳”出来 */
--dark-text: #2B2B2B; /* 浓墨：减少绝对黑度，模拟墨迹干透后的自然色泽 */
--body-text: #4A453A; /* 墨迹：加深对比，确保在长文阅读时符合视觉易读性 */
--light-text: #F5F0E6; /* 绢白：降低高光刺眼度，与深蓝背景融合更自然 */
--gray-text: #8C7F6A; /* 赭石：作为次要辅助色，用于标注或不重要的信息 */
--border-color: #D4C9A8; /* 牙色：增强存在感，用于模拟古籍装订的骨架线 */
--background-color: #F0E9D7; /* 宣纸：提高净度，去掉了原版的“脏感”，更护眼 */
--surface-color: #F7F3E8; /* 云帛：新增容器色，用于卡片或侧边栏，拉开层级 */
}

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

@font-face {
    font-family: 'CustomFont';
    src: url('../fonts/jhlst-subset.woff2') format('woff2');
    font-style: normal;
    font-weight: normal;
    font-display: swap;
}

body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--dark-text);
    background-color: var(--background-color);
    overflow-x: hidden;
    text-rendering: optimizeLegibility;
    /* -webkit-font-smoothing: antialiased; */
}

a {
    text-decoration: none;
    color: inherit;
}

a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 3px;
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}


/* 2. 设置 em 样式 */
em {
  /* 优先西文默认衬线斜体，后接霞鹜文楷 */
  font-family: "Noto Serif", "Times New Roman", "LXGW WenKai TC", serif;
  font-style: italic;
  font-synthesis: none;
}



/* 导航栏样式 */
.topnav {
    background-color: var(--primary-color);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    padding: 0 20px;
}

.nav-container {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    height: 70px;
}

/* Right side container for nav links and language switcher */
.nav-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-container img {
    height: 30px;
    width: auto;
}

.logo-container span {
    font-size: 18px;
    font-weight: 600;
    color: var(--light-text);
}

.nav-links {
    display: flex;
    gap: 15px;
}

.nav-links a {
    color: var(--light-text);
    padding: 10px;
    font-size: 16px;
    font-weight: 500;
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--accent-color);
    transition: width 0.3s ease;
}

.nav-links a:hover::after,
.nav-links a.active::after {
    width: 100%;
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--light-text);
    font-size: 24px;
    cursor: pointer;
    padding: 10px;
}

/* Global Language Switcher in Navigation */
.global-lang-switcher {
    position: relative;
    display: inline-block;
    margin-left: 0;
}

.global-lang-button {
    background-color: transparent;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--light-text);
    font-size: 1.1rem;
    transition: all 0.3s ease;
    padding: 0;
}

.global-lang-button:hover {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
}

.global-lang-button:active {
    transform: scale(0.95);
}

.global-lang-menu {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    background-color: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    list-style: none;
    padding: 8px 0;
    min-width: 140px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1001;
}

.global-lang-switcher.active .global-lang-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.global-lang-menu li {
    padding: 10px 20px;
    cursor: pointer;
    color: var(--body-text);
    transition: background-color 0.2s ease;
    font-size: 0.95rem;
}

.global-lang-menu li:hover {
    background-color: #f5f5f5;
}

.global-lang-menu li.active {
    background-color: var(--accent-color);
    color: var(--light-text);
}

.global-lang-menu li.active:hover {
    background-color: var(--accent-color);
}

/* 头部区域 */
header {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    /* background: linear-gradient(135deg, var(--primary-color), #05110a); */
    background: var(--primary-color);
    color: var(--light-text);
    text-align: center;
    padding: 100px 20px 30px;
}


.h1-container{
    width: 600px;
    max-width: 80vw;
    max-height: 80vh;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 2;
    writing-mode: vertical-rl; 
    direction: ltr;
    margin: 0 auto;
    padding: 40px 0;
}

header h1 {
    font-size: 3rem;
    margin-bottom: 15px;
    margin-left: 30px;
    font-weight: 400;
    letter-spacing: 2px;
    font-family: 'CustomFont', serif;
    text-align: start;
}

header h2 {
    font-size: 1.5rem;
    font-weight: 300;
    opacity: 0.9;
    margin-top: 50px;
    padding-right: 10px;
    font-family: 'CustomFont', serif;
    text-align: start;
    text-orientation: upright;
}

header h2 .lead-circle {
    display: inline-block;
    transform: translateX(-0.05em) translateY(-0.1em);
}


.en{
  writing-mode: horizontal-tb;
  direction: ltr;
}

.h1-container.en {
    margin-top: -80px;
}



/* 延迟反转淡入动画 */
.fade-in-1, .fade-in-2, .fade-in-3, .fade-in-4 {
    animation: fadeIn 0.5s ease-in forwards;
    opacity: 0;
}

/* 中文版延迟 */
.fade-in-2 { animation-delay: 0.2s; }
.fade-in-3 { animation-delay: 0.6s; }
.fade-in-4 { animation-delay: 0.8s; }


@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* 主要内容区域 */
main {
    max-width: 900px;
    margin: 0 auto;
    padding: 60px 20px;
}

section {
    margin-bottom: 60px;
    scroll-margin-top: 90px;
}

section h2 {
    font-size: 1.5rem;
    color: var(--primary-color);
    padding-bottom: 10px;
    margin-bottom: 20px;
    position: relative;
    border-bottom: 2px solid var(--border-color);
    font-weight: 500;
}

section h2::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 3px;
    background-color: var(--accent-color);
}

/* 简介部分 */
.profile-section {
    display: grid;
    direction: rtl;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
    padding: 20px 0;
}

.profile-section div {
    direction: ltr;
}

.profile-img {
    display: grid;
    justify-content: center;
    row-gap: 20px;
}

.profile-img img {
    width: 100%;
    max-width: 250px;
    height: auto;
    border-radius: 10%;
    place-self: center;
}

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

.profile-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--primary-color);
}

/* 旁注/注释段落 */
.note {
    font-size: 0.9rem;
    color: var(--gray-text);
    font-style: italic;
    margin-top: 20px;
}

/* 研究兴趣小标题 */
.research-topic {
    font-weight: 600;
    font-size: 1rem;
    color: var(--primary-color);
    margin-top: 28px;
    margin-bottom: 10px;
    padding-left: 10px;
    border-left: 3px solid var(--accent-color);
}

/* 论文链接分隔符 */
.pub-sep {
    color: var(--gray-text);
    margin: 0 2px;
}

.profile-info p {
    font-size: 1rem;
    color: var(--gray-text);
    margin-bottom: 8px;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--primary-color);
    font-size: 1.1rem;
    border: 1px solid var(--primary-color);
    transition: all 0.3s ease;
}

.social-links a:hover {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
    transform: translateY(-2px);
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        scroll-behavior: auto !important;
    }
}

p {
    font-family: 'Noto Serif', 'Charis SIL', 'Noto Serif SC', 'Noto Serif TC', serif;
    font-size: 1rem;
    margin-bottom: 15px;
    color: var(--body-text);
}

.body-list {
    margin: 0 0 15px;
    padding-left: 1.5em;
}

.body-list li {
    margin-bottom: 6px;
}



/* 教育背景部分（简洁列表） */
.edu-list {
    margin-top: 10px;
}

.edu-item {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 2px 20px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    align-items: start;
}

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

.edu-year {
    color: var(--gray-text);
    font-size: 0.9rem;
    padding-top: 3px;
    white-space: nowrap;
}

.edu-institution {
    font-weight: 600;
    margin-bottom: 4px;
}

.edu-details p {
    margin-bottom: 4px;
}

.edu-details p:last-child {
    margin-bottom: 0;
}


.link-body {
    color: var(--primary-color);
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, var(--primary-color) 40%, transparent);
    text-underline-offset: 3px;
    transition: all 0.3s ease;
}

.link-body:hover {
    color: var(--accent-color);
    text-decoration-color: var(--accent-color);
}

/* 論文列表（简洁风格，用于主页） */
.pub-list {
    list-style: disc;
    padding-left: 1.5em;
    margin: 0;
}

/* 开源项目列表（用于 opensource.html） */
.proj-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* 通用条目样式（pub-list 和 proj-list 共用） */
.list-item {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    line-height: 1.6;
}

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

.list-title {
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}

.list-meta {
    font-family: 'Noto Serif', 'Charis SIL', 'Noto Serif SC', 'Noto Serif TC', serif;
    color: var(--body-text);
    margin-bottom: 4px;
}

.list-links {
    font-size: 0.95em;
}

.list-link {
    color: var(--accent-color);
    text-decoration: underline;
    margin-right: 10px;
}

.list-link:hover {
    color: var(--primary-color);
}

/* 书单列表（用于 booklist.html） */
.book-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.book-item {
    padding-left: 2em;
    text-indent: -2em;
    margin-bottom: 15px;
    line-height: 1.6;
    color: var(--body-text);
    font-family: "Noto Serif", "Charis SIL", "Noto Serif SC", "Noto Serif TC", serif;
}

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

/* 移动端优化 */
@media (max-width: 768px) {
    .book-item {
        padding-left: 1.5em;
        text-indent: -1.5em;
        font-size: 0.95rem;
    }
}

/* 页脚 */
footer {
    background-color: var(--primary-color);
    color: var(--light-text);
    padding: 40px 0;
}

.footer-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
    text-align: left;
}

.footer-content p { 
    margin-bottom: 8px; /* 减小段落间距，原为 20px */
    line-height: 1.4;   /* 减小行高 */
    opacity: 0.8;
    color:#fff;
    font-size: 0.9rem; /* 确保字体稍小 */
}

.copyright {
    font-size: 0.9rem;
    opacity: 0.7;
}

/* 响应式设计 */
@media (max-width: 992px) {
    header h2 {
        font-size: 1.5rem;
    }
    
    .profile-section {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .profile-img {
        order: -1;
    }
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
        position: absolute;
        top: 70px;
        left: 0;
        right: 0;
        background-color: var(--primary-color);
        flex-direction: column;
        padding: 20px;
        box-shadow: 0 10px 15px rgba(0,0,0,0.1);
    }
    
    .nav-links.active {
        display: flex;
    }
    
    .nav-links a {
        padding: 12px 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .nav-links a::after {
        height: 3px;
        background-color: var(--accent-color);
    }
    
    /* Mobile: nav-right keeps buttons in same order */
    .nav-right {
        gap: 10px;
    }
    
    .mobile-toggle {
        display: block;
        order: 2;
    }
    
    .global-lang-switcher {
        margin-left: 0;
        order: 1;
    }
    
    .global-lang-button {
        width: 34px;
        height: 34px;
        font-size: 1rem;
    }
    
    .global-lang-menu {
        min-width: 120px;
    }
    
    .global-lang-menu li {
        padding: 8px 16px;
        font-size: 0.9rem;
    }
    
    header h1 {
        font-size: 2.5rem;
    }
    
    header h2 {
        font-size: 1.3rem;
    }
    
    /* 新增：在平板和大手机尺寸就提前缩小英文 Quote */
    .en h1 {
        font-size: 2.2rem; /* 稍微缩小 */
    }

    .en h2 {
        font-size: 1.1rem; /* 确保不撑爆 */
        padding: 0 20px;
        margin-top: 40px;
    }

    .h1-container.en {
        margin-top: -60px;
    }
}

@media (max-width: 576px) {
    .nav-container {
        padding: 0 15px;
    }
    
    header {
        padding-top: 80px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    header h2 {
        font-size: 1.1rem;
    }

    /* 手机端进一步缩小 */
    .en h1 {
        font-size: 1.8rem;
        margin-top: 0;
    }

    .en h2 {
        font-size: 0.9rem; /* 实际上 0.95rem 可能还有点大，改为 0.9rem */
        padding: 0 15px;
        line-height: 1.5;
        margin-top: 25px; /* 收紧间距 */
    }

    .h1-container.en {
        margin-top: -30px;
    }
    
    .edu-item {
        grid-template-columns: 90px 1fr;
    }
}

/* ========================================
   Language Switcher Styles
   ======================================== */

/* Section header with language switcher */
.lang-switchable .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    position: relative;
}

.lang-switchable .section-header h2 {
    margin: 0;
    flex: 1;
}

/* Language switcher container */
.lang-switcher {
    position: relative;
    display: inline-block;
    margin-left: 1rem;
}

/* Language button */
.lang-button {
    background-color: transparent;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--body-text);
    font-size: 1.1rem;
    transition: all 0.3s ease;
    padding: 0;
}

.lang-button:hover {
    background-color: var(--accent-color);
    color: var(--light-text);
    border-color: var(--accent-color);
}

.lang-button:active {
    transform: scale(0.95);
}

/* Language menu dropdown */
.lang-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background-color: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    list-style: none;
    padding: 8px 0;
    min-width: 140px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 100;
}

.lang-switcher.active .lang-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-menu li {
    padding: 10px 20px;
    cursor: pointer;
    color: var(--body-text);
    transition: background-color 0.2s ease;
    font-size: 0.95rem;
}

.lang-menu li:hover {
    background-color: #f5f5f5;
}

.lang-menu li.active {
    background-color: var(--accent-color);
    color: var(--light-text);
}

.lang-menu li.active:hover {
    background-color: var(--accent-color);
}

/* Language content visibility */
.lang-content {
    display: none;
}

.lang-content.active {
    display: block;
}

/* Responsive design for mobile */
@media (max-width: 768px) {
    .lang-switchable .section-header {
        align-items: flex-start;
        gap: 0.5rem;
    }

    .lang-switcher {
        margin-left: 0.5rem;
        flex-shrink: 0;
    }

    .lang-button {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }

    .lang-menu {
        min-width: 120px;
    }

    .lang-menu li {
        padding: 8px 16px;
        font-size: 0.9rem;
    }
}
