/* ============================================
   组件：链接卡片
   依赖：themes/*.css
   结构：.nav-card > (图标 / 标题 / 描述)
   说明：图标底色由内联变量 --cat-color 提供（来自分类配色）
   ============================================ */

.nav-card {
    position: relative;
    height: 100%;
    padding: .85rem .9rem;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 12px;
    color: var(--app-text);
    box-shadow: var(--app-shadow);
    transition: transform .18s ease, box-shadow .18s ease,
                border-color .18s ease, background-color .18s ease;
}
.nav-card:hover {
    transform: translateY(-3px);
    border-color: var(--cat-color, var(--app-accent));
    box-shadow: var(--app-shadow-lg);
}

/* 主链接：撑满整块卡片（stretched link） */
.nav-card__main {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    min-width: 0;
    color: inherit;
    text-decoration: none;
}
.nav-card__main::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
}

/* ---------- 图标 ---------- */
.nav-card__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--cat-color, var(--app-accent));
    color: #fff;
    font-size: 1.1rem;
    flex-shrink: 0;
    overflow: hidden;
}
.nav-card__icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
/* 暗色下外站图标若偏暗，轻微提亮 */
[data-bs-theme="dark"] .nav-card__icon img {
    filter: brightness(1.05);
}

/* ---------- 文本 ---------- */
.nav-card__body {
    min-width: 0;
    flex: 1;
}
.nav-card__title {
    font-size: .92rem;
    font-weight: 600;
    margin: 0 0 .15rem;
    color: var(--app-text);
    /* 兼容老浏览器：-webkit-line-clamp 不支持时退化为省略号 */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nav-card__desc {
    font-size: .78rem;
    line-height: 1.45;
    color: var(--app-text-muted);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.26em;   /* 占位，保证卡片高度一致 */
}

/* ---------- 直达外站快捷按钮 ---------- */
.nav-card__go {
    position: absolute;
    top: .45rem;
    right: .45rem;
    z-index: 2;          /* 盖在 .nav-card__main::after 之上 */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 7px;
    color: var(--app-text-muted);
    background: var(--app-surface-alt);
    font-size: .72rem;
    opacity: 0;
    transition: opacity .16s ease, color .16s ease, background-color .16s ease;
}
.nav-card:hover .nav-card__go,
.nav-card__go:focus-visible {
    opacity: 1;
}
.nav-card__go:hover {
    color: var(--app-accent);
    background: var(--app-accent-soft);
}

/* 无 hover 设备（手机）常驻显示 */
@media (hover: none) {
    .nav-card__go {
        opacity: .6;
    }
}

/* ---------- 网格间距 ---------- */
.card-grid {
    display: grid;
    gap: .75rem;
    grid-template-columns: repeat(1, minmax(0, 1fr));
}

@media (min-width: 576px) {
    .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 992px) {
    .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .85rem; }
}
@media (min-width: 1400px) {
    .card-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ---------- 骨架屏 ---------- */
.nav-card--skeleton {
    pointer-events: none;
}
.nav-card--skeleton .skeleton {
    animation: skeleton-pulse 1.4s ease-in-out infinite;
}
@keyframes skeleton-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: .45; }
}

/* ---------- 空状态 / 错误状态 ---------- */
.state-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    padding: 3.5rem 1rem;
    text-align: center;
    color: var(--app-text-muted);
}
.state-box__icon {
    font-size: 2.5rem;
    opacity: .55;
}
.state-box__title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--app-text);
    margin: 0;
}
.state-box__desc {
    font-size: .85rem;
    margin: 0;
}

/* ---------- 移动端触摸反馈（无 hover 设备） ---------- */
@media (hover: none) {
    .nav-card:active {
        transform: scale(.98);
        background: var(--app-surface-alt);
    }
}
