/* ============================================================
   京剪官网 · base.css
   设计 token + reset + 排版 + 布局原语
   纯静态、零外部依赖（不引 CDN / webfont / 统计脚本）。
   ============================================================ */

:root {
  /* ---- 品牌色 ----
     品牌主色沿用顾客端小程序 app.wxss 的 --color-primary。
     ⚠️ #ff5a5f 对白底只有 3.05:1，只满足「大字号」的 AA 要求，
        所以它只用于图标 / 装饰条 / 大标题 / 徽章描边；
        正文链接、按钮底色一律用 --brand-ink（4.87:1，AA 通过）。 */
  --brand: #ff5a5f;
  --brand-ink: #d62f35;   /* 正文可读的品牌色 */
  --brand-soft: #ffe5e6; /* 浅底 / 标签底 */
  --brand-deep: #b32429; /* 深底上的浅色文字强调 */

  /* ---- 中性色 ---- */
  --text: #222222;       /* 正文 14.7:1 */
  --text-sub: #666666;   /* 次要说明 5.74:1 */
  --text-mute: #767676;  /* 辅助文字 4.54:1（小程序里的 #999 只有 2.85:1，官网不用） */
  --border: #eeeeee;
  --border-strong: #d8d8d8;
  --bg: #f7f7f7;
  --card: #ffffff;
  --dark: #1c1c1c;       /* 深色区块底 */
  --dark-text: #e6e6e6;  /* 深底正文 13.6:1 */

  /* ---- 状态色（只作图形点，不作文字色） ---- */
  --success: #4cd964;
  --warning: #f0ad4e;
  --danger: #ff4d4f;

  /* ---- 尺寸 ---- */
  --container: 1120px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 24px rgba(0, 0, 0, .06);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .05);

  /* ---- 字体（系统字体栈，无外部请求） ---- */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC",
          "Noto Sans CJK SC", sans-serif;

  --header-h: 60px;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* 锚点跳转时给 sticky 头部留位置 */
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-wrap: pretty;
}

h1, h2, h3, h4 {
  margin: 0 0 .6em;
  line-height: 1.3;
  font-weight: 600;
  text-wrap: balance;
}

h1 { font-size: clamp(1.75rem, 5vw, 2.75rem); line-height: 1.25; }
h2 { font-size: clamp(1.375rem, 3.6vw, 2rem); line-height: 1.35; }
h3 { font-size: 1.0625rem; line-height: 1.5; }

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

ul, ol { margin: 0 0 1em; padding-left: 1.25em; }
li { margin-bottom: .35em; }
li:last-child { margin-bottom: 0; }

a { color: var(--brand-ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--brand-deep); }

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

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .9em;
  background: var(--bg);
  padding: .1em .35em;
  border-radius: 4px;
}

hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; }

/* ---------- 可访问性 ---------- */

/* 跳到主要内容：默认视觉隐藏，聚焦时出现 */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--card);
  color: var(--brand-ink);
  padding: .75rem 1.25rem;
  border-radius: 0 0 var(--radius-sm) 0;
  box-shadow: var(--shadow);
}
.skip-link:focus {
  left: 0;
  outline: 2px solid var(--brand-ink);
  outline-offset: 2px;
}

/* 焦点可见：不要 outline:none */
:focus-visible {
  outline: 2px solid var(--brand-ink);
  outline-offset: 2px;
  border-radius: 3px;
}

/* 只给读屏用的文本 */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------- 布局原语 ---------- */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 20px;
}
@media (min-width: 960px) {
  .container { padding-inline: 32px; }
}

.section { padding: clamp(2.5rem, 7vw, 4.5rem) 0; }
.section--tight { padding: clamp(1.75rem, 5vw, 3rem) 0; }
.section--alt { background: var(--bg); }
.section--card { background: var(--card); }

.section__head { max-width: 46rem; margin-bottom: clamp(1.5rem, 4vw, 2.5rem); }
.section__head p {
  color: var(--text-sub);
  font-size: 1.0625rem;
  margin-bottom: 0;
}

.eyebrow {
  display: inline-block;
  font-size: .8125rem;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--brand-ink);
  background: var(--brand-soft);
  border: 1px solid rgba(214, 47, 53, .18);
  border-radius: 999px;
  padding: .25rem .75rem;
  margin-bottom: 1rem;
}

.lead { font-size: 1.0625rem; color: var(--text-sub); }

/* 栅格 */
.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
@media (min-width: 640px) { .grid { gap: 20px; } }
@media (min-width: 960px) { .grid { gap: 24px; } }

/* 4 项一组的板块排成 2×2，避免 auto-fit 在宽屏下断成 3+1 */
@media (min-width: 640px) {
  .grid--2 { grid-template-columns: repeat(2, 1fr); }
}

/* 10 张卡的板块：窄 1 列 / 中 2 列 / 宽 4 列，末两张各占半宽（4+4+2），不留孤儿卡 */
.grid--wide { grid-template-columns: 1fr; }
@media (min-width: 640px) {
  .grid--wide { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1060px) {
  .grid--wide { grid-template-columns: repeat(4, 1fr); }
  .grid--wide > :nth-last-child(2),
  .grid--wide > :last-child { grid-column: span 2; }
}

/* 7 张卡的板块：宽 4 列，末张占半宽（4+3），不留孤儿卡 */
.grid--seven { grid-template-columns: 1fr; }
@media (min-width: 640px) {
  .grid--seven { grid-template-columns: repeat(2, 1fr); }
  .grid--seven > :last-child { grid-column: span 2; }
}
@media (min-width: 1060px) {
  .grid--seven { grid-template-columns: repeat(4, 1fr); }
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
@media (min-width: 640px) { .card { padding: 24px; } }

.card__icon {
  width: 40px; height: 40px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand-ink);
  margin-bottom: 12px;
}
.card__icon svg { width: 22px; height: 22px; }

.card h3 { margin-bottom: .35em; }
.card p { color: var(--text-sub); font-size: .9375rem; }

.card ul { font-size: .9375rem; color: var(--text-sub); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5em;
  min-height: 44px;              /* 触摸目标 ≥44px */
  padding: .625rem 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: .9375rem;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn--primary { background: var(--brand-ink); color: #fff; }
.btn--primary:hover { background: var(--brand-deep); color: #fff; }
.btn--ghost { background: transparent; color: var(--brand-ink); border-color: var(--brand); }
.btn--ghost:hover { background: var(--brand-soft); color: var(--brand-deep); }
.btn--light { background: rgba(255, 255, 255, .12); color: #fff; border-color: rgba(255, 255, 255, .35); }
.btn--light:hover { background: rgba(255, 255, 255, .2); color: #fff; }

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

/* ---------- 标签 ---------- */
.tag {
  display: inline-block;
  /* 放在 flex 列容器里时不要被拉成整条横幅 */
  align-self: flex-start;
  font-size: .75rem;
  font-weight: 600;
  color: var(--brand-ink);
  background: var(--brand-soft);
  border-radius: 999px;
  padding: .15rem .625rem;
}
.tag--muted {
  color: var(--text-sub);
  background: var(--bg);
  border: 1px solid var(--border-strong);
}

/* ---------- 提示条 ---------- */
.note {
  font-size: .875rem;
  color: var(--text-sub);
  background: var(--bg);
  border-left: 3px solid var(--brand);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 12px 16px;
}
.note--plain { border-left-color: var(--border-strong); }

/* ---------- 表格 ---------- */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9375rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.table th,
.table td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.table tr:last-child th,
.table tr:last-child td { border-bottom: 0; }
.table th {
  font-weight: 600;
  color: var(--text-sub);
  width: 8.5em;
  white-space: nowrap;
  background: var(--bg);
}
@media (max-width: 639px) {
  .table, .table tbody, .table tr, .table th, .table td { display: block; }
  .table tr { border-bottom: 1px solid var(--border); }
  .table tr:last-child { border-bottom: 0; }
  .table th { width: auto; white-space: normal; padding-bottom: 2px; }
  .table td { padding-top: 2px; }
}

/* ---------- 动效降级 ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
