﻿@charset "utf-8";

/* =========================================
   1. 全局定义 (SJTU Theme)
   ========================================= */
:root {
    --primary-blue: #004098;       /* 交大蓝 (标准色) */
    --primary-light: #0056D2;      /* 亮蓝 */
    --primary-red: #C8102E;        /* 交大红 (点缀色) */
    --tech-cyan: #00E5FF;          /* 高亮青色 */
    
    /* 视觉风格 */
    --bg-overlay: rgba(248, 250, 252, 0.94);
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-border: 1px solid rgba(255, 255, 255, 0.8);
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
    
    --max-width: 1280px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { 
    scroll-behavior: smooth; 
    scroll-padding-top: 150px; 
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.7;
    color: #334155;
    background: linear-gradient(var(--bg-overlay), var(--bg-overlay)), url('background.jpg');
    background-size: cover;
    background-attachment: fixed;
    background-position: center;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { text-decoration: none; color: inherit; transition: 0.3s ease; }
ul { list-style: none; }
img { max-width: 100%; display: block; }
sub { font-size: 75%; bottom: -0.25em; position: relative; line-height: 0; }

/* =========================================
   2. 通用组件
   ========================================= */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 20px; }

.section-card {
    background: var(--glass-bg);
    border: var(--glass-border);
    border-radius: 12px;
    padding: 35px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.section-card:hover { box-shadow: var(--shadow-md); }

.section-title {
    font-size: 1.5rem; color: var(--primary-blue); 
    padding-bottom: 15px; margin-bottom: 25px;
    border-bottom: 2px solid #e2e8f0;
    display: flex; align-items: center; justify-content: flex-start;
}
.section-title::before {
    content: ''; width: 6px; height: 24px;
    background: var(--primary-red); margin-right: 12px; border-radius: 3px;
}
.more-link { 
    margin-left: auto; font-size: 0.9rem; color: #888; font-weight: normal; 
}
.more-link:hover { color: var(--primary-blue); text-decoration: underline; }

/* =========================================
   3. 头部与导航 (Header)
   ========================================= */
.header-wrapper { position: sticky; top: 0; z-index: 1000; box-shadow: 0 4px 20px rgba(0,0,0,0.08); }

.header-top {
    background: linear-gradient(90deg, #003366 0%, #004098 100%);
    color: white; padding: 12px 0;
}

.header-row { display: flex; justify-content: space-between; align-items: center; }

.logo-area { display: flex; align-items: center; gap: 15px; }
.logo-img { height: 56px; width: auto; background: white; border-radius: 50%; padding: 2px; }
.lab-title h1 { font-size: 1.25rem; font-weight: 700; margin-bottom: 2px; letter-spacing: 0.5px; }
.lab-title p { font-size: 0.85rem; opacity: 0.85; font-weight: 300; letter-spacing: 1px; }

.top-links a { color: rgba(255,255,255,0.85); font-size: 0.9rem; margin-left: 20px; transition: 0.3s; }
.top-links a:hover { color: #fff; text-decoration: underline; }

.nav-bar {
    background: rgba(255, 255, 255, 0.98);
    border-bottom: 1px solid #e2e8f0;
}
.nav-list { display: flex; justify-content: center; flex-wrap: wrap; }
.nav-list li a {
    display: block; padding: 15px 22px; font-weight: 600; color: #1e293b;
    position: relative; transition: 0.3s;
}
.nav-list li a:hover, .nav-list li a.active { color: var(--primary-blue); background: rgba(0, 64, 152, 0.03); }
.nav-list li a.active::after {
    content: ''; position: absolute; bottom: 0; left: 0; width: 100%; height: 3px; background: var(--primary-blue);
}

/* =========================================
   4. 轮播图 (Carousel)
   ========================================= */
.hero-wrapper { margin-top: 20px; padding: 0 20px; display: flex; justify-content: center; }
.hero-container {
    width: 100%; max-width: var(--max-width);
    aspect-ratio: 21/8;
    position: relative; border-radius: 8px; overflow: hidden;
    box-shadow: var(--shadow-md); background: #000;
}

.slide {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    object-fit: cover; opacity: 0; 
    transition: opacity 0.8s ease-in-out, transform 6s linear;
    transform: scale(1.0);
}
.slide.active { opacity: 1; transform: scale(1.08); }

.hero-caption {
    position: absolute; bottom: 0; left: 0; width: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.85), transparent);
    padding: 40px 20px 20px 30px; 
    z-index: 10;
}

.caption-link {
    color: white; font-size: 1.3rem; font-weight: 500; 
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
    display: inline-block; 
    transition: all 0.3s ease; 
}
.caption-link:hover {
    color: var(--tech-cyan); 
    text-shadow: 0 0 10px rgba(0, 229, 255, 0.6); 
    transform: translateX(5px); 
}
.caption-text-wrap { display: inline-block; }

.carousel-dots {
    position: absolute; bottom: 20px; right: 30px;
    display: flex; gap: 8px; z-index: 20;
}
.dot {
    width: 10px; height: 10px; 
    background: rgba(255,255,255,0.4); 
    border-radius: 50%; 
    cursor: pointer; 
    transition: all 0.3s;
    border: 1px solid rgba(0,0,0,0.1);
}
.dot:hover { background: rgba(255,255,255,0.8); }
.dot.active { 
    background: #fff; transform: scale(1.2); box-shadow: 0 0 8px rgba(255,255,255,0.5);
}

/* =========================================
   5. 布局与侧边栏
   ========================================= */
.content-wrapper {
    display: flex; gap: 30px; margin: 30px auto;
    max-width: var(--max-width); padding: 0 20px; width: 100%; flex: 1;
}

.sidebar { width: 240px; flex-shrink: 0; }
.side-menu { 
    position: sticky; top: 160px;
    background: white; border-radius: 8px; box-shadow: var(--shadow-sm); overflow: hidden;
}
.side-header {
    background: var(--primary-blue); color: white; padding: 12px 15px; font-weight: bold;
}
.side-menu ul li a {
    display: block; padding: 12px 15px; border-bottom: 1px solid #f1f1f1;
    color: #64748b; border-left: 4px solid transparent;
}
.side-menu ul li a:hover, .side-menu ul li a.active {
    background: #f8fafc; color: var(--primary-blue); border-left-color: var(--primary-blue);
}

.main-area { flex: 1; min-width: 0; }

/* =========================================
   6. 列表样式
   ========================================= */
.news-list { display: flex; flex-direction: column; }
.news-list li {
    border-bottom: 1px dashed #e2e8f0; padding: 12px 0;
    transition: transform 0.2s;
}
.news-list li:hover { transform: translateX(5px); }
.news-list li:last-child { border-bottom: none; }

.news-link {
    display: flex; align-items: flex-start; width: 100%; color: #334155;
}
.news-link::before {
    content: ''; display: inline-block; width: 6px; height: 6px;
    background-color: var(--tech-cyan); margin-right: 12px; margin-top: 10px;
    flex-shrink: 0; border-radius: 1px;
}
.news-text { flex: 1; font-weight: 500; }
.news-link:hover .news-text { color: var(--primary-blue); }
.news-meta {
    font-size: 0.85rem; color: #94a3b8; margin-left: 15px; margin-top: 4px; white-space: nowrap;
}

/* =========================================
   7. 页面组件 (Grid & Cards)
   ========================================= */
.home-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 30px; }

/* 负责人卡片 */
.leader-card {
    display: flex; gap: 30px;
    background: linear-gradient(to right, #ffffff, #f0f7ff);
    padding: 30px; border-radius: 12px;
    border-left: 5px solid var(--primary-blue);
    box-shadow: var(--shadow-sm); margin-bottom: 40px;
    /* 允许换行，适配小屏 */
    flex-wrap: wrap; 
}

.leader-photo-box {
    flex: 0 0 240px; height: 320px;
    border-radius: 8px; overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1); background: #eee;
}
.leader-photo-box img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }

/* 桌面端默认样式 */
.leader-info {
    flex: 1;
    min-width: 300px; /* 桌面端限制，防止过窄 */
}

.leader-info h3 { 
    font-size: 1.6rem; color: var(--primary-blue); margin-bottom: 15px; 
    border-bottom: 1px solid #e2e8f0; padding-bottom: 10px;
}

/* 学生列表 */
.student-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px;
}
.student-card {
    background: white; border-radius: 8px; padding: 20px;
    border: 1px solid #f1f5f9; border-left: 4px solid #cbd5e1;
    box-shadow: 0 2px 4px rgba(0,0,0,0.03);
    transition: all 0.3s;
}
.student-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    border-left-color: var(--primary-blue);
}
.student-name { font-size: 1.15rem; font-weight: bold; color: #1e293b; margin-bottom: 5px; }
.student-role { font-size: 0.9rem; color: #64748b; margin-bottom: 5px; }
.student-email { font-size: 0.85rem; color: #94a3b8; font-family: monospace; }

/* 研究方向 */
.research-item { 
    display: flex; gap: 40px; margin-bottom: 50px; align-items: center; 
}
.research-img { width: 380px; border-radius: 8px; box-shadow: var(--shadow-md); flex-shrink: 0; }
.research-desc { flex: 1; text-align: justify; color: #475569; font-size: 1.05rem; }

/* 设备 */
.equip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 25px; }
.equip-card { 
    border: 1px solid #eee; border-radius: 8px; overflow: hidden; background: white; 
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.equip-card:hover { 
    transform: translateY(-5px) scale(1.02); 
    box-shadow: 0 10px 25px rgba(0,0,0,0.1); border-color: #e0e7ff; z-index: 1;
}
.equip-img { 
    width: 100%; height: 200px; object-fit: cover; background: #f9f9f9; 
}
.equip-title { padding: 15px; text-align: center; font-weight: 600; color: #334155; }

/* =========================================
   8. 页脚 & 回到顶部
   ========================================= */
.footer-wrapper {
    margin-top: auto; background: #0f172a; color: #94a3b8;
    padding: 40px 0; text-align: center; font-size: 0.9rem;
    border-top: 4px solid var(--primary-blue);
}
.footer-wrapper a { color: #fff; opacity: 0.8; border-bottom: 1px dotted #64748b; }
.footer-wrapper a:hover { opacity: 1; border-bottom-style: solid; }

.back-to-top {
    position: fixed; bottom: 40px; right: 40px;
    width: 48px; height: 48px; border-radius: 50%;
    background: var(--primary-blue); color: white;
    border: none; cursor: pointer;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    font-size: 1.2rem; display: flex; align-items: center; justify-content: center;
    z-index: 1000;
    opacity: 0; transform: translateY(20px); transition: all 0.4s ease;
}
.back-to-top.show { opacity: 1; transform: translateY(0); }
.back-to-top:hover { background: var(--primary-red); transform: translateY(-5px); }

/* =========================================
   9. 移动端适配 (重点修复)
   ========================================= */
@media (max-width: 768px) {
    .header-row { flex-direction: column; text-align: center; gap: 10px; }
    .top-links { margin: 5px 0; }
    .nav-list li a { padding: 10px 15px; font-size: 0.9rem; }
    .hero-container { aspect-ratio: 16/9; }
    .caption-link { font-size: 1rem; padding: 10px; }
    
    .content-wrapper { flex-direction: column; padding: 0 15px; }
    .sidebar { width: 100%; }
    
    /* === 侧边栏小屏修复 === */
    .side-menu { 
        position: static; 
        display: flex; 
        align-items: center;
        overflow-x: auto; 
        -webkit-overflow-scrolling: touch; /* 核心修复：开启 iOS 平滑滚动 */
        margin-bottom: 20px;
        white-space: nowrap; 
        
        padding: 0;
        background: white;
        border: 1px solid #eee;
        border-radius: 8px;
        overflow: hidden; 
        
        /* 核心修复：确保容器本身有固定宽度，才能滚动 */
        max-width: 100%;
        width: 100%;
    }
    
    /* 隐藏滚动条但保留功能 */
    .side-menu::-webkit-scrollbar { display: none; }
    
    .side-header {
        margin: 0; 
        padding: 0 15px;
        flex-shrink: 0; 
        background: var(--primary-blue); 
        color: white; 
        display: flex;
        align-items: center;
        align-self: stretch;
    }
    
    .side-menu ul { 
        display: flex; 
        min-width: max-content; /* 核心修复：让内容撑开宽度，从而触发父容器滚动 */
        gap: 0;
        padding-left: 10px;
        flex-grow: 1;
    }
    
    .side-menu ul li a {
        border-left: none; 
        border-bottom: 3px solid transparent; 
        background: transparent; 
        border-radius: 0; 
        padding: 10px 15px;
        font-size: 0.9rem;
        color: #64748b;
    }
    .side-menu ul li a:hover, .side-menu ul li a.active {
        background: transparent;
        color: var(--primary-blue);
        border-bottom-color: var(--primary-blue);
    }
    
    .home-grid { grid-template-columns: 1fr; }
    .research-item { flex-direction: column; }
    .research-img { width: 100%; margin-bottom: 15px; }
    
    /* === 负责人卡片防溢出修复 === */
    .leader-card { 
        flex-direction: column; 
        align-items: center; 
        text-align: center; 
        padding: 20px; /* 减小内边距 */
    }
    
    .leader-photo-box { 
        width: 100%; 
        max-width: 300px; 
        height: auto; 
        aspect-ratio: 3/4;
        margin-bottom: 20px; 
    }
    
    .leader-info { 
        text-align: center; 
        width: 100%;
        /* 核心修复：移除最小宽度限制，允许在极窄屏幕下收缩 */
        min-width: 0; 
        /* 核心修复：允许长单词换行，防止 URL 等撑破容器 */
        word-wrap: break-word; 
        overflow-wrap: break-word;
    }
    
    /* 大段文字两端对齐，标题保持居中 */
    .leader-info p { text-align: justify; }
    .leader-info h3, 
    .leader-info p:first-of-type, /* 邮箱 */
    .leader-info p:nth-of-type(2) { /* 地点 */
        text-align: center; 
    }
}