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

/* 入场动画 */
.project-card,
.about-text,
.about-stats {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.project-card.in-view,
.about-text.in-view,
.about-stats.in-view {
    opacity: 1;
    transform: translateY(0);
}

:root {
    /* 配色 */
    --accent: #6366f1;
    --accent-dark: #4f46e5;
    --accent-light: #eef2ff;
    --bg: #ffffff;
    --bg-soft: #f7f7f8;
    --text: #18181b;
    --text-light: #71717a;
    --border: #e4e4e7;
    --success: #22c55e;

    /* 间距 */
    --space-xs: 8px;
    --space-sm: 16px;
    --space-md: 24px;
    --space-lg: 40px;
    --space-xl: 80px;

    /* 阴影 */
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 12px 32px rgba(99, 102, 241, 0.18);
    --shadow-nav: 0 8px 24px rgba(0, 0, 0, 0.12);

    /* 圆角 */
    --radius-card: 16px;
    --radius-btn: 50px;
    --radius-img: 12px;

    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: "PingFang SC", "Microsoft YaHei", "Inter", "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 24px;
}

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

.accent {
    color: var(--accent);
}

/* ===== 导航栏 ===== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid transparent;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.navbar.scrolled {
    border-bottom-color: var(--border);
    box-shadow: var(--shadow-nav);
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.nav-logo {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--accent);
}

.nav-links {
    display: flex;
    gap: 32px;
    list-style: none;
}

.nav-links a {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-light);
    transition: color var(--transition);
}

.nav-links a:hover {
    color: var(--accent);
}

/* ===== 英雄区 ===== */
.hero {
    padding: 160px 0 100px;
    text-align: center;
}

.hero-greet {
    color: var(--accent);
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.hero-title {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: var(--space-md);
}

.hero-desc {
    max-width: 560px;
    margin: 0 auto var(--space-lg);
    color: var(--text-light);
    font-size: 1.1rem;
}

.hero-actions {
    display: flex;
    gap: var(--space-sm);
    justify-content: center;
}

/* ===== 按钮 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    padding: 14px 32px;
    border-radius: var(--radius-btn);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: all var(--transition);
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
    background: var(--accent-dark);
    transform: translateY(-2px);
}

.btn-ghost {
    border-color: var(--border);
    color: var(--text);
}

.btn-ghost:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ===== 通用区块 ===== */
.section {
    padding: var(--space-xl) 0;
}

.section-soft {
    background: var(--bg-soft);
}

.section-head {
    text-align: center;
    margin-bottom: var(--space-lg);
}

.section-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: var(--space-xs);
}

.section-sub {
    color: var(--text-light);
}

/* ===== 作品网格 ===== */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: var(--space-md);
}

.project-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-hover);
    border-color: var(--accent);
}

/* 卡片缩略图 */
.card-thumb {
    position: relative;
    display: block;
    height: 200px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--g1), var(--g2));
}

.card-thumb img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition);
}

.project-card:hover .card-thumb img {
    transform: scale(1.04);
}

.thumb-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.4rem;
    color: rgba(0, 0, 0, 0.25);
    z-index: 0;
}

.thumb-fallback::before {
    content: var(--emoji);
    font-size: 3.4rem;
    filter: grayscale(0.2);
}

/* 卡片正文 */
.card-body {
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-xs);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
}

.card-no {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent);
    opacity: 0.5;
    font-family: "JetBrains Mono", monospace;
}

.card-desc {
    color: var(--text-light);
    font-size: 0.95rem;
    margin-bottom: var(--space-sm);
    flex: 1;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: var(--space-sm);
}

.tag {
    background: var(--accent-light);
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: var(--radius-btn);
}

.card-links {
    display: flex;
    gap: var(--space-md);
    padding-top: var(--space-sm);
    border-top: 1px solid var(--border);
}

.link-demo {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.92rem;
    transition: color var(--transition);
}

.link-demo:hover {
    color: var(--accent-dark);
}

.link-code {
    color: var(--text-light);
    font-size: 0.92rem;
    transition: color var(--transition);
}

.link-code:hover {
    color: var(--text);
}

/* ===== 关于 ===== */
.about-inner {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: var(--space-xl);
    align-items: center;
}

.about-text p {
    color: var(--text-light);
    margin-top: var(--space-sm);
    margin-bottom: var(--space-md);
}

.about-skills {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.skill {
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 6px 16px;
    border-radius: var(--radius-btn);
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text);
}

.about-stats {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-sm);
}

.stat {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    padding: var(--space-md);
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-num {
    display: block;
    font-size: 2.4rem;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
}

.stat-label {
    display: block;
    margin-top: 6px;
    color: var(--text-light);
    font-size: 0.9rem;
}

/* ===== 页脚 ===== */
.footer {
    background: var(--bg);
    border-top: 1px solid var(--border);
    padding: var(--space-md) 0;
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text-light);
    font-size: 0.9rem;
}

.footer-links {
    display: flex;
    gap: var(--space-md);
}

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

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .hero {
        padding: 120px 0 70px;
    }
    .hero-title {
        font-size: 2.2rem;
    }
    .section {
        padding: 56px 0;
    }
    .section-title {
        font-size: 1.6rem;
    }
    .about-inner {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }
    .footer-inner {
        flex-direction: column;
        gap: var(--space-xs);
        text-align: center;
    }
}

@media (max-width: 480px) {
    .nav-links {
        gap: 18px;
    }
    .hero-actions {
        flex-direction: column;
    }
}
