/* style.css - 小鹏的博客样式 */

:root {
    --primary: #4361ee;
    --secondary: #3a0ca3;
    --accent: #4cc9f0;
    --light: #f8f9fa;
    --dark: #212529;
    --gray: #6c757d;
    --light-gray: #e9ecef;
    --border-radius: 8px;
    --shadow: 0 4px 12px rgba(0,0,0,0.08);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--dark);
    background-color: #f9fafb;
    background-image: linear-gradient(120deg, #fdfbfb 0%, #ebedee 100%);
}

/* 导航栏样式 */
header {
    background-color: white;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}

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

.nav-links {
    display: flex;
    list-style: none;
    gap: 1.8rem;
}

.nav-links a {
    text-decoration: none;
    color: var(--dark);
    font-weight: 500;
    transition: var(--transition);
    padding: 8px 12px;
    border-radius: var(--border-radius);
}

.nav-links a:hover, .nav-links a.active {
    color: var(--primary);
    background-color: rgba(67, 97, 238, 0.08);
}

.menu-toggle {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
}

/* 主内容区域 */
.hero {
    padding: 5rem 0;
    text-align: center;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    margin-bottom: 3rem;
    border-bottom-left-radius: 50% 20px;
    border-bottom-right-radius: 50% 20px;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--secondary);
}

.hero p {
    font-size: 1.2rem;
    max-width: 700px;
    margin: 0 auto 2rem;
    color: var(--gray);
}

.btn {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 12px 28px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
    border: none;
    cursor: pointer;
}

.btn:hover {
    background: var(--secondary);
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(67, 97, 238, 0.25);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    margin-left: 15px;
}

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

/* 关于部分 */
.section {
    padding: 4rem 0;
}

.section-title {
    text-align: center;
    margin-bottom: 3rem;
    font-size: 2rem;
    color: var(--secondary);
    position: relative;
}

.section-title::after {
    content: "";
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: var(--accent);
    border-radius: 2px;
}

.about-content {
    display: flex;
    align-items: center;
    gap: 3rem;
    background: white;
    padding: 2.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.profile-img {
    flex: 0 0 250px;
    height: 250px;
    border-radius: 50%;
    background: linear-gradient(45deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 5rem;
    font-weight: bold;
    box-shadow: var(--shadow);
}

.about-text h3 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: var(--secondary);
}

.contact-info {
    display: flex;
    gap: 1.5rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    background: var(--light-gray);
    border-radius: 20px;
    font-size: 0.9rem;
}

.contact-item i {
    color: var(--primary);
}

/* 博客文章部分 */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.blog-card {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.blog-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.15);
}

.card-img {
    height: 180px;
    background: linear-gradient(45deg, #4361ee, #4cc9f0);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 3rem;
}

.card-content {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-content h3 {
    margin-bottom: 0.8rem;
    color: var(--secondary);
}

.card-content p {
    color: var(--gray);
    margin-bottom: 1.2rem;
    flex: 1;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    color: var(--gray);
    font-size: 0.85rem;
    border-top: 1px solid var(--light-gray);
    padding-top: 12px;
}

/* 联系表单 */
.contact-form {
    max-width: 600px;
    margin: 0 auto;
    background: white;
    padding: 2.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
}

textarea {
    min-height: 120px;
    resize: vertical;
}

/* 页脚 */
footer {
    background: var(--dark);
    color: white;
    padding: 3rem 0 1.5rem;
    margin-top: 4rem;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section {
    flex: 1;
    min-width: 250px;
}

.footer-section h3 {
    margin-bottom: 1.2rem;
    color: var(--accent);
    font-size: 1.3rem;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.8rem;
}

.footer-links a {
    color: #adb5bd;
    text-decoration: none;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--accent);
    padding-left: 5px;
}

.social-links {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

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

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

.copyright {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    color: #adb5bd;
    font-size: 0.9rem;
}

/* 页面切换 */
.page {
    display: none;
    animation: fadeIn 0.5s ease;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .nav-links {
        position: fixed;
        top: 70px;
        right: -100%;
        flex-direction: column;
        background: white;
        width: 80%;
        height: calc(100vh - 70px);
        padding: 2rem;
        box-shadow: -5px 0 15px rgba(0,0,0,0.1);
        transition: var(--transition);
    }

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

    .menu-toggle {
        display: block;
    }

    .about-content {
        flex-direction: column;
        text-align: center;
    }

    .profile-img {
        margin: 0 auto;
    }

    .contact-info {
        justify-content: center;
    }

    .hero h1 {
        font-size: 2.2rem;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
    }

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

/* 加载动画 */
.loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.5s;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--light-gray);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 通知提示 */
.notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--primary);
    color: white;
    padding: 15px 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transform: translateY(100px);
    opacity: 0;
    transition: var(--transition);
    z-index: 200;
}

.notification.show {
    transform: translateY(0);
    opacity: 1;
}

/* ==========================================
   微信二维码悬浮效果
   ========================================== */

.social-links .wechat-hover {
    position: relative;
}

.social-links .wechat-popup {
    display: none;
    position: absolute;
    bottom: 55px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 10px;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.25);
    z-index: 200;
}

.social-links .wechat-popup img {
    width: 160px;
    height: auto;
    border-radius: 8px;
    display: block;
}

.social-links .wechat-popup::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid white;
}

.social-links .wechat-hover:hover .wechat-popup {
    display: block;
}

/* ==========================================
   文章内容排版美化
   ========================================== */

.post-content {
    font-size: 1.05rem;
    line-height: 1.9;
    color: #2d3748;
}

.post-content h2 {
    font-size: 1.6rem;
    color: var(--secondary);
    margin: 2.5rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 3px solid var(--accent);
    display: inline-block;
}

.post-content h3 {
    font-size: 1.3rem;
    color: var(--primary);
    margin: 2rem 0 0.8rem;
    padding-left: 12px;
    border-left: 4px solid var(--accent);
}

.post-content p {
    margin-bottom: 1.2rem;
}

.post-content blockquote {
    margin: 1.5rem 0;
    padding: 1.2rem 1.5rem;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8f0 100%);
    border-left: 5px solid var(--primary);
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    font-style: italic;
    color: #4a5568;
}

.post-content table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 1.5rem 0;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    font-size: 0.95rem;
}

.post-content table thead {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
}

.post-content table thead th {
    color: white;
    font-weight: 600;
    padding: 14px 16px;
    text-align: left;
}

.post-content table tbody tr:nth-child(even) {
    background-color: #f8fafc;
}

.post-content table tbody tr:hover {
    background-color: #e8f4f8;
}

.post-content table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
}

.post-content table tbody tr:last-child td {
    border-bottom: none;
}

.post-content table td:first-child {
    font-weight: 600;
    color: var(--secondary);
    white-space: nowrap;
    background: rgba(67, 97, 238, 0.03);
}

.post-content pre {
    background: #1e1e2e;
    color: #cdd6f4;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    overflow-x: auto;
    margin: 1.5rem 0;
    box-shadow: var(--shadow);
}

.post-content code {
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.9rem;
}

.post-content p code {
    background: #f1f5f9;
    color: #e11d48;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.88rem;
    border: 1px solid #e2e8f0;
}

.post-content ul, .post-content ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.post-content li {
    margin-bottom: 0.5rem;
    line-height: 1.8;
}

.post-content hr {
    border: none;
    height: 2px;
    background: linear-gradient(to right, transparent, var(--accent), transparent);
    margin: 2rem 0;
}

.post-content strong {
    color: var(--secondary);
    font-weight: 700;
}

.post-content img {
    max-width: 100%;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin: 1rem 0;
}

@media (max-width: 768px) {
    .post-content table {
        font-size: 0.85rem;
        display: block;
        overflow-x: auto;
    }
}

