/* ==========================================================================
   徐海学院党委 · 站点头部（Banner + LOGO + 导航）
   改造目标：对齐 zzb.cumt.edu.cn（党委组织部）头部
   1) 头部整体浮在 Banner 之上，LOGO 与导航默认全透明；
   2) 鼠标下滑后导航吸顶，底色变为品牌红并带阴影；
   3) 全端响应式：≥1101px 通栏导航，≤1100px 折叠为抽屉菜单。
   说明：本文件可整段追加在站点 style/style.css 之后（或用 link 单独引入），
        类名沿用原有 .top / .index_banner / .logo / .nav_bg / .top_box / .nav / .float_list，
        因此 HTML 只需按 index.html 中的结构替换即可。
   ========================================================================== */

:root {
    --brand: #8f0607;
    /* 主色（与站点原红色一致） */
    --brand-light: #a2060a;
    --brand-dark: #6d0305;
    --container: 1200px;
    /* 与站点 .top_box / .foot_box 一致 */

    --head-pad: 26px;
    /* 顶部留白（吸顶时收窄） */
    --head-pad-fixed: 10px;
    --logo-h: 54px;
    /* LOGO 高度（吸顶时收窄） */
    --logo-h-fixed: 40px;
    --nav-h: 58px;
    --nav-h-fixed: 48px;
    --nav-gap: 16px;
    --head-shadow: 0 8px 26px rgba(0, 0, 0, .22);
    --ease: cubic-bezier(.4, 0, .2, 1);
}

/* --------------------------------------------------------------------------
   1. 头部外壳：固定定位 + 透明 → 吸顶变红
   -------------------------------------------------------------------------- */
.top {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    transition: box-shadow .35s var(--ease);
    /* 未吸顶时：仅一层极淡的顶部压暗，保证白色 LOGO / 导航在任何 Banner 上都清晰 */
    background: linear-gradient(180deg, rgba(0, 0, 0, .26) 0%, rgba(0, 0, 0, .08) 55%, rgba(0, 0, 0, 0) 100%);
}

/* 品牌红底板（用伪元素叠层，才能让"透明 → 实色"平滑过渡） */
.top::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, var(--brand-light) 0%, var(--brand) 100%);
    opacity: 0;
    transition: opacity .35s var(--ease);
    pointer-events: none;
}

/* 吸顶后压暗层淡出，避免和红色底板叠加发黑 */
.top::after {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, rgba(0, 0, 0, .26) 0%, rgba(0, 0, 0, 0) 100%);
    opacity: 1;
    transition: opacity .35s var(--ease);
    pointer-events: none;
}

.top.is-fixed {
    box-shadow: var(--head-shadow);
}

.top.is-fixed::before {
    opacity: 1;
}

.top.is-fixed::after {
    opacity: 0;
}

.top_box {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    row-gap: var(--nav-gap);
    width: 100%;
    max-width: 1500px;
    margin: 0 auto;
    padding: var(--head-pad) 20px 0;
    box-sizing: border-box;
    transition: padding .35s var(--ease), row-gap .35s var(--ease);
}

/* --------------------------------------------------------------------------
   2. LOGO 行
   说明：CMS 里如果 LOGO / 搜索 / 导航是三个平级组件，直接放进 .top_box 也能自动排好；
        如果能包一层容器，用 .top_head 包住 LOGO + 工具区效果更稳。
   -------------------------------------------------------------------------- */
.top_head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    width: 100%;
    flex: 1 1 100%;
}

.logo {
    position: static;
    /* 覆盖旧版 absolute + 居中定位 */
    width: auto;
    transform: none;
    left: auto;
    top: auto;
    flex: 0 1 auto;
    min-width: 0;
}

.logo a {
    display: block;
}

.logo img {
    display: block;
    height: var(--logo-h);
    width: auto;
    max-width: 100%;
    margin: 0;
    transition: height .35s var(--ease);
}

/* 可选：LOGO 居中排布（给 .top 加 .logo-center 类即可） */
.top.logo-center .logo {
    margin: 0 auto;
}

.top.logo-center .top_tools {
    position: absolute;
    right: 20px;
    top: var(--head-pad);
}

/* 右侧工具区（搜索等） */
.top_tools {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 0 0 auto;
    margin-left: auto;
}

.tool_ico {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255, 255, 255, .62);
    border-radius: 50%;
    color: #fff;
    transition: background-color .3s, color .3s, border-color .3s;
}

.tool_ico svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.tool_ico:hover {
    background-color: #fff;
    border-color: #fff;
    color: var(--brand);
}

/* --------------------------------------------------------------------------
   3. 导航行：透明底 + 白色文字 + 1px 白色分隔线（zzb 同款）
   -------------------------------------------------------------------------- */
.nav_bg {
    position: relative;
    bottom: auto;
    /* 覆盖旧版 absolute bottom:0 */
    width: 100%;
    flex: 1 1 100%;
    margin-top: 0;
    border-top: 1px solid rgba(255, 255, 255, .5);
}

.nav {
    height: auto;
    width: 100%;
}

/* 注意：这里刻意带上 .top 前缀，用来覆盖原 style.css 中
   .top .nav ul>li / .top .nav ul>li>a 的旧规则（同等权重、靠加载顺序取胜） */
.top .nav ul,
.top .nav .float_list {
    display: flex;
    align-items: stretch;
    width: 100%;
}

.top .nav ul>li {
    flex: 1 1 0;
    min-width: 0;
    height: auto;
    line-height: normal;
    float: none;
    text-align: center;
}

.top .nav ul>li>a {
    display: block;
    height: var(--nav-h);
    line-height: var(--nav-h);
    padding: 0 4px;
    font-size: 18px;
    font-weight: normal;
    letter-spacing: .5px;
    color: #fff;
    white-space: nowrap;
    position: relative;
    transition: height .35s var(--ease), line-height .35s var(--ease),
        background-color .25s var(--ease), font-weight .2s;
}

/* 悬停 / 当前栏目底部短线 */
.top .nav ul>li>a::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 9px;
    width: 0;
    height: 2px;
    background-color: #fff;
    transform: translateX(-50%);
    transition: width .3s var(--ease);
}

.top .nav ul>li>a:hover::after,
.top .nav ul>li.on>a::after {
    width: 26px;
}

/* 透明态：hover 只加粗，不铺底色（与 zzb 一致） */
.top:not(.is-fixed) .nav ul>li>a:hover {
    font-weight: bold;
}

/* 吸顶态：hover / 当前栏目铺半透明深色 */
.top.is-fixed .nav ul>li>a:hover,
.top.is-fixed .nav ul>li.on>a {
    background-color: rgba(0, 0, 0, .16);
}

/* --------------------------------------------------------------------------
   4. 吸顶（下滑后）紧凑形态
   -------------------------------------------------------------------------- */
.top.is-fixed .top_box {
    padding-top: var(--head-pad-fixed);
    row-gap: 8px;
}

.top.is-fixed .logo img {
    height: var(--logo-h-fixed);
}

.top.is-fixed .nav ul>li>a {
    height: var(--nav-h-fixed);
    line-height: var(--nav-h-fixed);
}

/* 吸顶态不用下划线，改为整块底色（与 zzb 一致） */
.top.is-fixed .nav ul>li>a::after {
    display: none;
}

.top.is-fixed .tool_ico {
    width: 36px;
    height: 36px;
}

/* --------------------------------------------------------------------------
   5. Banner：整幅铺满、随宽度等比缩放
   -------------------------------------------------------------------------- */
.index_banner {
    position: relative;
    width: 100%;
    height: clamp(400px, 39vw, 730px);
    overflow: hidden;
    background-color: var(--brand);
}

.index_banner .slider,
.index_banner .slick-list,
.index_banner .slick-track,
.index_banner .item {
    height: 100%;
}

.index_banner .item a {
    display: block;
    height: 100%;
}

.index_banner img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 45%;
}

/* Banner 内不需要旧版居中的 LOGO 叠层 */
.index_banner .logo {
    display: none;
}

/* ---- 轮播圆点（与样例站同款：细长小横条，居中贴底） ---- */
.index_banner .slick-dots,
.index_banner .bn_dots {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 34px;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: auto;
    height: auto;
    margin: 0;
    padding: 0;
    list-style: none;
    text-align: center;
}

.index_banner .slick-dots li,
.index_banner .bn_dots li {
    position: relative;
    display: block;
    width: 42px;
    height: 4px;
    margin: 0;
    padding: 0;
    cursor: pointer;
}

.index_banner .slick-dots li button,
.index_banner .bn_dots li button {
    display: block;
    width: 42px;
    height: 4px;
    padding: 0;
    border: 0;
    outline: none;
    background: transparent;
    font-size: 0;
    line-height: 0;
    color: transparent;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

/* 覆盖 slick 默认的「小圆点字符」 */
.index_banner .slick-dots li button::before {
    content: "";
    position: absolute;
    left: 0;
    top: 1px;
    width: 100%;
    height: 2px;
    opacity: 1;
    font-family: inherit;
    font-size: 0;
    line-height: 0;
    color: transparent;
    background-color: rgba(255, 255, 255, .45);
    border-radius: 1px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
    transition: height .3s var(--ease), top .3s var(--ease), background-color .3s var(--ease);
}

/* 原生兜底的圆点（不是 button::before，直接画在 button 上） */
.index_banner .bn_dots li button {
    position: relative;
}

.index_banner .bn_dots li button::before {
    content: "";
    position: absolute;
    left: 0;
    top: 1px;
    width: 100%;
    height: 2px;
    background-color: rgba(255, 255, 255, .45);
    border-radius: 1px;
    transition: height .3s var(--ease), top .3s var(--ease), background-color .3s var(--ease);
}

/* 当前张：加粗成白色实心条 */
.index_banner .slick-dots li.slick-active button::before,
.index_banner .bn_dots li.on button::before {
    top: 0;
    height: 4px;
    background-color: #fff;
}

.index_banner .slick-dots li:hover button::before,
.index_banner .bn_dots li:hover button::before {
    background-color: rgba(255, 255, 255, .8);
}

/* 只有一张图时 slick 也会塞一个圆点，这里干脆不显示 */
.index_banner .slick-dots li:only-child {
    display: none;
}

/* ---- 原生兜底轮播（页面没加载 jQuery/slick 时生效） ---- */
.index_banner .slider--native {
    position: relative;
    overflow: hidden;
}

.index_banner .slider--native .item {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity .7s var(--ease), visibility .7s var(--ease);
}

.index_banner .slider--native .item.is-active {
    opacity: 1;
    visibility: visible;
    z-index: 2;
}

/* 键盘聚焦时给圆点一个可见轮廓（无障碍） */
.index_banner .slick-dots li button:focus-visible,
.index_banner .bn_dots li button:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 4px;
}

/* --------------------------------------------------------------------------
   6. 移动端抽屉菜单
   -------------------------------------------------------------------------- */
.menuBtn {
    display: none;
    position: relative;
    top: auto;
    right: auto;
    width: 30px;
    height: 30px;
    padding: 0;
    flex: 0 0 auto;
    cursor: pointer;
}

.menuBtn i {
    position: absolute;
    left: 4px;
    width: 22px;
    height: 2px;
    border-radius: 2px;
    background-color: #fff;
    transition: transform .3s var(--ease), opacity .2s;
}

.menuBtn i:nth-child(1) {
    top: 8px;
}

.menuBtn i:nth-child(2) {
    top: 14px;
}

.menuBtn i:nth-child(3) {
    top: 20px;
}

.menuBtn.active i:nth-child(1) {
    top: 14px;
    transform: rotate(45deg);
}

.menuBtn.active i:nth-child(2) {
    opacity: 0;
}

.menuBtn.active i:nth-child(3) {
    top: 14px;
    transform: rotate(-45deg);
}

/* 抽屉面板 */
.nav_panel {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: 1100;
    background: linear-gradient(160deg, var(--brand-light) 0%, var(--brand-dark) 100%);
    transform: translateY(-100%);
    visibility: hidden;
    transition: transform .45s var(--ease), visibility .45s;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.nav_panel.open {
    transform: translateY(0);
    visibility: visible;
}

.nav_panel_head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, .22);
}

.nav_panel_head img {
    display: block;
    height: 32px;
    width: auto;
}

.nav_panel_close {
    position: relative;
    width: 30px;
    height: 30px;
    cursor: pointer;
}

.nav_panel_close::before,
.nav_panel_close::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 14px;
    width: 22px;
    height: 2px;
    background-color: #fff;
    border-radius: 2px;
}

.nav_panel_close::before {
    transform: rotate(45deg);
}

.nav_panel_close::after {
    transform: rotate(-45deg);
}

.nav_panel ul {
    padding: 6px 0 40px;
}

.nav_panel li {
    border-bottom: 1px solid rgba(255, 255, 255, .16);
}

.nav_panel li a {
    display: block;
    padding: 0 20px;
    height: 52px;
    line-height: 52px;
    font-size: 17px;
    color: #fff;
    letter-spacing: .5px;
}

.nav_panel li.on a,
.nav_panel li a:hover {
    background-color: rgba(0, 0, 0, .16);
    font-weight: bold;
}

/* ---- 二级菜单：点右侧箭头展开 / 收起（与原站 #hd-m 的交互一致） ---- */
.nav_panel li.has_sub {
    position: relative;
}

.nav_panel li.has_sub>a {
    padding-right: 68px;
}

.nav_panel .sub_toggle {
    position: absolute;
    right: 0;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 52px;
    padding: 0;
    border: 0;
    border-left: 1px solid rgba(255, 255, 255, .16);
    background: transparent;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.nav_panel .sub_toggle i {
    width: 9px;
    height: 9px;
    margin-top: -4px;
    border-right: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(45deg);
    transition: transform .32s var(--ease);
}

.nav_panel li.open .sub_toggle i {
    margin-top: 4px;
    transform: rotate(-135deg);
}

.nav_panel .sub_toggle:focus-visible {
    outline: 2px solid #fff;
    outline-offset: -6px;
}

/* 收起态靠 max-height 过渡，展开后给足高度即可 */
.nav_panel .subBox {
    max-height: 0;
    overflow: hidden;
    background-color: rgba(0, 0, 0, .16);
    transition: max-height .38s var(--ease);
}

.nav_panel li.open .subBox {
    max-height: 520px;
}

.nav_panel .subBox dl,
.nav_panel .subBox dd {
    margin: 0;
    padding: 0;
}

.nav_panel .subBox dd a {
    display: block;
    height: 46px;
    line-height: 46px;
    padding: 0 20px 0 36px;
    font-size: 15px;
    font-weight: normal;
    color: rgba(255, 255, 255, .9);
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.nav_panel .subBox dd:last-child a {
    border-bottom: 0;
}

.nav_panel .subBox dd a::before {
    content: "";
    display: inline-block;
    width: 5px;
    height: 5px;
    margin-right: 10px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, .6);
    vertical-align: 2px;
}

.nav_panel .subBox dd a:hover,
.nav_panel .subBox dd a:focus-visible {
    background-color: rgba(0, 0, 0, .12);
    color: #fff;
    font-weight: normal;
}

body.menu-open {
    overflow: hidden;
}

/* --------------------------------------------------------------------------
   7. 无 Banner 的子页面（给 body 加 .no-banner 即可，避免头部压住内容）
   -------------------------------------------------------------------------- */
body.no-banner .top {
    background-color: var(--brand);
}

body.no-banner .top::before {
    opacity: 1;
}

body.no-banner .top::after {
    opacity: 0;
}

body.no-banner {
    padding-top: calc(var(--head-pad) + var(--logo-h) + var(--nav-gap) + var(--nav-h) + 2px);
}

/* --------------------------------------------------------------------------
   8. 响应式
   -------------------------------------------------------------------------- */
@media all and (max-width: 1400px) {
    :root {
        --container: 1140px;
        --logo-h: 48px;
        --nav-h: 54px;
    }

    .top .nav ul>li>a {
        font-size: 16px;
    }
}

@media all and (max-width: 1240px) {
    :root {
        --container: 100%;
        --logo-h: 44px;
        --nav-h: 50px;
    }

    .top .nav ul>li>a {
        font-size: 15px;
        letter-spacing: 0;
    }
}

/* 折叠为抽屉菜单 */
@media all and (max-width: 1100px) {
    :root {
        --head-pad: 12px;
        --head-pad-fixed: 12px;
        --logo-h: 36px;
        --logo-h-fixed: 32px;
    }

    .top {
        background: linear-gradient(180deg, rgba(0, 0, 0, .34) 0%, rgba(0, 0, 0, 0) 100%);
    }

    .top_box {
        padding: 12px 16px;
    }

    .nav_bg,
    .nav {
        display: none;
    }

    .menuBtn {
        display: block;
    }

    .top_tools {
        gap: 10px;
    }

    .tool_ico {
        width: 36px;
        height: 36px;
    }

    .tool_ico svg {
        width: 16px;
        height: 16px;
    }

    .top.is-fixed .top_box {
        padding-top: 12px;
    }

    .index_banner {
        height: 56vw;
        min-height: 300px;
    }

    body.no-banner {
        padding-top: 60px;
    }
}

@media all and (max-width: 768px) {
    :root {
        --logo-h: 30px;
    }

    .top_head {
        gap: 12px;
    }

    .index_banner {
        height: 62vw;
        min-height: 240px;
    }

    .index_banner img {
        object-position: center center;
    }

    /* 圆点缩小一档，避免窄屏挤在一起 */
    .index_banner .slick-dots,
    .index_banner .bn_dots {
        bottom: 20px;
        gap: 8px;
    }

    .index_banner .slick-dots li,
    .index_banner .bn_dots li,
    .index_banner .slick-dots li button,
    .index_banner .bn_dots li button {
        width: 26px;
    }

    .nav_panel li a {
        height: 48px;
        line-height: 48px;
        font-size: 16px;
    }

    .nav_panel .sub_toggle {
        height: 48px;
    }

    .nav_panel .subBox dd a {
        height: 42px;
        line-height: 42px;
    }
}

@media all and (max-width: 480px) {
    :root {
        --logo-h: 26px;
    }

    .index_banner {
        height: 58vw;
        min-height: 190px;
    }

    .index_banner .slick-dots,
    .index_banner .bn_dots {
        bottom: 14px;
        gap: 6px;
    }

    .index_banner .slick-dots li,
    .index_banner .bn_dots li,
    .index_banner .slick-dots li button,
    .index_banner .bn_dots li button {
        width: 20px;
    }

    .tool_ico {
        display: none;
    }
}

/* 尊重系统"减少动效"设置 */
@media (prefers-reduced-motion: reduce) {

    .top,
    .top::before,
    .top::after,
    .logo img,
    .nav_bg,
    .nav ul>li>a,
    .nav_panel,
    .menuBtn i {
        transition: none !important;
    }
}
