/* ===================================================
   个人网站模板 - 完整 CSS 样式表
   =================================================== */

/* ---------- CSS 变量 / 设计系统 ---------- */
:root {
    /* 主色调 */
    --primary: #4f46e5;
    --primary-light: #6366f1;
    --primary-dark: #3730a3;

    /* 中性色 */
    --white: #ffffff;
    --bg-light: #f8fafc;
    --bg-gray: #f1f5f9;
    --text-dark: #1e293b;
    --text-medium: #475569;
    --text-light: #94a3b8;
    --border: #e2e8f0;

    /* 辅助色 */
    --accent: #06b6d4;
    --success: #10b981;
    --warning: #f59e0b;

    /* 排版 */
    --font-main: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue',
        sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;

    /* 间距 */
    --section-padding: 100px 0;
    --container-width: 1140px;

    /* 阴影 */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.15);

    /* 圆角 */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --radius-full: 50%;

    /* 过渡 */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- 全局重置 ---------- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    scroll-padding-top: 80px;
}

body {
    font-family: var(--font-main);
    color: var(--text-dark);
    background-color: var(--white);
    line-height: 1.7;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.no-scroll {
    overflow: hidden;
}

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

ul {
    list-style: none;
}

img {
    max-width: 100%;
    display: block;
}

/* ---------- 容器 ---------- */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 24px;
}

/* ---------- 通用 Section ---------- */
.section {
    padding: var(--section-padding);
}

.bg-light {
    background-color: var(--bg-light);
}

/* ---------- Section Header ---------- */
.section-header {
    text-align: center;
    margin-bottom: 60px;
}

.section-header.animate-ready {
    opacity: 0;
    transform: translateY(30px);
    transition: var(--transition-slow);
}

.section-header.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.section-line {
    width: 60px;
    height: 4px;
    background: var(--primary);
    margin: 0 auto 16px;
    border-radius: 2px;
}

.section-subtitle {
    font-size: 1.1rem;
    color: var(--text-medium);
    margin-top: 8px;
}

/* ===================================================
   导航栏
   =================================================== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: transparent;
    transition: var(--transition);
    padding: 16px 0;
}

.navbar.scrolled {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: var(--shadow-sm);
    padding: 10px 0;
}

.nav-container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

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

.nav-menu {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-link {
    padding: 10px 18px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-medium);
    border-radius: 30px;
    transition: var(--transition);
    position: relative;
}

.nav-link:hover {
    color: var(--primary);
    background: rgba(79, 70, 229, 0.06);
}

.nav-link.active {
    color: var(--primary);
    font-weight: 600;
    background: rgba(79, 70, 229, 0.08);
}

/* 汉堡菜单 */
.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 6px;
    z-index: 1001;
    padding: 4px;
}

.hamburger span {
    width: 28px;
    height: 2.5px;
    background: var(--text-dark);
    border-radius: 3px;
    transition: var(--transition);
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* ===================================================
   Hero 区域
   =================================================== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 120px 24px 60px;
    background: linear-gradient(180deg,
            #f0f4ff 0%,
            #fafbff 40%,
            var(--white) 100%);
    overflow: hidden;
}

/* 背景装饰 */
.hero::before {
    content: '';
    position: absolute;
    top: -200px;
    right: -200px;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(79, 70, 229, 0.06) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.hero::after {
    content: '';
    position: absolute;
    bottom: -150px;
    left: -150px;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.05) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.hero-content {
    max-width: 600px;
    text-align: left;
    z-index: 1;
}

.hero-greeting {
    font-size: 1.2rem;
    color: var(--primary);
    font-weight: 500;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.hero-title {
    font-size: 4rem;
    font-weight: 800;
    color: var(--text-dark);
    line-height: 1.1;
    margin-bottom: 16px;
    letter-spacing: -2px;
}

.hero-subtitle {
    font-size: 1.3rem;
    color: var(--text-medium);
    margin-bottom: 20px;
    min-height: 32px;
}

.typed-text {
    color: var(--primary);
    font-weight: 600;
}

.cursor {
    display: inline-block;
    color: var(--primary);
    font-weight: 300;
    animation: blink 0.8s infinite;
}

@keyframes blink {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0;
    }
}

.hero-description {
    font-size: 1.1rem;
    color: var(--text-medium);
    line-height: 1.8;
    margin-bottom: 32px;
    max-width: 480px;
}

.hero-buttons {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 36px;
}

.hero-social {
    display: flex;
    gap: 14px;
}

.hero-social a {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-full);
    background: var(--white);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-medium);
    font-size: 1.1rem;
    transition: var(--transition);
}

.hero-social a:hover {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

/* Hero 头像 */
.hero-image {
    z-index: 1;
    margin-left: 80px;
}

.hero-avatar {
    width: 320px;
    height: 320px;
}

.avatar-placeholder {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-xl);
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 50%, #a5b4fc 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-xl);
    border: 6px solid var(--white);
}

.avatar-placeholder i {
    font-size: 7rem;
    color: var(--primary);
    opacity: 0.6;
}

/* 向下滚动 */
.scroll-down {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-light);
    font-size: 0.85rem;
    transition: var(--transition);
    z-index: 1;
    animation: bounceDown 2s infinite;
}

.scroll-down:hover {
    color: var(--primary);
}

@keyframes bounceDown {
    0%,
    100% {
        transform: translateX(-50%) translateY(0);
    }
    50% {
        transform: translateX(-50%) translateY(10px);
    }
}

/* ===================================================
   按钮样式
   =================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
    letter-spacing: 0.3px;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.35);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

/* ===================================================
   关于我
   =================================================== */
.about-content {
    display: flex;
    align-items: center;
    gap: 70px;
}

.about-image {
    flex-shrink: 0;
}

.about-image.animate-ready {
    opacity: 0;
    transform: translateX(-40px);
    transition: var(--transition-slow);
}

.about-image.animate-in {
    opacity: 1;
    transform: translateX(0);
}

.about-img-placeholder {
    width: 340px;
    height: 380px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, #e0e7ff 0%, #ddd6fe 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
}

.about-img-placeholder i {
    font-size: 8rem;
    color: var(--primary);
    opacity: 0.5;
}

.about-text {
    flex: 1;
}

.about-text.animate-ready {
    opacity: 0;
    transform: translateX(40px);
    transition: var(--transition-slow);
}

.about-text.animate-in {
    opacity: 1;
    transform: translateX(0);
}

.about-text h3 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-dark);
}

.about-text p {
    color: var(--text-medium);
    margin-bottom: 14px;
    line-height: 1.8;
}

.about-text strong {
    color: var(--text-dark);
}

.about-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 30px;
    margin: 24px 0;
}

.info-item {
    font-size: 0.95rem;
    color: var(--text-medium);
    padding: 8px 0;
    border-bottom: 1px dashed var(--border);
}

.info-label {
    font-weight: 600;
    color: var(--text-dark);
    margin-right: 4px;
}

/* ===================================================
   技能卡片
   =================================================== */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
}

.skill-card {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 32px 28px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.skill-card.animate-ready {
    opacity: 0;
    transform: translateY(30px);
    transition: var(--transition-slow);
}

.skill-card.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.skill-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.skill-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--primary);
    transform: scaleX(0);
    transition: var(--transition);
}

.skill-card:hover::before {
    transform: scaleX(1);
}

.skill-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-full);
    background: rgba(79, 70, 229, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 1.5rem;
    color: var(--primary);
    transition: var(--transition);
}

.skill-card:hover .skill-icon {
    background: var(--primary);
    color: var(--white);
}

.skill-card h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text-dark);
}

.skill-card p {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 16px;
}

.skill-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-gray);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 6px;
}

.skill-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 4px;
    transition: width 1.2s ease;
}

.skill-card.animate-in .skill-fill {
    animation: fillBar 1s ease forwards;
}

@keyframes fillBar {
    from {
        width: 0 !important;
    }
    to {
        width: var(--target-width);
    }
}

.skill-percent {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary);
}

/* ===================================================
   项目卡片
   =================================================== */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
}

.project-card {
    background: var(--white);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.project-card.animate-ready {
    opacity: 0;
    transform: translateY(30px);
    transition: var(--transition-slow);
}

.project-card.animate-in {
    opacity: 1;
    transform: translateY(0);
}

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

.project-img {
    position: relative;
    height: 200px;
    overflow: hidden;
}

.project-img-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
    color: var(--primary);
    opacity: 0.5;
    transition: var(--transition);
}

.project-card:hover .project-img-placeholder {
    opacity: 0.7;
    transform: scale(1.05);
}

.project-overlay {
    position: absolute;
    inset: 0;
    background: rgba(79, 70, 229, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
}

.project-card:hover .project-overlay {
    opacity: 1;
}

.project-link {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-full);
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 1.2rem;
    transition: var(--transition);
}

.project-link:hover {
    transform: scale(1.1);
}

.project-info {
    padding: 22px 20px;
}

.project-tag {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--primary);
    background: rgba(79, 70, 229, 0.08);
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 10px;
}

.project-info h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-dark);
}

.project-info p {
    font-size: 0.9rem;
    color: var(--text-medium);
    line-height: 1.6;
    margin-bottom: 14px;
}

.project-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.project-tech span {
    font-size: 0.78rem;
    padding: 4px 10px;
    background: var(--bg-gray);
    border-radius: 4px;
    color: var(--text-medium);
    font-weight: 500;
}

.projects-more {
    text-align: center;
    margin-top: 48px;
}

/* ===================================================
   联系我
   =================================================== */
.contact-content {
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    gap: 50px;
    align-items: start;
}

.contact-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.contact-card {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 28px 20px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.contact-card.animate-ready {
    opacity: 0;
    transform: translateY(20px);
    transition: var(--transition-slow);
}

.contact-card.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.contact-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.contact-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    background: rgba(79, 70, 229, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    font-size: 1.2rem;
    color: var(--primary);
}

.contact-card h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text-dark);
}

.contact-card p {
    font-size: 0.9rem;
    color: var(--text-medium);
}

.contact-form {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 36px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.form-group {
    margin-bottom: 18px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: var(--font-main);
    color: var(--text-dark);
    background: var(--bg-light);
    transition: var(--transition);
    outline: none;
    resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.06);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-light);
}

/* ===================================================
   页脚
   =================================================== */
.footer {
    background: var(--text-dark);
    color: var(--white);
    padding: 50px 0 30px;
    text-align: center;
}

.footer-logo {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -1px;
    display: inline-block;
    margin-bottom: 20px;
}

.footer-logo span {
    color: var(--primary-light);
}

.footer-social {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 20px;
}

.footer-social a {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 1rem;
    transition: var(--transition);
}

.footer-social a:hover {
    background: var(--primary);
    transform: translateY(-3px);
}

.footer-copy {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 6px;
}

.footer-credit {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.4);
}

.footer-credit i {
    color: #ef4444;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%,
    100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

/* ===================================================
   返回顶部按钮
   =================================================== */
.back-to-top {
    position: fixed;
    bottom: 36px;
    right: 36px;
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    background: var(--primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    box-shadow: var(--shadow-md);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: var(--transition);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

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

/* ===================================================
   响应式设计
   =================================================== */

/* 平板及以下 */
@media (max-width: 1024px) {
    .hero {
        flex-direction: column;
        text-align: center;
        padding: 140px 24px 80px;
    }

    .hero-content {
        text-align: center;
        order: 2;
    }

    .hero-description {
        max-width: 100%;
        margin: 0 auto 32px;
    }

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

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

    .hero-image {
        margin: 0 0 40px;
        order: 1;
    }

    .hero-avatar {
        width: 220px;
        height: 220px;
        margin: 0 auto;
    }

    .avatar-placeholder i {
        font-size: 5rem;
    }

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

    .about-content {
        flex-direction: column;
        gap: 40px;
    }

    .about-img-placeholder {
        width: 260px;
        height: 300px;
        margin: 0 auto;
    }

    .about-img-placeholder i {
        font-size: 6rem;
    }

    .about-info-grid {
        grid-template-columns: 1fr;
    }

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

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

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

/* 手机 */
@media (max-width: 768px) {
    .section-title {
        font-size: 2rem;
    }

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

    .hero-avatar {
        width: 170px;
        height: 170px;
    }

    .avatar-placeholder i {
        font-size: 3.5rem;
    }

    /* 移动端导航 */
    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 75%;
        max-width: 340px;
        height: 100vh;
        background: var(--white);
        flex-direction: column;
        justify-content: center;
        gap: 8px;
        padding: 60px 30px;
        box-shadow: var(--shadow-xl);
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .nav-menu.active {
        right: 0;
    }

    .nav-link {
        font-size: 1.1rem;
        padding: 14px 20px;
        width: 100%;
        text-align: center;
    }

    .hamburger {
        display: flex;
    }

    .skills-grid {
        grid-template-columns: 1fr;
        max-width: 420px;
        margin: 0 auto;
    }

    .projects-grid {
        grid-template-columns: 1fr;
        max-width: 460px;
        margin: 0 auto;
    }

    .contact-info {
        grid-template-columns: 1fr;
    }

    .back-to-top {
        bottom: 24px;
        right: 20px;
        width: 42px;
        height: 42px;
        font-size: 0.95rem;
    }

    .scroll-down {
        bottom: 24px;
    }
}

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

    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }

    .btn {
        width: 100%;
        justify-content: center;
        padding: 12px 24px;
    }

    .about-img-placeholder {
        width: 200px;
        height: 240px;
    }

    .contact-form {
        padding: 24px;
    }

    .section {
        padding: 70px 0;
    }
}
