/**
 * AI 工具库大图卡片
 *
 * 配合子主题覆盖的 archive-links.php 使用。
 * 仅在 links 归档页与分类页加载（见 inc/tools.php）。
 */

/* =========================================================================
 * 分组
 * ====================================================================== */

.b2c-tools .b2c-tools-box {
    /* 父版每个分组是一个白色 box 面板；改为透明，让卡片自己成为视觉单元 */
    background: transparent;
    padding: 0;
    margin-bottom: 28px;
}

.b2c-tools .b2c-tools-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.b2c-tools .link-title-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    min-width: 0;
}

/*
 * 分类标题。
 *
 * ⚠️ 父主题给 .cat-box 画了一条 ::before 竖线：
 *      position:absolute; left:0; width:4px; height:18px; top:6px
 *    竖线不占位，靠 h2 自身的 padding-left 让出空间。
 *
 *    上一版这里写了 padding:0，把这段空间清掉了，文字直接贴在竖线上，
 *    看起来像挤在一起。这里补回左内边距 —— 4px 竖线 + 9px 间隙。
 */
.b2c-tools .link-title-left h2 {
    margin: 0;
    padding: 0 0 0 13px;
    font-size: 17px;
    font-weight: 700;
    background: transparent;
    line-height: 1.7;
}

.b2c-tools .child-link-cat {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.b2c-tools .child-link-cat a,
.b2c-tools .link-more a {
    font-size: 12.5px;
    color: var(--b2c-text-muted, #8a8a8a);
    padding: 4px 9px;
    border-radius: 4px;
    background: rgba(0, 0, 0, .04);
}

.b2c-tools .child-link-cat a:hover,
.b2c-tools .link-more a:hover {
    color: var(--b2c-primary, #ff3a55);
}

.b2c-tools .link-more a {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    background: transparent;
}

/* =========================================================================
 * 网格 —— 每行 4 个
 * ====================================================================== */

.b2c-tools-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

/* =========================================================================
 * 卡片
 * ====================================================================== */

.b2c-tools .b2c-tool-card {
    display: block;
    background: var(--b2c-card-bg, #fff);
    border-radius: 10px;
    padding: 12px 12px 14px;
    color: inherit;
    transition: box-shadow .22s ease, transform .22s ease;
    /* 卡片整体可点，内部不再嵌套链接 */
    overflow: hidden;
}

.b2c-tools .b2c-tool-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, .09);
    transform: translateY(-3px);
}

/* ── 网站截图 ────────────────────────────────────── */

.b2c-tool-shot {
    position: relative;
    /* 16:10 —— 与实际截图比例（1440×900）一致，避免裁掉内容 */
    aspect-ratio: 16 / 10;
    border-radius: 7px;
    overflow: hidden;
    background: rgba(0, 0, 0, .05);
    display: flex;
    align-items: center;
    justify-content: center;
}

.b2c-tool-shot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* 截图内容集中在顶部（网站首屏），从上往下裁更合理 */
    object-position: top center;
    display: block;
    transition: transform .3s ease;
}

.b2c-tools .b2c-tool-card:hover .b2c-tool-shot img {
    transform: scale(1.03);
}

/* 无图兜底：渐变底 + 名称首字（目前 125 个工具都有图，这里是保险） */
.b2c-tool-shot-letter {
    font-size: 34px;
    font-weight: 800;
    color: rgba(255, 255, 255, .9);
    line-height: 1;
}

/* ── logo + 名称 ─────────────────────────────────── */

.b2c-tool-meta {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 12px 0 8px;
    min-width: 0;
}

.b2c-tool-logo {
    width: 30px;
    height: 30px;
    flex: none;
    border-radius: 7px;
    overflow: hidden;
    background: rgba(0, 0, 0, .04);
    display: block;
}

.b2c-tool-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.b2c-tool-name {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--b2c-text, #1a1a1a);
    /* 名称最多一行，超出省略 —— 父版 5 列时大量标题被截断，
       4 列 + 省略号比硬裁半个字好看 */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.b2c-tools .b2c-tool-card:hover .b2c-tool-name {
    color: var(--b2c-primary, #ff3a55);
}

/* ── 描述 ────────────────────────────────────────── */

.b2c-tool-desc {
    margin: 0;
    font-size: 12.5px;
    line-height: 1.75;
    color: var(--b2c-text-muted, #8a8a8a);
    /* 固定两行，保证同一行的卡片等高 */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: calc(1.75em * 2);
}

/* =========================================================================
 * 响应式
 * ====================================================================== */

@media (max-width: 1200px) {
    .b2c-tools-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    .b2c-tools-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
}

@media (max-width: 520px) {
    .b2c-tools-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

    .b2c-tools .b2c-tool-card { padding: 9px 9px 11px; border-radius: 8px; }

    .b2c-tool-name { font-size: 13.5px; }

    .b2c-tool-logo { width: 24px; height: 24px; }

    .b2c-tool-desc { font-size: 12px; -webkit-line-clamp: 2; }

    .b2c-tools .b2c-tools-head { margin-bottom: 10px; }
    .b2c-tools .link-title-left h2 { font-size: 15px; }
}
