/* 通用样式和变量 */
:root {
    --primary-color: #007bff; /* 蓝色 */
    --secondary-color: #28a745; /* 绿色，用于强调 */
    --dark-color: #343a40; /* 深色文字/背景 */
    --light-color: #f8f9fa; /* 浅色背景 */
    --text-color: #495057; /* 普通文本颜色 */
    --white-color: #ffffff;
    --border-color: #dee2e6;
    --heading-font: 'Arial', sans-serif;
    --body-font: 'Helvetica', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--body-font);
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--light-color);
    scroll-behavior: smooth; /* 平滑滚动 */
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

a {
    text-decoration: none;
    color: var(--primary-color);
}

ul {
    list-style: none;
}

h1, h2, h3, h4 {
    font-family: var(--heading-font);
    color: var(--dark-color);
    line-height: 1.2;
}

h2 {
    font-size: 2.5em;
    margin-bottom: 40px;
    text-align: center;
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 12px 25px;
    border-radius: 5px;
    font-weight: bold;
    text-align: center;
    transition: background-color 0.3s ease, color 0.3s ease;
    cursor: pointer;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white-color);
    border: 2px solid var(--primary-color);
}

.btn-primary:hover {
    background-color: darken(var(--primary-color), 10%); /* 这是一个 SCSS 函数，CSS需要手动计算 */
    background-color: #0056b3; /* 简单示例，深一点的蓝色 */
}

/* Header 导航栏 */
.header {
    background-color: var(--white-color);
    color: var(--dark-color);
    padding: 15px 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: sticky; /* 粘性定位 */
    top: 0; /* 距离顶部0 */
    z-index: 1000; /* 确保在其他内容之上 */
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header .logo a {
    font-size: 1.8em;
    font-weight: bold;
    color: var(--dark-color);
}

.header .nav ul {
    display: flex;
}

.header .nav ul li {
    margin-left: 30px;
}

.header .nav ul li a {
    color: var(--text-color);
    font-weight: bold;
    transition: color 0.3s ease;
    position: relative; /* 用于下划线动画 */
}

.header .nav ul li a:hover {
    color: var(--primary-color);
}

/* 导航下划线效果 */
.header .nav ul li a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 3px;
    background-color: var(--primary-color);
    left: 50%;
    bottom: -5px;
    transition: width 0.3s ease, left 0.3s ease;
}

.header .nav ul li a:hover::after {
    width: 100%;
    left: 0;
}

.header .nav-cta {
    margin-left: 30px;
}

/* 移动端菜单按钮 */
.menu-toggle {
    display: none; /* 默认隐藏 */
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 20px;
    cursor: pointer;
}

.menu-toggle .bar {
    height: 3px;
    width: 100%;
    background-color: var(--dark-color);
    border-radius: 10px;
    transition: all 0.3s ease;
}

/* Hero Section (现在作为“我们的课程”介绍模块) */
.hero-section {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--white-color); /* 外部背景色保持为浅灰色 */
    /* padding: 20px 0;  */
    padding-top: 20px;
    min-height: auto; /* 不再强制一个大高度 */
}

.hero-content {
    /* 核心样式：改为白色背景，类似“我们的优势” */
    background-color: var(--white-color); /* 修改为白色背景 */
    color: var(--text-color); /* 文本颜色改为深色，以适应白色背景 */
    text-align: center; /* 文本居中 */

    padding: 30px 30px 10px 30px; /* 调整内边距，使其更紧凑 */ 
    min-height: auto; /* 让高度由内容决定 */
    
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column; /* 保持竖向排列，方便 h2, p, grid 的布局 */
    align-items: center; /* 内部内容水平居中 */
    justify-content: center;
    width: 100%; /* 确保它占据 container 内部的全部宽度 */
}

/* 新增的副标题样式 */
.section-subtitle {
    font-size: 1.1em; /* 副标题字体大小 */
    margin-bottom: 40px; /* 副标题下方间距，与课程卡片网格分隔 */
    max-width: 830px; /* 限制副标题宽度，使其不会太长 */
    line-height: 1.8; /* 行高 */
    color: var(--text-color);
    /* ====== BEGIN MODIFICATION ====== */
    white-space: nowrap;     /* 防止文本换行 */
    overflow: hidden;        /* 隐藏溢出内容 */
    text-overflow: ellipsis; /* 显示省略号 */
    /* ====== END MODIFICATION ====== */
}

/* 调整原来的 h1 样式，现在它对应 hero-content 内部的 h2 */
.hero-content h2 {
    font-size: 2.8em; /* 主标题字体大小 */
    margin-bottom: 20px; /* 主标题下方间距 */
    color: var(--dark-color); /* 确保标题颜色在白色背景上可见 */
}

/* 新增：课程网格样式 */
.courses-grid {
    display: grid;
    /* 2 行 3 列的布局： auto-fit 会自动填充，minmax(300px, 1fr) 确保每列最小 300px，并平均分配剩余空间 */
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px; /* 卡片之间的间距 */
    width: 100%; /* 确保网格占据父容器的全部宽度 */
}

/* 新增：课程卡片样式 */
.course-item {
    background-color: var(--light-color); /* 卡片背景色，与外层白色区分 */
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05); /* 柔和的阴影 */
    text-align: center;
    transition: transform 0.3s ease;
}

.course-item:hover {
    transform: translateY(-5px); /* 鼠标悬停时上浮效果 */
}

.course-item h3 {
    font-size: 1.5em;
    color: var(--primary-color); /* 课程标题颜色 */
    margin-bottom: 15px;
}

.course-item p {
    font-size: 1em;
    line-height: 1.6;
    color: var(--text-color);
}


.features-section {
    padding: 40px 10px 10px 10px; /* 调整内边距，使其更紧凑 */ 
    text-align: center;
    background-color: var(--white-color); /* 保持白色背景 */
}

.features-section h2 {
    font-size: 2.8em; /* 主标题字体大小 */
    margin-bottom: 20px; /* 主标题下方间距 */
    color: var(--dark-color); /* 确保标题颜色在白色背景上可见 */
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 50px;
}

.feature-item {
    background-color: var(--light-color);
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: transform 0.3s ease;
}

.feature-item:hover {
    transform: translateY(-5px);
}

.feature-item i {
    font-size: 3em;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.feature-item h3 {
    font-size: 1.5em;
    margin-bottom: 10px;
}

.testimonials-section {
    padding: 30px 0px 10px 0px; /* 调整内边距，使其更紧凑 */ 
    /* padding: 50px 0;  */
    text-align: center;
    background-color: var(--white-color); /* 保持白色背景 */
}

.testimonials-inner-content {
    background-color: var(--white-color); /* 新的背景色，使其成为一个可见的块 */
    padding: 5px 20px; 
    border-radius: 8px; /* 可选：圆角 */
    box-shadow: 0 4px 10px rgba(0,0,0,0.1); /* 可选：阴影 */
    text-align: center;
}

.testimonials-inner-content h2 {
    font-size: 2.8em; /* 主标题字体大小 */
    margin-bottom: 20px; /* 主标题下方间距 */
    color: var(--dark-color); /* 确保标题颜色在白色背景上可见 */
}

.testimonial-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.testimonial-item {
    background-color: var(--light-color);
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    font-style: italic;
    text-align: left;
}

.testimonial-item p {
    margin-bottom: 15px;
    font-size: 0.95em;
}

.testimonial-item h4 {
    font-size: 1.1em;
    color: var(--dark-color);
    margin-bottom: 5px;
}

.testimonial-item span {
    font-size: 0.85em;
    color: var(--text-color);
}

/* About Section */
.about-section {
    padding: 80px 0;
    text-align: center;
    background-color: var(--white-color);
}

.about-section h2 {
    font-size: 2.8em; /* 主标题字体大小 */
    margin-bottom: 20px; /* 主标题下方间距 */
    color: var(--dark-color); /* 确保标题颜色在白色背景上可见 */
}

.about-section p {
    max-width: 800px;
    margin: 20px auto 0;
    font-size: 1.1em;
}

/* Contact Section */
.contact-section {
    padding: 80px 0;
    background-color: var(--dark-color);
    color: var(--white-color);
    text-align: center;
}

.contact-section h2 {
    color: var(--white-color);
}

.contact-content {
    display: flex;
    justify-content: center;
    align-items: flex-start; /* 调整对齐方式 */
    gap: 50px;
    margin-top: 50px;
    flex-wrap: wrap; /* 允许换行 */
}

.contact-form {
    flex: 1;
    max-width: 500px;
    background-color: var(--white-color);
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1em;
    color: var(--text-color);
}

.contact-form textarea {
    min-height: 120px;
    resize: vertical; /* 允许垂直拖拽 */
}

.contact-form .btn {
    width: 100%; /* 按钮宽度100% */
}

.contact-info {
    flex: 0.8;
    max-width: 350px;
    text-align: left;
    background-color: var(--primary-color); /* 联系信息背景色 */
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    color: var(--white-color); /* 联系信息文本颜色 */
}

.contact-info h3 {
    color: var(--white-color);
    margin-bottom: 25px;
    font-size: 1.6em;
}

.contact-info p {
    margin-bottom: 15px;
    font-size: 1.1em;
    display: flex;
    align-items: center;
}

.contact-info p i {
    margin-right: 10px;
    font-size: 1.2em;
}

.wechat-qr {
    margin-top: 30px;
    display: flex;         /* 启用 Flexbox 布局 */
    flex-direction: column; /* 让子元素垂直堆叠 */
    align-items: center;   /* 在主轴（此处为横向）上居中所有子元素 */
}

.wechat-qr img {
    width: 120px;
    height: 120px;
    border-radius: 5px;
    margin-bottom: 10px;
}

.wechat-qr p {
    font-size: 0.95em;
    color: var(--white-color);
    margin-bottom: 0;
    text-align: center; /* 确保段落内的文本居中 */
}


/* Footer */
.footer {
    background-color: var(--dark-color);
    color: var(--white-color);
    text-align: center;
    padding: 30px 0;
    font-size: 0.9em;
}

/* ================== 响应式设计 ================== */

/* 移动端菜单切换 */
.menu-toggle.active .bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.menu-toggle.active .bar:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active .bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* 媒体查询 - 针对更小的桌面和大型平板 (<= 1024px) */
@media (max-width: 1024px) {
    .header .nav ul li {
        margin-left: 20px;
    }

    .header .nav-cta {
        margin-left: 20px;
        padding: 10px 20px;
    }

    .hero-content h2 {
        font-size: 2.2em;
    }

    .section-subtitle {
        font-size: 1em;
    }

    .courses-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); /* 在中等屏幕下也可以保持 3 列，或者根据内容调整 minmax */
    }

    .features-grid, .testimonial-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

/* 媒体查询 - 针对平板和中等屏幕 (<= 768px) */
@media (max-width: 768px) {
    .header .container {
        flex-wrap: wrap;
        justify-content: space-between;
    }

    .header .logo {
        margin-right: auto; /* Logo 靠左 */
    }

    .header .nav {
        order: 2; /* 导航在移动端排在下方 */
        flex-basis: 100%; /* 占据整行 */
        display: none; /* 默认隐藏 */
        flex-direction: column;
        width: 100%;
        text-align: center;
        margin-top: 15px;
    }

    .header .nav.active {
        display: flex; /* 激活时显示 */
    }

    .header .nav ul {
        flex-direction: column;
        width: 100%;
    }

    .header .nav ul li {
        margin: 10px 0;
    }

    .header .nav-cta {
        display: none; /* 移动端CTA可以隐藏或集成到移动菜单中 */
    }

    .menu-toggle {
        display: flex; /* 在小屏幕显示汉堡菜单 */
    }

    h2 {
        font-size: 2em;
        margin-bottom: 30px;
    }

    .hero-section {
        padding: 30px 0; /* 调整小屏幕下外部 section 的间距 */
    }
    .hero-content {
        padding: 40px 20px; /* 调整小屏幕下的内边距 */
        min-height: auto;
    }
    .hero-content h2 {
        font-size: 2em;
    }
    .section-subtitle {
        font-size: 0.95em;
        margin-bottom: 30px; /* 保持间距一致 */
        /* ====== BEGIN MODIFICATION ====== */
        /* 在小屏幕下，如果一行显示会太长，可以考虑移除 white-space: nowrap; 
           或者调整 max-width 确保文本能适应。
           目前保持 nowrap，但请注意可能导致的截断。
           如果希望小屏幕换行，可以添加：white-space: normal;
        */
        /* ====== END MODIFICATION ====== */
    }
    .courses-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); /* 调整为 2 列或自动适配 */
        gap: 20px;
    }

    .features-grid, .testimonial-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 20px;
    }

    .testimonials-inner-content {
        padding: 50px 15px; /* 调整小屏幕下的内部块内边距 */
    }

    .contact-content {
        flex-direction: column; /* 联系模块堆叠 */
        align-items: center;
        gap: 30px;
    }
    .contact-form, .contact-info {
        width: 90%; /* 占据大部分宽度 */
        max-width: 400px; /* 限制最大宽度 */
        padding: 30px;
    }
}

/* 媒体查询 - 针对手机和更小屏幕 (<= 480px) */
@media (max-width: 480px) {
    .header .logo a {
        font-size: 1.5em;
    }

    h2 {
        font-size: 1.8em;
        margin-bottom: 25px;
    }

    .hero-content {
        padding: 30px 15px; /* 调整更小屏幕下的内边距 */
    }
    .hero-content h2 {
        font-size: 1.8em;
    }
    .section-subtitle {
        font-size: 0.85em;
        margin-bottom: 25px;
        /* ====== BEGIN MODIFICATION ====== */
        /* 在小屏幕下，通常建议让长文本换行以保持可读性。
           如果确实需要单行且截断，则保留 white-space: nowrap;。
           如果希望换行，可以覆盖为：white-space: normal;
        */
        /* ====== END MODIFICATION ====== */
    }
    .courses-grid {
        grid-template-columns: 1fr; /* 在更小屏幕上变为单列 */
        gap: 15px;
    }

    .features-grid, .testimonial-grid {
        grid-template-columns: 1fr; /* 单列显示 */
        gap: 15px;
    }

    .feature-item, .testimonial-item, .course-item {
        padding: 20px;
    }

    .testimonials-inner-content {
        padding: 30px 10px; /* 调整更小屏幕下的内部块内边距 */
    }

    .contact-form, .contact-info {
        padding: 25px;
    }
    .contact-form input, .contact-form textarea {
        font-size: 0.9em;
    }
    .contact-info h3 {
        font-size: 1.4em;
    }
    .contact-info p {
        font-size: 1em;
    }
}