/* ==========================================================================
   base.css —— 重置、排版基线、容器、无障碍
   依赖：tokens.css
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--sp-6));
}

body {
  margin: 0;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Source Han Sans SC", "Noto Sans CJK SC", -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, sans-serif;
  font-size: var(--fs-body);
  line-height: var(--lh-base);
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--sp-4);
  line-height: var(--lh-tight);
  font-weight: var(--fw-semi);
  color: var(--c-text);
  letter-spacing: -0.01em;
}

h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-body); }

p {
  margin: 0 0 var(--sp-4);
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--c-brand-600);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease);
}

a:hover {
  color: var(--c-accent-600);
}

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

/* 行内图标默认尺寸。
   裸 <svg> 会被上面的 max-width:100% 撑满父容器，
   故此处给出安全兜底：无显式尺寸的内联图标一律 1em。
   需要更大尺寸时，用具体组件类或 width/height 属性覆盖。 */
svg:not([width]):not([class]) {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: -0.125em;
  flex: none;
}

ul, ol {
  margin: 0 0 var(--sp-4);
  padding-left: var(--sp-6);
}

li {
  margin-bottom: var(--sp-2);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

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

/* ---------- 无障碍：可见焦点环 ---------- */
:focus-visible {
  outline: 2px solid var(--c-accent-500);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

/* ---------- 布局容器 ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.container--narrow {
  max-width: var(--container-narrow);
}

/* ---------- 区块节奏：留白 ≥ 40%，桌面模块间距 80–120px ---------- */
.section {
  padding-block: var(--sp-16);
}

@media (min-width: 768px) {
  .section {
    padding-block: var(--sp-24);
  }
}

.section--subtle {
  background: var(--c-bg-subtle);
}

.section--inverse {
  background: var(--c-bg-inverse);
  color: var(--c-text-invert);
}

.section--inverse h1,
.section--inverse h2,
.section--inverse h3 {
  color: var(--c-text-invert);
}

.section--inverse p {
  color: rgba(244, 247, 251, 0.78);
}

/* ---------- 区块标题组 ---------- */
.section-head {
  max-width: 720px;
  margin-bottom: var(--sp-12);
}

.section-head--center {
  margin-inline: auto;
  text-align: center;
}

.eyebrow {
  display: inline-block;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--c-accent-600);
  margin-bottom: var(--sp-3);
}

.section--inverse .eyebrow {
  color: var(--c-accent-300);
}

.lead {
  font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.1875rem);
  line-height: var(--lh-snug);
  color: var(--c-text-muted);
}

.section--inverse .lead {
  color: rgba(244, 247, 251, 0.8);
}

/* ---------- 文本工具 ---------- */
.text-muted { color: var(--c-text-muted); }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mb-6 { margin-bottom: var(--sp-6); }
.mb-8 { margin-bottom: var(--sp-8); }
.hidden { display: none !important; }

/* 视觉隐藏但保留无障碍可读（蜜罐字段、跳转链接使用） */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* 跳转到主内容（键盘可达性） */
.skip-link {
  position: absolute;
  top: -100px;
  left: var(--sp-4);
  z-index: 200;
  padding: var(--sp-3) var(--sp-5);
  background: var(--c-brand-800);
  color: var(--c-text-invert);
  border-radius: var(--r-sm);
  transition: top var(--dur-base) var(--ease);
}

.skip-link:focus {
  top: var(--sp-4);
  color: var(--c-text-invert);
}

/* ---------- 滚动进入动效（一次性，IntersectionObserver 驱动） ---------- */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease);
  will-change: opacity, transform;
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
  will-change: auto;
}

@media print {
  .site-header, .site-footer, .skip-link { display: none; }
}
