/* ==========================================================================
   首页信息流版面 (home feed)
   配套模板: template/default/html/index/index.html
   配套脚本: template/default/asset/js/home-feed.js
   ========================================================================== */

/* 变量定义在 :root，因为 .hf-dock 是 .hf-page 的兄弟节点（固定在视窗底部），
   放在 .hf-page 上的话 dock 取不到这些值。 */
:root {
    --hf-grad: linear-gradient(90deg, #d9121c 0%, #c11038 33%, #ac0a5c 66%, #9a0877 100%);
    --hf-gold: linear-gradient(180deg, #fff6a8 0%, #ffe23f 55%, #ff9c00 100%);
    --hf-gold-text: #8a1010;
    --hf-page-bg: #edf1fa;
    --hf-card-bg: #ffffff;
    --hf-muted: #8a8f9c;
    --hf-gap: 7px;
    --hf-radius: 4px;
    --hf-dock-h: 54px;
}

body.bstem {
    --hf-page-bg: #16181d;
    --hf-card-bg: #22252c;
    --hf-muted: #7d828c;
}

.hf-page {
    background: var(--hf-page-bg);
    padding: 0 8px;
    padding-bottom: calc(var(--hf-dock-h) + 18px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
}

/* 本版面自带底部操作条，隐藏模板原本的手机版底部导航，避免两条并存 */
body.home-feed-body .hidden_mb { display: none !important; }

.hf-inner {
    max-width: 1280px;
    margin: 0 auto;
}

/* ---------- 顶部搜索 + 分类面板 ---------- */

.hf-topbar {
    background: var(--hf-grad);
    border-radius: var(--hf-radius);
    padding: 10px 8px 8px;
    margin: 8px 0 10px;
}

.hf-search-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hf-search-form {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    margin: 0;
}

.hf-search-input {
    flex: 1 1 auto;
    min-width: 0;
    height: 32px;
    line-height: 32px;
    padding: 0 10px;
    border: 0;
    border-radius: var(--hf-radius);
    background: #fff;
    color: #333;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
}

.hf-search-input::placeholder { color: #9a9a9a; }

.hf-btn-gold {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    padding: 0 12px;
    border: 0;
    border-radius: var(--hf-radius);
    background: var(--hf-gold);
    color: var(--hf-gold-text);
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 1px 0 rgba(0, 0, 0, .12);
}

.hf-btn-gold:hover,
.hf-btn-gold:focus { color: var(--hf-gold-text); opacity: .92; }

/* 「今日新片」筛选生效时的状态 */
.hf-btn-gold.is-on {
    box-shadow: 0 0 0 2px #fff, 0 1px 0 rgba(0, 0, 0, .12);
}

.hf-btn-gold.is-on::before {
    content: '\2713';
    margin-right: 3px;
    font-weight: 700;
}

/* ---------- 分类标签 ---------- */

.hf-tags-wrap { position: relative; margin-top: 8px; }

.hf-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    overflow: hidden;
}

.hf-tags-wrap.is-collapsed .hf-tags { max-height: 128px; }

.hf-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 26px;
    padding: 0 12px;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(255, 255, 255, .24), rgba(255, 255, 255, .07));
    color: #fff;
    font-size: 13px;
    line-height: 1;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.hf-tag:hover,
.hf-tag:focus { color: #fff; background: linear-gradient(180deg, rgba(255, 255, 255, .34), rgba(255, 255, 255, .14)); }

.hf-tag.is-active,
.hf-tag--link {
    background: var(--hf-gold);
    border-color: transparent;
    color: var(--hf-gold-text);
    font-weight: 700;
}

.hf-tag--link:hover,
.hf-tag--link:focus { background: var(--hf-gold); color: var(--hf-gold-text); opacity: .92; }

/* 佈景有 `a:link, a:visited { color: var(--tpl-text-muted) }`，优先度 0,1,1，
   会盖过 .hf-tag / .hf-dock-btn 的 0,1,0，让胶囊与底部按钮的文字变成灰色。
   这里用 0,2,1 的选择器把文字抢回来。 */
.hf-tags a.hf-tag {
    color: #fff;
}

.hf-tags a.hf-tag.is-active,
.hf-tags a.hf-tag--link {
    color: var(--hf-gold-text);
}

.hf-dock a.hf-dock-btn {
    color: #fff;
}

.hf-dock a.hf-dock-btn--gold {
    color: var(--hf-gold-text);
}

.hf-tags-toggle {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 2px 0;
    border: 0;
    background: transparent;
    color: rgba(255, 255, 255, .85);
    font-size: 12px;
    line-height: 1.4;
    cursor: pointer;
}

.hf-tags-toggle::after { content: ' \25BE'; }
.hf-tags-wrap:not(.is-collapsed) .hf-tags-toggle::after { content: ' \25B4'; }

/* ---------- 卡片网格 ---------- */

.hf-feed {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--hf-gap);
}

.hf-card {
    display: block;
    background: var(--hf-card-bg);
    border-radius: var(--hf-radius);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
}

.hf-card:hover { color: inherit; text-decoration: none; }

.hf-card-pic {
    position: relative;
    width: 100%;
    padding-top: 72%;
    background: #d8dce6;
    overflow: hidden;
}

.bstem .hf-card-pic { background: #2f3138; }

.hf-card-pic img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border: 0;
}

.hf-card-date {
    position: absolute;
    top: 5px;
    left: 5px;
    padding: 1px 5px;
    border-radius: 3px;
    background: rgba(0, 0, 0, .48);
    color: #fff;
    font-size: 10px;
    line-height: 15px;
}

.hf-card-hits {
    position: absolute;
    left: 6px;
    bottom: 5px;
    color: #fff;
    font-size: 11px;
    line-height: 15px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .75);
}

.hf-card-title {
    background: var(--hf-grad);
    color: #fff;
    font-size: 12px;
    line-height: 1.45;
    padding: 6px 8px;
    min-height: 36px;
    box-sizing: border-box;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-all;
}

/* ---------- 状态 / 加载 ---------- */

.hf-more-wrap {
    padding: 14px 0 2px;
    text-align: center;
}

.hf-more-btn {
    min-width: 160px;
    height: 34px;
    padding: 0 18px;
    border: 0;
    border-radius: 999px;
    background: var(--hf-grad);
    color: #fff;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
}

.hf-more-btn[disabled] { opacity: .6; cursor: default; }

.hf-status {
    padding: 14px 0 4px;
    text-align: center;
    color: var(--hf-muted);
    font-size: 12px;
}

.hf-status[hidden] { display: none; }

.hf-empty {
    padding: 40px 0;
    text-align: center;
    color: var(--hf-muted);
    font-size: 13px;
}

.hf-skeleton .hf-card-pic { animation: hfPulse 1.3s ease-in-out infinite; }
.hf-skeleton .hf-card-title { background: #c9cddb; min-height: 36px; }
.bstem .hf-skeleton .hf-card-title { background: #32353d; }

@keyframes hfPulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

/* ---------- 底部固定操作条 ---------- */

.hf-dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    height: var(--hf-dock-h);
    padding: 0 10px calc(env(safe-area-inset-bottom, 0px));
    background: var(--hf-grad);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, .18);
}

.hf-dock-btn {
    flex: 1 1 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 34px;
    padding: 0 8px;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: var(--hf-radius);
    /* 用深色叠层而不是白色：白色叠在渐层左侧那段亮红上会把字洗掉 */
    background: rgba(0, 0, 0, .14);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
}

.hf-dock-btn:hover,
.hf-dock-btn:focus { color: #fff; text-decoration: none; }

.hf-dock-btn--gold {
    flex: 0 0 auto;
    min-width: 108px;
    height: 40px;
    border-color: transparent;
    background: var(--hf-gold);
    color: var(--hf-gold-text);
    font-size: 15px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .22);
}

.hf-dock-btn--gold:hover,
.hf-dock-btn--gold:focus { color: var(--hf-gold-text); }

/* ---------- 响应式：宽屏多列 ---------- */

@media (min-width:100000px) {
    .hf-feed { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width:100000px) {
    .hf-page { padding-left: 16px; padding-right: 16px; }
    .hf-feed { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .hf-topbar { padding: 12px; }
    .hf-tags-wrap.is-collapsed .hf-tags { max-height: 104px; }
    .hf-search-row { justify-content: flex-start; }
    .hf-search-form { flex: 0 1 520px; }
}

@media (min-width:100000px) {
    .hf-feed { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (min-width:100000px) {
    .hf-feed { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
