/* 基础变量设置 */

:root {
    /* 扩展颜色变量 */
    --primary-color: #4a90e2;
    --primary-light: #6ba7e8;
    --secondary-color: #f8fafc;
    /* 调亮背景色 */
    --text-color: #2c3e50;
    --text-light: #64748b;
    --border-color: #e1e8ed;
    --card-bg: #ffffff;
    --shadow-color: rgba(0, 0, 0, 0.08);
    --hover-color: #edf2f7;
    /* 字体大小变量 */
    --title-size: 2.4rem;
    --subtitle-size: 2rem;
    --heading-size: 1.6rem;
    --text-size: 1.2rem;
    --small-text: 1rem;
    /* 其他变量保持不变 */
    --main-font: "FangSong", "仿宋", FangSong, "STFangsong", "华文仿宋", serif;
    --transition-speed: 0.4s;
    --transition-timing: cubic-bezier(0.4, 0, 0.2, 1);
    /* 添加主题切换过渡变量 */
    --theme-transition: 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    --card-bg-rgb: 255, 255, 255;
    /* 亮色主题 */
}


/* 基础样式优化 */

body {
    line-height: 1.8;
    /* 增加行高 */
    color: var(--text-color);
    background-color: var(--secondary-color);
    transition: all var(--theme-transition);
}

.tutorial-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 2rem;
}


/* 学习路径导航美化 */

.learning-path {
    background: linear-gradient(to right, var(--card-bg), var(--hover-color));
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 3rem;
    box-shadow: 0 4px 20px var(--shadow-color);
}

.learning-path ol {
    display: flex;
    justify-content: space-around;
    gap: 2rem;
    padding: 1rem 0;
}

.learning-path li {
    font-size: var(--text-size);
    padding: 1rem 1.5rem;
    background-color: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 2px 8px var(--shadow-color);
    transition: transform 0.3s ease;
}

.learning-path li:hover {
    transform: translateY(-2px);
}

.learning-path li:nth-child(1) {
    animation-delay: 0.1s;
}

.learning-path li:nth-child(2) {
    animation-delay: 0.2s;
}

.learning-path li:nth-child(3) {
    animation-delay: 0.3s;
}

.learning-path li:nth-child(4) {
    animation-delay: 0.4s;
}


/* 章节样式优化 */

.chapter {
    background-color: var(--card-bg);
    border-radius: 16px;
    padding: 3rem;
    margin-bottom: 3rem;
    box-shadow: 0 4px 20px var(--shadow-color);
}

.chapter h2 {
    font-size: var(--title-size);
    color: var(--primary-color);
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 1rem;
}

.chapter h3 {
    font-size: var(--subtitle-size);
    color: var(--text-color);
    margin: 2rem 0 1.5rem;
}

.chapter h4 {
    font-size: var(--heading-size);
    color: var(--text-light);
    margin: 1.5rem 0 1rem;
}


/* 内容区域优化 */

.visual-example {
    background-color: var(--secondary-color);
    border-radius: 12px;
    padding: 2rem;
    margin: 1.5rem 0;
}

.explanation {
    font-size: var(--text-size);
    line-height: 1.8;
    color: var(--text-color);
}


/* 交互演示区域美化 */

.interactive-demo {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.property {
    background-color: var(--secondary-color);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 12px var(--shadow-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    transform-origin: center center;
}

.property:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--shadow-color);
}


/* 示例盒子美化 */

.example-box {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: inset 0 2px 4px var(--shadow-color);
}


/* 实践项目区域优化 */

.practice-projects {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.project {
    background: linear-gradient(145deg, var(--card-bg), var(--hover-color));
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 15px var(--shadow-color);
}


/* 小贴士卡片美化 */

.tip-card {
    background: linear-gradient(to right bottom, var(--primary-light), var(--primary-color));
    color: white;
    border-radius: 16px;
    padding: 2rem;
    margin: 2rem 0;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.tip-card h4 {
    color: white;
    font-size: var(--heading-size);
}

.tip-card ul {
    font-size: var(--text-size);
    margin-top: 1rem;
}

.tip-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--shadow-color);
}


/* 进度追踪区域美化 */

.learning-progress {
    position: sticky;
    top: 20px;
    padding: 1.5rem;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 2px 10px var(--shadow-color);
    margin-top: 2rem;
}

.quick-review {
    margin-top: 1.5rem;
}

.quick-review h3 {
    font-size: var(--heading-size);
    color: var(--text-color);
    margin-bottom: 1rem;
}

.key-points {
    list-style: none;
    padding: 0;
}

.key-points li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: color 0.3s ease;
}

.key-points li:hover {
    color: var(--primary-color);
}


/* 响应式优化 */

@media screen and (max-width: 768px) {
     :root {
        --title-size: 2rem;
        --subtitle-size: 1.8rem;
        --heading-size: 1.4rem;
        --text-size: 1.1rem;
    }
    .tutorial-container {
        padding: 1rem;
    }
    .chapter {
        padding: 1.5rem;
    }
    .interactive-demo {
        grid-template-columns: 1fr;
    }
}


/* 暗色主题变量 */

[data-theme="dark"] {
    --primary-color: #60a5fa;
    --primary-light: #93c5fd;
    --secondary-color: #1a1b1e;
    --text-color: #e2e8f0;
    --text-light: #cbd5e1;
    --border-color: #2d3748;
    --card-bg: #2d3748;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --hover-color: #4a5568;
    --card-bg-rgb: 45, 55, 72;
    /* 暗色主题 */
}


/* 添加平滑过渡效果 */

body {
    transition: background-color 0.6s ease, color 0.6s ease;
}


/* 添加入场动画 */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}


/* 应用动画 */

.chapter {
    animation: fadeInUp 0.6s ease-out;
    animation-fill-mode: both;
}

.learning-path li {
    animation: slideInRight 0.4s ease-out;
    animation-fill-mode: both;
}

.learning-path li:nth-child(1) {
    animation-delay: 0.1s;
}

.learning-path li:nth-child(2) {
    animation-delay: 0.2s;
}

.learning-path li:nth-child(3) {
    animation-delay: 0.3s;
}

.learning-path li:nth-child(4) {
    animation-delay: 0.4s;
}


/* 添加悬停效果 */

.property,
.example-card,
.tool-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    transform-origin: center center;
}

.property:hover,
.example-card:hover,
.tool-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--shadow-color);
}


/* 添加滚动显示动画 */

.fade-in {
    opacity: 1;
    transform: none;
}


/* 主题切换按钮样式更新 */

.theme-switch {
    position: relative;
    margin-left: auto;
}

.theme-btn {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--theme-transition);
    padding: 0;
    box-shadow: 0 2px 8px var(--shadow-color);
}

.theme-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px var(--shadow-color);
}


/* 响应式适配 */

@media (max-width: 768px) {
    .theme-btn {
        width: 36px;
        height: 36px;
    }
}


/* 无障碍支持 */

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.demo-widget {
    transition: background-color 0.3s ease;
}

.color-sample {
    transition: transform 0.2s ease;
}

.color-sample:hover {
    transform: scale(1.02);
}

.tip-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.tip-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--shadow-color);
}


/* 章节样式统一 */

.chapter {
    background-color: var(--card-bg);
    border-radius: 16px;
    padding: 3rem;
    margin-bottom: 3rem;
    box-shadow: 0 4px 20px var(--shadow-color);
}


/* 统一所有章节的标题大小 */

.chapter h2 {
    font-size: var(--title-size);
    /* 2.4rem */
    color: var(--primary-color);
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 1rem;
}

.chapter h3 {
    font-size: var(--subtitle-size);
    /* 2rem */
    color: var(--text-color);
    margin: 2rem 0 1.5rem;
}

.chapter h4 {
    font-size: var(--heading-size);
    /* 1.6rem */
    color: var(--text-light);
    margin: 1.5rem 0 1rem;
}


/* 统一正文文字大小 */

.chapter p,
.chapter li,
.explanation,
.property-explanation p,
.example-card p,
.tool-card p,
.project-brief p {
    font-size: var(--text-size);
    /* 1.2rem */
    line-height: 1.8;
    color: var(--text-color);
}


/* 确保示例和演文字大小一致 */

.example-box,
.demo-widget,
.color-sample,
.property-explanation {
    font-size: var(--text-size);
}


/* 移除可能导致大小不一致的动画和变换效果 */

.chapter,
.chapter * {
    animation: none;
    transform: none;
}


/* 所有可能随主题变化的元素添加过渡效果 */

.chapter,
.learning-path,
.tool-card,
.example-card,
.property-explanation,
.demo-widget,
.theme-btn {
    transition: background-color 0.6s ease, color 0.6s ease, border-color 0.6s ease, box-shadow 0.6s ease;
}


/* 顶部导航样式优化 */

.site-header {
    position: fixed;
    /* 固定定位 */
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    /* 确保在其他元素上层 */
    background-color: var(--card-bg);
    /* 确保有背景色 */
    box-shadow: 0 2px 10px var(--shadow-color);
    /* 添加阴影效果 */
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    transition: all var(--theme-transition);
    /* 平滑过渡效果 */
}


/* 确保主内容不被固定头部遮挡 */

.tutorial-container {
    margin-top: 80px;
    /* 根据header高度调整，确保内容不被遮挡 */
}


/* 添加到 :root 变量中 */

:root {
    /* 已有的变量 */
    --card-bg-rgb: 255, 255, 255;
    /* 亮色主题 */
}


/* 暗色主题背景色 RGB 值 */

[data-theme="dark"] {
    /* 已有的暗色主题变量 */
    --card-bg-rgb: 45, 55, 72;
    /* 暗色主题 */
}


/* 在滚动时添加更明显的阴效果 */

.site-header.scrolled {
    box-shadow: 0 4px 20px var(--shadow-color);
    padding: 0.8rem 2rem;
    /* 稍微压缩一下高度 */
}


/* Logo 样式 */

.site-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.site-logo:hover {
    opacity: 0.9;
}

.logo-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, #FF6B6B, #4ECDC4, #45B7D1);
    position: relative;
}

.logo-text {
    font-family: var(--main-font);
    font-size: 1.8rem;
    font-weight: normal;
    background: linear-gradient(to right, #FF6B6B, #4ECDC4);
    -webkit-background-clip: text;
    color: transparent;
    margin: 0;
    transition: all var(--theme-transition);
}


/* Logo 印章样式 */

.logo-seal {
    width: 60px;
    height: 60px;
    border: 2px solid #c41e3a;
    color: #c41e3a;
    font-family: "FangSong", serif;
    transform: rotate(-5deg);
    box-shadow: 2px 2px 0 rgba(196, 30, 58, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all var(--theme-transition);
    background-color: var(--card-bg);
}


/* 印章悬停效果 */

.logo-seal:hover {
    transform: rotate(0deg);
}


/* 印章暗色主题适配 */

[data-theme="dark"] .logo-seal {
    border-color: #ff6b6b;
    color: #ff6b6b;
    box-shadow: 2px 2px 0 rgba(255, 107, 107, 0.2);
}


/* 面包屑导航样式 */

.breadcrumb {
    padding: 1rem 2rem;
    background: #f8f9fa;
    border-radius: 4px;
    margin: 1rem 0;
}

.breadcrumb ol {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
}

.breadcrumb li {
    display: flex;
    align-items: center;
    color: #6c757d;
    font-size: 0.9rem;
}

.breadcrumb li:not(:last-child)::after {
    content: "/";
    margin: 0 0.5rem;
    color: #dee2e6;
}

.breadcrumb a {
    color: #4a90e2;
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumb a:hover {
    color: #357abd;
}


/* 页面标题样式 */

.page-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-color);
    text-align: center;
    margin: 2rem 0 3rem;
    padding: 0 1rem;
    line-height: 1.3;
    position: relative;
    transition: color var(--theme-transition);
}

.page-title::after {
    content: "";
    display: block;
    width: 80px;
    height: 4px;
    background: linear-gradient(45deg, var(--primary-color), var(--primary-light));
    margin: 1rem auto 0;
    border-radius: 2px;
    transition: background var(--theme-transition);
}


/* 响应式设计 */

@media (max-width: 768px) {
    .site-header {
        padding: 0.8rem 1rem;
    }
    .logo-icon {
        width: 28px;
        height: 28px;
    }
    .logo-text {
        font-size: 1.2rem;
    }
    .page-title {
        font-size: 2rem;
        margin: 1.5rem 0 2rem;
    }
    .breadcrumb {
        padding: 0.8rem 1rem;
        font-size: 0.8rem;
    }
}


/* 暗色主题支持 */

@media (prefers-color-scheme: dark) {
    .site-header {
        background: #1a1a1a;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    }
    .site-logo {
        color: #ffffff;
    }
    .breadcrumb {
        background: #2d2d2d;
    }
    .breadcrumb li {
        color: #a0a0a0;
    }
    .page-title {
        color: #ffffff;
    }
}


/* 顶部导航布局 */

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background-color: var(--card-bg);
    box-shadow: 0 2px 10px var(--shadow-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}


/* 右侧容器样式 */

.header-right {
    display: flex;
    align-items: center;
    gap: 2rem;
    /* 导航和主题切换按钮之间的间距 */
}


/* 导航样式 */

.main-nav {
    display: flex;
    align-items: center;
    gap: 2rem;
}


/* 移除之前的 margin-right: auto */

.site-nav {
    display: flex;
    align-items: center;
    gap: 2rem;
}


/* 主题切换按钮样式 */

.theme-switch {
    display: flex;
    align-items: center;
}

.theme-btn {
    /* 保持原有样式不变 */
}


/* 导航链接样式美化 */

.nav-link {
    color: var(--text-color);
    text-decoration: none;
    font-size: var(--text-size);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all var(--transition-speed) var(--transition-timing);
    position: relative;
}


/* 悬停效果 */

.nav-link:hover {
    color: var(--primary-color);
    background-color: var(--hover-color);
}


/* 活跃状态 */

.nav-link.active {
    color: var(--primary-color);
    font-weight: 500;
}


/* 活跃状态下的下划线效果 */

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    background: linear-gradient(to right, var(--primary-color), var(--primary-light));
    border-radius: 2px;
}


/* 暗色主题适配 */

@media (prefers-color-scheme: dark) {
    .nav-link {
        color: #e1e1e1;
    }
    .nav-link:hover {
        color: var(--primary-light);
        background-color: rgba(255, 255, 255, 0.1);
    }
    .nav-link.active {
        color: var(--primary-light);
    }
}


/* 页脚样式美化 */

.site-footer {
    background-color: var(--card-bg);
    box-shadow: 0 -2px 10px var(--shadow-color);
    padding: 2rem;
    margin-top: 4rem;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.copyright {
    color: var(--text-light);
    font-size: var(--small-text);
}

.footer-nav {
    display: flex;
    gap: 2rem;
}

.footer-nav a {
    color: var(--text-color);
    text-decoration: none;
    font-size: var(--small-text);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all var(--transition-speed) var(--transition-timing);
}

.footer-nav a:hover {
    color: var(--primary-color);
    background-color: var(--hover-color);
}


/* 暗色主题适配 */

@media (prefers-color-scheme: dark) {
    .site-footer {
        background-color: #1a1a1a;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
    }
    .copyright {
        color: #a0a0a0;
    }
    .footer-nav a {
        color: #e1e1e1;
    }
    .footer-nav a:hover {
        color: var(--primary-light);
        background-color: rgba(255, 255, 255, 0.1);
    }
}


/* 响应式适配 */

@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    .footer-nav {
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .main-nav {
        position: fixed;
        top: 60px;
        /* header高度 */
        left: 0;
        right: 0;
        background: var(--card-bg);
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
        transform: translateY(-100%);
        transition: transform 0.3s ease;
        box-shadow: 0 2px 10px var(--shadow-color);
    }
    .main-nav.active {
        transform: translateY(0);
    }
    /* 添加汉堡菜单按钮 */
    .menu-toggle {
        display: block;
        /* 默认是隐藏的 */
    }
}


/* 建议添加 */

img {
    max-width: 100%;
    height: auto;
}

@media (max-width: 768px) {
    .property {
        padding: 1rem;
    }
    .example-box {
        margin-top: 1rem;
        padding: 1rem;
    }
    .practice-projects {
        grid-template-columns: 1fr;
    }
}


/* 页脚响应式适配 */

@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        /* 将横向排列改为纵向排列 */
        text-align: center;
        /* 文字居中对齐 */
        gap: 1rem;
        /* 元素之间的间距 */
    }
    .footer-nav {
        flex-wrap: wrap;
        /* 允许导航项换行 */
        justify-content: center;
        /* 导航项居中对齐 */
    }
}