/* ============================================================
   discover.css — 万象生活 · 发现页
   用在首页 / 上。

   这份样式【逐字来自 design/prototype 的内联 <style>】，不是重新写的：
   原型那几页各自把样式写在页内（它们明确不引 app.css —— 那份带
   html,body{overflow:hidden}，会杀死阅读页的滚动），这里只是把它
   搬成独立文件，好让浏览器缓存它。

   与原型保持一致是硬要求（见 .scratch/prototype-parity/spec.md）：
   改这里的值等于改设计稿，先改原型或先在票面记差异。
   ============================================================ */

/* ===== T1 设计令牌 · news.html / app.css / article.html 三处必须一致（忽略行首缩进） ===== */
:root {
    --bg: #f4f5f9;          /* 全局背景 */
    --card: #ffffff;        /* 卡片底色 */
    --primary: #0052d9;     /* 资讯蓝 */
    --hot: #ff4d4f;         /* 热点 / 直播红 */
    --life: #00b578;        /* 生活绿 */
    --t1: #111;             /* 标题 */
    --t2: #888;             /* 次要描述 */
    --t3: #999;             /* 时间 */
    --t4: #bbb;             /* 播放量 / 图标默认 */
    --line: #f0f0f0;
    --gap: 8px;             /* 卡片间距 */
    --top-h: 52px;          /* 刷流页顶部栏高度 */
    --rail-w: 44px;         /* 刷流页右侧互动列宽度 */
    --sheet-r: 16px;        /* 底部弹层圆角 */
}
/* ===== /T1 ===== */

/* ================= 全局重置 ================= */
* { margin: 0; padding: 0; box-sizing: border-box; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
body { background-color: var(--bg); color: #333; padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)); -webkit-tap-highlight-color: transparent; }
img { display: block; }

/* ===== T4 资讯卡组件 · news.html 与 article.html 必须一致（忽略行首缩进） ===== */
.top-bar { position: sticky; top: 0; z-index: 100; background: var(--card); height: 50px; display: flex; align-items: center; justify-content: space-between; padding: 0 15px; transition: box-shadow 0.25s ease; }
.top-bar.scrolled { box-shadow: 0 1px 8px rgba(0,0,0,0.07); }
.icon-btn { background: none; border: none; padding: 2px; color: #666; cursor: pointer; display: flex; transition: color 0.2s ease; }
.icon-btn:active, .icon-btn.active { color: var(--primary); }
.icon-btn svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.section-header { display: flex; justify-content: space-between; align-items: flex-end; padding: 5px 15px 10px; }
.section-header h2 { font-size: 17px; font-weight: 700; color: #222; display: flex; align-items: center; gap: 7px; }
.sh-bar { width: 3px; height: 14px; border-radius: 2px; background: var(--primary); flex-shrink: 0; }
.sh-bar.hot { background: var(--hot); }
.sh-bar.life { background: var(--life); }
.section-header .more { font-size: 13px; color: var(--t3); cursor: pointer; transition: color 0.2s ease; user-select: none; }
.section-header .more:active { color: var(--primary); }
.news-feed { padding: 0 12px; }
.news-card { background: var(--card); border-radius: 8px; padding: 12px; margin-bottom: var(--gap); box-shadow: 0 1px 4px rgba(0,0,0,0.03); display: flex; justify-content: space-between; gap: 12px; transition: background-color 0.18s ease; }
.news-card:active { background: #fafafa; }
.news-card .text-area { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: space-between; }
.news-card .text-area h3 { font-size: 15px; font-weight: 600; line-height: 1.4; color: var(--t1); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.news-card .img-wrap { width: 100px; height: 75px; flex-shrink: 0; border-radius: 6px; overflow: hidden; background: #eee; }
.news-card .img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.news-card .text-area .meta-bar { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--t3); margin-top: 8px; }
.news-card .text-area .meta-left { display: flex; gap: 10px; align-items: center; }
.news-card .text-area .meta-right { display: flex; gap: 12px; align-items: center; }
.hot-tag, .news-tag, .life-tag { display: inline-block; color: #fff; font-size: 11px; padding: 1px 4px; border-radius: 3px; margin-right: 4px; vertical-align: middle; font-weight: 500; }
.hot-tag { background: var(--hot); }
.news-tag { background: var(--primary); }
.life-tag { background: var(--life); }
/* ===== /T4 ===== */

/* ================= 顶部栏（发现页专属：logo 与图标组） ================= */
.top-bar .logo { font-size: 18px; font-weight: 700; color: var(--primary); letter-spacing: 0.5px; }
.top-bar .icons { display: flex; gap: 16px; align-items: center; }

/* ================= 沉浸式头条 ================= */
.hero-news { position: relative; width: 100%; height: 220px; background: #ddd; margin-bottom: 12px; overflow: hidden; }
.hero-news img { width: 100%; height: 100%; object-fit: cover; transition: filter 0.18s ease; }
.hero-news:active img { filter: brightness(0.94); }
.hero-news .overlay { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0) 40%, rgba(0,0,0,0.85) 100%); }
.hero-news .content { position: absolute; bottom: 0; left: 0; width: 100%; padding: 15px 15px 18px; color: #fff; }
.hero-news .content h2 { font-size: 18px; font-weight: 700; line-height: 1.35; margin-bottom: 8px; text-shadow: 0 1px 4px rgba(0,0,0,0.3); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hero-news .content .meta { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: rgba(255,255,255,0.8); }
.hero-news .content .meta .meta-icon:not(.active) { color: rgba(255,255,255,0.8); }

/* ================= 话题标签 ================= */
.topic-swiper { padding: 5px 15px 12px; scroll-padding-inline: 15px; }
.topic-tag { display: inline-block; padding: 6px 16px; background: var(--card); color: #555; font-size: 13px; border-radius: 20px; margin-right: var(--gap); box-shadow: 0 1px 3px rgba(0,0,0,0.03); cursor: pointer; transition: 0.2s; user-select: none; }
.topic-tag.active { background: var(--primary); color: #fff; font-weight: 600; }
.topic-tag:active { transform: scale(0.96); }

/* ================= 横滑容器通用规则（含"露出半张"吸附） ================= */
.swiper { display: flex; overflow-x: auto; white-space: nowrap; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; scrollbar-width: none; -ms-overflow-style: none; }
.swiper::-webkit-scrollbar { display: none; }
.swiper > * { flex-shrink: 0; scroll-snap-align: start; }

/* ================= 横滑广告 Banner ================= */
.banner-swiper { padding: 0 15px; scroll-padding-inline: 15px; }
.banner-card { display: inline-block; width: 78%; height: 140px; margin-right: 12px; border-radius: 12px; overflow: hidden; position: relative; background: #ddd; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.banner-card img { width: 100%; height: 100%; object-fit: cover; transition: filter 0.18s ease; }
.banner-card:active img { filter: brightness(0.94); }
.banner-card .overlay { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.5) 100%); }
.banner-card .btn { position: absolute; top: 12px; right: 12px; background: var(--primary); color: #fff; padding: 4px 12px; border-radius: 15px; font-size: 12px; font-weight: 600; }
.banner-card .text { position: absolute; bottom: 12px; left: 12px; right: 12px; color: #fff; font-size: 15px; font-weight: 600; white-space: normal; }
/* 页码指示器 */
.banner-dots { display: flex; justify-content: center; gap: 5px; padding: 10px 0 14px; }
.banner-dots i { width: 5px; height: 5px; border-radius: 3px; background: #d5d8e0; transition: 0.25s; }
.banner-dots i.active { width: 14px; background: var(--primary); }

/* ================= 区块标题标签页（发现页专属） ================= */
.section-header .tabs { display: flex; gap: 15px; font-size: 14px; color: var(--t3); }
.section-header .tabs span { cursor: pointer; user-select: none; }
.section-header .tabs .active { color: #222; font-weight: 700; position: relative; }
.section-header .tabs .active::after { content: ''; position: absolute; bottom: -4px; left: 0; width: 100%; height: 3px; background: var(--primary); border-radius: 2px; }

/* 紧凑资讯信息流与标签样式已移入上方 T4 共享块 */

/* ================= 沉浸式媒体卡片 (视频 / MV / 直播) ================= */
.media-feed { padding: 0 12px; margin-bottom: var(--gap); }
.media-card { background: var(--card); border-radius: 12px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,0.03); }
.media-card .media-wrap { position: relative; width: 100%; height: 190px; background: #ddd; }
.media-card .media-wrap img { width: 100%; height: 100%; object-fit: cover; transition: filter 0.18s ease; }
.media-card:active .media-wrap img { filter: brightness(0.94); }
.media-card .media-wrap .text-overlay { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0) 40%, rgba(0,0,0,0.8) 100%); display: flex; flex-direction: column; justify-content: flex-end; padding: 12px; }
.media-card .media-wrap .text-overlay h3 { color: #fff; font-size: 15px; font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 6px; text-shadow: 0 1px 3px rgba(0,0,0,0.3); }
.media-card .media-wrap .text-overlay .meta { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: rgba(255,255,255,0.85); }
.media-card .media-wrap .text-overlay .meta .meta-icon:not(.active) { color: rgba(255,255,255,0.85); }

/* 播放按钮：纯白色三角，无背景圈，无边框，微弱投影 */
.media-card .play-icon { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: #fff; font-size: 40px; z-index: 2; text-shadow: 0 2px 8px rgba(0,0,0,0.4); opacity: 0.95; pointer-events: none; }

/* 时长：右上角，避免压迫底部文字叠加层的互动数据 */
.media-card .duration { position: absolute; top: 10px; right: 10px; background: rgba(0,0,0,0.6); color: #fff; padding: 2px 6px; border-radius: 3px; font-size: 11px; z-index: 2; }

/* 直播呼吸灯 */
.live-badge { position: absolute; top: 10px; left: 10px; background: var(--hot); color: #fff; padding: 2px 8px; border-radius: 4px; font-size: 11px; display: flex; align-items: center; gap: 4px; z-index: 2; box-shadow: 0 0 8px rgba(255,77,79,0.6); animation: livePulse 2s infinite; }
.live-badge::before { content: ''; width: 5px; height: 5px; background: #fff; border-radius: 50%; animation: blink 1s infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
@keyframes livePulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }

/* MV 专属标签 */
.mv-tag { position: absolute; top: 10px; left: 10px; background: var(--hot); color: #fff; padding: 2px 6px; border-radius: 4px; font-size: 11px; font-weight: bold; z-index: 2; }

/* 密集互动数据组（叠加层内使用） */
.meta-group { display: flex; gap: 10px; align-items: center; }

/* ================= 榜单区块 ================= */
.rank-list { padding: 0 15px; }
.rank-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.rank-item:last-child { border-bottom: none; }
.rank-num { width: 26px; font-size: 18px; font-weight: 700; color: var(--t4); text-align: center; flex-shrink: 0; font-style: italic; }
.rank-num.top { color: var(--hot); font-size: 20px; }   /* Top3 变色 */
.rank-cover { width: 60px; height: 60px; border-radius: 8px; overflow: hidden; flex-shrink: 0; background: #eee; }
.rank-cover img { width: 100%; height: 100%; object-fit: cover; transition: filter 0.18s ease; }
.rank-item:active .rank-cover img { filter: brightness(0.94); }
.rank-info { flex: 1; min-width: 0; }
.rank-info h4 { font-size: 15px; font-weight: 600; color: var(--t1); margin-bottom: 4px; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.rank-info .desc { font-size: 12px; color: var(--t2); margin-bottom: 6px; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.rank-info .stats { display: flex; gap: 10px; font-size: 11px; color: var(--t4); align-items: center; }
.rank-info .stats .tag { padding: 1px 4px; border-radius: 3px; }
.rank-info .stats .tag-gold { color: #e6a23c; background: #fdf6ec; }
.rank-info .stats .tag-hot { color: var(--hot); background: #fff2f0; }
/* 左右滑切榜时的入场动画：新内容从手势来的方向滑入 */
.rank-list.anim { animation: rankIn 0.22s ease; }
@keyframes rankIn {
    from { opacity: 0; transform: translateX(var(--rank-dx, 0px)); }
    to { opacity: 1; transform: none; }
}

/* ================= 横滑歌单区块 ================= */
.scroll-swiper { padding: 0 15px 8px; scroll-padding-inline: 15px; }
.scroll-card { display: inline-block; width: 100px; margin-right: 10px; }
.scroll-card .img-wrap { width: 100%; height: 100px; border-radius: 8px; overflow: hidden; position: relative; background: #ddd; }
.scroll-card .img-wrap img { width: 100%; height: 100%; object-fit: cover; transition: filter 0.18s ease; }
.scroll-card:active .img-wrap img { filter: brightness(0.94); }
.scroll-card .img-wrap .tag-top { position: absolute; top: 6px; left: 6px; background: rgba(0,0,0,0.5); color: #fff; padding: 1px 5px; border-radius: 3px; font-size: 9px; }
.scroll-card .img-wrap .play-count { position: absolute; bottom: 6px; left: 6px; color: #fff; font-size: 10px; display: flex; align-items: center; gap: 3px; text-shadow: 0 1px 3px rgba(0,0,0,0.6); }
.scroll-card .img-wrap .play-count::before { content: '▶'; font-size: 8px; }
/* 播放键：纯白三角，无圆形背景圈 */
.scroll-card .img-wrap .play-btn { position: absolute; bottom: 6px; right: 6px; color: #fff; font-size: 13px; text-shadow: 0 1px 4px rgba(0,0,0,0.55); line-height: 1; }
.scroll-card h4 { font-size: 12px; font-weight: 600; color: var(--t1); margin-top: 5px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.3; }

/* 听书卡片：沿用 .scroll-card 形态，加宽以容纳「书名 + 主播 · 总章数」
   刻意不要歌单卡的 .play-count / .play-btn —— 听书卡不在首页播放，
   ▶ 会误导成「就地播放」；左上角改由 .tag-top 放追更进度。 */
.scroll-card.book { width: 112px; }
.scroll-card.book .img-wrap { height: 112px; }
.scroll-card.book h4 { font-size: 13px; }   /* 不设 min-height：书名都是 3~4 字，预留两行会空出一整行 */
.scroll-card.book .sub { font-size: 11px; color: var(--t3); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scroll-card.book .sub .dot { margin: 0 4px; color: #ddd; }    /* 必须写后代选择器：.dot 在全站没有独立规则 */

/* ================= 歌曲卡片（第一行合并，第二行推荐语） ================= */
.audio-card { background: var(--card); border-radius: 10px; padding: 12px; margin-bottom: var(--gap); box-shadow: 0 1px 4px rgba(0,0,0,0.03); display: flex; align-items: center; gap: 12px; cursor: pointer; transition: background-color 0.18s ease; }
.audio-card:active { background: #fafafa; }
/* 封面容器 */
.audio-card .cover-wrap { position: relative; width: 56px; height: 56px; border-radius: 8px; overflow: hidden; flex-shrink: 0; background: #eee; transition: box-shadow 0.2s ease; cursor: pointer; }
.audio-card .cover-wrap img { width: 100%; height: 100%; object-fit: cover; }
/* 左下角音乐符号（未播放） */
.audio-card .cover-wrap .music-icon { position: absolute; bottom: 2px; left: 4px; color: rgba(255,255,255,0.9); font-size: 16px; text-shadow: 0 1px 4px rgba(0,0,0,0.5); line-height: 1; }
/* 声波跳动动画（播放中，占据音乐符号位置） */
.audio-card .cover-wrap .wave { position: absolute; bottom: 5px; left: 5px; display: none; align-items: flex-end; gap: 2px; height: 13px; }
.audio-card .cover-wrap .wave i { width: 2px; border-radius: 1px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.55); transform-origin: bottom; animation: wave 0.9s ease-in-out infinite; }
.audio-card .cover-wrap .wave i:nth-child(1) { height: 6px;  animation-delay: 0s; }
.audio-card .cover-wrap .wave i:nth-child(2) { height: 13px; animation-delay: 0.15s; }
.audio-card .cover-wrap .wave i:nth-child(3) { height: 8px;  animation-delay: 0.3s; }
.audio-card .cover-wrap .wave i:nth-child(4) { height: 11px; animation-delay: 0.45s; }
@keyframes wave { 0%, 100% { transform: scaleY(0.35); } 50% { transform: scaleY(1); } }

/* 播放中状态 */
.audio-card.playing .cover-wrap { box-shadow: 0 0 0 2px rgba(0,82,217,0.28); }
.audio-card.playing .cover-wrap .music-icon { display: none; }
.audio-card.playing .cover-wrap .wave { display: flex; }
.audio-card.playing .info .first-line { color: var(--primary); }

/* 文字区是 <a>：点它进播放页，与封面的"就地播放"分离 */
.audio-card .info { flex: 1; min-width: 0; text-decoration: none; color: inherit; }
.audio-card .info:active .first-line { color: var(--primary); }
/* 第一行：歌名 + 歌手 · 专辑 · 时长 */
.audio-card .info .first-line { font-size: 15px; font-weight: 600; color: var(--t1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 5px; transition: color 0.2s ease; }
.audio-card .info .first-line .sub { font-size: 12px; font-weight: 400; color: var(--t2); margin-left: 6px; }
.audio-card .info .first-line .sub .dot { margin: 0 4px; color: #ddd; }
/* 第二行：推荐语 */
.audio-card .info .desc { font-size: 12px; color: var(--t3); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ===== T2 线框图标 · news.html / app.css / article.html 三处必须一致（忽略行首缩进） ===== */
.meta-icon { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--t4); cursor: pointer; transition: color 0.2s ease; user-select: none; }
.meta-icon .icon { font-size: 12px; display: inline-block; line-height: 1; font-weight: 400; }
.icon-comment::before { content: '☐'; font-size: 12px; }
.icon-like::before { content: '♡'; font-size: 13px; }
.icon-collect::before { content: '☆'; font-size: 13px; }
.icon-play::before { content: '▶'; font-size: 10px; }
.icon-view::before { content: '◉'; font-size: 12px; }
.meta-icon.active { color: var(--primary); }
.meta-icon.pop { animation: pop 0.28s ease; }
/* ===== /T2 ===== */

/* ===== T3 关键帧 · news.html / app.css / article.html 三处必须一致（忽略行首缩进） ===== */
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.18); } 100% { transform: scale(1); } }
/* ===== /T3 ===== */

/* ================= 可跳转卡片的指针反馈 ================= */
.media-feed[data-ch] .media-card,
.news-card[data-go],
.hero-news[data-go],
.rank-list[data-ch] .rank-item,
.scroll-card[data-go] { cursor: pointer; }

/* ================= 无障碍：遵循系统减弱动效偏好 ================= */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ============================================================
   以下是【我们加的】，不是原型里的 —— 原型没有空态这一说（它永远有内容）。
   加在这里而不是引 mobile.css：那一份是账号页的外壳，把整份拉进发现页
   等于把两套版心混在一页上。票 04 的夹具测试把 .empty 放进白名单，就是这条。
   ============================================================ */

.empty { text-align: center; color: var(--t3); padding: 64px 24px; }
.empty p { font-size: 15px; }
.empty .hint { font-size: 13px; margin-top: 8px; opacity: .75; }

/* ================= 区块分组（我们自己加的一层，原型没有） =================
   原型里没有「分组」这个概念：榜单那三个 tab 是同一批节点换个顺序重排出来的。
   我们把它做成「多组 = 多个面板，切换器切显隐」—— 于是它同时服务榜单与将来别的分组。
   只有这四条规则是新的，其余样式仍逐字来自原型。 */
.block-panel { display: none; }
.block-panel.active { display: block; }

/* 胶囊切换器落在标题行里时不要那圈外间距（原型的话题胶囊是独立一行的） */
.section-header .topic-swiper { padding: 0; }
.section-header .topic-tag { padding: 4px 12px; font-size: 12px; }

/* 区块标签（那颗蓝色小标）落在标题行里，跟标题走 */
.section-header h2 .news-tag { margin-left: 6px; vertical-align: middle; }
