/**
 * 文章展示组件样式
 * 设计风格：左图右文横向卡片布局
 * 支持日夜间模式自适应
 *
 * @package AeroCore Child
 * @version 1.0.0
 */

/* ============================================
   CSS 变量定义 - 跟随主题日夜间模式
   ============================================ */

/* 日间模式（默认） */
:root {
    --as-bg-white: #ffffff;
    --as-bg-card: #f8f9fa;
    --as-bg-hover: #f1f3f5;
    --as-text-primary: #1a1a2e;
    --as-text-secondary: #6b7280;
    --as-text-tertiary: #9ca3af;
    --as-border: #e5e7eb;
    --as-border-light: #f3f4f6;
    --as-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    --as-shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.12);
    --as-radius: 12px;
    --as-radius-sm: 8px;
    --as-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 夜间模式 - 跟随主题 */
html[data-theme="dark"] {
    --as-bg-white: #1e1e2e;
    --as-bg-card: #252535;
    --as-bg-hover: #2d2d42;
    --as-text-primary: #f1f5f9;
    --as-text-secondary: #94a3b8;
    --as-text-tertiary: #64748b;
    --as-border: #3d3d5c;
    --as-border-light: #2d2d42;
    --as-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --as-shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* ============================================
   文章展示组件 - 容器
   ============================================ */

.article-showcase {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 0 24px;
}

/* 头部区域 */
.article-showcase__header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--as-border);
}

.article-showcase__title {
    font-size: 20px;
    font-weight: 700;
    color: var(--as-text-primary);
    margin: 0 0 6px;
    line-height: 1.3;
}

.article-showcase__subtitle {
    font-size: 13px;
    color: var(--as-text-secondary);
    margin: 0;
}

/* ============================================
   分类筛选标签
   ============================================ */

.article-showcase__filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--as-border-light);
}

.article-showcase__filter-btn {
    padding: 6px 16px;
    border: 1px solid var(--as-border);
    border-radius: 20px;
    background: var(--as-bg-white);
    color: var(--as-text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: var(--as-transition);
}

.article-showcase__filter-btn:hover {
    border-color: var(--color-link, #3b82f6);
    color: var(--color-link, #3b82f6);
    background: var(--as-bg-hover);
}

.article-showcase__filter-btn.is-active {
    background: var(--color-link, #3b82f6);
    color: #fff;
    border-color: var(--color-link, #3b82f6);
}

/* ============================================
   文章网格布局 - 2列横向卡片
   ============================================ */

.article-showcase__grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    align-items: stretch; /* 统一卡片高度 */
}

/* ============================================
   文章卡片 - 左图右文横向布局
   ============================================ */

.article-showcase__item {
    display: flex;
    flex-direction: row;
    background: var(--as-bg-white);
    border-radius: var(--as-radius);
    border: 1px solid var(--as-border);
    overflow: hidden;
    transition: var(--as-transition);
    min-height: 160px; /* 最小高度而非固定高度 */
    height: 100%; /* 填充网格单元 */
}

.article-showcase__item:hover {
    box-shadow: var(--as-shadow-hover);
    transform: translateY(-2px);
}

/* ============================================
   缩略图区域 - 左侧
   ============================================ */

.article-showcase__thumbnail-wrap {
    position: relative;
    width: 160px;
    flex-shrink: 0;
    overflow: hidden;
    background: var(--as-bg-card);
    order: 1;
    aspect-ratio: 1 / 1; /* 固定 1:1 比例 */
    align-self: stretch; /* 垂直填充 */
}

/* 缩略图占位符样式 */
.article-showcase__thumbnail-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--as-bg-card);
    color: var(--as-text-tertiary);
}

.article-showcase__thumbnail-link {
    display: block;
    width: 100%;
    height: 100%;
}

.article-showcase__thumbnail-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.article-showcase__item:hover .article-showcase__thumbnail-img {
    transform: scale(1.05);
}

/* ============================================
   内容区域 - 右侧
   ============================================ */

.article-showcase__body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 12px 14px;
    gap: 6px;
    min-width: 0;
    order: 2;
}

/* 标签区域 - 在最上方 */
.article-showcase__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 2px;
}

.article-showcase__tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    font-size: 12px;
    border-radius: 12px;
    text-decoration: none;
    transition: var(--as-transition);
    line-height: 1.4;
}

/* 分类标签样式 */
.article-showcase__tag--category {
    background: #e3f2fd;
    color: #1976d2;
    font-weight: 500;
}

html[data-theme="dark"] .article-showcase__tag--category {
    background: rgba(25, 118, 210, 0.2);
    color: #64b5f6;
}

.article-showcase__tag--category:hover {
    background: #1976d2;
    color: #fff;
    transform: translateY(-1px);
}

/* 普通标签样式 - 与分类标签统一 */
.article-showcase__tag:not(.article-showcase__tag--category) {
    background: var(--as-bg-card);
    color: var(--as-text-secondary);
    border: 1px solid var(--as-border-light);
}

html[data-theme="dark"] .article-showcase__tag:not(.article-showcase__tag--category) {
    background: var(--as-bg-hover);
    border-color: var(--as-border);
}

.article-showcase__tag:not(.article-showcase__tag--category):hover {
    background: var(--as-bg-hover);
    border-color: var(--as-border);
    color: var(--as-text-primary);
    transform: translateY(-1px);
}

html[data-theme="dark"] .article-showcase__tag:not(.article-showcase__tag--category):hover {
    background: var(--as-border);
    color: var(--as-text-primary);
}

/* 文章标题 */
.article-showcase__item-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-showcase__item-title a {
    color: var(--as-text-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.article-showcase__item-title a:hover {
    color: var(--color-link, #3b82f6);
}

/* 文章摘要 */
.article-showcase__excerpt {
    font-size: 13px;
    line-height: 1.6;
    color: var(--as-text-secondary);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* 限制为2行 */
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1; /* 占据剩余空间 */
}

/* ============================================
   元信息区域
   ============================================ */

.article-showcase__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 4px;
    font-size: 12px;
    color: var(--as-text-tertiary);
}

/* 作者信息 */
.article-showcase__author-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.article-showcase__author-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

.article-showcase__author-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.article-showcase__author-name {
    color: var(--as-text-secondary);
    font-weight: 500;
    font-size: 12px;
    line-height: 1.2;
}

.article-showcase__date {
    font-size: 11px;
    color: var(--as-text-tertiary);
    line-height: 1.2;
}

/* 统计信息 */
.article-showcase__stats {
    display: flex;
    align-items: center;
    gap: 12px;
}

.article-showcase__stat {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.article-showcase__stat svg {
    width: 14px;
    height: 14px;
}

/* ============================================
   分页区域
   ============================================ */

.article-showcase__pagination {
    margin-top: 32px;
    text-align: center;
}

/* 加载更多按钮 */
.article-showcase__load-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 32px;
    background: var(--as-bg-white);
    border: 1px solid var(--as-border);
    border-radius: var(--as-radius-sm);
    color: var(--as-text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: var(--as-transition);
}

.article-showcase__load-more:hover {
    background: var(--color-link, #3b82f6);
    border-color: var(--color-link, #3b82f6);
    color: #fff;
}

.article-showcase__load-more.is-loading {
    pointer-events: none;
    opacity: 0.7;
}

.article-showcase__loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
}

.article-showcase__loading-spinner svg {
    width: 100%;
    height: 100%;
    animation: as-spin 1s linear infinite;
}

@keyframes as-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 传统分页 */
.article-showcase__page-nav {
    display: flex;
    justify-content: center;
}

.article-showcase__page-nav .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    margin: 0 4px;
    background: var(--as-bg-white);
    border: 1px solid var(--as-border);
    border-radius: var(--as-radius-sm);
    color: var(--as-text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: var(--as-transition);
}

.article-showcase__page-nav .page-numbers:hover,
.article-showcase__page-nav .page-numbers.current {
    background: var(--color-link, #3b82f6);
    border-color: var(--color-link, #3b82f6);
    color: #fff;
}

.article-showcase__page-nav .page-numbers.dots {
    border: none;
    background: transparent;
    color: var(--as-text-tertiary);
}

/* ============================================
   空状态
   ============================================ */

.article-showcase__empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--as-text-secondary);
}

.article-showcase__empty-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    color: var(--as-text-tertiary);
}

.article-showcase__empty-icon svg {
    width: 100%;
    height: 100%;
}

.article-showcase__empty-text {
    font-size: 14px;
    margin: 0;
}

/* ============================================
   响应式适配
   ============================================ */

/* 平板设备 */
@media (max-width: 1024px) {
    .article-showcase__grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* 移动端 */
@media (max-width: 768px) {
    .article-showcase {
        padding: 16px 0;
    }
    
    .article-showcase__item {
        min-height: 120px;
        height: auto;
    }
    
    .article-showcase__thumbnail-wrap {
        width: 100px;
        aspect-ratio: 1 / 1;
    }
    
    .article-showcase__body {
        padding: 10px 12px;
        gap: 6px;
    }
    
    .article-showcase__item-title {
        font-size: 14px;
        -webkit-line-clamp: 2; /* 移动端允许2行标题 */
    }
    
    .article-showcase__excerpt {
        font-size: 12px;
        -webkit-line-clamp: 2;
    }
    
    /* 手机端元信息优化 - 作者和统计分开两行 */
    .article-showcase__meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding-top: 8px;
        border-top: 1px solid var(--as-border-light);
        margin-top: auto;
    }
    
    .article-showcase__author-wrap {
        gap: 6px;
        width: 100%;
    }
    
    .article-showcase__author-avatar {
        width: 20px;
        height: 20px;
    }
    
    .article-showcase__author-info {
        flex-direction: row;
        align-items: center;
        gap: 8px;
        flex: 1;
    }
    
    .article-showcase__author-name {
        font-size: 11px;
    }
    
    .article-showcase__date {
        font-size: 10px;
    }
    
    .article-showcase__date::before {
        content: "•";
        margin-right: 4px;
        color: var(--as-text-tertiary);
    }
    
    /* 统计数据一行展示 */
    .article-showcase__stats {
        display: flex;
        gap: 12px;
        width: 100%;
        justify-content: flex-start;
    }
    
    .article-showcase__stat {
        font-size: 11px;
        display: flex;
        align-items: center;
        gap: 3px;
    }
    
    .article-showcase__stat svg {
        width: 12px;
        height: 12px;
    }
}

/* 小屏手机 */
@media (max-width: 480px) {
    .article-showcase__item {
        min-height: 110px;
    }
    
    .article-showcase__thumbnail-wrap {
        width: 90px;
    }
    
    .article-showcase__body {
        padding: 8px 10px;
    }
    
    .article-showcase__thumbnail-wrap {
        width: 100px;
    }
    
    .article-showcase__body {
        padding: 10px;
    }
    
    .article-showcase__item-title {
        font-size: 13px;
    }
    
    .article-showcase__tags {
        display: none;
    }
}

/* ============================================
   加载动画
   ============================================ */

.article-showcase__item {
    animation: as-fade-in 0.4s ease-out;
}

@keyframes as-fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 骨架屏加载效果 */
.article-showcase.is-loading .article-showcase__item {
    pointer-events: none;
}

.article-showcase.is-loading .article-showcase__thumbnail-wrap {
    background: linear-gradient(
        90deg,
        var(--as-bg-card) 25%,
        var(--as-bg-hover) 50%,
        var(--as-bg-card) 75%
    );
    background-size: 200% 100%;
    animation: as-shimmer 1.5s infinite;
}

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