/* ================================================================
   home.css — 首页专用样式
   - 浅色简约主题
   - 左：分类侧边栏 + 订阅卡
   - 右：标题 + 文章卡片网格 + 分页
   ================================================================ */

/* ============ 首页容器 ============ */
.home-wrapper {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem 1.5rem 2.5rem;
}
.home-grid {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 1.75rem;
    align-items: start;
}
.home-content { min-width: 0; }
.mobile-home-intro { display: none; }

/* ============ 左侧栏：分类卡 ============ */
.home-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    position: sticky;
    top: 88px;
}

.sidebar-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem 0.75rem;
    box-shadow: var(--shadow-sm);
}
.sidebar-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.5rem;
    margin: 0 0 0.5rem;
    border-bottom: 1px solid var(--border-color);
}
.sidebar-card-header svg {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}
.sidebar-card-titles {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}
.sidebar-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.2;
}
.sidebar-card-header small {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
    line-height: 1.2;
}
.sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
    text-decoration: none;
}
.sidebar-item svg {
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
    flex-shrink: 0;
    transition: color 0.15s;
}
.sidebar-item small {
    display: block;
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
}
.sidebar-item:hover {
    background: var(--accent-light);
    color: var(--accent);
    text-decoration: none;
}
.sidebar-item:hover svg { color: var(--accent); }
.sidebar-item.active {
    background: var(--accent);
    color: #fff;
}
.sidebar-item.active svg { color: #fff; }
.sidebar-item.active small { color: rgba(255,255,255,0.85); }

/* ============ 订阅卡 ============ */
.subscribe-card {
    background: #1F2937;
    border: 1px solid #1F2937;
    color: #fff;
    padding: 1.25rem;
}
.subscribe-title {
    font-size: 1.0625rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #fff;
}
.subscribe-desc {
    font-size: 0.85rem;
    line-height: 1.6;
    color: rgba(255,255,255,0.75);
    margin-bottom: 1rem;
}
.subscribe-btn {
    width: 100%;
    background: #374151;
    color: #fff;
    border: 1px solid rgba(255,255,255,0.08);
    padding: 0.625rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
}
.subscribe-btn:hover {
    background: #4B5563;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}
.subscribe-btn:active { transform: translateY(0); }

/* ============ 二维码图（侧边栏） ============ */
.qr-image {
    display: block;
    width: 140px;
    height: 140px;
    margin: 14px auto 10px;
    padding: 6px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}
.qr-hint {
    margin: 0;
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.75rem;
}

/* ============ 标题栏 ============ */
.content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    gap: 1rem;
}
.content-title {
    font-size: 1.875rem;
    font-family: var(--font-headline);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    position: relative;
    padding-bottom: 0.5rem;
}
.content-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 4rem;
    height: 4px;
    background: var(--accent);
    border-radius: 2px;
}

/* ============ 文章卡片网格 ============ */
.post-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
}

.post-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem 1.25rem 1.125rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    color: inherit;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
}
.post-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
    text-decoration: none;
    color: inherit;
}

.post-card-meta {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
}
.post-card-date {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}
.post-card-date svg {
    width: 13px;
    height: 13px;
}

.post-card-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.55;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.15s;
}
.post-card:hover .post-card-title { color: var(--primary); }

.post-card-excerpt {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.65;
    margin: 0;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card-link {
    font-size: 0.875rem;
    color: var(--accent);
    font-weight: 500;
    margin-top: auto;
    align-self: flex-start;
}
.post-card-link::after {
    content: ' →';
    display: inline-block;
    transition: transform 0.15s;
}
.post-card:hover .post-card-link::after { transform: translateX(3px); }


/* ============ 分类 Pill ============ */
.pill {
    display: inline-block;
    padding: 0.1875rem 0.625rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.5;
    letter-spacing: 0.01em;
}
.pill-default,
.pill-linux,
.pill-ai,
.pill-python,
.pill-seo,
.pill-web,
.pill-database,
.pill-java,
.pill-windows,
.pill-tools,
.pill-site,
.pill-vps { background: #DBEAFE; color: #1D4ED8; }

/* ============ 分页 ============ */
.pagination-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin: 2rem 0 1rem;
    flex-wrap: wrap;
}
.pagination-nav .page-link {
    min-width: 2.5rem;
    height: 2.5rem;
    padding: 0 0.875rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s;
    box-shadow: var(--shadow-sm);
}
.pagination-nav .page-link-arrow {
    min-width: auto;
    padding: 0 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-surface);
}
.pagination-nav .page-link-arrow:hover {
    color: var(--primary);
    border-color: var(--primary);
}
.pagination-nav .page-link:hover {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
    text-decoration: none;
}
.pagination-nav .page-link.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.pagination-nav .page-link.disabled {
    opacity: 0.5;
    pointer-events: none;
}
.pagination-nav .page-ellipsis {
    color: var(--text-muted);
    padding: 0 0.25rem;
}

/* ============ 响应式 ============ */
@media (max-width: 991.98px) {
    .home-grid {
        grid-template-columns: 1fr;
    }
    .home-sidebar {
        position: static;
        order: 2;
        flex-direction: row;
        flex-wrap: wrap;
    }
    .sidebar-card, .subscribe-card {
        flex: 1 1 280px;
    }
    .post-list {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 767.98px) {
    .home-wrapper { padding: 0 16px 2rem; }
    .home-grid { display: block; }
    .home-sidebar {
        position: fixed;
        z-index: 1050;
        inset: 0 auto 0 0;
        width: min(82vw, 320px);
        margin: 0;
        padding: 0;
        display: block;
        overflow-y: auto;
        background: #F8FAFC;
        box-shadow: 12px 0 30px rgba(15, 23, 42, .14);
        transform: translateX(-102%);
        transition: transform 220ms ease;
    }
    .home-sidebar.is-open { transform: translateX(0); }
    .home-sidebar .sidebar-card { border: 0; border-radius: 0; box-shadow: none; margin: 0; padding: 12px 10px; }
    .home-sidebar .subscribe-card { display: none; }
    .mobile-home-intro { display: block; padding: 28px 22px 24px; text-align: center; }
    .mobile-home-intro > span { display: block; width: 38px; height: 3px; margin: 0 auto 16px; background: var(--text-primary); }
    .mobile-home-intro h1 { margin: 0 0 8px; font-size: 1.35rem; letter-spacing: -.02em; }
    .mobile-home-intro p { max-width: 290px; margin: 0 auto; color: var(--text-muted); font-size: .78rem; line-height: 1.7; }
    .content-header { margin-bottom: 12px; }
    .content-title { font-size: 1rem; padding: 0; }
    .content-title::after { display: none; }
    .post-list { gap: 14px; }
    .post-card { padding: 15px 14px 14px; border-radius: 7px; gap: 8px; box-shadow: 0 2px 8px rgba(15,23,42,.06); }
    .post-card-meta { justify-content: space-between; font-size: .62rem; }
    .post-card-date svg { display: none; }
    .post-card-date { font-size: .6rem; text-transform: uppercase; letter-spacing: .05em; }
    .post-card-title { font-size: 1rem; line-height: 1.3; }
    .post-card-excerpt { font-size: .72rem; line-height: 1.55; -webkit-line-clamp: 3; }
    .post-card-link { font-size: .72rem; }
    .pill { padding: 3px 8px; font-size: .58rem; text-transform: uppercase; }
}
