/* ==================== 基础样式重置 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* 主色调 */
    --primary-color: #0052FF;
    --primary-hover: #0041CC;
    --primary-light: rgba(0, 82, 255, 0.1);

    /* 背景色 */
    --bg-primary: #FAFAFA;
    --bg-secondary: #FFFFFF;
    --bg-dark: #0F172A;

    /* 文字颜色 */
    --text-primary: #0F172A;
    --text-secondary: #64748B;
    --text-muted: #94A3B8;

    /* 边框颜色 */
    --border-color: #E2E8F0;

    /* 阴影 */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.1);

    /* 教程卡片颜色 */
    --html-color: #E34F26;
    --css-color: #1572B6;
    --js-color: #F7DF1E;
    --python-color: #3776AB;
    --java-color: #007396;
    --mysql-color: #4479A1;
    --php-color: #777BB4;
    --linux-color: #FCC624;

    /* 字体 */
    --font-display: "Plus Jakarta Sans", "PingFang SC", "Microsoft YaHei UI", sans-serif;
    --font-body: "Inter", "Noto Sans SC", "Microsoft YaHei", sans-serif;
    --font-mono: "JetBrains Mono", "Fira Code", monospace;

    /* 过渡 */
    --transition: all 0.2s ease-out;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

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

ul {
    list-style: none;
}

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

/* ==================== 容器 ==================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ==================== 头部导航 ==================== */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
}

.header .container {
    display: flex;
    align-items: center;
    height: 64px;
    gap: 40px;
}

.header-left {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.25rem;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary-color), #4D7CFF);
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.1rem;
}

.logo-text {
    color: var(--text-primary);
}

.nav-menu {
    display: flex;
    gap: 8px;
    flex: 1;
}

.nav-item {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
}

.nav-item:hover {
    color: var(--primary-color);
    background: var(--primary-light);
}

.nav-item.active {
    color: var(--primary-color);
    background: var(--primary-light);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0 12px;
    transition: var(--transition);
}

.search-box:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.search-box input {
    border: none;
    background: transparent;
    padding: 10px 8px;
    font-size: 0.9rem;
    outline: none;
    width: 180px;
}

.search-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    transition: var(--transition);
}

.search-btn:hover {
    color: var(--primary-color);
}

.btn-login {
    padding: 8px 20px;
    background: var(--primary-color);
    color: white;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.9rem;
    transition: var(--transition);
}

.btn-login:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
}

/* ==================== 移动端菜单 ==================== */
.mobile-menu {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-secondary);
    z-index: 2000;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.mobile-menu.active {
    transform: translateX(0);
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.close-menu-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
}

.mobile-nav {
    padding: 20px;
}

.mobile-nav-item {
    display: block;
    padding: 15px 20px;
    font-size: 1rem;
    color: var(--text-secondary);
    border-radius: 8px;
    margin-bottom: 8px;
    transition: var(--transition);
}

.mobile-nav-item:hover,
.mobile-nav-item.active {
    background: var(--primary-light);
    color: var(--primary-color);
}

/* ==================== Hero 区域 ==================== */
.hero {
    padding: 80px 0;
    background: linear-gradient(135deg, var(--bg-primary) 0%, #EEF2FF 100%);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(0, 82, 255, 0.08) 0%, transparent 70%);
    border-radius: 50%;
}

.hero .container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero-title {
    font-family: var(--font-display);
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 24px;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--primary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 32px;
    line-height: 1.8;
}

.hero-buttons {
    display: flex;
    gap: 16px;
}

.btn {
    padding: 14px 32px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 14px rgba(0, 82, 255, 0.25);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 82, 255, 0.35);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* 代码窗口 */
.hero-graphic {
    position: relative;
}

.code-window {
    background: var(--bg-dark);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-xl);
    transform: perspective(1000px) rotateY(-5deg) rotateX(5deg);
    transition: var(--transition);
}

.code-window:hover {
    transform: perspective(1000px) rotateY(0deg) rotateX(0deg);
}

.code-header {
    background: #1E293B;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dot.red { background: #EF4444; }
.dot.yellow { background: #F59E0B; }
.dot.green { background: #10B981; }

.code-title {
    margin-left: 12px;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-family: var(--font-mono);
}

.code-body {
    padding: 24px;
    font-family: var(--font-mono);
    font-size: 0.95rem;
    line-height: 1.8;
}

.code-body code {
    color: #E2E8F0;
}

.code-body .keyword {
    color: #C084FC;
}

.code-body .function {
    color: #60A5FA;
}

.code-body .string {
    color: #4ADE80;
}

/* ==================== 教程分类 ==================== */
.tutorials {
    padding: 80px 0;
}

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

.tutorial-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

.tutorial-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 28px;
    transition: var(--transition);
    cursor: pointer;
}

.tutorial-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: transparent;
}

.card-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin-bottom: 20px;
}

.card-icon.html { background: rgba(227, 79, 38, 0.1); color: var(--html-color); }
.card-icon.css { background: rgba(21, 114, 182, 0.1); color: var(--css-color); }
.card-icon.js { background: rgba(247, 223, 30, 0.1); color: #B8860B; }
.card-icon.python { background: rgba(55, 118, 171, 0.1); color: var(--python-color); }
.card-icon.java { background: rgba(0, 115, 150, 0.1); color: var(--java-color); }
.card-icon.mysql { background: rgba(68, 121, 161, 0.1); color: var(--mysql-color); }
.card-icon.php { background: rgba(119, 123, 180, 0.1); color: var(--php-color); }
.card-icon.linux { background: rgba(252, 198, 36, 0.1); color: #B8860B; }

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.card-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.6;
}

.card-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary-color);
    font-weight: 500;
    font-size: 0.9rem;
    transition: var(--transition);
}

.card-link:hover {
    gap: 10px;
}

/* ==================== 在线工具 ==================== */
.tools {
    padding: 80px 0;
    background: var(--bg-secondary);
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 20px;
}

.tool-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 24px 16px;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
}

.tool-card:hover {
    border-color: var(--primary-color);
    background: var(--primary-light);
}

.tool-card i {
    font-size: 1.75rem;
    color: var(--primary-color);
    margin-bottom: 12px;
}

.tool-card span {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* ==================== 统计数据 ==================== */
.stats {
    padding: 60px 0;
    background: linear-gradient(135deg, var(--primary-color) 0%, #4D7CFF 100%);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 40px;
    text-align: center;
}

.stat-item {
    color: white;
}

.stat-number {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 1rem;
    opacity: 0.9;
}

/* ==================== 最新文章 ==================== */
.articles {
    padding: 80px 0;
}

.articles-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.article-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 28px;
    transition: var(--transition);
}

.article-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.article-tag {
    display: inline-block;
    padding: 4px 12px;
    background: var(--primary-light);
    color: var(--primary-color);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 16px;
}

.article-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
    line-height: 1.4;
}

.article-excerpt {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.6;
}

.article-meta {
    display: flex;
    gap: 20px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.article-meta i {
    margin-right: 6px;
}

/* ==================== 页脚 ==================== */
.footer {
    background: var(--bg-dark);
    color: white;
    padding: 60px 0 30px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.footer-section h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 20px;
}

.footer-section p {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.7;
}

.footer-section ul li {
    margin-bottom: 12px;
}

.footer-section ul li a {
    font-size: 0.9rem;
    color: var(--text-muted);
    transition: var(--transition);
}

.footer-section ul li a:hover {
    color: white;
}

.footer-bottom {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    gap: 16px;
}

.footer-bottom p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.social-links {
    display: flex;
    gap: 16px;
}

.social-links a {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: var(--transition);
}

.social-links a:hover {
    background: var(--primary-color);
}

/* ==================== 返回顶部 ==================== */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 48px;
    height: 48px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    box-shadow: var(--shadow-lg);
    z-index: 999;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--primary-hover);
    transform: translateY(-4px);
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 1024px) {
    .tutorial-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .tools-grid {
        grid-template-columns: repeat(3, 1fr);
    }

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

@media (max-width: 768px) {
    .nav-menu {
        display: none;
    }

    .search-box {
        display: none;
    }

    .mobile-menu-btn {
        display: block;
    }

    .mobile-menu {
        display: block;
    }

    .hero .container {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .hero-buttons {
        justify-content: center;
    }

    .hero-graphic {
        display: none;
    }

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

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

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
    }

    .stat-number {
        font-size: 2.5rem;
    }

    .articles-grid {
        grid-template-columns: 1fr;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .tutorial-grid {
        grid-template-columns: 1fr;
    }

    .tools-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .hero-buttons {
        flex-direction: column;
    }
}

/* ==================== 动画 ==================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tutorial-card,
.tool-card,
.article-card {
    animation: fadeInUp 0.6s ease forwards;
}

.tutorial-card:nth-child(1) { animation-delay: 0.1s; }
.tutorial-card:nth-child(2) { animation-delay: 0.2s; }
.tutorial-card:nth-child(3) { animation-delay: 0.3s; }
.tutorial-card:nth-child(4) { animation-delay: 0.4s; }
.tutorial-card:nth-child(5) { animation-delay: 0.5s; }
.tutorial-card:nth-child(6) { animation-delay: 0.6s; }
.tutorial-card:nth-child(7) { animation-delay: 0.7s; }
.tutorial-card:nth-child(8) { animation-delay: 0.8s; }
