/* ==========================================================================
   /news.html — sspai-inspired layout
   [left: category nav] [center: feed] [right: prices + trending]
   ========================================================================== */

:root {
    --news-site-width: 1200px;
    --news-primary: #161c2d;
    --news-text: #2e3346;
    --news-text-muted: #595f6d;
    --news-text-light: #8b93a7;
    --news-border: #e5e7eb;
    --news-bg: #ffffff;
    --news-bg-soft: #f5f6f8;
    --news-accent: #1956ff;
    --news-accent-blue: #1956ff;
    --news-radius: 8px;
    --news-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
        Arial, sans-serif;
    --info-accent: #7eb8e8;
    --info-line: #e8e8e8;
}

.news-page {
    background: var(--news-bg);
    font-family: var(--news-font);
    color: var(--news-text);
}

.news-page__title {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.news-page .container {
    max-width: var(--news-site-width);
    margin: 0 auto;
    padding: 0 2rem;
    box-sizing: border-box;
}

/* ---------- Three-column layout ---------- */
.news-layout {
    display: grid;
    grid-template-columns: 148px minmax(0, 1fr) 260px;
    gap: 1.5rem;
    padding: 1.5rem 0 3rem;
    align-items: start;
}

/* ---------- Left: sspai category nav ---------- */
.news-nav {
    position: sticky;
    top: 1.5rem;
}

.news-nav__list {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.news-nav__item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: none;
    border-radius: var(--news-radius);
    background: transparent;
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--news-text-muted);
    cursor: pointer;
    text-align: left;
    transition: color 0.15s, background 0.15s;
}

.news-nav__item:hover {
    color: var(--news-text);
    background: var(--news-bg-soft);
}

.news-nav__item.is-active {
    color: var(--news-primary);
    font-weight: 600;
    background: var(--news-bg-soft);
}

.news-nav__icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.55;
}

.news-nav__item.is-active .news-nav__icon {
    opacity: 1;
}

/* ---------- Center: sspai feed list ---------- */
.news-feed {
    min-width: 0;
}

.feed-list {
    display: flex;
    flex-direction: column;
}

.feed-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.25rem;
    padding: 1.35rem 0;
    border-bottom: 1px solid var(--news-border);
}

.feed-item:first-child {
    padding-top: 0.5rem;
}

.feed-item__main {
    flex: 1;
    min-width: 0;
}

.feed-item__title {
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.45;
    margin: 0 0 0.65rem;
    color: var(--news-primary);
}

.feed-item__title a {
    color: inherit;
    text-decoration: none;
}

.feed-item__title a:hover {
    color: var(--news-accent);
}

.feed-item__time {
    display: block;
    font-size: 0.8rem;
    color: var(--news-text-muted);
    margin: 0.2rem 0 0.55rem;
}

.feed-item__excerpt {
    font-size: 0.88rem;
    line-height: 1.55;
    color: var(--news-text-muted);
    margin: 0 0 0.65rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.feed-item__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.feed-item__tag {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--news-accent-blue);
    background: var(--news-bg-soft);
    border: none;
    border-radius: 4px;
    line-height: 1.4;
}

.feed-item__tag--link {
    text-decoration: none;
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
}

.feed-item__tag--link:hover {
    color: #fff;
    background: var(--news-accent-blue);
}

.feed-item__thumb {
    flex-shrink: 0;
    display: block;
    width: 148px;
    height: 94px;
    border-radius: var(--news-radius);
    overflow: hidden;
    background: var(--news-bg-soft);
}

.feed-item__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.feed-item__thumb.is-broken {
    display: none;
}

/* ==========================================================================
   Opinion 卡片：加粗简介（可点）+ 时间 + 作者昵称，与 news 卡片结构统一
   ========================================================================== */
.feed-item--opinion {
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
    padding: 1.4rem 0;
}

/* opinion 正文：加粗展示，整块可点击 */
.feed-item__excerpt--opinion {
    display: block;
    -webkit-line-clamp: initial;
    -webkit-box-orient: initial;
    overflow: visible;
    margin: 0 0 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.6;
    color: var(--news-text);
}

.feed-item__excerpt--opinion a {
    color: inherit;
    text-decoration: none;
    display: block;
}

.feed-item__excerpt--opinion a:hover {
    color: var(--news-accent);
}

/* opinion 元信息行：时间一行、用户（头像+昵称）单独一行 */
.opinion-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem 0.75rem;
    margin: 0.2rem 0 0.9rem;
}

.opinion-meta__time {
    font-size: 0.8rem;
    color: var(--news-text-muted);
    font-variant-numeric: tabular-nums;
}

.opinion-meta__author {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--news-text);
}

.opinion-meta__avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.opinion-meta__avatar.is-broken {
    display: none;
}

/* 无头像时：首字母圆形头像（纯 CSS，无需图片资源） */
.opinion-meta__avatar--initial {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(25, 86, 255, 0.1);
    color: var(--news-accent);
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    user-select: none;
}

.opinion-thumb {
    display: block;
    width: 100%;
    max-height: 360px;
    border-radius: var(--news-radius);
    overflow: hidden;
    background: var(--news-bg-soft);
}

.opinion-thumb img {
    width: 100%;
    max-height: 360px;
    object-fit: cover;
    display: block;
}

.opinion-thumb.is-broken {
    display: none;
}

/* ---------- View More button (outline style) ---------- */
.feed-more-wrap {
    display: flex;
    justify-content: center;
    padding: 2rem 0 0.5rem;
    margin-top: 0;
}

.feed-more-wrap[hidden] {
    display: none;
}

.feed-more-btn {
    appearance: none;
    display: inline-block;
    min-width: 200px;
    padding: 0.65rem 2.25rem;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 400;
    color: #7eb8e8;
    background: #fff;
    border: 1px solid #7eb8e8;
    border-radius: 2px;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.feed-more-btn:hover:not(:disabled) {
    color: #1956ff;
    border-color: #1956ff;
    background: #fff;
}

.feed-more-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* SEO 归档入口：远离 View More 按钮，避免移动端误触导致整页跳转 */
.feed-crawl-links {
    margin-top: 2.5rem;
    padding: 1rem 0 0.5rem;
    text-align: center;
    font-size: 13px;
}

/* ---------- Loader / empty ---------- */
.feed-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 1.5rem 0;
    color: var(--news-text-muted);
    font-size: 0.85rem;
}

.feed-loader[hidden] {
    display: none;
}

.feed-loader__spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--news-border);
    border-top-color: var(--news-accent);
    border-radius: 50%;
    animation: news-spin 0.8s linear infinite;
}

@keyframes news-spin {
    to { transform: rotate(360deg); }
}

.feed-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--news-text-muted);
}

.feed-empty__icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.feed-empty h3 {
    margin: 0 0 0.35rem;
    color: var(--news-text);
}

.feed-empty p {
    margin: 0;
    font-size: 0.88rem;
}

/* ---------- Right sidebar ---------- */
.news-sidebar--right {
    position: sticky;
    top: 1.5rem;
    align-self: start;
}

/* ---------- Latest Info timeline ---------- */
.price-panel {
    margin-bottom: 0;
}

.price-panel__title {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0 0 1.15rem;
    color: var(--news-primary);
}

.price-panel__title-icon {
    display: inline-block;
    position: relative;
    width: 14px;
    height: 16px;
    flex-shrink: 0;
}

.price-panel__title-icon::before,
.price-panel__title-icon::after {
    content: '';
    position: absolute;
    top: 1px;
    width: 2px;
    height: 14px;
    border-radius: 1px;
    background: var(--info-accent);
    transform: rotate(18deg);
}

.price-panel__title-icon::before {
    left: 3px;
}

.price-panel__title-icon::after {
    left: 9px;
}

.price-timeline {
    list-style: none;
    margin: 0;
    padding: 0;
    position: relative;
}

.price-timeline::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 8px;
    bottom: 8px;
    width: 1px;
    background: var(--info-line);
}

.price-timeline__item {
    position: relative;
    padding: 0 0 1.25rem 1.35rem;
}

.price-timeline__item:last-child {
    padding-bottom: 0;
}

.price-timeline__node {
    position: absolute;
    left: 5px;
    top: 0.22rem;
    transform: translateX(-50%);
    width: 11px;
    height: 11px;
    border-radius: 50%;
    border: 2px solid var(--info-accent);
    background: var(--news-bg);
    box-sizing: border-box;
}

.price-timeline__node::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--info-accent);
    transform: translate(-50%, -50%);
}

.price-timeline__body {
    min-width: 0;
}

.price-timeline__title {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.45;
    color: var(--news-primary);
    text-decoration: none;
    margin-bottom: 0.25rem;
}

.price-timeline__title:hover {
    color: var(--news-accent);
}

.price-timeline__meta {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.35rem 0.5rem;
}

.price-timeline__time {
    font-size: 0.75rem;
    color: var(--news-text-light);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.price-timeline__product {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--news-text-muted);
}

.price-timeline__product--link {
    text-decoration: none;
    cursor: pointer;
    transition: color 0.15s ease;
}

.price-timeline__product--link:hover {
    color: var(--news-accent);
    text-decoration: underline;
}

.price-timeline__empty {
    padding: 1rem 0;
    font-size: 0.82rem;
    color: var(--news-text-muted);
}

/* ---------- Trending ---------- */
.trending-panel__title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 0.85rem;
    color: var(--news-primary);
}

.ranking-list {
    list-style: none;
    counter-reset: rank;
    margin: 0;
    padding: 0;
}

.ranking-item {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.55rem 0;
    border-bottom: 1px dashed var(--news-border);
}

.ranking-item:last-child {
    border-bottom: none;
}

.ranking-item__num {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--news-text-light);
    background: var(--news-bg-soft);
    border-radius: 4px;
}

.ranking-item__num.is-top {
    color: #fff;
    background: var(--news-accent);
}

.ranking-item__link {
    font-size: 0.84rem;
    line-height: 1.45;
    color: var(--news-text);
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ranking-item__link:hover {
    color: var(--news-accent);
}

.ranking-item--empty {
    color: var(--news-text-muted);
    font-size: 0.82rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .news-layout {
        grid-template-columns: 132px minmax(0, 1fr);
        gap: 1.25rem;
    }
    .news-sidebar--right {
        display: none;
    }
}

@media (max-width: 768px) {
    .news-page .container {
        padding: 0 1rem;
    }

    .news-layout {
        grid-template-columns: 1fr;
        gap: 0;
        padding: 1rem 0 2.5rem;
    }
    .news-nav {
        position: static;
        margin-bottom: 0.9rem;
        border-bottom: 0;
        padding-bottom: 0;
    }
    /* 移动端 tab：三个栏目平分一行，不横向滚动；隐藏图标省空间；胶囊选中态 */
    .news-nav__list {
        flex-direction: row;
        overflow-x: visible;
        gap: 0;
        padding: 0.2rem;
        background: var(--news-bg-soft);
        border-radius: 10px;
    }
    .news-nav__item {
        flex: 1 1 0;
        min-width: 0;
        justify-content: center;
        padding: 0.5rem 0.25rem;
        font-size: 0.86rem;
        border-radius: 8px;
        transition: color 0.15s, background 0.15s, box-shadow 0.15s;
    }
    .news-nav__item + .news-nav__item {
        margin-left: 0.2rem;
    }
    .news-nav__icon {
        display: none;
    }
    .news-nav__item.is-active {
        background: #fff;
        box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1);
    }
    .news-nav__item span {
        display: block;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .feed-item {
        flex-direction: column-reverse;
        gap: 0.75rem;
        padding: 1.1rem 0;
    }
    .feed-item--opinion {
        flex-direction: column;
    }
    .feed-item__thumb {
        width: 100%;
        height: 180px;
    }
    .feed-item__title {
        font-size: 1.05rem;
    }
    .feed-more-btn {
        min-width: 180px;
        padding: 0.65rem 2rem;
        font-size: 0.88rem;
    }
}

/* Hide legacy sections if cached */
.news-hero,
.news-page__header,
.product-tags-section,
.latest-news-section,
.product-chips { display: none; }
