/* ========== 基础 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --bg: #f5f6fa;
    --card: #ffffff;
    --text: #1f2937;
    --text-light: #6b7280;
    --border: #e5e7eb;
    --radius: 12px;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

html { scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    display: flex;
    min-height: 100vh;
    flex-direction: column;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; }

.container { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* ========== 顶部导航 ========== */
.site-header {
    background: var(--card);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 24px;
    height: 64px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 20px;
}

.logo-icon {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    color: #fff;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.main-nav {
    display: flex;
    gap: 4px;
    flex: 1;
}

.main-nav a {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 15px;
    color: var(--text-light);
    transition: all 0.2s;
}

.main-nav a:hover { color: var(--primary); background: #eef2ff; }
.main-nav a.active { color: var(--primary); background: #eef2ff; font-weight: 600; }

.search-form {
    display: flex;
    align-items: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 4px 6px 4px 14px;
    transition: all 0.2s;
}

.search-form:focus-within {
    border-color: var(--primary);
    background: #fff;
}

.search-form input {
    border: none;
    outline: none;
    background: transparent;
    width: 150px;
    font-size: 14px;
}

.search-form button {
    border: none;
    background: var(--primary);
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.search-form button:hover { background: var(--primary-dark); }

.nav-toggle { display: none; background: none; border: none; font-size: 24px; cursor: pointer; }

/* ========== 布局 ========== */
.main-wrap { flex: 1; width: 100%; padding: 32px 20px 48px; }

.content-area {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 28px;
    max-width: 1120px;
    margin: 0 auto;
    width: 100%;
}

.section-title {
    font-size: 20px;
    margin-bottom: 20px;
    padding-left: 12px;
    border-left: 4px solid var(--primary);
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.section-sub { font-size: 14px; color: var(--text-light); font-weight: 400; }

/* ========== 幻影灯轮播 ========== */
.hero-slider {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    height: 340px;
    margin-bottom: 24px;
    background: #1f2937;
    box-shadow: var(--shadow);
}
.hero-track { display: flex; height: 100%; transition: transform 0.5s ease; }
.hero-slide {
    position: relative;
    flex: 0 0 100%;
    height: 100%;
    overflow: hidden;
    display: block;
}
.hero-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.6s ease;
}
.hero-slide.active .hero-img { transform: scale(1.05); }
.hero-mask {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.05) 0%, rgba(0,0,0,0.25) 45%, rgba(0,0,0,0.72) 100%);
}
.hero-caption {
    position: absolute;
    left: 28px;
    right: 28px;
    bottom: 24px;
    color: #fff;
    z-index: 2;
}
.hero-cat {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 20px;
    margin-bottom: 10px;
}
.hero-title {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 6px;
    line-height: 1.35;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
.hero-desc {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.85);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-width: 90%;
}
.hero-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, opacity 0.2s;
    opacity: 0;
}
.hero-slider:hover .hero-arrow { opacity: 1; }
.hero-arrow:hover { background: var(--primary); }
.hero-prev { left: 14px; }
.hero-next { right: 14px; }
.hero-dots {
    position: absolute;
    right: 20px;
    bottom: 14px;
    z-index: 3;
    display: flex;
    gap: 8px;
}
.hero-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.45);
    cursor: pointer;
    transition: all 0.3s;
}
.hero-dot.active { background: #fff; width: 20px; border-radius: 4px; }

/* ========== 文章卡片 ========== */
.post-card {
    display: flex;
    gap: 20px;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 24px;
    margin-bottom: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.post-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1); }

/* 封面图 */
.post-cover {
    flex: 0 0 190px;
    width: 190px;
    height: 132px;
    align-self: center;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e6ecff, #f5e9ff);
    text-decoration: none;
}

.post-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.post-cover:hover img { transform: scale(1.06); }

.post-cover--empty { background: linear-gradient(135deg, #e6ecff, #f5e9ff); }

.post-cover-icon { width: 42px; height: 42px; color: #b9c5f0; }

.post-body { flex: 1; min-width: 0; }

.post-meta { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; font-size: 13px; }

.post-category {
    background: #eef2ff;
    color: var(--primary);
    padding: 2px 12px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 12px;
}

.post-date { color: var(--text-light); }

.post-title { font-size: 20px; margin-bottom: 8px; line-height: 1.4; }

.post-title a { transition: color 0.2s; }
.post-title a:hover { color: var(--primary); }

.post-summary {
    color: var(--text-light);
    font-size: 14.5px;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-footer { display: flex; align-items: center; gap: 16px; font-size: 13px; color: var(--text-light); }

.post-stat { display: inline-flex; align-items: center; gap: 4px; }

.post-tag {
    color: var(--primary);
    background: #f3f4f6;
    padding: 2px 10px;
    border-radius: 6px;
    font-size: 12.5px;
    transition: all 0.2s;
}

.post-tag:hover { background: #eef2ff; }

/* ========== 文章详情 ========== */
.post-detail {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 36px 40px;
    margin-bottom: 24px;
}

.detail-header { margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }

.detail-title { font-size: 28px; line-height: 1.4; margin-bottom: 12px; }

.detail-stats { display: flex; gap: 20px; font-size: 14px; color: var(--text-light); }

.detail-summary {
    margin-top: 14px;
    padding: 12px 16px;
    background: #f8f9ff;
    border-left: 3px solid var(--primary);
    border-radius: 4px;
    color: var(--text-light);
    font-size: 14.5px;
}

.detail-content { font-size: 16px; line-height: 1.9; }

.detail-content h2, .detail-content h3 {
    margin: 24px 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.detail-content p { margin: 12px 0; }
.detail-content ul, .detail-content ol { margin: 12px 0; padding-left: 24px; }
.detail-content li { margin: 6px 0; }
.detail-content code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 14px;
    font-family: "Consolas", "Courier New", monospace;
}
.detail-content pre {
    background: #111827;
    color: #e5e7eb;
    padding: 16px 20px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 16px 0;
}
.detail-content pre code { background: transparent; color: inherit; padding: 0; }
.detail-content blockquote {
    border-left: 4px solid var(--primary);
    background: #f8f9ff;
    padding: 12px 16px;
    margin: 16px 0;
    color: var(--text-light);
    border-radius: 0 8px 8px 0;
}
.detail-content img { max-width: 100%; border-radius: 8px; }

.detail-tags { margin: 24px 0 0; display: flex; gap: 10px; flex-wrap: wrap; }

/* 上下篇 */
.post-nav {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    font-size: 14px;
}

.post-nav a { color: var(--primary); max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-nav a:hover { text-decoration: underline; }
.nav-disabled { color: #d1d5db; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ========== 评论 ========== */
.comments {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px 32px;
    margin-bottom: 24px;
}

.comment-item {
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.comment-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }

.comment-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 15px;
    flex-shrink: 0;
}

.comment-nick { font-weight: 600; font-size: 15px; }
.comment-time { font-size: 12.5px; color: var(--text-light); margin-left: auto; }
.comment-content { font-size: 14.5px; color: #374151; padding-left: 44px; }

.comment-form { margin-top: 24px; }
.comment-form h4 { margin-bottom: 14px; font-size: 16px; }

.form-row { display: flex; gap: 12px; margin-bottom: 12px; }

.comment-form input,
.comment-form textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    background: #fff;
    resize: vertical;
}

.comment-form input:focus, .comment-form textarea:focus { border-color: var(--primary); }

.btn-primary {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 10px 26px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 12px;
}

.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.form-tip { margin-left: 12px; font-size: 13px; }
.form-tip.ok { color: #16a34a; }
.form-tip.err { color: #dc2626; }

/* ========== 侧边栏 ========== */
.sidebar { display: flex; flex-direction: column; gap: 20px; }

.widget {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 22px;
}

.widget-title {
    font-size: 15px;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border);
    position: relative;
}

.widget-title::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 40px;
    height: 2px;
    background: var(--primary);
}

.widget-list li { margin-bottom: 8px; }

.widget-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-light);
    transition: all 0.2s;
}

.widget-list a:hover, .widget-list a.on { background: #eef2ff; color: var(--primary); }

.badge {
    background: var(--bg);
    color: var(--text-light);
    font-size: 12px;
    padding: 1px 9px;
    border-radius: 999px;
}

.hot-list a { justify-content: flex-start; gap: 10px; }
.hot-rank {
    width: 22px;
    height: 22px;
    background: var(--bg);
    color: var(--text-light);
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}
.hot-list li:nth-child(-n+3) .hot-rank { background: var(--primary); color: #fff; }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }

.tag-item {
    background: var(--bg);
    color: var(--text-light);
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12.5px;
    transition: all 0.2s;
}

.tag-item:hover { background: var(--primary); color: #fff; }

/* ========== 分页 ========== */
.pagination { margin: 28px 0 8px; display: flex; justify-content: center; }
.pagination ul { display: flex; gap: 8px; flex-wrap: wrap; }
.pagination li { list-style: none; }
.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: 8px;
    background: var(--card);
    color: var(--text-light);
    font-size: 14px;
    box-shadow: var(--shadow);
    transition: all 0.2s;
}
.pagination a:hover { color: var(--primary); }
.pagination .current span { background: var(--primary); color: #fff; }
.pagination .disabled span { opacity: 0.5; }

/* ========== 空状态 ========== */
.empty-tip {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 60px 20px;
    text-align: center;
    color: var(--text-light);
    font-size: 15px;
}
.empty-tip p:first-child { font-size: 40px; margin-bottom: 8px; }
.empty-tip.small { padding: 24px; font-size: 13.5px; }

/* ========== 页脚 ========== */
.site-footer {
    background: #111827;
    color: #9ca3af;
    padding: 28px 0;
    text-align: center;
    font-size: 13.5px;
}

.footer-links { margin-top: 8px; }
.footer-links a:hover { color: #fff; }
.dot { margin: 0 8px; color: #4b5563; }

/* ========== 响应式 ========== */
@media (max-width: 900px) {
    .content-area { grid-template-columns: 1fr; }
    .sidebar { order: 2; }

    .main-nav {
        display: none;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--card);
        flex-direction: column;
        padding: 12px 20px 16px;
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    }
    .main-nav.open { display: flex; }
    .main-nav a { padding: 12px 14px; }
    .nav-toggle { display: block; }
    .search-form { margin-left: auto; }
    .search-form input { width: 100px; }
    .post-detail { padding: 24px 20px; }
    .detail-title { font-size: 22px; }

    /* 卡片封面改为顶部通栏，移动端图文纵向排布 */
    .post-card { flex-direction: column; padding: 16px; }
    .post-cover {
        flex: none;
        width: 100%;
        height: 180px;
        align-self: stretch;
    }

    /* 幻影灯移动端 */
    .hero-slider { height: 240px; }
    .hero-caption { left: 20px; right: 20px; bottom: 18px; }
    .hero-title { font-size: 20px; }
    .hero-desc { display: none; }
    .hero-arrow { opacity: 1; width: 34px; height: 34px; }
}
