/* ═══════════════════════════════════════════════════════════════
   AI 热点页：左 2/3 时间轴新闻 + 右 1/3 排名
   ─────────────────────────────────────────────────────────────
   布局：.hotspot-layout 用 grid-template-columns: 2fr 1fr
        桌面端严格 2/3 : 1/3；≤1024px 塌成单列（新闻在上，排名在下）
   卡片：复用 .article-item 的玻璃卡语言（--glass-bg / --glass-border）
   ═══════════════════════════════════════════════════════════════ */

.hotspot-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    /* ⚠️ 必须 stretch（默认），不能是 start
       align-items:start 会让 .hotspot-rank 高度 = 自身内容高度，
       而 sticky 元素只能在**父容器内部**移动 —— 父容器和内容一样高时，
       sticky 完全没有可移动空间，表现为「滚动时完全不固定」。
       → 拉伸成和左栏等高，sticky 才有活动空间。 */
    align-items: stretch;
    margin: 1.5rem auto 0;
    padding: 0 2rem 3rem;
    /* 站点其它区块都是居中定宽（.articles-section 900px / .page-content 800px）。
       热点页两栏如果铺满全宽，左栏会到 1050px —— 单行太长、扫读吃力。
       1280px 下左栏约 805px、右栏约 400px，符合站内阅读宽度。 */
    max-width: 1280px;
}

/* ── 左栏：时间轴 ───────────────────────────────────────── */

.hotspot-news {
    min-width: 0;   /* 允许 grid 子项收缩，避免长标题撑破布局 */
}

/* 左栏标题**不**做 sticky：
   用户要的是「左栏随页面正常滚动，只有右栏固定」。
   之前给标题加了 sticky，结果滚动时它带着半透明背景压在卡片上方，
   底下的卡片文字透出来形成鬼影（vision 复查抓到了）。
   → 标题回归普通文档流，滚动时自然滚走。 */

.news-feed {
    position: relative;
    padding-left: 1.25rem;
}

/* 时间轴竖线 */
.news-feed::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: linear-gradient(180deg,
        var(--accent-color, #58a6ff) 0%,
        rgba(var(--accent-rgb, 88, 166, 255), 0.25) 18%,
        rgba(var(--accent-rgb, 88, 166, 255), 0.12) 100%);
    border-radius: 2px;
}

/* 日期节点 */
.news-day {
    position: relative;
    margin-bottom: 1.25rem;
}

/* 时间轴圆点 */
.news-day::before {
    content: '';
    position: absolute;
    left: -1.25rem;
    top: 7px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--bg-primary, #0d1117);
    border: 2px solid var(--accent-color, #58a6ff);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb, 88, 166, 255), 0.12);
    z-index: 1;
}

.news-day-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-color, #58a6ff);
    letter-spacing: 0.03em;
    margin-bottom: 0.6rem;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    background: rgba(var(--accent-rgb, 88, 166, 255), 0.1);
}

.news-day-label .news-day-count {
    font-weight: 500;
    font-size: 0.75rem;
    color: var(--text-secondary);
    letter-spacing: 0;
}

/* 事件卡 */
.news-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem 1.1rem;
    margin-bottom: 0.75rem;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: var(--glass-shadow);
    transition: all 0.25s ease;
}

.news-card:hover {
    box-shadow: var(--accent-glow);
    transform: translateY(-2px);
    border-color: rgba(var(--accent-rgb, 88, 166, 255), 0.4);
}

.news-card-head {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    margin-bottom: 0.45rem;
}

.news-card-title {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
    color: var(--text-primary);
    margin: 0;
    flex: 1;
    min-width: 0;
}

.news-card-type {
    flex-shrink: 0;
    font-size: 0.7rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    white-space: nowrap;
    margin-top: 0.15rem;
}

.news-card-summary {
    font-size: 0.875rem;
    line-height: 1.65;
    color: var(--text-secondary);
    margin: 0 0 0.6rem;
}

/* 事实要点 */
.news-card-facts {
    list-style: none;
    padding: 0;
    margin: 0 0 0.6rem;
}

.news-card-facts li {
    position: relative;
    padding-left: 0.9rem;
    font-size: 0.82rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 0.2rem;
}

.news-card-facts li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.62em;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(var(--accent-rgb, 88, 166, 255), 0.6);
}

/* 标签行 */
.news-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.news-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.7rem;
    padding: 0.12rem 0.45rem;
    border-radius: 4px;
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    background: var(--bg-secondary);
    white-space: nowrap;
}

.news-tag.primary {
    color: #3fb950;
    border-color: rgba(63, 185, 80, 0.35);
    background: rgba(63, 185, 80, 0.1);
}

.news-tag.multisource {
    color: var(--accent-color, #58a6ff);
    border-color: rgba(var(--accent-rgb, 88, 166, 255), 0.35);
    background: rgba(var(--accent-rgb, 88, 166, 255), 0.1);
}

.news-tag.caveat {
    color: #d29922;
    border-color: rgba(210, 153, 34, 0.35);
    background: rgba(210, 153, 34, 0.1);
}

.news-tag.span {
    color: #a371f7;
    border-color: rgba(163, 113, 247, 0.35);
    background: rgba(163, 113, 247, 0.1);
}

/* 来源列表 */
.news-card-sources {
    margin-top: 0.55rem;
    padding-top: 0.55rem;
    border-top: 1px dashed var(--glass-border);
    font-size: 0.75rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

.news-card-sources .src-label {
    color: var(--text-secondary);
    opacity: 0.8;
    margin-right: 0.3rem;
}

.news-src {
    display: inline-block;
    padding: 0.05rem 0.4rem;
    margin: 0.15rem 0.2rem 0.15rem 0;
    border-radius: 3px;
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
}

/* 主题句 */
.news-feed-theme {
    font-size: 0.92rem;
    line-height: 1.8;
    /* ⚠️ 用 --text-secondary 太浅，vision 复查会把它误判成「空白圆角框」。
       → 用介于主文与次文之间的色值，保证可读又不抢标题。 */
    color: var(--text-primary);
    opacity: 0.82;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-left: 3px solid var(--accent-color, #58a6ff);
    border-radius: 8px;
    padding: 0.85rem 1rem;
    margin-bottom: 1.25rem;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

/* ── 右栏：排名 ─────────────────────────────────────────── */

.hotspot-rank {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ⚠️ 右栏两个模块**各自** sticky，不整栏 sticky
   整栏 sticky（position:sticky 在 .hotspot-rank 上）的话，
   整块内容高度超过视口时，底部会被视口切掉且无法滚动到 —— 经典 sticky 陷阱。
   改成每个 .trending-section 单独 sticky：
     · 「GitHub 热门」滚到顶就钉住
     · 「热门搜索」跟着继续走，到顶也钉住
   top 必须 > 导航栏高度(65px)，否则被 fixed 导航栏盖住。 */
.hotspot-rank .trending-section {
    position: sticky;
    top: 72px;
    margin-bottom: 0;
    /* ⚠️ .trending-section 在 pages.css 里是 `max-width:800px; margin:0 auto`
       的居中块，放进右栏会按内容收缩（实测只占 349/525px，右边一片空白）。
       → 右栏里必须撑满并去掉居中外边距。
       另外 padding 归零：卡片背景在 .trending-list 上，
       外层留白会让右栏标题比左栏标题低 15px（标题对不齐）。 */
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
}

/* 第二个模块（热门搜索）跟着往下滚，滚到它自己的位置才钉住。
   它的 top 必须 = 第一个模块的高度 + 间距，否则两个模块会叠在一起。
   ⚠️ 高度不能写死：GitHub 列表的条数/行高会变（实测 287px，不是估算值）。
   → 由 JS 用 ResizeObserver 实测第一块高度，写进 --gh-h，这里只做算术。 */
.hotspot-rank .trending-section + .trending-section {
    top: calc(72px + var(--gh-h, 287px) + 1rem);
}

/* 右栏窄，排名项文字需要能换行 */
.hotspot-rank .trending-item {
    padding: 0.5rem 0.7rem;
}

/* GitHub 行去掉简介后只剩「名 + 语言 + 星数」，行高可以收紧。
   pages.css 的 .trending-item 默认 padding 1rem 1.25rem，在窄栏里
   6 行就占掉 395px，把「热门搜索」压到首屏外。 */
.hotspot-rank .github-item {
    padding: 0.45rem 0.7rem;
}

/* ⚠️ 语言标签已移除（Shell / Python 这类分类在窄栏里是噪音），
   .trending-content 就只剩仓库名一行。此时它仍带 flex:1，
   仓库名和右侧星数之间会拉出一大片空白。
   → 改成 flex 靠左，星数紧跟在名字后面。 */
.hotspot-rank .github-item .trending-content {
    flex: 0 1 auto;
    min-width: 0;
}

.hotspot-rank .github-item .trending-keyword {
    flex: 0 1 auto;
}

.hotspot-rank .github-item .repo-stars {
    margin-left: auto;
    padding-left: 0.75rem;
}

/* ⚠️ .trending-keyword 是 flex:1 但没有 min-width:0，
   长关键词在窄栏里不会收缩成省略号，而是把右侧热度数字挤出容器 →
   实测出现「...Open Sou」直接粘着「968」，视觉上连成一个字符串。
   → 这里补 min-width:0 + 单行省略号，并让数字块不被压缩。 */
.hotspot-rank .trending-keyword {
    font-size: 0.85rem;
    line-height: 1.45;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hotspot-rank .trending-index {
    flex-shrink: 0;
    font-size: 0.8rem;
    gap: 0.3rem;
}

.hotspot-rank .trending-rank {
    width: 24px;
    height: 24px;
    font-size: 0.78rem;
    flex-shrink: 0;
}

.hotspot-rank .section-title {
    font-size: 0.95rem;
}

.hotspot-rank .trending-header {
    padding: 0 0.1rem;
}

/* ── 响应式 ─────────────────────────────────────────────── */

@media (max-width: 1024px) {
    .hotspot-layout {
        grid-template-columns: 1fr;
    }
    .hotspot-rank {
        position: static;
    }
}

@media (max-width: 600px) {
    .news-feed {
        padding-left: 1rem;
    }
    .news-day::before {
        left: -1rem;
        width: 10px;
        height: 10px;
    }
    .news-card {
        padding: 0.85rem 0.9rem;
    }
    .news-card-title {
        font-size: 0.95rem;
    }
}

/* GitHub 数据不可用（2026-11-16）
   删掉写死的 FALLBACK_TRENDING 后，拿不到真数据时显示这个状态。
   没有实时性的排行榜不如不显示——假的星数配「实时」徽标是在骗人。 */
.github-unavailable {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-size: 0.85rem;
}

.github-unavailable i {
    color: var(--text-secondary);
    margin-right: 0;
}

.github-retry {
    border: 1px solid var(--border-color, rgba(128, 128, 128, 0.3));
    background: transparent;
    color: var(--text-primary);
    font-size: 0.8rem;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.github-retry:hover {
    background: rgba(128, 128, 128, 0.12);
    border-color: rgba(128, 128, 128, 0.5);
}
