/* ===================== 基础 ===================== */
:root {
    --green: #1a9952;
    --green-light: #22b462;
    --text: #444;
    --text-dark: #1f1f1f;
    --text-gray: #595959;
}

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

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-family: "Microsoft YaHei", SimHei, arial, sans-serif;
    font-size: 18px;
    color: var(--text);
    background: #fff;
}

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

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

li {
    list-style: none;
}

input,
button {
    font: inherit;
}

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

.container {
    width: 100%;
    max-width: 1350px;
    margin: 0 auto;
    padding: 0 15px;
}

/* ===================== 头部 ===================== */
.site-header {
    padding: 40px 0;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.site-logo img {
    display: block;
    width: 742px;
    max-width: 100%;
    height: auto;
}

.search-box {
    position: relative;
}

.search-input {
    width: 220px;
    padding: 10px 42px 10px 16px;
    border: 1px solid #ccc;
    border-radius: 30px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(26, 153, 82, 0.12);
}

.search-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    padding: 6px;
    background: none;
    border: 0;
    cursor: pointer;
}

.search-btn img {
    width: 16px;
    height: 16px;
}

.search-btn:active {
    transform: translateY(-50%) scale(0.9);
}

/* ===================== 导航 ===================== */
.site-nav {
    background: #ececec;
}

.nav-inner {
    display: flex;
}

.nav-menu {
    display: flex;
    justify-content: space-between;
    width: 100%;
}

.nav-menu > li {
    position: relative;
}

.nav-menu > li > a {
    display: block;
    padding: 0 24px;
    line-height: 50px;
    transition: background 0.2s, color 0.2s;
}

.nav-menu > li:hover > a,
.nav-menu > li > a.is-active {
    background: var(--green);
    color: #fff;
}

/* 有子菜单的项加下拉箭头 */
.has-sub > a::after {
    content: "";
    display: inline-block;
    margin-left: 7px;
    vertical-align: 2px;
    border: 4px solid transparent;
    border-top-color: currentColor;
}

.sub-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    min-width: 100%;
    padding: 6px 0;
    background: var(--green);
    border-radius: 0 0 6px 6px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(10px);
    transition: opacity 0.25s, transform 0.25s, visibility 0.25s;
    z-index: 20;
}

.nav-menu > li:hover .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.sub-menu li a {
    display: block;
    padding: 10px 22px;
    color: #fff;
    font-size: 16px;
    text-align: center;
    white-space: nowrap;
    transition: background 0.2s;
}

.sub-menu li a:hover {
    background: var(--green-light);
}

/* ===================== banner ===================== */
.banner img {
    display: block;
    width: 100%;
    height: auto;
}

/* ===================== 通用栏目标题 ===================== */
.section-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 24px;
}

.section-head h2 {
    font-size: 34px;
    font-weight: 500;
    color: var(--text-dark);
}

.section-head h2 span {
    color: var(--green);
}

.more-link {
    font-size: 15px;
    color: #888;
    transition: color 0.2s;
}

.more-link:hover {
    color: var(--green);
}

/* ===================== 新闻 + 通知公告 ===================== */
.news-section {
    margin-top: 50px;
}

.news-grid {
    display: flex;
    align-items: flex-start;
    gap: 40px;
}

.news-main {
    flex: 1 1 auto;
    min-width: 0;
}

.notice {
    flex: 0 0 380px;
    min-width: 0;
}

.news-body {
    display: flex;
    gap: 20px;
    min-width: 0;
}

/* 轮播 */
.carousel {
    position: relative;
    flex: 0 0 530px;
    width: 530px;
    min-width: 0;
    max-width: 100%;
    height: 440px;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.carousel-slider {
    min-width: 0;
}

.carousel-slider {
    display: flex;
}

.carousel-slide {
    position: relative;
    flex: 0 0 100%;
}

.carousel-slide a {
    display: block;
    height: 100%;
}

.carousel-slide img {
    display: block;
    width: 100%;
    height: 440px;
    object-fit: cover;
}

.carousel-text {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 30px 118px 12px 14px;
    color: #fff;
    font-size: 16px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.72));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 分页小圆点（index.js 自绘，不使用 Swiper 分页模块） */
.carousel-dots {
    position: absolute;
    right: 14px;
    bottom: 16px;
    display: flex;
    gap: 8px;
    z-index: 5;
}

.carousel-dots .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.55);
    cursor: pointer;
    transition: background 0.3s;
}

.carousel-dots .dot.active {
    background: var(--green);
}

/* 新闻卡片 */
.news-cards {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.news-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 18px 16px 12px;
    background: #f8f8f8;
    border-radius: 6px;
    border-bottom: 2px solid transparent;
    transition: background 0.3s, border-color 0.3s, box-shadow 0.3s;
}

.news-card:hover {
    background: #f4fff9;
    border-bottom-color: var(--green);
    box-shadow: 0 6px 16px rgba(26, 153, 82, 0.1);
}

.news-card h3 {
    font-size: 19px;
    font-weight: 600;
    line-height: 1.5;
    color: var(--text-dark);
    transition: color 0.2s;
}

.news-card:hover h3 {
    color: var(--green);
}

.news-card p {
    margin-top: 10px;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-gray);
}

.news-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 14px;
    font-size: 14px;
}

.news-card-meta time {
    color: var(--green);
}

.news-card-more {
    color: #999;
    transition: color 0.2s;
}

.news-card:hover .news-card-more {
    color: var(--green);
}

/* 通知公告列表 */
.notice-list li {
    border-bottom: 1px dashed #ccc;
}

.notice-list a {
    position: relative;
    display: block;
    padding: 15px 0 13px 20px;
}

.notice-list a::before {
    content: "";
    position: absolute;
    left: 2px;
    top: 25px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #b3b3b3;
    transition: background 0.2s;
}

.notice-list a:hover::before {
    background: var(--green);
}

.notice-list p {
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s;
}

.notice-list a:hover p {
    color: var(--green);
}

.notice-list time {
    display: block;
    margin-top: 5px;
    font-size: 14px;
    color: #9f9f9f;
}

/* ===================== 图片快捷入口 ===================== */
.quick-links {
    margin-top: 50px;
}

.quick-links-inner {
    display: flex;
    gap: 30px;
}

.quick-card {
    position: relative;
    display: block;
    flex: 1;
    height: 254px;
    overflow: hidden;
    border-radius: 8px;
}

.quick-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.quick-card:hover img {
    transform: scale(1.08);
}

/* 遮罩层：保证文字在任何图片上都可读 */
.quick-card-mask {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.5));
    transition: background 0.3s;
}

.quick-card:hover .quick-card-mask {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.6));
}

.quick-card h3 {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 6px 18px;
    border: 2px solid #fff;
    color: #fff;
    font-size: 24px;
    font-weight: bold;
    white-space: nowrap;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
}

/* ===================== 在线学习资源 ===================== */
.courses {
    margin: 50px 0 45px;
}

.course-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 26px 20px;
    margin-top: 30px;
}

.course-card {
    display: block;
    text-align: center;
}

.course-thumb {
    overflow: hidden;
    border-radius: 8px;
    aspect-ratio: 313 / 163;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}

.course-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease;
}

.course-card:hover .course-thumb img {
    transform: scale(1.08);
}

.course-card h3 {
    margin-top: 12px;
    font-size: 19px;
    font-weight: 500;
    transition: color 0.2s;
}

.course-card:hover h3 {
    color: var(--green);
}

/* ===================== 页脚 ===================== */
.site-footer {
    flex: 0 0 auto;
    background: #404040;
    border-top: 4px solid var(--green);
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 50px;
    padding-top: 36px;
    padding-bottom: 36px;
}

.footer-info {
    flex: 1;
    min-width: 0;
}

.footer-logo {
    display: block;
}

.footer-divider {
    height: 1px;
    background: #5a5a5a;
    margin: 22px 0 16px;
}

.footer-contact {
    display: flex;
    gap: 60px;
    flex-wrap: wrap;
}

.footer-contact p {
    font-size: 15px;
    font-weight: 300;
    line-height: 2.2;
    color: #a9a9a9;
}

.footer-qrcode {
    text-align: center;
}

.footer-qrcode img {
    width: 112px;
    height: 112px;
    padding: 6px;
    background: #fff;
    border-radius: 8px;
}

.footer-qrcode p {
    margin-top: 10px;
    font-size: 15px;
    letter-spacing: 2px;
    color: #ccc;
}

/* ===================== 滚动入场动画 ===================== */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.reveal.is-visible {
    opacity: 1;
    transform: none;
}

/* ===================== 移动端导航按钮（index.js 动态插入） ===================== */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    padding: 10px;
    background: none;
    border: 0;
    cursor: pointer;
    flex-shrink: 0;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 3px;
    border-radius: 2px;
    background: var(--green);
    transition: transform 0.3s, opacity 0.3s;
}

/* 打开状态：三道杠变 X */
.nav-toggle.is-open span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.nav-toggle.is-open span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.is-open span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* 父栏目链接的克隆项，只在移动端菜单里显示 */
.sub-overview {
    display: none;
}

/* 菜单打开时锁定页面滚动 */
body.nav-locked {
    overflow: hidden;
}

/* ===================== 响应式 ===================== */
@media (max-width: 1380px) {
    .news-grid {
        flex-direction: column;
    }

    .news-main {
        width: 100%;
    }

    .notice {
        flex: none;
        width: 100%;
    }

    .quick-card {
        height: auto;
        aspect-ratio: 430 / 254;
    }
}

@media (max-width: 992px) {
    .site-header {
        padding: 20px 0;
    }

    .header-inner {
        flex-direction: column;
        gap: 14px;
    }

    /* 搜索框一栏：输入框占满，汉堡按钮在右侧 */
    .site-search {
        display: flex;
        align-items: center;
        gap: 10px;
        width: 100%;
    }

    .site-search form {
        flex: 1;
        min-width: 0;
    }

    .search-input {
        width: 100%;
    }

    .nav-toggle {
        display: flex;
    }

    /* 全屏遮罩式菜单：从 header 底部展开，覆盖整页 */
    .site-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        top: var(--nav-top, 0px);
        z-index: 1000;
        background: rgba(9, 52, 30, 0.9);
        -webkit-backdrop-filter: blur(12px);
        backdrop-filter: blur(12px);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }

    .site-nav.nav-open {
        opacity: 1;
        visibility: visible;
    }

    .nav-inner {
        display: block;
        height: 100%;
        overflow-y: auto;
        padding: 14px 24px 40px;
    }

    .nav-menu {
        flex-direction: column;
        width: 100%;
    }

    .nav-menu > li {
        position: static;
        border-bottom: 1px solid rgba(255, 255, 255, 0.16);
    }

    .nav-menu > li > a,
    .nav-menu > li:hover > a,
    .nav-menu > li > a.is-active {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 17px 4px;
        background: none;
        color: #fff;
        font-size: 19px;
        line-height: 1.4;
    }

    .nav-menu > li > a.is-active {
        color: #8fe6b8;
    }

    /* 下拉箭头改为可旋转的 V 形 */
    .has-sub > a::after {
        content: "";
        width: 9px;
        height: 9px;
        margin-left: 12px;
        vertical-align: 0;
        border: 0;
        border-right: 2px solid rgba(255, 255, 255, 0.85);
        border-bottom: 2px solid rgba(255, 255, 255, 0.85);
        transform: rotate(45deg);
        transition: transform 0.3s;
        flex-shrink: 0;
    }

    .has-sub.open > a::after {
        transform: rotate(225deg);
    }

    /* 手风琴二级菜单 */
    .sub-menu {
        position: static;
        min-width: 0;
        padding: 0;
        background: transparent;
        border-radius: 0;
        box-shadow: none;
        opacity: 1;
        visibility: visible;
        transform: none;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.35s ease;
    }

    .has-sub.open .sub-menu {
        max-height: 420px;
    }

    /* 触屏点击会残留 :hover 状态，必须压掉桌面端 hover 下拉的位移，
       否则展开的二级菜单会被 translateX(-50%) 移出屏幕 */
    .nav-menu > li:hover .sub-menu {
        opacity: 1;
        visibility: visible;
        transform: none;
    }

    .sub-menu li a {
        padding: 13px 8px 13px 22px;
        color: rgba(255, 255, 255, 0.85);
        font-size: 16px;
        text-align: left;
        border-top: 1px dashed rgba(255, 255, 255, 0.14);
    }

    .sub-menu li a:hover {
        background: rgba(255, 255, 255, 0.08);
    }

    .sub-overview {
        display: block;
    }

    .news-body {
        flex-direction: column;
    }

    /* 不用 aspect-ratio：图片加载失败时会与子元素 height:100% 形成循环依赖导致布局失控 */
    .carousel {
        flex: none;
        width: 100%;
        height: min(78vw, 440px);
    }

    .carousel-slide img {
        height: 100%;
    }

    .course-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .footer-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 26px;
    }
}

@media (max-width: 768px) {
    .quick-links-inner {
        flex-direction: column;
        align-items: center;
    }

    .quick-card {
        width: 100%;
        max-width: 430px;
    }

    .section-head h2 {
        font-size: 26px;
    }
}

@media (max-width: 576px) {
    .course-grid {
        grid-template-columns: 1fr;
    }

    .footer-contact {
        flex-direction: column;
        gap: 0;
    }
}
