/* 公共样式 - 湖南大学生命医学交叉研究院（红色主题，依 Figma 设计稿） */

:root {
    --primary-red: #C13432;
    --header-red: #B93433;
    --nav-red: #C03A37;
    --nav-active: #A82B29;
    --gold: #CEA983;
    --pink-head: #F9DED6;
    --pink-head-2: #FCEBE5;
    --bg-acad: #FFFFFF;
    --bg-exch: #FFFFFF;
    --footer-bg: #313131;
    --text-main: #333333;
    --text-sub: #666666;
    --container-width: 1280px;
}

/* 容器 */
.container {
    width: 100%;
    max-width: var(--container-width);
    margin: 0 auto;
    box-sizing: border-box;
}

/* 页面整体：内容不足时让页脚始终贴底（sticky footer） */
body {
    height: auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ========== 页头 ========== */
.site-header {
    width: 100%;
    background: #fff;
}

/* 顶部：Logo + 搜索 */
.header-main {
    height: 120px;
    background: transparent;
}

.header-main .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
}

.header-logo {
    flex-shrink: 0;
    display: block;
}

.header-logo img {
    width: 470px;
    height: auto;
    display: block;
}

/* 搜索框 */
.header-search {
    position: relative;
    display: flex;
    align-items: center;
    width: 255px;
    height: 38px;
    background: #fff;
    border: 1px solid var(--header-red);
    border-radius: 19px;
    overflow: hidden;
    flex-shrink: 0;
}

.header-search input[type="text"] {
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: 0 40px 0 19px;
    font-size: 12px;
    color: var(--text-main);
    background: transparent;
}

.header-search input[type="text"]::placeholder {
    color: #999999;
}

.header-search-btn {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 19px;
    height: 19px;
    border: none;
    padding: 0;
    cursor: pointer;
}

/* 主导航 */
.main-nav {
    height: 50px;
    background: var(--nav-red);
    position: relative;
    z-index: 100;
}

.main-nav .container {
    height: 100%;
}

.nav-menu {
    display: flex;
    align-items: center;
    height: 100%;
}

/* 8 项等宽单元格，文字居中（实测中心间距恒定） */
.nav-menu > li {
    flex: 1;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

/* 悬停：整格整高红底（比面板更深，突出当前项） */
.nav-menu > li:hover {
    background: #AF1E1C;
}

.nav-menu > li > a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #fff;
    font-size: 16px;
    font-weight: 400;
    line-height: 1;
    white-space: nowrap;
}

/* 一级菜单项（含子菜单） */
.nav-menu > li.has-submenu {
    position: relative;
}

/* 二级菜单（下拉面板） */
.nav-menu .submenu {
    position: absolute;
    top: 100%;
    left: 50%;
    min-width: 121px;
    padding: 0;
    background: #AF1E1C;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(8px);
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
    z-index: 200;
}

/* 二级菜单的 hover 展开只在桌面宽屏生效；
   <1280 由点击切换 .open 控制（见下方移动端/平板断点），避免触摸端要先“悬停”一次 */
@media (min-width: 1280px) {
    .nav-menu > li.has-submenu:hover .submenu {
        opacity: 1;
        visibility: visible;
        transform: translateX(-50%) translateY(0);
    }

    /* 三级菜单：桌面端刻意隐藏（与经贸一致），仅在移动端展开 */
    .nav-menu > li.has-submenu .submenu .submenu {
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
    }
}

.nav-menu .submenu li a {
    display: block;
    height: 38px;
    line-height: 38px;
    padding: 0 20px;
    color: #fff;
    font-size: 14px;
    white-space: nowrap;
    text-align: center;
    transition: background 0.2s, color 0.2s;
}

/* 二级菜单悬停：金色底 + 白字 */
.nav-menu .submenu li a:hover {
    background: var(--gold);
    color: #fff;
}

/* ========== 板块标题（图标 + 标题 + 更多） ========== */
.sec-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 40px;
    margin-bottom: 20px;
}

.sec-head-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.sec-head-icon {
    width: 35px;
    height: 38px;
    display: block;
    object-fit: contain;
}

.sec-head-title {
    font-family: "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
    font-size: 28px;
    font-weight: 400;
    color: var(--text-main);
    line-height: 36px;
}

.more-link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--gold);
    font-size: 16px;
    line-height: 1;
}

.more-link:hover {
    color: var(--primary-red);
}

.more-link img {
    width: 20px;
    height: 20px;
    display: block;
    object-fit: contain;
}

/* ========== 页脚 ========== */
.page-footer {
    width: 100%;
    background: var(--footer-bg);
    color: #ccc;
    margin-top: auto;
}

.footer-inner {
    display: flex;
    align-items: flex-start;
    padding: 22px 0 26px;
    box-sizing: border-box;
}

.footer-left {
    flex-shrink: 0;
    width: 390px;
}

.footer-logo {
    display: block;
    margin-top: 5px;
}

.footer-logo img {
    width: 390px;
    height: auto;
    display: block;
}

.footer-copyright {
    margin-top: 16px;
    text-align: center;
    font-family: "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    color: #fff;
    line-height: 26px;
}

.footer-links {
    flex-shrink: 0;
    width: 284px;
    margin-left: 180px;
    margin-top: 0;
}

.footer-link-col {
    padding-left: 7px;
    display: grid;
    grid-template-columns: 121px auto;
    grid-template-rows: repeat(4, auto);
    grid-auto-flow: column;
    column-gap: 30px;
}

.footer-link-col li {
    margin-bottom: 0;
}

.footer-link-col li:last-child {
    margin-bottom: 0;
}

.footer-link-col li a {
    display: flex;
    align-items: center;
    gap: 9px;
    white-space: nowrap;
    font-family: "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
    font-size: 12px;
    color: #fff;
    line-height: 26px;
}

.footer-link-col li a::before {
    content: '';
    flex-shrink: 0;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--gold);
}

.footer-link-col li a:hover {
    color: var(--gold);
    text-decoration: underline;
    text-decoration-color: var(--gold);
    text-decoration-thickness: 1px;
    text-underline-offset: 5px;
}

.footer-contact {
    flex-shrink: 0;
    width: 297px;
    margin-left: 129px;
    margin-top: 0;
}

.footer-contact p {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0;
    font-family: "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
    font-size: 12px;
    line-height: 26px;
    color: #fff;
}

.footer-contact p:last-child {
    margin-bottom: 0;
}

.footer-contact p img {
    flex-shrink: 0;
    display: block;
    width: 11px;
    height: 12px;
    margin-top: 2px;
}

/* ========== 回到顶部按钮 ========== */
.back-to-top {
    position: fixed;
    right: 30px;
    bottom: 30px;
    width: 48px;
    height: 48px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 50%;
    cursor: pointer;
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.back-to-top::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -40%) rotate(-45deg);
    width: 12px;
    height: 12px;
    border-top: 2px solid var(--primary-red);
    border-right: 2px solid var(--primary-red);
}

.back-to-top:hover {
    background: var(--primary-red);
    border-color: var(--primary-red);
}

.back-to-top:hover::before {
    border-color: #fff;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

/* ========== 滚动动画 ========== */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll.animated {
    opacity: 1;
    transform: translateY(0);
}

.animate-on-scroll.delay-1 { transition-delay: 0.1s; }
.animate-on-scroll.delay-2 { transition-delay: 0.2s; }
.animate-on-scroll.delay-3 { transition-delay: 0.3s; }
.animate-on-scroll.delay-4 { transition-delay: 0.4s; }
.animate-on-scroll.delay-5 { transition-delay: 0.5s; }
.animate-on-scroll.delay-6 { transition-delay: 0.6s; }

/* ========== 移动端专属元素（桌面端隐藏） ========== */
.header-actions,
.nav-mask,
.footer-link-select {
    display: none;
}

/* ============================================================
   小屏适配（≤1279px：移动端 + 平板，依 Figma 移动端设计稿 375px 基准）
   平板沿用移动端版式，仅在文件末尾的「平板区间」按比例放大关键尺寸
   ============================================================ */
@media (max-width: 1279px) {

    .container {
        padding: 0 16px;
    }

    /* ---------- 页头 ---------- */
    /* 移动端/平板：顶部栏固定在顶部，使 Logo/菜单/搜索始终可达，
       并与 fixed 抽屉（top 与页头高度对齐）保持一致 */
    .site-header {
        position: sticky;
        top: 0;
        z-index: 1000;
    }

    .header-main {
        height: 60px;
    }

    .header-logo img {
        width: 220px;
    }

    .header-actions {
        display: flex;
        align-items: center;
        gap: 16px;
        flex-shrink: 0;
    }

    .header-action-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--header-red);
        padding: 0;
    }

    /* 搜索：点击图标后浮层展开 */
    .header-search {
        display: none;
    }

    .site-header.search-open .header-search {
        display: flex;
        position: absolute;
        left: 15px;
        right: 15px;
        top: 60px;
        width: auto;
        height: 40px;
        z-index: 300;
        box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
    }

    /* 汉堡按钮 */
    .header-menu-toggle {
        flex-direction: column;
        gap: 4px;
        width: 22px;
    }

    .header-menu-toggle span {
        display: block;
        width: 22px;
        height: 2px;
        background: var(--header-red);
        border-radius: 2px;
        transition: transform 0.3s ease, opacity 0.3s ease;
    }

    .site-header.nav-open .header-menu-toggle span:nth-child(1) {
        transform: translateY(6px) rotate(45deg);
    }

    .site-header.nav-open .header-menu-toggle span:nth-child(2) {
        opacity: 0;
    }

    .site-header.nav-open .header-menu-toggle span:nth-child(3) {
        transform: translateY(-6px) rotate(-45deg);
    }

    /* 主导航改为右侧抽屉 */
    .main-nav {
        position: fixed;
        top: 60px;
        right: 0;
        bottom: 0;
        left: auto;
        width: 76%;
        max-width: 300px;
        height: auto;
        padding: 0 0 24px;
        background: #fff;
        overflow-y: auto;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        z-index: 1000;
        box-shadow: -6px 0 24px rgba(0, 0, 0, 0.16);
    }

    .site-header.nav-open .main-nav {
        transform: translateX(0);
    }

    .main-nav .container {
        padding: 0;
        height: auto;
    }

    .nav-menu {
        display: block;
        height: auto;
    }

    .nav-menu > li {
        display: block;
        width: 100%;
        height: auto;
    }

    .nav-menu > li:hover {
        background: transparent;
    }

    .nav-menu > li > a {
        justify-content: flex-start;
        height: 48px;
        padding: 0 20px;
        color: var(--text-main);
        font-size: 15px;
        border-bottom: 1px solid #F0F0F0;
    }

    .nav-menu > li > a.active {
        color: var(--primary-red);
    }

    /* 含二级菜单的一级项：右侧 +/− 指示（参考经贸移动端导航） */
    .nav-menu > li.has-submenu > a::after {
        content: '+';
        margin-left: auto;
        font-size: 20px;
        font-weight: 300;
        line-height: 1;
        color: #B0B0B0;
    }

    .nav-menu > li.has-submenu.open > a::after {
        content: '−';
    }

    /* 首页（首项）虽有二级菜单，但不显示 +/− 指示 */
    .nav-menu > li:first-child > a::after {
        display: none;
    }

    .nav-menu .submenu {
        position: static;
        display: none;
        min-width: 0;
        background: #FAF7F3;
        box-shadow: none;
        opacity: 1;
        visibility: visible;
        transform: none;
        transition: none;
    }

    .nav-menu li.has-submenu.open > .submenu {
        display: block;
    }

    /* 三级菜单（移动端）：换一层底色 + 更深的缩进 */
    .nav-menu .submenu .submenu {
        background: #F2EDE7;
        border-top: 1px solid #EFE9E2;
    }

    .nav-menu .submenu .submenu li a {
        padding-left: 56px;
        font-size: 13px;
        color: #777;
    }

    /* 二级中含三级菜单的项：右侧 +/− 指示 */
    .nav-menu .submenu li.has-submenu > a {
        display: flex;
        align-items: center;
    }

    .nav-menu .submenu li.has-submenu > a::after {
        content: '+';
        margin-left: auto;
        font-size: 18px;
        font-weight: 300;
        line-height: 1;
        color: #B0B0B0;
    }

    .nav-menu .submenu li.has-submenu.open > a::after {
        content: '−';
    }

    .nav-menu .submenu li a {
        height: 42px;
        line-height: 42px;
        padding: 0 32px;
        text-align: left;
        font-size: 14px;
        color: #666;
    }

    /* 二级菜单项前的圆点标记 */
    .nav-menu .submenu li a::before {
        content: '';
        display: inline-block;
        width: 5px;
        height: 5px;
        margin-right: 8px;
        border-radius: 50%;
        background: currentColor;
        opacity: 0.45;
        vertical-align: middle;
    }

    .nav-menu .submenu li a:hover {
        background: transparent;
        color: var(--primary-red);
    }

    /* 抽屉遮罩 */
    .nav-mask {
        display: block;
        position: fixed;
        left: 0;
        right: 0;
        top: 60px;
        bottom: 0;
        background: rgba(0, 0, 0, 0.45);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
        z-index: 999;
    }

    .site-header.nav-open .nav-mask {
        opacity: 1;
        visibility: visible;
    }

    body.nav-open {
        overflow: hidden;
    }

    /* ---------- 页脚 ---------- */
    /* 版式依设计稿：左右留白 24px、上留白 28px / 下留白 30px、logo 宽 286px */
    .footer-inner {
        display: block;
        padding: 28px 24px 30px;
    }

    .footer-left {
        width: 100%;
    }

    .footer-logo {
        margin-top: 0;
    }

    .footer-logo img {
        width: 286px;
        margin: 0 auto;
    }

    .footer-copyright {
        display: none;
    }

    .footer-links {
        width: 100%;
        margin: 24px 0 0;
    }

    .footer-links-box {
        display: none;
    }

    .footer-link-select {
        display: block;
        width: 100%;
        margin: 0;
    }

    /* 原生 select 的浮层只能向下展开，在页脚处会溢出并撑高页面，
       故由 JS 生成自定义下拉（common.js initFriendLinkSelect），始终向上展开 */
    .footer-link-select select {
        width: 100%;
        height: 43px;
        padding: 0 12px;
        background-color: #2B2B2B;
        background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%), linear-gradient(135deg, var(--gold) 50%, transparent 50%);
        background-position: calc(100% - 18px) 19px, calc(100% - 13px) 19px;
        background-size: 5px 5px, 5px 5px;
        background-repeat: no-repeat;
        border: 1px solid #6D645B;
        border-radius: 2px;
        color: #fff;
        font-size: 14px;
        appearance: none;
        -webkit-appearance: none;
        -moz-appearance: none;
    }

    .footer-link-select select option {
        background: #fff;
        color: #333;
    }

    .footer-link-select.is-custom {
        position: relative;
    }

    .footer-link-select.is-custom select {
        display: none;
    }

    .footer-link-trigger {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        width: 100%;
        height: 43px;
        padding: 0 12px;
        box-sizing: border-box;
        background-color: #2B2B2B;
        border: 1px solid #6D645B;
        border-radius: 2px;
        color: #fff;
        font-size: 14px;
        font-family: inherit;
        text-align: left;
        cursor: pointer;
    }

    .footer-link-select.is-open .footer-link-trigger {
        border-color: var(--gold);
    }

    .footer-link-caret {
        flex-shrink: 0;
        width: 0;
        height: 0;
        border-left: 5px solid transparent;
        border-right: 5px solid transparent;
        border-bottom: 5px solid var(--gold);
    }

    .footer-link-select.is-open .footer-link-caret {
        border-bottom-color: #fff;
    }

    .footer-link-options {
        position: absolute;
        left: 0;
        right: 0;
        bottom: calc(100% + 6px);
        z-index: 30;
        max-height: 320px;
        overflow-y: auto;
        margin: 0;
        padding: 0;
        list-style: none;
        background: #fff;
        border: 1px solid #6D645B;
        border-radius: 2px;
        box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.18);
        display: none;
    }

    .footer-link-select.is-open .footer-link-options {
        display: block;
    }

    .footer-link-option {
        padding: 0 12px;
        line-height: 40px;
        font-size: 14px;
        color: #333;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        cursor: pointer;
    }

    .footer-link-option:hover {
        background: var(--pink-head-2);
        color: var(--primary-red);
    }

    .footer-contact {
        width: 100%;
        margin: 20px 0 0;
    }

    .footer-contact p {
        gap: 10px;
        padding-left: 0;
        font-size: 13px;
        line-height: 24px;
    }

    .footer-contact p img {
        width: 14px;
        height: 15px;
        margin-top: 0;
    }

    /* ---------- 回到顶部 ---------- */
    .back-to-top {
        right: 15px;
        bottom: 15px;
        width: 40px;
        height: 40px;
    }

    .back-to-top::before {
        width: 10px;
        height: 10px;
    }
}

/* ============================================================
   平板区间（768–1279px）：沿用移动端版式，按比例放大关键尺寸
   ============================================================ */
@media (min-width: 768px) and (max-width: 1279px) {

    .container {
        padding: 0 clamp(28px, 4vw, 48px);
    }

    /* ---------- 页头 ---------- */
    .header-main {
        height: clamp(72px, 8.4vw, 92px);
    }

    .header-logo img {
        width: clamp(300px, 32vw, 400px);
    }

    .header-actions {
        gap: 22px;
    }

    .header-menu-toggle,
    .header-menu-toggle span {
        width: 26px;
    }

    .site-header.search-open .header-search {
        top: clamp(72px, 8.4vw, 92px);
        left: 32px;
        right: 32px;
        height: 44px;
    }

    /* 抽屉顶部与页头下沿对齐 */
    .main-nav,
    .nav-mask {
        top: clamp(72px, 8.4vw, 92px);
    }

    .main-nav {
        max-width: 380px;
    }

    .nav-menu > li > a {
        height: 54px;
        padding: 0 26px;
        font-size: 16px;
    }

    .nav-menu .submenu li a {
        height: 46px;
        line-height: 46px;
        padding: 0 40px;
        font-size: 15px;
    }

    /* ---------- 页脚 ---------- */
    .footer-inner {
        padding: 34px 32px 38px;
    }

    .footer-logo img {
        width: 360px;
    }

    .footer-links {
        margin-top: 30px;
    }

    .footer-link-select {
        max-width: 460px;
        margin: 0 auto;
    }

    .footer-link-select select,
    .footer-link-select .footer-link-trigger {
        height: 48px;
        font-size: 15px;
    }

    .footer-contact {
        margin-top: 26px;
    }

    .footer-contact p {
        font-size: 14px;
        line-height: 26px;
    }

    .footer-contact p img {
        width: 15px;
        height: 16px;
    }

    /* ---------- 回到顶部 ---------- */
    .back-to-top {
        right: 24px;
        bottom: 24px;
        width: 46px;
        height: 46px;
    }
}
