/* 重置与基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scroll-behavior: smooth;
}

:root {
    --primary: #7e3ebe;
    --primary-light: #7e3ebe;
    --primary-dark: #7e3ebe;
    --secondary: #b7ba6b;
    --accent: #ff6b6b;
    --light: #f8f9fa;
    --dark: #343a40;
    --gray: #6c757d;
    --transition: all 0.3s ease;
    --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 25px rgba(0, 0, 0, 0.15);
    --radius: 12px;

    /* 暗色模式变量 */
    --bg-color: #fafafa;
    --card-bg: #ffffff;
    --text-color: #343a40;
    --text-light: #6c757d;
    --border-color: rgba(0, 0, 0, 0.05);
    --header-bg: rgba(255, 255, 255, 0.95);
}

[data-theme="dark"] {
    --primary: #a56bde;
    --secondary: #d0d38a;
    --bg-color: #1a1a1a;
    --card-bg: #2d2d2d;
    --text-color: #f0f0f0;
    --text-light: #a0a0a0;
    --border-color: rgba(255, 255, 255, 0.1);
    --header-bg: rgba(45, 45, 45, 0.95);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    background-image: linear-gradient(135deg, var(--bg-color) 0%, var(--card-bg) 100%);
    min-height: 100vh;
    padding-bottom: 2rem;
    transition: background-color 0.5s ease, color 0.5s ease;
}

a {
    text-decoration: none;
    color: var(--primary);
    transition: var(--transition);
}

a:hover {
    color: var(--primary-light);
}

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

/* 容器布局 */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* 头部导航 */
.header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--header-bg);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
    border-bottom: 2px solid var(--secondary);
    padding: 1rem 0;
    transition: var(--transition);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.header.hidden-header {
    transform: translateY(-100%);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo h1 {
    font-size: 1.5rem;
    color: var(--primary);
    font-weight: 700;
    letter-spacing: -0.5px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

.nav-bar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-link {
    font-weight: 500;
    padding: 0.5rem 0;
    position: relative;
    color: var(--text-color);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--secondary);
    transition: var(--transition);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

/* 主要内容区域 */
.main-content {
    display: grid;
    grid-template-columns: 1fr 3fr;
    gap: 2.5rem;
    margin-top: 2rem;
}

/* 个人信息卡片 */
.about-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 2rem;
    position: sticky;
    top: 100px;
    height: fit-content;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease, background 0.5s ease;
}

.about-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.profile {
    text-align: center;
    margin-bottom: 1.5rem;
}

.profile-img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 1rem;
    border: 4px solid var(--light);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.profile-img:hover {
    transform: scale(1.05);
    border-color: var(--primary);
}

.profile h2 {
    color: var(--primary);
    margin-bottom: 0.25rem;
    font-size: 1.75rem;
}

.profile-tag {
    display: inline-block;
    background: rgba(126, 62, 190, 0.1);
    color: var(--primary);
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-top: 0.5rem;
    transition: var(--transition);
}

.profile-tag:hover {
    background: rgba(126, 62, 190, 0.2);
}

.about-section {
    margin: 1.5rem 0;
    padding: 1.25rem 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.about-section h4 {
    font-size: 1.1rem;
    color: var(--primary);
    margin-bottom: 0.75rem;
    text-align: center;
}

.about-section p {
    color: var(--text-light);
    font-size: 0.95rem;
    text-align: center;
    line-height: 1.7;
}

.contact-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.contact-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.contact-icon {
    width: 40px;
    height: 40px;
    background: var(--card-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.contact-link:hover .contact-icon {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    background: var(--primary);
}

.contact-link:hover .contact-icon img {
    filter: invert(1);
}

.contact-link span {
    font-size: 0.85rem;
    color: var(--text-light);
}

/* 博客区域 */
.blog-section {
    padding-bottom: 2rem;
}

.section-title {
    font-size: 1.75rem;
    margin-bottom: 2rem;
    color: var(--text-color);
    position: relative;
    padding-bottom: 0.75rem;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 80px;
    height: 4px;
    background: var(--secondary);
    border-radius: 2px;
}

.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

.blog-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    height: 100%;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease, box-shadow 0.3s ease, transform 0.3s ease;
    cursor: pointer;
    position: relative;
}

.blog-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.blog-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.blog-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, var(--primary), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.blog-card:hover::before {
    opacity: 0.1;
}

.blog-image {
    height: 180px;
    overflow: hidden;
    position: relative;
}

.blog-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.blog-card:hover .blog-image img {
    transform: scale(1.05);
}

.blog-content {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 2;
}

.blog-content h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    color: var(--text-color);
    line-height: 1.4;
    transition: color 0.3s ease;
}

.blog-card:hover .blog-content h3 {
    color: var(--primary);
}

.blog-content p {
    color: var(--text-light);
    font-size: 0.95rem;
    margin-bottom: 1.25rem;
    flex-grow: 1;
}

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

.read-more {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary);
    font-weight: 500;
    font-size: 0.9rem;
    transition: var(--transition);
}

.blog-card:hover .read-more {
    gap: 0.7rem;
    font-weight: 600;
}

/* 回到顶部按钮 */
.to-top {
    position: fixed;
    right: 2rem;
    bottom: 2rem;
    width: 50px;
    height: 50px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    z-index: 100;
    opacity: 0;
    transform: translateY(20px);
    transition: var(--transition);
    cursor: pointer;
}

.to-top.visible {
    opacity: 0.8;
    transform: translateY(0);
}

.to-top:hover {
    opacity: 1;
    transform: translateY(-5px);
    background: var(--primary-dark);
}

/* 主题切换按钮样式 */
.theme-toggle {
    position: fixed;
    right: 30px;
    bottom: 90px;
    z-index: 999;
    background: var(--card-bg);
    border: none;
    cursor: pointer;
    font-size: 24px;
    color: var(--text-color);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-normal);
}

.theme-toggle:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

/* 响应式设计 */
@media (max-width: 992px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .about-card {
        position: static;
        margin-bottom: 2rem;
    }
}

@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .nav-bar {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

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

    .to-top {
        right: 1rem;
        bottom: 1rem;
        width: 45px;
        height: 45px;
    }
}

@media (max-width: 576px) {
    .contact-links {
        flex-wrap: wrap;
    }
}