
/* 
整体样式设置
使用CSS变量定义主色、辅色和点缀色，便于统一管理和快速调整。
*/
:root {
    --primary-color: #1B263B; /* 主色调，深蓝色，传达专业与稳定 */
    --background-color: #F9FAFB; /* 背景色，浅灰色，提升层次感 */
    --accent-color: #34C759; /* 点缀色，亮绿色，传递积极与信任感 */
    --text-color: #333333; /* 正文字体颜色 */
    --font-title: 'Poppins', sans-serif; /* 标题字体 */
    --font-body: 'Poppins', sans-serif; /* 正文字体 */
}

/* 
全局样式
设置全局背景色、字体、边距等基础样式，确保一致的视觉效果。
*/
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow-x: hidden; /* 避免水平滚动条 */
}

/* 
导航栏样式
固定在顶部，使用Flexbox进行布局，响应式设计适配不同屏幕。
*/
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background-color: var(--primary-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.navbar .logo {
    color: #ffffff;
    font-size: 1.5rem;
    font-weight: 700;
    text-decoration: none;
}

.navbar .menu {
    display: flex;
    gap: 25px;
}

.navbar .menu a {
    color: #ffffff;
    text-decoration: none;
    font-size: 1rem;
    transition: color 0.3s ease;
}

.navbar .menu a:hover {
    color: var(--accent-color);
}

/* 
移动设备下的导航栏样式
隐藏菜单，显示菜单切换按钮，点击后显示菜单。
*/
.menu-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
}

.menu-toggle span {
    width: 30px;
    height: 3px;
    background-color: #ffffff;
    margin: 4px 0;
    transition: all 0.3s ease;
}

@media (max-width: 768px) {
    .navbar .menu {
        display: none;
        flex-direction: column;
        background-color: var(--primary-color);
        position: absolute;
        top: 60px;
        right: 30px;
        width: 200px;
        padding: 20px;
        border-radius: 8px;
    }

    .navbar .menu.active {
        display: flex;
    }

    .menu-toggle {
        display: flex;
    }
}

/* 
首页英雄区样式
使用线性渐变背景，中心对齐内容，加入动画效果。
*/
.hero {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-color), var(--background-color));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #ffffff;
    position: relative;
    padding: 0 20px;
}

.hero h1 {
    font-family: var(--font-title);
    font-weight: 700;
    font-size: 2.5rem;
    margin-bottom: 20px;
}

.hero p {
    font-family: var(--font-body);
    font-size: 1.2rem;
    margin-bottom: 30px;
    max-width: 600px;
}

.hero .cta-btn {
    background-color: var(--accent-color);
    color: #ffffff;
    padding: 12px 25px;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.hero .cta-btn:hover {
    background-color: darkgreen;
    transform: scale(1.05);
}

/* 
背景动画效果
通过::before伪元素添加背景插画，并应用旋转动画。
*/
.hero::before {
    content: '';
    position: absolute;
    top: -10%;
    left: -10%;
    width: 120%;
    height: 120%;
    background: url('https://images.gptkong.com/demo/sample1.png') no-repeat center center;
    background-size: cover;
    opacity: 0.2;
    animation: rotateBackground 60s linear infinite;
    z-index: -1;
}

@keyframes rotateBackground {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 
主要内容区样式
使用网格布局，模块化卡片展示关键功能。
*/
.main-content {
    padding: 80px 30px;
    max-width: 1200px;
    margin: 0 auto;
}

.section-title {
    text-align: center;
    font-family: var(--font-title);
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 40px;
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.card {
    background-color: #ffffff;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    padding: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-10px);
    box-shadow: 0 12px 20px rgba(0,0,0,0.2);
}

.card img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 15px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card img:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

.card h3 {
    font-family: var(--font-title);
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.card p {
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--text-color);
    line-height: 1.6;
}

/* 
示例文章区样式
确保文章内容在大屏设备上显示舒适，且在小屏设备上自适应。
*/
.article-container {
    padding: 60px 30px;
    max-width: 1000px;
    margin: 0 auto;
}

.article-container h2,
.article-container h3,
.article-container h4 {
    font-family: var(--font-title);
    color: var(--primary-color);
    margin-bottom: 20px;
}

.article-container p {
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--text-color);
    margin-bottom: 15px;
    line-height: 1.8;
}

.article-container pre {
    background-color: #2d2d2d;
    color: #f8f8f2;
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.article-container code {
    font-family: 'Courier New', Courier, monospace;
}

.article-container table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.article-container table, 
.article-container th, 
.article-container td {
    border: 1px solid #dddddd;
}

.article-container th, 
.article-container td {
    padding: 12px;
    text-align: left;
}

.article-container th {
    background-color: var(--primary-color);
    color: #ffffff;
}

.article-container ul {
    list-style-type: disc;
    margin-left: 40px;
    margin-bottom: 20px;
}

.article-container a {
    color: var(--accent-color);
    text-decoration: none;
}

.article-container a:hover {
    text-decoration: underline;
}

/* 
代码块样式
区别于正文内容，突出显示代码部分。
*/
.code-block {
    background-color: #272822;
    color: #f8f8f2;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 20px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
}

.code-block .language-css {
    color: #f8f8f2;
}

/* 
图文混排样式
确保图片与文字的和谐搭配，提升可读性。
*/
.image-text {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 40px;
}

.image-text img {
    flex: 1 1 300px;
    max-width: 100%;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.image-text img:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

.image-text .text-content {
    flex: 2 1 500px;
    font-size: 1rem;
    color: var(--text-color);
    line-height: 1.8;
}

/* 
折叠区域样式
用于隐藏和显示次要信息，提升页面整洁度。
*/
.collapsible {
    background-color: #ffffff;
    border: 1px solid #dddddd;
    border-radius: 8px;
    margin-bottom: 20px;
}

.collapsible-summary {
    padding: 15px;
    cursor: pointer;
    font-family: var(--font-title);
    font-size: 1.1rem;
    color: var(--primary-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.collapsible-summary:hover {
    background-color: #f0f0f0;
}

.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding: 0 15px;
}

.collapsible-content p {
    margin: 15px 0;
}

.collapsible.open .collapsible-content {
    max-height: 500px; /* 根据内容调整 */
    padding: 15px;
}

/* 
底部区域样式
包括常见问题与订阅表单，布局简洁有序。
*/
.footer {
    background-color: var(--primary-color);
    color: #ffffff;
    padding: 40px 30px;
}

.footer .footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

.footer .footer-section h4 {
    font-family: var(--font-title);
    font-size: 1.5rem;
    margin-bottom: 15px;
}

.footer .footer-section a {
    color: #ffffff;
    text-decoration: none;
    margin-bottom: 10px;
    display: block;
    transition: color 0.3s ease;
}

.footer .footer-section a:hover {
    color: var(--accent-color);
}

.footer .subscribe-form input {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 4px;
    margin-bottom: 10px;
    font-family: var(--font-body);
    font-size: 1rem;
}

.footer .subscribe-form button {
    width: 100%;
    padding: 10px;
    background-color: var(--accent-color);
    border: none;
    border-radius: 4px;
    color: #ffffff;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.footer .subscribe-form button:hover {
    background-color: darkgreen;
}

@media (max-width: 768px) {
    .image-text {
        flex-direction: column;
    }

    .collapsible-content {
        max-height: none;
    }

    .footer .footer-content {
        grid-template-columns: 1fr;
    }
}

/* 
响应式调整，确保在不同屏幕宽度下内容的良好显示。
避免在宽度小于500px的容器内放置长文章内容，调整布局。
*/
@media (max-width: 500px) {
    .article-container {
        padding: 40px 15px;
    }

    .image-text .text-content {
        flex: 1 1 100%;
    }
}

/* 
视觉过渡效果，引导用户的注意力。
*/
.transition-area {
    height: 50px;
    background: linear-gradient(to bottom, transparent, var(--background-color));
    margin-bottom: 20px;
}

/* 
代码示例样式
与正文样式区分开，便于阅读和理解。
*/
.code-example {
    background-color: #272822;
    color: #f8f8f2;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 20px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
}

.code-example code {
    display: block;
}

/* 
高亮显示当前视口中重要元素的样式，增强视觉层次感。
*/
.highlight {
    background: linear-gradient(90deg, var(--accent-color) 0%, var(--primary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

