/* ============================================================
   NewsCMS 前台样式
   设计风格：大气 · 高端 · 简洁 · 多端自适应
   ============================================================ */

/* ---------- 设计变量 ---------- */
:root {
    --ink:        #0f172a;   /* 主文字/深色 */
    --ink-2:      #1e293b;
    --text:       #1f2937;
    --text-sub:   #5b6472;
    --text-mut:   #94a3b8;
    --bg:         #f5f6f8;    /* 页面底色 */
    --bg-soft:    #eef1f5;
    --card:       #ffffff;
    --border:     #e6e9ef;
    --border-2:   #eef1f6;

    --brand:      #2f54eb;   /* 品牌主色（知性蓝） */
    --brand-dark: #1d3ec0;
    --brand-soft: #eaf0ff;
    --gold:       #b8860b;   /* 点缀（热点/高端感） */

    --red:        #e23b3b;
    --green:      #16a34a;
    --orange:     #f59e0b;

    --radius:     14px;
    --radius-sm:  9px;
    --radius-pill: 999px;

    --shadow:     0 1px 2px rgba(15,23,42,.04), 0 6px 18px rgba(15,23,42,.06);
    --shadow-hov: 0 8px 28px rgba(15,23,42,.12);
    --ring:       0 0 0 3px rgba(47,84,235,.15);

    --header-h:   66px;
    --maxw:       1180px;
    --ease:       .22s cubic-bezier(.4,0,.2,1);
}

/* ---------- 基础重置 ---------- */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.7;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: var(--brand); text-decoration: none; transition: color var(--ease); }
a:hover { color: var(--brand-dark); }

img { max-width: 100%; height: auto; display: block; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }

/* ============================================================
   头部导航
   ============================================================ */
.site-header {
    position: sticky; top: 0; z-index: 200;
    background: rgba(255,255,255,.86);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
}
.nav-wrap {
    display: flex; align-items: center; gap: 18px;
    height: var(--header-h);
}
.logo {
    font-size: 21px; font-weight: 800; letter-spacing: .3px;
    color: var(--ink); white-space: nowrap; flex-shrink: 0;
    display: inline-flex; align-items: center; gap: 8px;
}
.logo::before {
    content: ""; width: 12px; height: 12px; border-radius: 4px;
    background: linear-gradient(135deg, var(--brand), #6f8bff);
    box-shadow: 0 2px 8px rgba(47,84,235,.45);
}
.logo:hover { color: var(--ink); }

.main-nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.main-nav > a {
    padding: 9px 15px; border-radius: var(--radius-pill);
    color: var(--text-sub); font-size: 15px; font-weight: 600;
    white-space: nowrap; transition: background var(--ease), color var(--ease);
}
.main-nav > a:hover { background: var(--brand-soft); color: var(--brand); }
.main-nav > a.active { color: var(--brand); background: var(--brand-soft); }

.search-box {
    display: flex; align-items: center; gap: 4px;
    background: var(--bg-soft); border: 1px solid var(--border);
    border-radius: var(--radius-pill); padding: 5px 6px 5px 16px;
    transition: box-shadow var(--ease), border-color var(--ease);
    flex-shrink: 0;
}
.search-box:focus-within { border-color: var(--brand); box-shadow: var(--ring); background:#fff; }
.search-box input {
    border: none; background: transparent; outline: none;
    font-size: 14px; width: 150px; color: var(--text);
}
.search-box button {
    border: none; background: var(--brand); color: #fff;
    width: 34px; height: 34px; border-radius: 50%; cursor: pointer;
    font-size: 15px; transition: background var(--ease);
}
.search-box button:hover { background: var(--brand-dark); }

.nav-toggle {
    display: none; flex-direction: column; gap: 5px;
    width: 42px; height: 42px; align-items: center; justify-content: center;
    background: var(--bg-soft); border: 1px solid var(--border);
    border-radius: 10px; cursor: pointer; flex-shrink: 0;
}
.nav-toggle span { width: 20px; height: 2px; background: var(--ink); border-radius: 2px; transition: var(--ease); }

/* ============================================================
   主体布局
   ============================================================ */
.site-main { padding: 28px 0 8px; min-height: 50vh; }

/* ---------- Hero ---------- */
.hero {
    position: relative; overflow: hidden;
    border-radius: 22px; margin-bottom: 38px;
    background:
        radial-gradient(1200px 400px at 80% -10%, rgba(111,139,255,.35), transparent 60%),
        linear-gradient(135deg, #0f172a 0%, #1e2a52 55%, #243b8f 100%);
    color: #fff;
}
.hero-inner { padding: 64px 44px; max-width: 760px; }
.hero h1 {
    font-size: clamp(28px, 4.4vw, 46px); line-height: 1.25;
    font-weight: 800; letter-spacing: .5px; margin-bottom: 14px;
}
.hero p { font-size: clamp(15px, 1.8vw, 19px); color: rgba(255,255,255,.82); margin-bottom: 26px; }
.hero-search { display: flex; max-width: 480px; background: #fff; border-radius: var(--radius-pill); padding: 6px; gap: 6px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.hero-search input { flex: 1; border: none; outline: none; background: transparent; padding: 0 16px; font-size: 15px; color: var(--ink); }
.hero-search button {
    border: none; background: var(--brand); color: #fff;
    padding: 0 24px; border-radius: var(--radius-pill); font-size: 15px; font-weight: 600; cursor: pointer;
    transition: background var(--ease);
}
.hero-search button:hover { background: var(--brand-dark); }

/* ---------- Section ---------- */
.section { margin-bottom: 40px; }
.section-title {
    font-size: 22px; font-weight: 800; color: var(--ink);
    margin-bottom: 20px; display: flex; align-items: center; gap: 12px;
}
.section-title::before {
    content: ""; width: 6px; height: 22px; border-radius: 4px;
    background: linear-gradient(180deg, var(--brand), #6f8bff);
}
.section-title .more { margin-left: auto; font-size: 14px; font-weight: 600; }
.section-title .more a { color: var(--text-mut); }
.section-title .more a:hover { color: var(--brand); }

/* ---------- 卡片网格 ---------- */
.card-grid {
    display: grid; gap: 22px;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
}
.news-card {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
    display: flex; flex-direction: column;
    transition: transform var(--ease), box-shadow var(--ease), border-color var(--ease);
}
.news-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hov); border-color: #d7defb; }
.card-thumb { display: block; aspect-ratio: 16/10; background: var(--bg-soft); overflow: hidden; }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.news-card:hover .card-thumb img { transform: scale(1.06); }
.thumb-ph {
    width: 100%; height: 100%;
    background: linear-gradient(135deg, #e9eefb, #f4f6fb);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-mut); font-size: 13px;
}
.card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; flex: 1; }
.card-cat {
    align-self: flex-start; font-size: 12px; font-weight: 700; color: var(--brand);
    background: var(--brand-soft); padding: 3px 10px; border-radius: var(--radius-pill); margin-bottom: 10px;
}
.card-title { font-size: 17px; font-weight: 700; line-height: 1.45; margin-bottom: 8px; }
.card-title a { color: var(--ink); }
.card-title a:hover { color: var(--brand); }
.card-summary { color: var(--text-sub); font-size: 14px; line-height: 1.65; flex: 1; }
.card-meta {
    display: flex; align-items: center; gap: 12px; margin-top: 14px;
    font-size: 13px; color: var(--text-mut); flex-wrap: wrap;
}
.tag-hot {
    margin-left: auto; font-size: 12px; font-weight: 700; color: #fff;
    background: linear-gradient(135deg, #f0452f, #ff8a3d); padding: 2px 9px; border-radius: var(--radius-pill);
}

/* ---------- 热点列表 ---------- */
.hot-list { list-style: none; display: flex; flex-direction: column; gap: 2px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 6px; }
.hot-list li { display: flex; align-items: center; gap: 14px; padding: 11px 14px; border-radius: var(--radius-sm); transition: background var(--ease); }
.hot-list li:hover { background: var(--bg-soft); }
.hot-rank { font-size: 15px; font-weight: 800; color: var(--text-mut); width: 22px; text-align: center; flex-shrink: 0; }
.hot-list li:nth-child(1) .hot-rank { color: var(--red); }
.hot-list li:nth-child(2) .hot-rank { color: var(--orange); }
.hot-list li:nth-child(3) .hot-rank { color: var(--gold); }
.hot-list li a { flex: 1; color: var(--text); font-size: 15px; line-height: 1.45; }
.hot-list li a:hover { color: var(--brand); }
.hot-views { font-size: 13px; color: var(--text-mut); flex-shrink: 0; }

/* ---------- 分页 ---------- */
.pagination { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; padding: 30px 0 8px; }
.pagination a {
    min-width: 40px; height: 40px; padding: 0 12px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--border); border-radius: 10px; color: var(--text-sub);
    background: #fff; font-size: 14px; font-weight: 600; transition: var(--ease);
}
.pagination a:hover { border-color: var(--brand); color: var(--brand); }
.pagination a.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ============================================================
   内容详情布局（文章 / 分类 / 搜索）
   ============================================================ */
.content-wrap { display: flex; gap: 28px; align-items: flex-start; }
.main-content { flex: 1; min-width: 0; }
.sidebar { width: 320px; flex-shrink: 0; }

.breadcrumb { padding: 4px 0 18px; font-size: 13px; color: var(--text-mut); }
.breadcrumb a { color: var(--text-sub); }
.breadcrumb a:hover { color: var(--brand); }
.breadcrumb .sep { margin: 0 8px; color: var(--text-mut); }
.breadcrumb .current { color: var(--text); }

.page-head { margin-bottom: 20px; }
.page-title { font-size: 26px; font-weight: 800; color: var(--ink); }
.page-desc { color: var(--text-sub); margin-top: 6px; }
.search-info { color: var(--text-sub); margin-bottom: 18px; }
.search-info b { color: var(--brand); }

/* ---------- 文章详情 ---------- */
.article-detail {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 36px 38px; box-shadow: var(--shadow);
}
.article-title { font-size: clamp(24px, 3vw, 32px); font-weight: 800; line-height: 1.4; color: var(--ink); margin-bottom: 18px; }
.article-meta {
    display: flex; flex-wrap: wrap; gap: 18px; align-items: center;
    padding-bottom: 18px; margin-bottom: 24px;
    border-bottom: 1px solid var(--border-2);
    font-size: 14px; color: var(--text-mut);
}
.article-meta .meta-label { color: var(--text-mut); }
.meta-badge { display: inline-block; padding: 2px 10px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 700; }
.meta-badge.original { background: var(--gold); color: #fff; }
.article-image { margin: 6px 0 26px; border-radius: var(--radius-sm); overflow: hidden; }
.article-body { font-size: 17px; line-height: 1.95; color: var(--text); }
.article-body p { margin-bottom: 18px; }
.article-body img { border-radius: var(--radius-sm); margin: 18px 0; }
.article-body h2, .article-body h3 { margin: 28px 0 14px; color: var(--ink); line-height: 1.4; }
.article-body a { color: var(--brand); text-decoration: underline; }
.article-footer {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; padding-top: 24px; margin-top: 28px; border-top: 1px solid var(--border-2); flex-wrap: wrap;
}
.article-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.article-tag { padding: 5px 14px; background: var(--brand-soft); color: var(--brand); border-radius: var(--radius-pill); font-size: 13px; font-weight: 600; }
.share-btn {
    border: 1px solid var(--border); background: #fff; padding: 8px 18px;
    border-radius: var(--radius-pill); cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-sub);
    transition: var(--ease);
}
.share-btn:hover { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ---------- 相关文章 ---------- */
.related-articles { margin-top: 26px; }
.related-list { display: flex; flex-direction: column; gap: 8px; }
.related-item {
    display: flex; align-items: center; gap: 12px; justify-content: space-between;
    padding: 13px 16px; background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius-sm); transition: var(--ease);
}
.related-item:hover { background: var(--brand-soft); border-color: #d7defb; }
.related-title { color: var(--text); font-size: 15px; line-height: 1.45; flex: 1; }
.related-item:hover .related-title { color: var(--brand); }
.related-time { font-size: 13px; color: var(--text-mut); flex-shrink: 0; margin-left: 12px; }

/* ---------- 侧边栏 ---------- */
.sidebar-block {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px; margin-bottom: 22px; box-shadow: var(--shadow);
}
.sidebar-title {
    font-size: 16px; font-weight: 800; color: var(--ink); margin-bottom: 14px;
    padding-bottom: 12px; border-bottom: 1px solid var(--border-2);
    display: flex; align-items: center; gap: 8px;
}
.sidebar-title::before { content: ""; width: 5px; height: 16px; border-radius: 3px; background: var(--brand); }
.latest-list { list-style: none; }
.latest-list li { padding: 10px 0; border-bottom: 1px dashed var(--border-2); }
.latest-list li:last-child { border-bottom: none; }
.latest-list a { display: block; color: var(--text); font-size: 14px; line-height: 1.5; transition: color var(--ease); }
.latest-list a:hover { color: var(--brand); }
.latest-time { display: block; font-size: 12px; color: var(--text-mut); margin-top: 3px; }

/* ---------- 文章列表（分类/搜索页） ---------- */
.article-list { display: flex; flex-direction: column; gap: 16px; }
.article-row {
    display: flex; gap: 18px; background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden; padding: 16px; transition: var(--ease);
}
.article-row:hover { box-shadow: var(--shadow-hov); transform: translateY(-2px); border-color: #d7defb; }
.article-row .row-thumb { width: 200px; flex-shrink: 0; aspect-ratio: 16/10; border-radius: var(--radius-sm); overflow: hidden; background: var(--bg-soft); }
.article-row .row-thumb img { width: 100%; height: 100%; object-fit: cover; }
.article-row .row-body { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.article-row .row-cat { align-self: flex-start; font-size: 12px; font-weight: 700; color: var(--brand); background: var(--brand-soft); padding: 2px 10px; border-radius: var(--radius-pill); margin-bottom: 8px; }
.article-row .row-title { font-size: 18px; font-weight: 700; line-height: 1.4; margin-bottom: 8px; }
.article-row .row-title a { color: var(--ink); }
.article-row .row-title a:hover { color: var(--brand); }
.article-row .row-summary { color: var(--text-sub); font-size: 14px; line-height: 1.6; flex: 1; }
.article-row .row-meta { display: flex; gap: 14px; margin-top: 12px; font-size: 13px; color: var(--text-mut); }

/* ---------- 空状态 ---------- */
.empty-state { text-align: center; padding: 70px 20px; color: var(--text-mut); background: var(--card); border: 1px dashed var(--border); border-radius: var(--radius); }
.empty-icon { font-size: 46px; margin-bottom: 14px; }
.empty-hint { font-size: 14px; margin-top: 6px; }

/* ============================================================
   页脚
   ============================================================ */
.site-footer { background: var(--ink); color: rgba(255,255,255,.72); padding: 40px 0 30px; margin-top: 50px; font-size: 14px; }
.site-footer .foot-cats { display: flex; flex-wrap: wrap; gap: 10px 22px; justify-content: center; margin-bottom: 18px; }
.site-footer .foot-cats a { color: rgba(255,255,255,.78); font-size: 14px; }
.site-footer .foot-cats a:hover { color: #fff; }
.site-footer .foot-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: center; align-items: center; font-size: 13px; color: rgba(255,255,255,.55); }
.site-footer .foot-meta a { color: rgba(255,255,255,.72); }
.site-footer .foot-meta a:hover { color: #fff; }
.site-footer .icp a { border-bottom: 1px dotted rgba(255,255,255,.4); }

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 980px) {
    .sidebar { width: 280px; }
    .article-row .row-thumb { width: 160px; }
}

@media (max-width: 768px) {
    .nav-toggle { display: flex; }
    .main-nav {
        position: fixed; top: var(--header-h); left: 0; right: 0;
        flex-direction: column; align-items: stretch; gap: 2px;
        background: #fff; border-bottom: 1px solid var(--border);
        padding: 10px 16px; box-shadow: var(--shadow-hov);
        transform: translateY(-12px); opacity: 0; pointer-events: none;
        transition: transform var(--ease), opacity var(--ease); z-index: 199;
        max-height: calc(100vh - var(--header-h)); overflow-y: auto;
    }
    .main-nav.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
    .main-nav > a { padding: 13px 14px; border-radius: 10px; }

    .search-box { display: none; }

    .hero-inner { padding: 44px 24px; }
    .content-wrap { flex-direction: column; }
    .sidebar { width: 100%; }
    .article-detail { padding: 24px 18px; }
    .article-body { font-size: 16px; }
    .card-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
    .article-row { flex-direction: column; }
    .article-row .row-thumb { width: 100%; aspect-ratio: 16/9; }
}

@media (max-width: 480px) {
    .container { padding: 0 14px; }
    .logo { font-size: 18px; }
    .section-title { font-size: 19px; }
    .article-detail { padding: 18px 14px; }
    .article-title { font-size: 22px; }
    .pagination a { min-width: 36px; height: 36px; padding: 0 9px; font-size: 13px; }
}
