﻿/* =========================================================
   前端动态栏目样式 news.css（类名前缀 nw-，依赖 site.css 的 af- 设计变量）
   由 tools/gen-news.mjs 生成的页面使用
   ========================================================= */

/* ---------- 栏目头部 ---------- */
.nw-hero { padding: 52px 0 40px; }
.nw-hero h1 { font-size: clamp(28px, 4vw, 42px); margin-bottom: 12px; }
.nw-hero .nw-lead { font-size: 17px; color: var(--af-muted); max-width: 720px; }
.nw-hero-row { display: flex; gap: 28px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; }
.nw-search { position: relative; width: 340px; max-width: 100%; }
.nw-search input { width: 100%; height: 46px; padding: 0 16px 0 44px; border: 1px solid var(--af-line); border-radius: 12px; font-size: 15px; font-family: inherit; background: #fff; color: var(--af-ink); }
.nw-search input:focus { outline: 0; border-color: var(--af-primary); box-shadow: 0 0 0 3px rgba(91, 71, 255, .15); }
.nw-search .af-ico { position: absolute; left: 15px; top: 14px; color: var(--af-muted); width: 18px; height: 18px; }
.nw-search-result { display: none; margin-top: 28px; }
.nw-search-result.is-on { display: block; }
.nw-search-result h2 { font-size: 18px; margin-bottom: 14px; }
.nw-empty { padding: 28px; text-align: center; color: var(--af-muted); border: 1px dashed var(--af-line); border-radius: var(--af-radius); background: #fff; }

/* ---------- 分类导航条 ---------- */
.nw-cats { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 22px; }
.nw-cats a { padding: 6px 16px; border-radius: 999px; background: #fff; border: 1px solid var(--af-line); color: var(--af-text); font-size: 14px; font-weight: 500; text-decoration: none !important; }
.nw-cats a:hover { border-color: var(--af-primary); color: var(--af-primary); }
.nw-cats a[aria-current="page"] { background: var(--af-primary); border-color: var(--af-primary); color: #fff; }
.nw-cats small { opacity: .7; margin-left: 4px; }

/* ---------- 主体布局 ---------- */
.nw-main { padding-top: 40px; padding-bottom: 72px; }
.nw-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 36px; align-items: start; }
.nw-layout > * { min-width: 0; }
.nw-layout[hidden] { display: none; }
@media (max-width: 991px) { .nw-layout { grid-template-columns: minmax(0, 1fr); } .nw-main { padding-top: 28px; padding-bottom: 56px; } }

/* ---------- 封面（纯 CSS，无图片请求） ---------- */
.nw-cover { position: relative; overflow: hidden; background: linear-gradient(135deg, var(--c1, #6c47ff), var(--c2, #008aff)); color: #fff; display: flex; align-items: flex-end; padding: 16px 18px; min-height: 140px; }
.nw-cover::before, .nw-cover::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .14); }
.nw-cover::before { width: 180px; height: 180px; right: -50px; top: -70px; }
.nw-cover::after { width: 110px; height: 110px; left: -30px; bottom: -50px; background: rgba(255, 255, 255, .1); }
.nw-cover b { position: relative; z-index: 1; font-size: 26px; line-height: 1.15; font-weight: 800; letter-spacing: 1px; text-shadow: 0 2px 10px rgba(0, 0, 0, .18); }
.nw-cover i { position: absolute; z-index: 1; right: 16px; top: 14px; font-style: normal; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: rgba(255, 255, 255, .22); }

/* ---------- 文章卡片 ---------- */
.nw-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
@media (max-width: 640px) { .nw-grid { grid-template-columns: minmax(0, 1fr); } }
.nw-card { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--af-line); border-radius: var(--af-radius); overflow: hidden; transition: box-shadow .2s, transform .2s, border-color .2s; }
.nw-card:hover { box-shadow: var(--af-shadow); transform: translateY(-3px); border-color: #d6dcf0; }
.nw-card .nw-cover { min-height: 128px; }
.nw-card-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.nw-card h2, .nw-card h3 { font-size: 17.5px; line-height: 1.45; }
.nw-card h2 a, .nw-card h3 a { color: var(--af-ink) !important; text-decoration: none !important; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.nw-card h2 a:hover, .nw-card h3 a:hover { color: var(--af-primary) !important; }
.nw-card h2 a::after, .nw-card h3 a::after { content: ""; position: absolute; inset: 0; }
.nw-card { position: relative; }
.nw-card p { font-size: 14.5px; color: var(--af-muted); line-height: 1.65; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.nw-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--af-muted); margin-top: auto; padding-top: 4px; }
.nw-card .nw-tags { position: relative; z-index: 1; }

/* 置顶大卡 */
.nw-feature { display: grid; grid-template-columns: 5fr 6fr; margin-bottom: 22px; }
.nw-feature .nw-cover { min-height: 280px; }
.nw-feature .nw-cover b { font-size: 34px; }
.nw-feature .nw-card-body { padding: 28px 30px; justify-content: center; }
.nw-feature h2 { font-size: 24px; }
.nw-feature p { -webkit-line-clamp: 4; font-size: 15.5px; }
@media (max-width: 760px) { .nw-feature { grid-template-columns: minmax(0, 1fr); } .nw-feature .nw-cover { min-height: 160px; } .nw-feature .nw-card-body { padding: 20px; } .nw-feature h2 { font-size: 20px; } }

.nw-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.nw-tags a, .nw-tags span { font-size: 12.5px; padding: 2px 10px; border-radius: 999px; background: var(--af-bg-soft); color: var(--af-muted); border: 1px solid var(--af-line); text-decoration: none !important; }
.nw-tags a:hover { color: var(--af-primary); border-color: var(--af-primary); }

/* ---------- 侧栏 ---------- */
.nw-side { display: grid; gap: 20px; position: sticky; top: calc(var(--af-header-h) + 20px); }
@media (max-width: 991px) { .nw-side { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); } .nw-side .nw-widget--cta { grid-column: 1 / -1; } }
@media (max-width: 640px) { .nw-side { grid-template-columns: minmax(0, 1fr); } }
.nw-widget { background: #fff; border: 1px solid var(--af-line); border-radius: var(--af-radius); padding: 20px; }
.nw-widget h2, .nw-widget h3 { font-size: 16px; margin-bottom: 12px; }
.nw-widget ul li { border-top: 1px dashed var(--af-line); }
.nw-widget ul li:first-child { border-top: 0; }
.nw-widget ul a { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; color: var(--af-text); font-size: 14.5px; text-decoration: none !important; }
.nw-widget ul a:hover { color: var(--af-primary); }
.nw-widget ul small { color: var(--af-muted); }
.nw-widget--cta { background: var(--af-grad); border: 0; color: #fff; }
.nw-widget--cta h2, .nw-widget--cta h3 { color: #fff; }
.nw-widget--cta p { font-size: 14px; opacity: .92; margin-bottom: 14px; }

/* ---------- 分页 ---------- */
.nw-pager { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 36px; }
.nw-pager a, .nw-pager span { min-width: 40px; height: 40px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--af-line); border-radius: 10px; background: #fff; color: var(--af-text); font-size: 14.5px; text-decoration: none !important; }
.nw-pager a:hover { border-color: var(--af-primary); color: var(--af-primary); }
.nw-pager [aria-current="page"] { background: var(--af-primary); border-color: var(--af-primary); color: #fff; }

/* ---------- 文章页 ---------- */
.nw-progress { position: fixed; left: 0; top: 0; height: 3px; width: 0; background: var(--af-grad); z-index: 200; transition: width .1s; }
.nw-art-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 44px; align-items: start; }
.nw-art-layout > * { min-width: 0; }
.nw-art-layout--single { grid-template-columns: minmax(0, 820px); justify-content: center; }
@media (max-width: 1099px) { .nw-art-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; } .nw-toc-wrap { order: -1; position: static !important; } }
.nw-art-head { padding: 44px 0 28px; background: radial-gradient(800px 300px at 90% -20%, rgba(108, 71, 255, .13), transparent 60%), var(--af-bg-soft); border-bottom: 1px solid var(--af-line); }
.nw-art-head h1 { font-size: clamp(26px, 3.6vw, 38px); line-height: 1.32; margin: 12px 0 16px; max-width: 920px; }
.nw-art-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; color: var(--af-muted); align-items: center; }
.nw-art-meta .af-ico { width: 15px; height: 15px; margin-right: 4px; }
.nw-art-body { padding-top: 36px; padding-bottom: 56px; }

.nw-summary { background: #f6f4ff; border-left: 4px solid var(--af-primary); border-radius: 0 12px 12px 0; padding: 16px 20px; margin-bottom: 26px; color: var(--af-ink); font-size: 15.5px; line-height: 1.8; }
.nw-summary b { display: block; font-size: 13px; letter-spacing: 1px; color: var(--af-primary); margin-bottom: 4px; }
.nw-prose .nw-conclusion { background: #f6f4ff; border-left: 4px solid var(--af-primary); border-radius: 0 12px 12px 0; padding: 16px 20px; margin-bottom: 26px; color: var(--af-ink); font-size: 16.5px; line-height: 1.85; }
.nw-ai { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; background: #fff8e8; border: 1px solid #fde3a7; color: #7a4b00; border-radius: 10px; padding: 10px 14px; margin-bottom: 22px; }
.nw-ai .af-ico { margin-top: 4px; }

.nw-toc-wrap { position: sticky; top: calc(var(--af-header-h) + 20px); max-height: calc(100vh - var(--af-header-h) - 40px); overflow-y: auto; }
.nw-toc { background: #fff; border: 1px solid var(--af-line); border-radius: var(--af-radius); padding: 14px 18px; }
.nw-toc summary { cursor: pointer; font-weight: 700; color: var(--af-ink); font-size: 15px; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.nw-toc summary::-webkit-details-marker { display: none; }
.nw-toc summary::after { content: "+"; color: var(--af-muted); font-size: 20px; line-height: 1; }
.nw-toc[open] summary::after { content: "−"; }
.nw-toc ol { list-style: none; margin: 10px 0 0; padding: 0; }
.nw-toc li a { display: block; padding: 6px 0 6px 12px; border-left: 2px solid var(--af-line); color: var(--af-text); font-size: 14px; line-height: 1.5; text-decoration: none !important; }
.nw-toc li a:hover { color: var(--af-primary); }
.nw-toc li a.is-active { border-left-color: var(--af-primary); color: var(--af-primary); font-weight: 600; }

/* 正文排版 */
.nw-prose { font-size: 17px; line-height: 1.9; color: #243044; overflow-wrap: anywhere; }
.nw-prose > :first-child { margin-top: 0; }
.nw-prose p { margin: 0 0 18px; }
.nw-prose h2 { font-size: 24px; margin: 44px 0 16px; padding-left: 14px; border-left: 5px solid var(--af-primary); line-height: 1.4; scroll-margin-top: calc(var(--af-header-h) + 16px); }
.nw-prose h3 { font-size: 19px; margin: 30px 0 12px; scroll-margin-top: calc(var(--af-header-h) + 16px); }
.nw-prose h4 { font-size: 17px; margin: 24px 0 10px; }
.nw-prose ul { list-style: disc; padding-left: 24px; margin: 0 0 18px; }
.nw-prose ol { list-style: decimal; padding-left: 24px; margin: 0 0 18px; }
.nw-prose li { margin-bottom: 8px; }
.nw-prose li > ul, .nw-prose li > ol { margin: 8px 0 0; }
.nw-prose strong { color: var(--af-ink); }
.nw-prose a { text-decoration: underline; text-underline-offset: 3px; word-break: break-all; }
.nw-prose code { font-family: var(--af-mono); font-size: .88em; background: #f1f4fb; color: var(--af-primary-dark); padding: 2px 6px; border-radius: 5px; word-break: break-word; }
.nw-prose blockquote { margin: 0 0 18px; padding: 12px 18px; border-left: 4px solid var(--af-line); background: var(--af-bg-soft); color: var(--af-muted); border-radius: 0 10px 10px 0; }
.nw-prose blockquote p:last-child { margin-bottom: 0; }
.nw-prose hr { border: 0; border-top: 1px solid var(--af-line); margin: 32px 0; }
.nw-prose .af-code { margin: 0 0 22px; box-shadow: none; }
.nw-prose .af-code code { background: none; color: inherit; padding: 0; font-size: inherit; word-break: normal; }
.nw-prose .af-code pre { font-size: 13.5px; line-height: 1.7; }
.nw-tablewrap { overflow-x: auto; margin: 0 0 22px; border: 1px solid var(--af-line); border-radius: 12px; -webkit-overflow-scrolling: touch; }
.nw-prose table { border-collapse: collapse; width: 100%; min-width: 480px; font-size: 14.5px; line-height: 1.65; }
.nw-prose th, .nw-prose td { padding: 11px 16px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--af-line); }
.nw-prose thead th { background: var(--af-bg-soft); color: var(--af-ink); white-space: nowrap; }
.nw-prose tbody tr:last-child td { border-bottom: 0; }
.nw-prose tbody tr:nth-child(even) td { background: #fafbfe; }
@media (max-width: 640px) { .nw-prose { font-size: 16px; line-height: 1.85; } .nw-prose h2 { font-size: 21px; margin-top: 36px; } }

/* 文末模块 */
.nw-end { margin-top: 36px; display: grid; gap: 22px; }
.nw-box { border: 1px solid var(--af-line); border-radius: var(--af-radius); padding: 20px 22px; background: #fff; }
.nw-box h2 { font-size: 16px; margin-bottom: 10px; }
.nw-box ol, .nw-box ul { list-style: none; display: grid; gap: 8px; font-size: 14.5px; }
.nw-box li a { overflow-wrap: anywhere; }
.nw-box small { color: var(--af-muted); margin-left: 6px; }
.nw-product { background: linear-gradient(135deg, #f6f4ff, #eaf5ff); border-color: #dcd7ff; }
.nw-product p { font-size: 14.5px; color: var(--af-text); margin-bottom: 12px; }
.nw-product .af-hero-actions { gap: 10px; }
.nw-pn { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .nw-pn { grid-template-columns: minmax(0, 1fr); } }
.nw-pn a { display: block; padding: 16px 18px; border: 1px solid var(--af-line); border-radius: var(--af-radius); background: #fff; color: var(--af-ink) !important; text-decoration: none !important; line-height: 1.5; font-weight: 600; font-size: 15px; }
.nw-pn a:hover { border-color: var(--af-primary); box-shadow: var(--af-shadow); }
.nw-pn a small { display: block; color: var(--af-muted); font-weight: 400; font-size: 12.5px; margin-bottom: 4px; }
.nw-pn a:last-child { text-align: right; }
.nw-pn .is-empty { visibility: hidden; }
.nw-related-title { font-size: 20px; margin: 0 0 16px; }

@media print { .af-header, .af-footer, .nw-side, .nw-toc-wrap, .nw-progress { display: none !important; } }
