/* ===== CSS变量 - 全局颜色和效果 ===== */
:root {
    --primary-color: #3498db;
    --secondary-color: #2c3e50;
    --accent-color: #e74c3c;
    --light-color: #ecf0f1;
    --dark-color: #34495e;
    --shadow-normal: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 15px rgba(0, 0, 0, 0.2);
    --transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    --transition-fast: all 0.2s ease;
    --border-radius: 15px;
    --border-radius-sm: 30px;
}

/* ===== 基础样式重置 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent; /* 移除移动端点击高亮 */
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased; /* 字体平滑 */
    -moz-osx-font-smoothing: grayscale; /* 字体平滑 */
}

/* ===== 通用组件样式 ===== */
.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 5%;
}

.section-padding {
    padding: 4rem 0;
}

.text-center {
    text-align: center;
}

/* ===== 导航栏样式 ===== */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 5%;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: var(--shadow-normal);
    transition: var(--transition);
}

.navbar.scrolled {
    padding: 0.75rem 5%;
    background-color: rgba(255, 255, 255, 0.98);
    box-shadow: var(--shadow-hover);
}

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

.logo:hover {
    transform: scale(1.05);
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-links a {
    text-decoration: none;
    color: var(--secondary-color);
    font-weight: 500;
    font-size: 1.1rem;
    position: relative;
    padding: 0.5rem 0;
    transition: var(--transition);
}

.nav-links a:hover {
    color: var(--primary-color);
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: var(--transition);
}

.nav-links a:hover::after {
    width: 100%;
}

.hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1001;
}

.hamburger-line {
    display: block;
    width: 25px;
    height: 3px;
    margin: 5px 0;
    background-color: var(--secondary-color);
    transition: var(--transition);
}

/* ===== 按钮样式 ===== */
.btn {
    display: inline-block;
    padding: 0.8rem 1.8rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    box-shadow: var(--shadow-normal);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: var(--transition);
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn-primary {
    background-color: var(--primary-color);
}
.btn-primary:hover {
    background-color: #2980b9;
}

.btn-accent {
    background-color: var(--accent-color);
}
.btn-accent:hover {
    background-color: #c0392b;
}

.btn-external {
    background-color: var(--primary-color);
    width: 100%;
    text-align: center;
    margin-top: 1rem;
}
.btn-external:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

/* ===== 卡片通用样式 ===== */
.card {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-normal);
    transition: var(--transition);
    animation: fadeInUp 0.6s ease forwards;
    opacity: 0;
    will-change: transform, opacity;
}

.card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-hover);
}

.card-header {
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    font-weight: bold;
    color: white;
    overflow: hidden;
    position: relative;
}

.card-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, rgba(255,255,255,0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card:hover .card-header::before {
    opacity: 1;
}

.card-content {
    padding: 1.5rem;
    text-align: center;
}

.card-content h3 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    color: var(--secondary-color);
}

.card-content p {
    color: #666;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

/* ===== 网格布局 ===== */
.grid-container {
    display: grid;
    gap: 2rem;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* ===== 首页特定样式 ===== */
.hero {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 0 2rem;
    margin-top: 70px;
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    animation: fadeInUp 1s ease;
}

.hero p {
    font-size: 1.3rem;
    color: rgba(255, 255, 255, 0.9);
    max-width: 700px;
    margin-bottom: 2rem;
    animation: fadeInUp 1s ease 0.2s forwards;
    opacity: 0;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    animation: fadeInUp 1s ease 0.4s forwards;
    opacity: 0;
}

/* ===== 关于页面特定样式 ===== */
.about-page {
    padding: 4rem 0;
    background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
    color: white;
    min-height: 100vh;
    margin-top: 70px;
}

.about-page .section-title {
    text-align: center;
    font-size: 3rem;
    margin-bottom: 3rem;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.external-card {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: var(--transition);
    will-change: transform, opacity;
    position: relative;
    overflow: hidden;
}

.external-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    transform: rotate(30deg);
    z-index: 0;
    transition: opacity 0.5s ease;
    opacity: 0.3;
}

.external-card:hover::before {
    opacity: 0.5;
}

.external-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.external-card-content {
    position: relative;
    z-index: 1;
    padding: 1.5rem;
    text-align: center;
}

.external-card-content h3 {
    color: white;
}

.external-card-content p {
    color: rgba(255, 255, 255, 0.8);
}

/* ===== 联系页面特定样式 - 优化版 ===== */
.contact-page {
    padding: 4rem 0;
    background: linear-gradient(135deg, #2c3e50 0%, #1a2530 100%);
    color: white;
    min-height: 100vh;
    margin-top: 70px;
}

.contact-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* ===== 优化玻璃卡片 - 消除抽搐 ===== */
.glass-card {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: var(--border-radius);
    padding: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: transform 0.3s ease, background 0.3s ease;
    will-change: transform;
    position: relative;
    overflow: hidden;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, rgba(255,255,255,0.05), transparent);
    z-index: 0;
    transition: opacity 0.5s ease;
    opacity: 0.7;
}

.glass-card:hover {
    transform: translateY(-3px);
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
}

.glass-card-content {
    position: relative;
    z-index: 1;
}

.contact-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 2rem;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    transition: transform 0.3s ease;
    will-change: transform;
}

.contact-item:hover {
    transform: translateX(3px);
    background: rgba(52, 152, 219, 0.15);
}

.contact-icon {
    font-size: 1.8rem;
    color: var(--primary-color);
    min-width: 36px;
    text-align: center;
    transition: transform 0.3s ease;
}

.contact-item:hover .contact-icon {
    transform: scale(1.1);
}

.contact-text h3 {
    font-size: 1.3rem;
    margin-bottom: 0.3rem;
    color: white;
}

.contact-text p, .contact-text a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    transition: var(--transition-fast);
}

.contact-text a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.contact-link {
    display: inline-block;
    padding: 0.3rem 0.6rem;
    background: rgba(52, 152, 219, 0.1);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.contact-link:hover {
    background: rgba(52, 152, 219, 0.2);
    transform: translateX(2px);
}

/* ===== 社交媒体卡片样式 - 优化版 ===== */
.social-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.social-card {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: transform 0.3s ease;
    will-change: transform;
    border: 1px solid rgba(255, 255, 255, 0.15);
    position: relative;
    overflow: hidden;
}

.social-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, rgba(255,255,255,0.05), transparent);
    z-index: 0;
    opacity: 0.8;
}

.social-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.social-card.bilibili {
    background: linear-gradient(45deg, rgba(251, 114, 153, 0.1), rgba(230, 33, 67, 0.1));
    border: 1px solid rgba(251, 114, 153, 0.3);
}

.social-card.github {
    background: linear-gradient(45deg, rgba(40, 40, 40, 0.1), rgba(60, 60, 60, 0.1));
    border: 1px solid rgba(240, 240, 240, 0.25);
}

.social-icon {
    font-size: 2.8rem;
    margin-bottom: 1rem;
    display: block;
    transition: transform 0.3s ease;
}

.social-card:hover .social-icon {
    transform: scale(1.1) rotate(5deg);
}

.bilibili .social-icon { color: #FB7299; }
.github .social-icon { color: white; }

.social-card h3 {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
    color: white;
}

.social-card p {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.95rem;
    margin-bottom: 1rem;
    line-height: 1.4;
}

.social-link {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    text-decoration: none;
    border-radius: 20px;
    transition: all 0.3s ease;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.social-link:hover {
    background: var(--primary-color);
    border-color: transparent;
    transform: scale(1.05);
    box-shadow: 0 3px 10px rgba(52, 152, 219, 0.3);
}

/* ===== 品牌颜色定义 ===== */
.bilibili { background: linear-gradient(45deg, #FB7299, #E62143); }
.baidu { background: linear-gradient(45deg, #2B90F5, #2D58A3); }
.edge { background: linear-gradient(45deg, #0078D7, #004E92); }
.baidupan { background: linear-gradient(45deg, #2932E1, #1F5DC7); }
.wechat { background: linear-gradient(45deg, #07C160, #049344); }
.apple { background: linear-gradient(45deg, #A2AAAD, #86898C); }

/* ===== 页脚样式 ===== */
footer {
    background-color: var(--secondary-color);
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: 2rem;
    position: relative;
    overflow: hidden;
}

footer::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.08), transparent);
    transform: rotate(45deg);
    transition: transform 0.5s ease;
    z-index: 0;
}

footer:hover::before {
    transform: rotate(45deg) translateX(50%);
}

footer p {
    position: relative;
    z-index: 1;
}

/* ===== 按钮块样式 ===== */
.btn-block {
    display: block;
    width: 100%;
}

/* ===== 动画关键帧 ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(52, 152, 219, 0.4); }
    70% { box-shadow: 0 0 0 15px rgba(52, 152, 219, 0); }
    100% { box-shadow: 0 0 0 0 rgba(52, 152, 219, 0); }
}

.pulse {
    animation: pulse 2s infinite;
}

/* ===== 响应式设计 ===== */
@media (max-width: 768px) {
    .nav-links {
        position: fixed;
        top: 70px;
        right: -100%;
        flex-direction: column;
        background-color: white;
        width: 80%;
        height: calc(100vh - 70px);
        padding: 2rem;
        transition: var(--transition);
        box-shadow: -5px 0 15px rgba(0,0,0,0.1);
        gap: 1.5rem;
    }

    .nav-links.active {
        right: 0;
    }

    .hamburger {
        display: block;
    }

    .hamburger.active .hamburger-line:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .hamburger.active .hamburger-line:nth-child(2) {
        opacity: 0;
    }

    .hamburger.active .hamburger-line:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -5px);
    }

    .hero h1 {
        font-size: 2.5rem;
    }

    .hero p {
        font-size: 1.1rem;
    }

    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }

    .about-page .section-title {
        font-size: 2.2rem;
    }

    .contact-title {
        font-size: 2rem;
    }

    .card-header {
        height: 120px;
        font-size: 3rem;
    }

    .contact-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .nav-links {
        width: 90%;
    }

    .btn {
        width: 100%;
        max-width: 300px;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .about-page .section-title {
        font-size: 1.8rem;
    }

    .contact-title {
        font-size: 1.8rem;
    }

    .card-header {
        height: 100px;
        font-size: 2.5rem;
    }

    .card-content h3 {
        font-size: 1.3rem;
    }

    .social-icon {
        font-size: 2rem;
    }

    .social-cards {
        grid-template-columns: 1fr;
    }

    .contact-icon {
        font-size: 1.5rem;
    }
}

/* ===== 减少运动模式 - 为抽搐问题提供终极解决方案 ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
        transition-delay: 0s !important;
    }
    
    .glass-card:hover,
    .external-card:hover,
    .card:hover,
    .social-card:hover {
        transform: none !important;
        box-shadow: none !important;
    }
    
    .pulse {
        animation: none !important;
    }
    
    .contact-item:hover {
        transform: none !important;
        background: rgba(0, 0, 0, 0.1) !important;
    }
}