/* ====================================================================
   Blog List Page Styles
   提取自 blog/index.html 内联 <style>，并增加骨架屏 + 渐入动画。
   ==================================================================== */

/* ---- 页面骨架 ---- */
.blog-page {
    position: relative;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    overflow-x: clip;
    padding-top: calc(56px + 3.5rem);
    padding-bottom: 80px;
    min-height: 100vh;
    background-color: var(--bg-section);
}

.blog-header-section {
    text-align: center;
    margin-bottom: 44px;
    animation: blog-header-fade-in 0.5s 0.05s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.blog-title {
    font-size: clamp(1.75rem, 5vw, 3rem);
    font-weight: 800;
    margin-bottom: 16px;
    line-height: 1.2;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #0a2540 0%, #425466 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.blog-header-section p {
    margin: 0 auto;
    max-width: 640px;
    line-height: 1.6;
}

@keyframes blog-header-fade-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* 分类过滤 - 简洁扁平，buttons 自身承担样式 */
.category-filter {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 44px;
}

.category-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 18px;
    min-height: 36px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: 0.01em;
    text-align: center;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition: background-color 0.18s ease,
                color 0.18s ease,
                border-color 0.18s ease,
                transform 0.14s ease;
    animation: blog-chip-fade-in 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.category-btn:nth-child(1) { animation-delay: 0.06s; }
.category-btn:nth-child(2) { animation-delay: 0.12s; }
.category-btn:nth-child(3) { animation-delay: 0.18s; }
.category-btn:nth-child(4) { animation-delay: 0.24s; }
.category-btn:nth-child(5) { animation-delay: 0.30s; }
.category-btn:nth-child(6) { animation-delay: 0.36s; }

.category-btn:hover:not(.active) {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: #f5f8ff;
}

.category-btn:active { transform: scale(0.97); }

.category-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #ffffff;
}

.category-btn.active:hover {
    background: var(--primary-hover, #0044a8);
    border-color: var(--primary-hover, #0044a8);
}

.category-btn:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

@keyframes blog-chip-fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---- 文章卡片 - 扁平专业，不再依赖 product-card 渐变与厚阴影 ---- */
.blog-card.product-card {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid var(--border-color, #e2e8f0);
    box-shadow: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.blog-card.product-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}

.blog-card-inner {
    padding: 28px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.blog-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.blog-tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    background: rgba(0, 86, 210, 0.08);
    color: var(--primary-color);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.5;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.blog-tag.research { background: rgba(147, 51, 234, 0.1); color: #9333ea; }
.blog-tag.tutorial { background: rgba(16, 185, 129, 0.1);  color: #10b981; }
.blog-tag.product  { background: rgba(59, 130, 246, 0.1);  color: #3b82f6; }

.blog-date {
    color: var(--text-secondary);
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.blog-card h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 12px;
    line-height: 1.35;
    letter-spacing: -0.01em;
    color: var(--text-main);
}

.blog-card p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    line-height: 1.6;
    margin-bottom: 20px;
    flex: 1;
}

.blog-read-more {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.9rem;
    transition: gap 0.18s ease;
    margin-top: auto;
}

.blog-card:hover .blog-read-more { gap: 12px; }

/* ---- 装饰光斑 ---- */
.bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
    z-index: 0;
    pointer-events: none;
}

.orb-1 {
    top: -80px;
    right: -80px;
    width: min(400px, 120vw);
    height: min(400px, 120vw);
    background: #4facfe;
}

.orb-2 {
    bottom: 8%;
    left: -60px;
    width: min(300px, 90vw);
    height: min(300px, 90vw);
    background: #00f2fe;
}

/* ====================================================================
   骨架屏 — 页面在 CSS / 头尾模板就绪前的占位，避免 CLS 与白屏闪烁
   ==================================================================== */

/* 头/尾占位，与真实组件就绪后切换 */
.layout-skeleton {
    background: linear-gradient(90deg,
            rgba(148, 163, 184, 0.10) 0%,
            rgba(148, 163, 184, 0.20) 50%,
            rgba(148, 163, 184, 0.10) 100%);
    background-size: 200% 100%;
    animation: blog-skeleton-shimmer 1.4s ease-in-out infinite;
}

#header-container.layout-skeleton {
    height: 56px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(15, 23, 42, 0.04);
}

#footer-container.layout-skeleton {
    height: 220px;
    margin-top: 40px;
    border-top: 1px solid rgba(15, 23, 42, 0.04);
}

#header-container:not(.layout-skeleton),
#footer-container:not(.layout-skeleton) {
    animation: none;
    background: none;
}

/* 文章卡片骨架 — 仅在 .products-grid.is-skeleton 状态下出现 */
.products-grid.is-skeleton {
    pointer-events: none;
}

.products-grid.is-skeleton .blog-card { display: none !important; }

.blog-card-skeleton {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid var(--border-color, #e2e8f0);
    box-shadow: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
    overflow: hidden;
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: blog-skeleton-fade-in 0.25s ease-out both;
}

.blog-card-skeleton .skeleton-block {
    background: linear-gradient(90deg,
            rgba(100, 116, 139, 0.10) 0%,
            rgba(100, 116, 139, 0.22) 50%,
            rgba(100, 116, 139, 0.10) 100%);
    background-size: 200% 100%;
    border-radius: 6px;
    display: block;
    animation: blog-skeleton-shimmer 1.4s ease-in-out infinite;
}

.blog-card-skeleton .skeleton-meta {
    display: flex;
    gap: 8px;
    margin-bottom: 4px;
}

.blog-card-skeleton .skeleton-tag   { width: 60px;  height: 18px; border-radius: 4px; }
.blog-card-skeleton .skeleton-date  { width: 100px; height: 14px; }
.blog-card-skeleton .skeleton-title { width: 90%;   height: 22px; }
.blog-card-skeleton .skeleton-title.shorter { width: 70%; }
.blog-card-skeleton .skeleton-line  { height: 12px; }
.blog-card-skeleton .skeleton-line-w-92 { width: 92%; }
.blog-card-skeleton .skeleton-line-w-86 { width: 86%; }
.blog-card-skeleton .skeleton-line-w-72 { width: 72%; }
.blog-card-skeleton .skeleton-readmore  { width: 88px; height: 14px; margin-top: 12px; }

@keyframes blog-skeleton-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes blog-skeleton-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* 真实卡片渐入：is-ready 触发，错峰显示（前 12 张） */
.products-grid.is-ready .blog-card {
    animation: blog-card-fade-in 0.42s ease both;
}

.products-grid.is-ready .blog-card:nth-child(1)  { animation-delay: 0ms; }
.products-grid.is-ready .blog-card:nth-child(2)  { animation-delay: 40ms; }
.products-grid.is-ready .blog-card:nth-child(3)  { animation-delay: 80ms; }
.products-grid.is-ready .blog-card:nth-child(4)  { animation-delay: 120ms; }
.products-grid.is-ready .blog-card:nth-child(5)  { animation-delay: 160ms; }
.products-grid.is-ready .blog-card:nth-child(6)  { animation-delay: 200ms; }
.products-grid.is-ready .blog-card:nth-child(7)  { animation-delay: 240ms; }
.products-grid.is-ready .blog-card:nth-child(8)  { animation-delay: 280ms; }
.products-grid.is-ready .blog-card:nth-child(9)  { animation-delay: 320ms; }
.products-grid.is-ready .blog-card:nth-child(10) { animation-delay: 360ms; }
.products-grid.is-ready .blog-card:nth-child(11) { animation-delay: 400ms; }
.products-grid.is-ready .blog-card:nth-child(12) { animation-delay: 440ms; }

@keyframes blog-card-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
    .products-grid .blog-card,
    .blog-card-skeleton,
    .layout-skeleton,
    .blog-header-section,
    .category-btn {
        animation: none !important;
        transition: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}

/* ====================================================================
   响应式适配
   ==================================================================== */
@media (max-width: 768px) {
    .blog-page {
        padding-top: calc(56px + 1.75rem);
        padding-bottom: 48px;
    }

    .blog-header-section { margin-bottom: 32px; }

    .blog-header-section p {
        font-size: 0.95rem;
        padding: 0 8px;
    }

    .category-filter {
        gap: 6px;
        margin-bottom: 32px;
    }

    .category-btn {
        padding: 7px 14px;
        min-height: 34px;
        font-size: 0.85rem;
        border-radius: 7px;
    }

    .blog-card-inner,
    .blog-card-skeleton { padding: 18px; }

    .blog-card h3 {
        font-size: 1.15rem;
        margin-bottom: 8px;
        line-height: 1.35;
    }

    .blog-card p {
        font-size: 0.9rem;
        line-height: 1.5;
        margin-bottom: 16px;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .blog-meta {
        margin-bottom: 10px;
        gap: 8px;
    }

    .blog-tag {
        font-size: 0.72rem;
        padding: 3px 8px;
    }

    .blog-date { font-size: 0.78rem; }
    .blog-read-more { font-size: 0.9rem; }

    .orb-1 {
        top: -48px;
        right: -48px;
        width: min(240px, 70vw);
        height: min(240px, 70vw);
        filter: blur(60px);
    }

    .orb-2 {
        left: -40px;
        width: min(180px, 55vw);
        height: min(180px, 55vw);
        filter: blur(50px);
    }
}

@media (max-width: 480px) {
    .blog-card-inner,
    .blog-card-skeleton { padding: 16px; }

    .blog-card h3 { font-size: 1.05rem; }

    .blog-card p {
        font-size: 0.85rem;
        -webkit-line-clamp: 2;
    }
}
