/* ============================================================
   友情链接页 · 深色主题
   ============================================================ */

body {
    background-color: rgb(30, 30, 30);
    margin: 0;
    font-family: Arial, "Microsoft YaHei", sans-serif;
    min-height: 100vh;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

/* ===== 主容器 ===== */
.links-main {
    width: 90%;
    max-width: 1000px;
    margin: 30px auto;
    flex: 1;
}

/* ===== 页头 ===== */
.links-head {
    text-align: center;
    margin-bottom: 32px;
    padding: 22px 20px;
    /* 与 homepage.css 内容卡片一致的高不透明度，避免底图透出影响标题可读性 */
    background: rgba(51, 51, 51, 0.99);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
}

.links-head h2 {
    color: #ececec;
    font-size: 28px;
    margin: 0 0 12px;
    letter-spacing: 1px;
    /* 页头文字压在底图上，加一层暗色遮罩保证任何背景下都清晰 */
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
}

.links-sub {
    color: #b5b5b5;
    font-size: 14px;
    line-height: 1.8;
    margin: 0;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
}

.links-apply {
    color: #8cc4f5;
    text-decoration: none;
    transition: color 0.2s ease;
}

.links-apply:hover {
    color: #4da3ff;
    text-decoration: underline;
}

/* ===== 友链卡片网格 ===== */
.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 36px;
}

.link-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 18px;
    /* 背景图 .bg-img 有 0.8 透明度，卡片需要更高的不透明度才能压住底图、保证文字可读 */
    background: rgba(45, 45, 45, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.link-card:hover {
    transform: translateY(-3px);
    background: rgba(51, 51, 51, 0.97);
    border-color: rgba(0, 123, 255, 0.4);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

/* 首字母图标：按名称派生色相，无需外部图片服务 */
.link-favicon {
    flex-shrink: 0;
    width: 46px;
    height: 46px;
    border-radius: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 21px;
    font-weight: 700;
    user-select: none;
}

.link-info {
    flex: 1;
    min-width: 0;
}

.link-name {
    color: #ececec;
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.link-desc {
    color: #9a9a9a;
    font-size: 13px;
    line-height: 1.6;
    margin: 0 0 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.link-host {
    color: #6f6f6f;
    font-size: 12px;
    word-break: break-all;
}

/* ===== 加载与空状态 ===== */
.links-loading,
.links-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: #888;
    padding: 50px 20px;
    font-size: 14px;
}

.links-empty a {
    color: #6db3f2;
    text-decoration: none;
}

.links-empty a:hover {
    color: #007BFF;
    text-decoration: underline;
}

/* ===== 申请说明 ===== */
.links-apply-box {
    background: rgba(45, 45, 45, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 24px 26px;
    margin-bottom: 20px;
}

.links-apply-box h3 {
    color: #ececec;
    font-size: 16px;
    margin: 0 0 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.links-apply-box ul {
    margin: 0;
    padding-left: 20px;
}

.links-apply-box li {
    color: #9a9a9a;
    font-size: 13px;
    line-height: 2;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .links-main {
        width: 94%;
        margin: 20px auto;
    }

    .links-head h2 {
        font-size: 23px;
    }

    .links-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .links-sub-br {
        display: none;
    }

    .links-apply-box {
        padding: 20px;
    }
}

/* ===== 滚动条 ===== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #6d6d6d;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}