/* =====================================================================
   布拖县人大代表之家 · 对外门户
   base.css —— 变量、重置、通用组件
   视觉基调：中国红 + 鎏金，取自参考截图的党政门户风格
   ===================================================================== */

:root {
  /* 主色 */
  --red-deep: #6e1512;
  --red: #a3221d;
  --red-bright: #c0392b;
  --red-dark: #4a0d0b;
  /* 金色 */
  --gold: #d9a441;
  --gold-light: #f7dca4;
  --gold-deep: #b07d1f;
  /* 文字 */
  --ink: #2b1612;
  --paper: #fff8ed;
  --text-on-red: #fff6e6;
  --text-dim: #e8cfa8;
  /* 尺寸 */
  --header-h: 88px;
  --content-max: 1560px;
  --radius: 4px;
  --shadow: 0 10px 30px rgba(60, 10, 8, .35);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--red-deep);
  color: var(--text-on-red);
  font: 16px/1.7 "Microsoft YaHei", "PingFang SC", "Source Han Sans SC", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

button { font: inherit; cursor: pointer; }

a { color: inherit; text-decoration: none; }

/* ---------------------------------------------------------------------
   背景：红色绸带 + 星光 + 天安门剪影（纯 CSS/SVG，无外部图片依赖）
   --------------------------------------------------------------------- */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 0%, #d64a33 0%, #b3301f 28%, #8e1d15 55%, #6e1512 78%, #4a0d0b 100%);
}

/* 绸带纹理 */
.bg-layer::before {
  content: "";
  position: absolute;
  inset: -10%;
  background:
    radial-gradient(45% 30% at 18% 22%, rgba(255, 170, 120, .35), transparent 70%),
    radial-gradient(50% 35% at 82% 30%, rgba(255, 140, 90, .28), transparent 72%),
    radial-gradient(60% 40% at 50% 88%, rgba(255, 110, 70, .22), transparent 75%),
    conic-gradient(from 200deg at 30% 40%, rgba(255, 190, 150, .16), transparent 45%);
  filter: blur(2px);
}

/* 星光点 */
.bg-layer::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1.6px 1.6px at 12% 18%, rgba(255, 236, 190, .9), transparent),
    radial-gradient(1.4px 1.4px at 28% 62%, rgba(255, 236, 190, .7), transparent),
    radial-gradient(1.8px 1.8px at 44% 30%, rgba(255, 240, 200, .85), transparent),
    radial-gradient(1.2px 1.2px at 63% 74%, rgba(255, 236, 190, .65), transparent),
    radial-gradient(1.7px 1.7px at 78% 24%, rgba(255, 240, 200, .8), transparent),
    radial-gradient(1.3px 1.3px at 88% 58%, rgba(255, 236, 190, .7), transparent),
    radial-gradient(1.5px 1.5px at 35% 86%, rgba(255, 240, 200, .6), transparent),
    radial-gradient(1.4px 1.4px at 70% 46%, rgba(255, 236, 190, .75), transparent);
  opacity: .85;
}

/* 底部绸带流动感 */
.bg-ribbon {
  position: absolute;
  left: -5%;
  right: -5%;
  bottom: -6%;
  height: 42%;
  background:
    radial-gradient(60% 100% at 20% 100%, rgba(120, 18, 14, .9), transparent 70%),
    radial-gradient(70% 100% at 78% 100%, rgba(140, 24, 18, .85), transparent 72%),
    linear-gradient(180deg, transparent, rgba(74, 13, 11, .85));
}

/* 天安门剪影（右下） */
.bg-gate {
  position: absolute;
  right: 1.5%;
  bottom: 0;
  width: 30%;
  max-width: 560px;
  opacity: .95;
}

/* ---------------------------------------------------------------------
   页头
   --------------------------------------------------------------------- */
.site-header {
  position: relative;
  z-index: 10;
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 34px;
}

/* 参考图的标题框：两侧斜角 + 金色描边 */
.title-frame {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  height: 56px;
  padding: 0 74px;
  margin: 0 auto;
  background: linear-gradient(180deg, rgba(150, 26, 20, .85), rgba(90, 14, 11, .9));
  box-shadow: inset 0 0 0 2px rgba(247, 220, 164, .55), 0 6px 22px rgba(40, 6, 4, .4);
  clip-path: polygon(0 50%, 34px 0, calc(100% - 34px) 0, 100% 50%, calc(100% - 34px) 100%, 34px 100%);
}
.title-frame h1 {
  margin: 0;
  font-family: "SimSun", "Songti SC", "STSong", serif;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 8px;
  color: #fff;
  text-shadow: 0 2px 6px rgba(60, 8, 6, .8), 0 0 22px rgba(255, 200, 120, .45);
  white-space: nowrap;
}
/* 标题两侧的斜线装饰 */
.title-frame::before,
.title-frame::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 26px;
  height: 16px;
  transform: translateY(-50%) skewX(-24deg);
  background: repeating-linear-gradient(90deg, rgba(247, 220, 164, .9) 0 2px, transparent 2px 7px);
}
.title-frame::before { left: 40px; }
.title-frame::after { right: 40px; }

/* 返回按钮（子页面用） */
.back-btn {
  position: absolute;
  left: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 18px;
  border: 1px solid rgba(247, 220, 164, .5);
  border-radius: 19px;
  background: rgba(90, 14, 11, .55);
  color: var(--gold-light);
  font-size: 15px;
  transition: background-color .18s ease, border-color .18s ease;
}
.back-btn:hover { background: rgba(150, 26, 20, .8); border-color: var(--gold-light); }

/* ---------------------------------------------------------------------
   页面容器
   --------------------------------------------------------------------- */
.site-main {
  position: relative;
  z-index: 5;
  min-height: calc(100vh - var(--header-h));
  padding: 0 24px 40px;
}

.page-wrap {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
}

/* ---------------------------------------------------------------------
   栏目页头（对应参考图二的红色标题徽章 + 右侧筛选）
   --------------------------------------------------------------------- */
.section-bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: 62px;
  margin-bottom: 22px;
  padding: 0 22px 0 0;
  border-bottom: 2px solid var(--gold);
}

.section-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 46px;
  padding: 0 34px 0 22px;
  background: linear-gradient(180deg, var(--red-bright), var(--red));
  box-shadow: inset 0 0 0 2px rgba(247, 220, 164, .55), 0 4px 14px rgba(50, 8, 6, .4);
  clip-path: polygon(0 0, 100% 0, calc(100% - 22px) 100%, 0 100%, 14px 50%);
}
.section-badge strong {
  font-family: "SimSun", "Songti SC", serif;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 4px;
  color: #fff;
  text-shadow: 0 2px 6px rgba(60, 8, 6, .7);
}

/* 右侧筛选下拉 */
.town-filter {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid rgba(247, 220, 164, .55);
  border-radius: 20px;
  background: rgba(90, 14, 11, .6);
  color: var(--gold-light);
  font-size: 15px;
}
.town-filter:hover { border-color: var(--gold-light); background: rgba(150, 26, 20, .75); }
.town-filter select {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  outline: 0;
  cursor: pointer;
}
.town-filter select option { background: #6e1512; color: #fff; }

/* ---------------------------------------------------------------------
   卡片网格（对应参考图二）
   --------------------------------------------------------------------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 2px solid rgba(217, 164, 65, .7);
  background: linear-gradient(180deg, rgba(140, 30, 22, .88), rgba(96, 16, 12, .92));
  box-shadow: 0 8px 22px rgba(40, 6, 4, .38);
  cursor: pointer;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.card:hover {
  transform: translateY(-4px);
  border-color: var(--gold-light);
  box-shadow: 0 16px 34px rgba(40, 6, 4, .5), 0 0 0 1px rgba(247, 220, 164, .45);
}
.card:focus-visible { outline: 3px solid var(--gold-light); outline-offset: 3px; }

/* 卡片封面：16:9，参考图的卡片上半是图、下半是文字 */
.card-cover {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: linear-gradient(135deg, #a63a2b, #6e1512);
}
.card-cover img { width: 100%; height: 100%; object-fit: cover; }
/* 无图占位：标题首字，保持克制，不抢文字 */
.card-cover .cover-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: "SimSun", serif;
  font-size: 40px;
  font-weight: 700;
  letter-spacing: 0;
  color: rgba(247, 220, 164, .38);
  background:
    radial-gradient(60% 60% at 30% 25%, rgba(255, 190, 150, .22), transparent 70%),
    linear-gradient(135deg, rgba(166, 58, 43, .9), rgba(95, 18, 15, .95));
}

.card-body { display: flex; flex-direction: column; gap: 7px; padding: 16px 16px 18px; }
.card-title {
  margin: 0;
  overflow: hidden;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.45;
  color: #fff;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-desc {
  margin: 0;
  overflow: hidden;
  font-size: 14.5px;
  color: var(--text-dim);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-date {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(247, 220, 164, .3);
  font-size: 15px;
  color: var(--gold-light);
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------------
   分页
   --------------------------------------------------------------------- */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 34px;
}
.pager button {
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid rgba(247, 220, 164, .45);
  border-radius: 50%;
  background: rgba(90, 14, 11, .66);
  color: var(--gold-light);
  font-size: 15px;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease;
}
.pager button:hover:not(:disabled) { border-color: var(--gold-light); background: rgba(160, 30, 22, .8); }
.pager button.is-active {
  border-color: var(--gold-light);
  background: linear-gradient(180deg, var(--gold), var(--gold-deep));
  color: var(--red-dark);
  font-weight: 700;
}
.pager button:disabled { opacity: .38; cursor: not-allowed; }
.pager .pager-info { margin-left: 14px; color: var(--text-dim); font-size: 14px; }

/* ---------------------------------------------------------------------
   空态 / 加载态
   --------------------------------------------------------------------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 80px 20px;
  color: var(--text-dim);
}
.empty-state .icon { font-size: 46px; color: rgba(247, 220, 164, .5); }
.empty-state p { margin: 0; font-size: 16px; }

/* ---------------------------------------------------------------------
   弹窗
   --------------------------------------------------------------------- */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 40px;
  background: rgba(30, 4, 3, .7);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity .2s ease;
}
.modal-mask.is-in { opacity: 1; }
.modal {
  width: min(760px, 100%);
  max-height: calc(100vh - 80px);
  overflow: auto;
  border: 2px solid var(--gold);
  background: linear-gradient(180deg, #8c1e16, #61110d);
  box-shadow: 0 26px 60px rgba(20, 2, 2, .6);
  transform: translateY(12px);
  transition: transform .22s ease;
}
.modal-mask.is-in .modal { transform: none; }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(247, 220, 164, .28);
}
.modal-head h3 {
  margin: 0;
  font-family: "SimSun", serif;
  font-size: 22px;
  letter-spacing: 2px;
  color: #fff;
}
.modal-close {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(247, 220, 164, .4);
  border-radius: 50%;
  background: transparent;
  color: var(--gold-light);
  font-size: 20px;
  line-height: 1;
}
.modal-close:hover { border-color: var(--gold-light); background: rgba(160, 30, 22, .8); }
.modal-body { padding: 20px; }

/* ---------------------------------------------------------------------
   页脚
   --------------------------------------------------------------------- */
.site-footer {
  position: relative;
  z-index: 5;
  padding: 26px 24px 34px;
  border-top: 1px solid rgba(247, 220, 164, .22);
  color: rgba(232, 207, 168, .75);
  font-size: 13.5px;
  text-align: center;
}
.site-footer p { margin: 4px 0; }

/* ---------------------------------------------------------------------
   响应式
   --------------------------------------------------------------------- */
@media (max-width: 1400px) {
  .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .title-frame h1 { font-size: 30px; letter-spacing: 6px; }
}
@media (max-width: 1080px) {
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-header { padding: 0 18px; }
  .title-frame { padding: 0 46px; }
  .title-frame::before { left: 26px; }
  .title-frame::after { right: 26px; }
  .title-frame h1 { font-size: 24px; letter-spacing: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
