/* =============================================================
   寿光市人民政府门户网站（静态演示样板）
   文件：assets/css/base.css
   职责：重置、排版基线、链接/按钮基线、焦点可见性、跳转链接、
         读屏工具类、容器、滚动条、通用工具类、打印前基线。
   依赖：tokens.css
   ============================================================= */

*,
*::before,
*::after { box-sizing: border-box; }

html {
  font-size: var(--fs-root);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* 吸顶导航不遮挡锚点目标 */
  scroll-padding-top: calc(var(--header-h) + 20px);
}

body.reduce-motion ~ html,
body.reduce-motion { scroll-behavior: auto; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-base);
  font-size: var(--fs-md);
  line-height: var(--lh-body);
  color: var(--c-text);
  background: var(--c-bg-page);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- 标题与正文 ---------- */
h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--sp-3);
  line-height: var(--lh-tight);
  font-weight: 700;
  color: var(--c-text);
  overflow-wrap: break-word;
  word-break: break-word;
}
h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }
h5, h6 { font-size: var(--fs-base); }

p {
  margin: 0 0 var(--sp-4);
  overflow-wrap: break-word;
}

ul, ol { margin: 0 0 var(--sp-4); padding-left: 1.5em; }
li { margin-bottom: var(--sp-1); }

ul.plain, ol.plain {
  list-style: none;
  padding: 0;
  margin: 0;
}
ul.plain > li { margin: 0; }

hr {
  border: 0;
  border-top: 1px solid var(--c-border-light);
  margin: var(--sp-6) 0;
}

blockquote {
  margin: 0 0 var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  border-left: 4px solid var(--c-gov-blue-light);
  background: var(--c-gov-blue-mist);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

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

table {
  border-collapse: collapse;
  width: 100%;
  font-size: var(--fs-base);
}
caption { text-align: left; font-weight: 700; margin-bottom: var(--sp-2); }

/* ---------- 链接 ---------- */
a {
  color: var(--c-gov-blue);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease);
}
a:hover { color: var(--c-gov-blue-dark); text-decoration: underline; }
a:active { color: var(--c-gov-blue-deep); }

/* ---------- 表单控件基线 ---------- */
button, input, select, textarea {
  font-family: inherit;
  font-size: var(--fs-base);
  line-height: inherit;
  color: inherit;
}
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled,
button[aria-disabled="true"] {
  cursor: not-allowed;
}
textarea { resize: vertical; }

/* ---------- 焦点可见性（全站统一） ---------- */
:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--focus-color);
  outline-offset: 2px;
  border-radius: 2px;
}
body.high-contrast :focus-visible {
  outline-width: 4px;
}

/* ---------- 跳至正文 ---------- */
.skip-link {
  position: fixed;
  left: 12px;
  top: -64px;
  z-index: var(--z-skip);
  background: var(--c-gov-blue);
  color: var(--c-text-invert);
  padding: 12px 22px;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  font-size: var(--fs-base);
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  transition: top var(--dur-fast) var(--ease);
}
.skip-link:focus,
.skip-link:focus-visible {
  top: 0;
  color: var(--c-text-invert);
  text-decoration: none;
  outline-offset: -3px;
  outline-color: #fff;
}

/* ---------- 读屏专用 ---------- */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- 容器与分区 ---------- */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding-left: var(--sp-5);
  padding-right: var(--sp-5);
}
.section { padding: var(--sp-10) 0; }
.section--tight { padding: var(--sp-8) 0; }
.section--soft { background: var(--c-bg); }

/* ---------- 通用工具类 ---------- */
/* hidden 属性优先于组件 display（.btn/.card 等为 inline-flex/flex，会覆盖 UA 的 [hidden]） */
[hidden] { display: none !important; }
.text-muted { color: var(--c-text-muted); }
.text-secondary { color: var(--c-text-secondary); }
.text-sm { font-size: var(--fs-sm); }
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: var(--sp-2); }
.mt-4 { margin-top: var(--sp-4); }
.mt-5 { margin-top: var(--sp-5); }
.mt-6 { margin-top: var(--sp-6); }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: var(--sp-2); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-6 { margin-bottom: var(--sp-6); }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }

.visually-disabled {
  opacity: 0.6;
  pointer-events: none;
}

/* 文本安全截断（列表标题用，配合 title 属性） */
.ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- 自定义滚动条（协调政务蓝；不隐藏原生能力） ---------- */
html {
  scrollbar-width: thin;
  scrollbar-color: var(--c-gov-blue-light) var(--c-bg-soft);
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--c-bg-soft); }
::-webkit-scrollbar-thumb {
  background: #9FB6CB;
  border-radius: 6px;
  border: 2px solid var(--c-bg-soft);
}
::-webkit-scrollbar-thumb:hover { background: var(--c-gov-blue-light); }

/* ---------- 动效全局保险（偏好/开关优先于一切动画） ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
body.reduce-motion *,
body.reduce-motion *::before,
body.reduce-motion *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}

/* ---------- 滚动显现（JS 不可用时正文必须可见：默认完全可见，
     仅当 html.js-on 时才应用初始位移，由 site.js 添加该类） ---------- */
.reveal { opacity: 1; transform: none; }
html.js-on .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity var(--dur-slow) var(--ease),
              transform var(--dur-slow) var(--ease);
}
html.js-on .reveal.is-visible,
html.js-on body.reduce-motion .reveal,
html.js-on body.care-mode .reveal {
  opacity: 1;
  transform: none;
}
@media (prefers-reduced-motion: reduce) {
  html.js-on .reveal { opacity: 1; transform: none; }
}

/* ---------- 选区颜色 ---------- */
::selection { background: var(--c-gov-blue-pale); color: var(--c-gov-blue-deep); }
