﻿/* ==========================================================================
   BasicCMS - 公共骨架样式（base.css）
   --------------------------------------------------------------------------
   职责：重置、栅格容器、共享内容组件（列表 / 卡片 / 详情 / 侧栏 / 面包屑）的
        纯结构与间距，以及三档响应式断点（≥1200 / ≥992 / <992 单列）。
   约定：本文件不含任何品牌色。所有配色、字体、装饰由 Content/themes/*.css 通过
        下面的 CSS 自定义属性（--color-* / --radius / --shadow ...）注入。
   ========================================================================== */

:root {
    /* ---- 主题可覆盖的设计令牌（默认值偏中性，主题缺失时也不会崩坏） ---- */
    --color-primary: #1a3a6b;
    --color-accent: #c41e2a;
    --color-text: #1f2937;
    --color-muted: #6b7280;
    --color-bg: #f5f7fa;
    --color-surface: #ffffff;
    --color-border: #e5e7eb;
    --radius-sm: 4px;
    --radius: 8px;
    --radius-lg: 14px;
    --shadow: 0 2px 12px rgba(15, 23, 42, .06);
    --shadow-hover: 0 10px 28px rgba(15, 23, 42, .12);
    --font-body: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Source Han Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-heading: var(--font-body);
    --container: 1220px;
    --sidebar: 300px;
    --gap: 24px;
    --transition: .22s ease;
}

/* ------------------------------ 基础重置 ------------------------------ */
* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.75;
    color: var(--color-text);
    background: var(--color-bg);
}

h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-family: var(--font-heading);
    line-height: 1.4;
    font-weight: 700;
    color: var(--color-text);
}

p { margin: 0 0 .8em; }
p:last-child { margin-bottom: 0; }

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition);
}

a:hover { color: var(--color-primary); }

img { max-width: 100%; height: auto; border: 0; }

ul, ol { margin: 0; padding: 0; list-style: none; }

.container {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 20px;
}

/* --------------------------- 主内容区 / 栅格 --------------------------- */
.main-content {
    padding: 24px 0 40px;
    min-height: 320px;
}

.content-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--sidebar);
    gap: var(--gap);
    align-items: start;
}

.content-main { min-width: 0; }
.content-sidebar { min-width: 0; }

/* ------------------------------ 滚动公告 ------------------------------ */
.scroll-notice {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    margin-bottom: var(--gap);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-accent);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.scroll-notice .notice-icon {
    flex-shrink: 0;
    font-size: 13px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 999px;
    color: #fff;
    background: var(--color-accent);
}

.scroll-notice .notice-content {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 14px;
}

.scroll-notice .notice-content a:hover { color: var(--color-accent); }

/* ------------------------------- 卡片 -------------------------------- */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: var(--gap);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--color-border);
}

.card-header h3 { font-size: 17px; position: relative; }

.card-body { padding: 16px 20px; }

/* --------------------------- 头条 / 列表容器 --------------------------- */
.top-news {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: var(--gap);
}

.top-news-item { padding: 20px 20px 14px; }

.top-news-item h3 {
    font-size: 20px;
    margin-bottom: 10px;
    text-align: center;
}

.top-news-item h3 a:hover { color: var(--color-accent); }

.summary {
    color: var(--color-muted);
    font-size: 14px;
    line-height: 1.9;
    text-align: center;
    margin-bottom: 10px;
}

.meta,
.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 13px;
    color: var(--color-muted);
    justify-content: center;
}

/* 通用新闻列表：标题省略 + 日期右对齐 */
/* 位于头条容器（.top-news）内时与 .card-body 一致留出左右边距 */
.top-news .news-list { padding: 2px 20px 12px; }

.news-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
    border-bottom: 1px dashed var(--color-border);
    font-size: 15px;
}

.news-list li:last-child { border-bottom: 0; }

.news-list li > a {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.news-list .category-tag {
    flex-shrink: 0;
    font-size: 12px;
    padding: 1px 8px;
    border-radius: var(--radius-sm);
    color: #fff;
    background: var(--color-primary);
}

.news-list .bullet {
    flex-shrink: 0;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-accent);
}

.news-list .date {
    flex-shrink: 0;
    font-size: 13px;
    color: var(--color-muted);
    font-variant-numeric: tabular-nums;
}

/* 分类页列表 */
.category-list li {
    padding: 16px 0;
    border-bottom: 1px solid var(--color-border);
}

.category-list li:last-child { border-bottom: 0; }

.category-list h4 { font-size: 17px; margin-bottom: 6px; }

.category-list h4 a:hover { color: var(--color-accent); }

.category-list .summary { text-align: left; margin-bottom: 6px; }

.category-list .meta { justify-content: flex-start; }

/* ------------------------------ 面包屑 ------------------------------ */
.breadcrumb-nav {
    padding: 12px 0;
    font-size: 13px;
    color: var(--color-muted);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}

.breadcrumb-nav .container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.breadcrumb-nav a:hover { color: var(--color-accent); }
.breadcrumb-nav .separator { opacity: .5; }
.breadcrumb-nav .current { color: var(--color-text); font-weight: 600; }

/* ------------------------------ 侧边栏 ------------------------------ */
.sidebar-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 18px;
    overflow: hidden;
}

.sidebar-section .section-header {
    padding: 12px 16px;
    font-weight: 700;
    font-size: 15px;
    color: var(--color-surface);
    background: var(--color-primary);
}

.sidebar-section .section-body { padding: 14px 16px; }

.intro-text {
    font-size: 14px;
    line-height: 1.9;
    color: var(--color-muted);
}

.side-nav li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 0;
    border-bottom: 1px dashed var(--color-border);
    font-size: 14px;
}

.side-nav li:last-child { border-bottom: 0; }

.side-nav .count {
    flex-shrink: 0;
    font-size: 12px;
    color: var(--color-muted);
    padding: 0 8px;
    border-radius: 999px;
    background: var(--color-bg);
}

/* 热门排行 */
.hot-rank { counter-reset: none; }

.hot-rank li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
    font-size: 14px;
    line-height: 1.6;
    border-bottom: 1px dashed var(--color-border);
}

.hot-rank li:last-child { border-bottom: 0; }

.hot-rank .rank {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 700;
    color: var(--color-muted);
    background: var(--color-bg);
}

.hot-rank li.rank-top .rank { color: #fff; background: var(--color-accent); }

.hot-rank li > a {
    flex: 1;
    min-width: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 链接列表 */
.link-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.link-list a {
    font-size: 13px;
    padding: 5px 12px;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-bg);
    transition: all var(--transition);
}

.link-list a:hover {
    color: #fff;
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.empty-tip {
    margin: 0;
    font-size: 13px;
    color: var(--color-muted);
}

/* ------------------------------ 文章详情 ------------------------------ */
.article-detail {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 32px;
}

.article-title {
    font-size: 28px;
    line-height: 1.45;
    margin-bottom: 12px;
}

.article-subtitle {
    font-size: 15px;
    color: var(--color-muted);
    padding: 10px 14px;
    margin-bottom: 16px;
    border-left: 3px solid var(--color-primary);
    background: var(--color-bg);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.article-body {
    margin-top: 22px;
    font-size: 16px;
    line-height: 2;
    color: var(--color-text);
    word-wrap: break-word;
}

.article-body p { margin: 0 0 1.1em; }
.article-body img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }
.article-body h2, .article-body h3, .article-body h4 { margin: 1.4em 0 .7em; }
.article-body blockquote {
    margin: 1em 0;
    padding: 12px 18px;
    color: var(--color-muted);
    border-left: 3px solid var(--color-primary);
    background: var(--color-bg);
}
.article-body table { width: 100%; border-collapse: collapse; margin: 1em 0; }
.article-body th, .article-body td {
    border: 1px solid var(--color-border);
    padding: 8px 12px;
    font-size: 15px;
}
.article-body th { background: var(--color-bg); }
.article-body a { color: var(--color-primary); text-decoration: underline; }

.article-actions {
    margin-top: 20px;
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-print,
.btn-close {
    display: inline-block;
    padding: 9px 28px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: #fff;
    background: var(--color-primary);
    transition: opacity var(--transition), transform var(--transition);
}

.btn-close { background: var(--color-muted); }
.btn-print:hover, .btn-close:hover { opacity: .88; color: #fff; transform: translateY(-1px); }

/* 信息列表 */
.info-list li {
    padding: 9px 0;
    border-bottom: 1px dashed var(--color-border);
}

.info-list li:last-child { border-bottom: 0; }

.info-label {
    display: block;
    font-size: 12px;
    color: var(--color-muted);
}

.info-value { display: block; font-size: 14px; }

.view-count { color: var(--color-accent); font-weight: 600; }

/* ------------------------------ 空状态 ------------------------------ */
.empty-state {
    padding: 60px 20px;
    text-align: center;
    color: var(--color-muted);
    background: var(--color-surface);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius);
}

.empty-state .icon { font-size: 42px; line-height: 1; margin-bottom: 12px; opacity: .7; }
.empty-state p { margin: 0; font-size: 14px; }

/* --------------------------- 移动端导航折叠 --------------------------- */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 40px;
    height: 34px;
    padding: 0 8px;
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: var(--radius-sm);
    background: transparent;
    cursor: pointer;
}

.nav-toggle i {
    display: block;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
}

[data-collapsible] { will-change: display; }

/* ------------------------------ 响应式 ------------------------------ */
@media (max-width: 1200px) {
    .container { padding: 0 16px; }
}

/* ≤992px：主体与侧栏堆叠为单列，导航折叠为汉堡按钮 */
@media (max-width: 992px) {
    .content-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .content-sidebar { order: 2; }

    .top-news-item h3 { font-size: 18px; }

    .nav-toggle { display: inline-flex; }

    /* !important：主题皮肤中的 display:flex 会与同优先级的选择器冲突，此处必须强制折叠 */
    [data-collapsible]:not(.is-open) { display: none !important; }
    [data-collapsible].is-open { display: block !important; }
}

@media (max-width: 768px) {
    body { font-size: 14.5px; }

    .main-content { padding: 16px 0 28px; }

    .meta,
    .article-meta { gap: 10px; font-size: 12px; }

    .article-detail { padding: 20px 16px; }

    .article-title { font-size: 22px; }

    .card-body,
    .top-news-item { padding: 14px; }

    .scroll-notice { align-items: flex-start; }

    .scroll-notice .notice-content {
        white-space: normal;
        -webkit-line-clamp: 2;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .link-list a { font-size: 12px; padding: 4px 10px; }
}

/* 备案信息（页脚）：ICP + 公安备案 */
.police-icp {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: inherit;
    text-decoration: none;
    vertical-align: middle;
}

.police-icp:hover { text-decoration: underline; }

.police-icp-icon {
    width: 20px;
    height: 20px;
    display: block;
    object-fit: contain;
}

/* 打印：仅保留正文 */
@media print {
    .top-bar, .header, .main-nav, .breadcrumb-nav, .content-sidebar,
    .footer, .article-actions, .scroll-notice { display: none !important; }

    .article-detail { border: 0; box-shadow: none; padding: 0; }
}
