/* portal.css — 门户 SSR 响应式骨架（PC + 移动媒体查询）。
   B5.1 只给可读的布局骨架；配色/精修由后续模板任务把握（reference-site.md 是布局依据）。
   门户是 Go 模板渲染的纯静态站点，frontend-spec（管理后台 SPA）不适用。 */

:root {
  --portal-primary: #1a5fb4;
  --portal-primary-dark: #15487f;
  --portal-text: #333;
  --portal-muted: #888;
  --portal-border: #e5e5e5;
  --portal-bg: #f7f8fa;
  --portal-link: #1a5fb4;
  --container: 1200px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body.portal {
  font-family: "Microsoft YaHei", "微软雅黑", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  color: var(--portal-text);
  background: var(--portal-bg);
  line-height: 1.6;
  font-size: 15px;
}
a { color: var(--portal-link); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
.container { max-width: var(--container); margin: 0 auto; padding: 0 16px; }

/* ---- 头部 ---- */
.portal-header { background: #fff; border-bottom: 1px solid var(--portal-border); }
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 16px; gap: 16px; }
/* D-114 品牌区行排（用户拍板 classic 升级）：徽标/首字徽章居左（跨两行），站名/副标题右侧两行叠排。
   base 层管结构（grid 行列），主题层只覆盖皮肤（尺寸/圆角/配色）。 */
.brand { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: center; line-height: 1.2; }
.brand:hover { text-decoration: none; }
.brand-logo { grid-column: 1; grid-row: 1 / 3; height: 48px; width: auto; max-width: 220px; object-fit: contain; border-radius: 10px; }
/* 无 logo 首字徽章占位（D-114）：classic 皮肤 = 主题蓝底白字 */
.brand-monogram { grid-column: 1; grid-row: 1 / 3; width: 44px; height: 44px; border-radius: 10px; background: var(--portal-primary); color: #fff; display: grid; place-items: center; font-size: 22px; font-weight: 800; }
.brand-name { grid-column: 2; grid-row: 1; font-size: 26px; font-weight: 700; color: var(--portal-primary); }
.brand-slogan { grid-column: 2; grid-row: 2; font-size: 13px; color: var(--portal-muted); }
.search-box { display: flex; }
.search-box input {
  border: 1px solid var(--portal-border); border-right: none; padding: 8px 12px;
  font-size: 14px; min-width: 180px; outline: none;
}
.search-box input:focus { border-color: var(--portal-primary); }
.search-box button {
  border: none; background: var(--portal-primary); color: #fff;
  padding: 8px 16px; cursor: pointer; font-size: 14px;
}
.search-box button:hover { background: var(--portal-primary-dark); }

/* ---- 主导航 ---- */
.portal-nav { background: var(--portal-primary); }
.nav-inner { position: relative; }
.nav-toggle {
  display: none; background: transparent; border: 0; color: #fff;
  font-size: 16px; padding: 12px 16px; cursor: pointer;
}
.nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; }
.nav-item { position: relative; }
.nav-item > a {
  display: block; color: #fff; padding: 14px 18px; font-size: 16px;
}
.nav-item > a:hover { background: var(--portal-primary-dark); text-decoration: none; }
.nav-item.has-children > a::after { content: " ▾"; font-size: 12px; opacity: .8; }
.nav-sub {
  list-style: none; margin: 0; padding: 0; position: absolute; left: 0; top: 100%;
  min-width: 160px; background: #fff; border: 1px solid var(--portal-border);
  box-shadow: 0 2px 8px rgba(0,0,0,.08); display: none; z-index: 20;
}
.nav-item.has-children:hover .nav-sub { display: block; }
.nav-sub li a { display: block; padding: 10px 16px; color: var(--portal-text); font-size: 14px; }
.nav-sub li a:hover { background: var(--portal-bg); }

/* ---- 主体 ---- */
/* padding-top 16px：portal-main 与主导航的呼吸空隙（D-121 后记 4 修正）——首页面包屑在主题下
   不渲染、空内容首页无首个子元素 margin 可折叠，间距必须挂在 portal-main 本身；
   主题 hero 以 margin-top:0 配平（主题 css），保持既有 16px 视觉节奏。 */
.portal-main { min-height: 50vh; padding: 16px 0 32px; }

/* 面包屑 */
.breadcrumb { background: #fff; border-bottom: 1px solid var(--portal-border); font-size: 13px; color: var(--portal-muted); }
.breadcrumb .container { padding-top: 10px; padding-bottom: 10px; }
.breadcrumb .crumb-sep { margin: 0 6px; }
.breadcrumb .crumb-current { color: var(--portal-text); }

/* 页面标题 */
.page-title { padding: 20px 0; border-bottom: 2px solid var(--portal-primary); margin-bottom: 16px; }
.page-title h1 { margin: 0 0 6px; font-size: 24px; color: var(--portal-primary); }
.page-title p { margin: 0; color: var(--portal-muted); font-size: 14px; }

/* ---- 首页 ---- */
/* 轮播：视口 + 绝对定位堆叠幻灯片，.active 可见（opacity 过渡），JS（portal.js）自动轮换。
   单张时不轮换；无 JS 时首张（模板标 active）仍可见，降级为静态大图。 */
.carousel {
  position: relative; margin: 16px 0; height: 360px;
  border-radius: 6px; overflow: hidden; background: #000;
}
.carousel-slide {
  position: absolute; inset: 0; margin: 0;
  opacity: 0; transition: opacity .6s ease; pointer-events: none;
}
.carousel-slide.active { opacity: 1; pointer-events: auto; z-index: 1; }
.carousel-slide img { width: 100%; height: 360px; object-fit: cover; display: block; }
.carousel-slide figcaption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 12px 16px;
  color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.65)); z-index: 2;
}
.carousel-dots {
  position: absolute; bottom: 12px; left: 0; right: 0; z-index: 3;
  display: flex; gap: 8px; justify-content: center;
}
.carousel-dot {
  width: 10px; height: 10px; padding: 0; border: 0; border-radius: 50%;
  background: rgba(255,255,255,.5); cursor: pointer;
}
.carousel-dot:hover { background: rgba(255,255,255,.8); }
.carousel-dot.active { background: #fff; }
.home-blocks { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin: 16px 0; }
.home-block { background: #fff; border: 1px solid var(--portal-border); border-radius: 6px; padding: 16px; }
/* B8.3 图库块并入统一版块列表：跨满两列保持原整宽图库视觉（D-122 配置化前图库块独立于区块网格） */
.home-block--gallery { grid-column: 1 / -1; }
.home-block .block-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--portal-border); padding-bottom: 10px; margin-bottom: 12px; }
.home-block .block-head h2 { margin: 0; font-size: 18px; color: var(--portal-primary); }
.home-block .more { font-size: 13px; }
.block-form-a { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.block-headline-cover { display: block; } /* D-115 头条图裁切窗口（classic 无缩放仅结构中立；圆角/高度归主题层） */
.block-headline img { width: 100%; height: 150px; object-fit: cover; border-radius: 4px; }
.block-headline h3 { font-size: 15px; margin: 8px 0 4px; }
.block-headline p { margin: 0; font-size: 13px; color: var(--portal-muted); }
.block-list { list-style: none; margin: 0; padding: 0; }
.block-list li { display: flex; align-items: baseline; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--portal-border); }
.block-list .date { color: var(--portal-muted); font-size: 13px; white-space: nowrap; }

/* 图库网格 */
.gallery-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.gallery-item { display: block; background: #fff; border: 1px solid var(--portal-border); border-radius: 4px; overflow: hidden; }
.gallery-item img { width: 100%; height: 160px; object-fit: cover; }
.gallery-item span { display: block; padding: 8px; text-align: center; font-size: 13px; color: var(--portal-text); }

/* ---- 列表页 ---- */
.article-list { list-style: none; margin: 0; padding: 0; }
.article-item { display: flex; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--portal-border); }
.search-page .article-body em { background: #fff3cd; color: #856404; font-style: normal; padding: 0 2px; border-radius: 2px; } /* B5.6 搜索关键词高亮 */
.article-cover { flex: 0 0 180px; }
.article-cover img { width: 180px; height: 110px; object-fit: cover; border-radius: 4px; }
.article-body h3 { margin: 0 0 6px; font-size: 17px; }
.article-body p { margin: 0 0 6px; color: var(--portal-muted); font-size: 14px; }
.article-body .date { font-size: 13px; color: var(--portal-muted); }

/* ---- 详情/单页 ---- */
.article-detail { background: #fff; border: 1px solid var(--portal-border); border-radius: 6px; padding: 24px; }
/* D-131 长英文串/URL 折行：overflow-wrap 可继承，挂容器覆盖标题/正文/附件名/上下篇——
   CJK 随处可断故中文不受影响；修 PC 窄窗口不折行、移动端溢出（用户报障）。 */
.article-detail, .article-body { overflow-wrap: anywhere; }
.article-detail .page-title { padding: 0; border-bottom: 2px solid var(--portal-primary); }
.article-detail h1 { font-size: 26px; text-align: center; }
.article-detail .subtitle { text-align: center; color: var(--portal-muted); }
.article-info { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; padding: 12px 0; border-bottom: 1px solid var(--portal-border); color: var(--portal-muted); font-size: 13px; }
.article-content { padding: 16px 0; }
.article-content :is(h2,h3) { color: var(--portal-primary-dark); margin-top: 1.2em; }
.article-content img { max-width: 100%; height: auto; }
.article-attachments { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--portal-border); }
.article-attachments h3 { font-size: 16px; }
.article-attachments ul { list-style: none; padding: 0; }
.article-attachments li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--portal-border); }
.article-attachments .att-size { color: var(--portal-muted); font-size: 13px; }
.prev-next { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--portal-border); font-size: 14px; }
.prev-next .prev, .prev-next .next { flex: 1 1 40%; }
.prev-next a { color: var(--portal-link); }
.article-related { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--portal-border); }
.article-related h3 { font-size: 16px; color: var(--portal-primary-dark); }
.article-related ul { list-style: none; padding: 0; }
.article-related li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--portal-border); font-size: 14px; }
.article-related li a { color: var(--portal-text); }
.article-related li a:hover { color: var(--portal-primary); }
.article-related .date { color: var(--portal-muted); font-size: 13px; white-space: nowrap; }

/* ---- 分页 ---- */
.pagination { margin: 24px 0; }
.pagination-inner { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; }
.page-link { display: inline-block; padding: 6px 12px; border: 1px solid var(--portal-border); background: #fff; border-radius: 4px; font-size: 14px; }
.page-link:hover { border-color: var(--portal-primary); text-decoration: none; }
.page-link.current { background: var(--portal-primary); color: #fff; border-color: var(--portal-primary); }
.page-link.disabled { color: var(--portal-muted); cursor: not-allowed; }
.page-info { margin-left: 12px; color: var(--portal-muted); font-size: 13px; }

/* ---- 搜索空结果 / 错误页 ---- */
.empty-state { background: #fff; border: 1px solid var(--portal-border); border-radius: 6px; padding: 32px; text-align: center; }
.error-page { display: flex; justify-content: center; padding: 60px 0; }
.error-box { text-align: center; }
.error-box h1 { font-size: 28px; color: var(--portal-primary); }
.btn { display: inline-block; padding: 8px 20px; border-radius: 4px; }
.btn-primary { background: var(--portal-primary); color: #fff; }
.btn-primary:hover { background: var(--portal-primary-dark); text-decoration: none; }

/* ---- 页脚 ---- */
.portal-footer { background: #2a2f36; color: #c8ccd2; margin-top: 40px; }
.footer-inner { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; padding: 32px 16px; }
.footer-title { display: block; font-size: 15px; color: #fff; margin-bottom: 12px; }
.footer-links-list { display: flex; flex-direction: column; gap: 6px; }
/* D-129：快捷链接 >6 项分两列（≤6 单列；上限 12=两列各 6） */
.footer-links-list--two { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 16px; }
.footer-contact p, .footer-record p { margin: 4px 0; font-size: 13px; }
.footer-record a { color: #c8ccd2; }
.footer-record .record-sep { margin: 0 8px; }
.footer-record-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.footer-record-line .record-icon,
.footer-record-line .gov-mark-icon { height: 18px; width: auto; vertical-align: middle; margin-right: 4px; opacity: 0.92; }
/* D-142：对抗全局 img{display:block}（portal.css 顶部 reset），公安国徽 icon 回到内联流与备案文字并排 */
.footer-record-line .record-icon { display: inline-block; }
.footer-record-line .gov-mark-icon { height: 24px; margin-left: 6px; }
.footer-record-line .gov-mark-link { display: inline-flex; align-items: center; }

/* ---- 响应式：移动端（≤768px）---- */
@media (max-width: 768px) {
  .header-inner { flex-direction: column; align-items: stretch; }
  .search-box input { min-width: 0; flex: 1; }
  .search-box { width: 100%; }
  .nav-toggle { display: block; }
  .nav-list { display: none; flex-direction: column; }
  .nav-list.open { display: flex; }
  .nav-item { width: 100%; }
  .nav-sub { position: static; display: block; box-shadow: none; border: 0; background: var(--portal-primary-dark); }
  .nav-sub li a { color: #fff; padding-left: 32px; }
  .home-blocks { grid-template-columns: 1fr; }
  .block-form-a { grid-template-columns: 1fr; }
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
  .carousel { height: 200px; }
  .carousel-slide img { height: 200px; }
  .article-item { flex-direction: column; }
  .article-cover, .article-cover img { width: 100%; }
  .footer-inner { grid-template-columns: 1fr; }
  /* D-129：移动端快捷链接两列收窄为单列（窄屏两列挤压标题换行） */
  .footer-links-list--two { grid-template-columns: 1fr; }
  /* D-131：移动端正文宽表格横向滚动（表格结构无法折行，避免撑破视口） */
  .article-content table { display: block; overflow-x: auto; max-width: 100%; }
}

/* ---- D-112 主题钩子（classic 隐藏）----
   override 主题（modern/gov/corp）的 hero CTA 按钮：classic 主题隐藏（新增节点，
   不改动本文件任何既有规则，classic 视觉零变化）。 */
.carousel-cta { display: none; }
