/* =========================================================
   article_list.css — 文章列表页专用样式
   ========================================================= */

html, body {
    min-height: 100%;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── 整体容器 ── */
.al-wrapper {
    flex: 1;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 16px 40px;
}

/* ── 分类标签导航：随页面滚动（不做吸顶，避免悬浮在文章卡片之上） ── */
.al-cat-nav {
    z-index: 20;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    padding: 16px 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: box-shadow 0.2s ease;
}

.al-cat-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 14px;
    border-radius: 20px;
    background: #fff;
    border: 1px solid #e8e8e8;
    color: #555;
    font-size: 13px;
    text-decoration: none;
    transition: all 0.18s;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.al-cat-tag:hover {
    border-color: #1890ff;
    color: #1890ff;
    background: #f0f7ff;
    text-decoration: none;
}

.al-cat-tag.active {
    background: #1890ff;
    border-color: #1890ff;
    color: #fff;
    font-weight: 500;
}

.al-cat-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: rgba(0,0,0,0.08);
    font-size: 11px;
    line-height: 1;
}

.al-cat-tag.active .al-cat-count {
    background: rgba(255,255,255,0.3);
}

/* 有子分类的tag - 带展开箭头 */
.al-cat-tag.has-sub {
    position: relative;
}

.al-cat-tag.has-sub .al-sub-arrow {
    font-size: 10px;
    transition: transform 0.2s;
    margin-left: 2px;
    opacity: 0.7;
}

.al-cat-tag.has-sub.open .al-sub-arrow {
    transform: rotate(180deg);
}

/* 子分类下拉容器 */
.al-sub-cat-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    z-index: 100;
    padding: 6px;
    min-width: 160px;
    flex-direction: column;
    gap: 2px;
}

.al-sub-cat-dropdown.open {
    display: flex;
}

.al-sub-cat-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 12px;
    border-radius: 7px;
    font-size: 13px;
    color: #555;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    gap: 8px;
}

.al-sub-cat-item:hover {
    background: #f0f7ff;
    color: #1890ff;
}

.al-sub-cat-item.active {
    background: #1890ff;
    color: #fff;
}

.al-sub-cat-item .al-cat-count {
    background: rgba(0,0,0,0.08);
}

.al-sub-cat-item.active .al-cat-count {
    background: rgba(255,255,255,0.3);
}

/* 父级tag包装（用于定位下拉） */
.al-cat-tag-wrap {
    position: relative;
}

/* ── 主体：主列表 + 右侧边栏 ── */
.al-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 24px;
    align-items: start;
}

/* 左列必须允许收缩，否则卡片最小内容宽度会把右栏挤到下一行并撑出横向滚动 */
.al-main {
    min-width: 0;
    max-width: 100%;
}

/* 切换分类/翻页时的过渡：旧内容淡出、新内容轻微上浮淡入，页面不滚动 */
.al-main {
    transition: opacity 0.18s ease;
}

.al-main.al-main-loading {
    opacity: 0.35;
}

.al-main.al-main-enter {
    animation: alMainEnter 0.28s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

@keyframes alMainEnter {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* 分类标签切换时的高亮过渡，点击反馈更顺 */
.al-cat-tag {
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

@media (prefers-reduced-motion: reduce) {

    .al-main,
    .al-main.al-main-enter {
        transition: none;
        animation: none;
    }
}

.al-main .article-grid,
.al-main .article-grid.grid-style {
    min-width: 0;
}

/* ── 列表页文章卡片：1 列节奏，左侧 7:5 缩略图 + 右侧标题/摘要/元信息 ── */
.al-main .article-grid,
.al-main .article-grid.grid-style {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
}

.al-main .article-grid .article-card,
.al-main .article-grid.grid-style .article-card {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    height: auto;
    min-height: 132px;
    padding: 16px;
    gap: 16px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, 0.05);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
    overflow: hidden;
    transition: box-shadow 0.25s, transform 0.25s;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

.al-main .article-grid .article-card:hover {
    box-shadow: 0 10px 24px -12px rgba(15, 23, 42, 0.22);
    transform: translateY(-2px);
}

/* 缩略图：固定 138px 宽、圆角、悬停轻微放大 */
.al-main .article-grid .article-card .article-thumb {
    position: relative;
    flex: 0 0 138px;
    width: 138px;
    height: 104px;
    border-radius: 8px;
    overflow: hidden;
    background: #f3f5f8;
}

.al-main .article-grid .article-card .article-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease, opacity 0.3s ease-in-out;
}

.al-main .article-grid .article-card:hover .article-thumb img {
    transform: scale(1.04);
}

/* 无缩略图时的占位：不再留下一条空白灰条 */
.article-thumb-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #c3c9d2;
    background: linear-gradient(135deg, #f7f9fc 0%, #eef1f6 100%);
}

/* 右侧内容：高度由内容决定，不再被缩略图高度挤压 */
.al-main .article-grid .article-card .article-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0;
    align-self: stretch;
}

.al-main .article-grid .article-card .article-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.45;
    color: #1a1a1a;
    margin: 0;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    transition: color 0.18s;
}

.al-main .article-grid .article-card:hover .article-title {
    color: #1890ff;
}

/* 摘要：line-height 固定成整数像素，避免 1.6 倍行高与 line-clamp 计算不一致时
   把第二行裁成半行、和下方标签行挤在一起 */
.al-main .article-grid .article-card .article-desc {
    font-size: 12.5px;
    color: #8a919c;
    line-height: 20px;
    max-height: 40px;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    flex: 0 0 auto;
}

/* 底部一行：左标签+时间，右浏览数 */
.al-main .article-grid .article-card .article-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: auto;
    padding: 0;
    border: 0;
    font-size: 12px;
    color: #a3aab5;
}

.article-meta-left,
.article-meta-right {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

/* 左侧：分类标签可收缩，日期永不换行，避免与右侧浏览数挤在一起 */
.al-main .article-grid .article-card .article-meta-left {
    flex: 0 1 auto;
    overflow: hidden;
}

.al-main .article-grid .article-card .article-meta-right {
    margin-left: auto;
    flex-shrink: 0;
}

.article-meta-right span {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.article-meta-right svg {
    fill: #b6bdc8;
    flex-shrink: 0;
}

.article-meta-time {
    white-space: nowrap;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.al-main .article-grid .article-cat-tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    border-radius: 6px;
    background: #f0f7ff;
    color: #1890ff;
    font-size: 11px;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
    min-width: 0;
}

/* 分类标签（文章卡片meta中） */
.article-cat-tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: #1890ff;
    background: #f0f7ff;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 11px;
}

.article-cat-tag svg {
    fill: #1890ff;
    flex-shrink: 0;
}

/* ── 空状态 ── */
.al-empty {
    background: #fff;
    border-radius: 12px;
    padding: 60px 20px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    color: #bbb;
}

.al-empty p {
    margin-top: 14px;
    font-size: 14px;
}

/* ── 文章列表 ── */
.al-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ── 文章卡片 ── */
.al-card {
    display: flex;
    gap: 16px;
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.04);
    transition: box-shadow 0.2s, transform 0.2s;
    overflow: hidden;
}

.al-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
    transform: translateY(-2px);
    text-decoration: none;
    color: inherit;
}

.al-card-thumb {
    flex-shrink: 0;
    width: 140px;
    height: 94px;
    border-radius: 8px;
    overflow: hidden;
    background: #f5f7fa;
}

.al-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.3s;
}

.al-card-thumb img.loaded {
    opacity: 1;
}

.al-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.al-card-title {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 8px;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
    overflow-wrap: break-word;
}

.al-card:hover .al-card-title {
    color: #1890ff;
}

.al-card-desc {
    font-size: 13px;
    color: #777;
    line-height: 1.6;
    margin: 0 0 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
    word-break: break-word;
    overflow-wrap: break-word;
}

.al-card-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.al-card-meta span {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 12px;
    color: #aaa;
}

.al-card-meta svg {
    flex-shrink: 0;
    fill: #bbb;
}

.al-meta-cat {
    color: #1890ff !important;
    background: #f0f7ff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px !important;
}

.al-meta-cat svg {
    fill: #1890ff !important;
}

/* ── 分页 ── */
.al-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 28px;
    flex-wrap: wrap;
}

.al-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: 8px;
    border: 1px solid #e8e8e8;
    background: #fff;
    color: #555;
    font-size: 13px;
    text-decoration: none;
    transition: all 0.18s;
    cursor: pointer;
}

.al-page-btn:hover {
    border-color: #1890ff;
    color: #1890ff;
    text-decoration: none;
}

.al-page-btn.current {
    background: #1890ff;
    border-color: #1890ff;
    color: #fff;
    font-weight: 600;
    cursor: default;
}

.al-page-btn svg {
    fill: currentColor;
}

.al-page-ellipsis {
    color: #bbb;
    padding: 0 4px;
    font-size: 14px;
}

/* ── 侧边栏卡片 ── */
.al-sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 96px; /* 固定导航 80 + 16 间隙（分类栏不再吸顶，无需再让位） */
    min-width: 0;
}

.al-sidebar-card {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.04);
}

.al-sidebar-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.al-sidebar-title svg {
    fill: #1890ff;
    flex-shrink: 0;
}

/* 侧边栏分类列表（模板里是 <li><span>，不是 a） */
.al-cat-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.al-cat-list li span {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 10px;
    border-radius: 8px;
    font-size: 13px;
    color: #555;
    text-decoration: none;
    transition: all 0.15s;
}

.al-cat-list li span:hover {
    background: #f5f7fa;
    color: #1890ff;
}

.al-cat-list li span.active {
    background: #f0f7ff;
    color: #1890ff;
    font-weight: 500;
}

.al-cat-list li a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 10px;
    border-radius: 8px;
    font-size: 13px;
    color: #555;
    text-decoration: none;
    transition: all 0.15s;
}

.al-cat-list li a:hover {
    background: #f5f7fa;
    color: #1890ff;
    text-decoration: none;
}

.al-cat-list li a.active {
    background: #f0f7ff;
    color: #1890ff;
    font-weight: 500;
}

.al-cat-list-count {
    font-size: 11px;
    color: #bbb;
    background: #f5f5f5;
    padding: 1px 7px;
    border-radius: 10px;
    flex-shrink: 0;
}

.al-cat-list li a.active .al-cat-list-count {
    background: #e0f0ff;
    color: #1890ff;
}

.al-cat-list li span.active .al-cat-list-count {
    background: #e0f0ff;
    color: #1890ff;
}

/* 热门文章列表 - 首页风格 */
.al-hot-articles-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.al-hot-article-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 6px;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
    border-bottom: 1px solid #f5f5f5;
}

.al-hot-article-item:last-child {
    border-bottom: none;
}

.al-hot-article-item:hover {
    background: #f8f9fa;
    text-decoration: none;
    color: inherit;
}

.al-hot-article-thumb {
    position: relative;
    flex-shrink: 0;
    width: 64px;
    height: 44px;
    border-radius: 6px;
    overflow: hidden;
    background: #f0f2f5;
}

.al-hot-article-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.al-hot-article-item.al-hot-featured .al-hot-article-thumb {
    width: 100%;
    height: 110px;
    border-radius: 8px;
}

.al-hot-article-item.al-hot-featured {
    flex-direction: column;
    align-items: stretch;
    padding: 0 0 10px;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 2px;
}

.al-hot-rank-badge {
    position: absolute;
    top: 4px;
    left: 4px;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    line-height: 1.4;
    color: #fff;
}

.al-hot-rank-badge.rank-1 { background: linear-gradient(135deg,#ff6b35,#f7931e); }
.al-hot-rank-badge.rank-2 { background: linear-gradient(135deg,#667eea,#764ba2); }
.al-hot-rank-badge.rank-3 { background: linear-gradient(135deg,#11998e,#38ef7d); }
.al-hot-rank-badge.rank-gray { background: rgba(0,0,0,0.35); }

.al-hot-article-info {
    flex: 1;
    min-width: 0;
}

.al-hot-article-title {
    font-size: 13px;
    font-weight: 500;
    color: #1a1a1a;
    margin: 0 0 4px;
    line-height: 1.45;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.al-hot-article-item.al-hot-featured .al-hot-article-title {
    font-size: 14px;
    font-weight: 600;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-top: 8px;
}

.al-hot-article-item:hover .al-hot-article-title {
    color: #1890ff;
}

.al-hot-article-meta {
    font-size: 11px;
    color: #bbb;
}

/* 最新文章列表 */
.al-latest-articles-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.al-latest-article-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 4px;
    border-radius: 6px;
    font-size: 13px;
    color: #555;
    text-decoration: none;
    transition: color 0.15s;
    border-bottom: 1px solid #f5f5f5;
}

.al-latest-article-item:last-child {
    border-bottom: none;
}

.al-latest-article-item:hover {
    color: #1890ff;
    text-decoration: none;
}

.al-latest-article-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    background: #f0f0f0;
    font-size: 11px;
    font-weight: 700;
    color: #999;
    flex-shrink: 0;
}

.al-latest-article-item:nth-child(1) .al-latest-article-num { background: #ff4d4f; color: #fff; }
.al-latest-article-item:nth-child(2) .al-latest-article-num { background: #ff7a45; color: #fff; }
.al-latest-article-item:nth-child(3) .al-latest-article-num { background: #ffa940; color: #fff; }

.al-latest-article-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.al-latest-article-date {
    font-size: 11px;
    color: #bbb;
    flex-shrink: 0;
}

/* =========================================================
   响应式
   ========================================================= */
@media (max-width: 1100px) {
    .al-body {
        grid-template-columns: minmax(0, 1fr) 260px;
        gap: 16px;
    }

    .al-main .article-grid .article-card .article-thumb {
        flex-basis: 120px;
        width: 120px;
    }
}

@media (max-width: 860px) {
    .al-body {
        display: block;
    }

    .al-sidebar {
        display: none !important;
    }
}

@media (max-width: 1024px) {
    .al-card-thumb {
        width: 110px;
        height: 76px;
    }
}

@media (max-width: 768px) {
    .al-wrapper {
        padding: 13px 10px 30px;
    }

    .al-main {
        width: 100%;
    }

    /* 手机端卡片收窄：缩略图 96px，尽量留标题空间 */
    .al-main .article-grid .article-card {
        padding: 12px;
        gap: 12px;
        min-height: 108px;
    }

    .al-main .article-grid .article-card .article-thumb {
        flex-basis: 96px;
        width: 96px;
        min-height: 72px;
    }

    .al-main .article-grid .article-card .article-title {
        font-size: 14px;
    }

    .al-main .article-grid .article-card .article-desc {
        font-size: 12px;
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }

    .al-main .article-grid .article-card .article-meta {
        font-size: 11px;
    }

    .article-meta-time {
        display: none;
    }

    .al-sidebar {
        position: static;
    }

    .al-cat-nav {
        top: 74px; /* 移动端导航 top:8 + height:58，再留 8px 间隙 */
        gap: 7px;
        margin-bottom: 14px;
        padding: 15px 18px;
    }

    .al-cat-tag {
        padding: 4px 10px;
        font-size: 12px;
    }

    .al-card {
        padding: 12px;
        gap: 12px;
    }

    .al-card-thumb {
        width: 90px;
        height: 64px;
    }

    .al-card-title {
        font-size: 14px;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        margin: 0 0 6px;
    }

    .al-card-desc {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        font-size: 12px;
        margin: 0 0 6px;
    }

    .al-card-meta {
        gap: 10px;
    }

    .article-meta span:last-child {
        display: none !important;
    }

    .al-page-btn {
        min-width: 32px;
        height: 32px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .al-main .article-grid .article-card {
        padding: 10px;
        gap: 10px;
        min-height: 96px;
    }

    .al-main .article-grid .article-card .article-thumb {
        flex-basis: 84px;
        width: 84px;
        min-height: 64px;
    }

    .al-main .article-grid .article-card .article-title {
        font-size: 13px;
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }

    .al-main .article-grid .article-card .article-desc {
        display: none;
    }

    .al-card-title {
        font-size: 13px;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
}
