/* ============================================================
   适老化设计手册 · 站点样式
   本站自身即适老化示范:
   - 正文 18px 起步,支持 标准/大/特大 三档(rem 全局缩放)
   - 高对比模式(纯黑白 + 强描边)
   - 可点目标 ≥44px、焦点可见、无悬停依赖、无动效依赖
   ============================================================ */

:root {
  --bg: #faf7f1;
  --surface: #ffffff;
  --ink: #26241f;
  --ink-2: #4c463c;
  --accent: #0a5c42;
  --accent-deep: #07432f;
  --accent-soft: #e3efe7;
  --warn: #8a4a12;
  --warn-soft: #f9ede0;
  --bad: #9a2727;
  --bad-soft: #faecec;
  --good: #175d34;
  --good-soft: #eaf4ec;
  --line: #d9d2c3;
  --line-strong: #b3a98f;
  --focus: #0b57d0;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(60, 50, 30, 0.08);
}

/* ---------- 基础 ---------- */
html {
  font-size: 18px;               /* 适老默认字号:大于常规 16px */
  scroll-behavior: smooth;
}
html[data-font="large"]  { font-size: 20px; }
html[data-font="xlarge"] { font-size: 23px; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Source Han Sans SC", "Noto Sans CJK SC", sans-serif;
  font-weight: 400;
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
}

p { margin: 0.9em 0; }
strong, b { font-weight: 700; }

a {
  color: var(--accent-deep);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}
a:hover { color: var(--accent); }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection { background: var(--accent-soft); color: var(--ink); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0); clip-path: inset(50%);
  overflow: hidden; white-space: nowrap;
}

.wrap {
  max-width: 1160px;
  margin-inline: auto;
  padding-inline: clamp(16px, 4vw, 32px);
}

/* ---------- 跳转链接(键盘用户) ---------- */
.skip-link {
  position: absolute;
  left: 12px; top: -60px;
  z-index: 100;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  padding: 12px 20px;
  border-radius: 0 0 10px 10px;
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 0; }

/* ---------- 头部与导航 ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 2px solid var(--line-strong);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 20px;
  padding-block: 10px;
}

.brand { margin: 0; line-height: 1.3; }
.brand a {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--ink);
  text-decoration: none;
}
.brand a:hover { color: var(--accent-deep); }
.brand-en {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--ink-2);
  text-transform: uppercase;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.controls-label { font-weight: 700; color: var(--ink-2); font-size: 0.95rem; }

.ctrl-btn {
  min-height: 44px;
  min-width: 44px;
  padding: 6px 16px;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  background: var(--surface);
  border: 2px solid var(--line-strong);
  border-radius: 8px;
  cursor: pointer;
}
.ctrl-btn:hover { border-color: var(--accent); color: var(--accent-deep); }
.ctrl-btn[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding-block: 8px;
  border-top: 1px solid var(--line);
}
.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 15px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink);
  text-decoration: none;
}
.site-nav a:hover { background: var(--accent-soft); color: var(--accent-deep); }
.site-nav a[aria-current="page"] {
  background: var(--accent);
  color: #fff;
}

/* ---------- 正文骨架 ---------- */
main { padding-block: 8px 40px; }

.page-head {
  padding-block: 34px 6px;
  max-width: 52rem;
}
.kicker {
  display: inline-block;
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  color: var(--accent-deep);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 4px 14px;
  margin-bottom: 14px;
}
h1 {
  font-size: 2.1rem;
  line-height: 1.35;
  margin: 0 0 14px;
  font-weight: 800;
}
.lede {
  font-size: 1.12rem;
  color: var(--ink-2);
  max-width: 42rem;
  margin-top: 0;
}

article { padding-bottom: 20px; }
.prose { max-width: 46rem; }
.prose-full { max-width: 72rem; }

h2 {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.4;
  margin: 2.4em 0 0.7em;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--line);
  scroll-margin-top: 170px;
}
section[id] { scroll-margin-top: 150px; }
h2 .h2-num {
  color: var(--accent-deep);
  margin-right: 8px;
  font-size: 0.9em;
}
h3 {
  font-size: 1.18rem;
  font-weight: 800;
  margin: 1.8em 0 0.5em;
  line-height: 1.45;
}
ul, ol { padding-left: 1.5em; }
li { margin-block: 0.35em; }
li::marker { color: var(--accent-deep); font-weight: 700; }

/* ---------- 本章导读 ---------- */
.toc {
  background: var(--accent-soft);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-block: 22px;
}
.toc-title {
  font-weight: 800;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  color: var(--accent-deep);
  margin-bottom: 6px;
}
.toc ol { margin: 0; padding-left: 1.3em; }
.toc a { font-weight: 600; }

/* ---------- 知识卡与四段式拆解 ---------- */
.fact {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-block: 20px;
}
.fact > h3:first-child { margin-top: 0; }
.fact-tag {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #fff;
  background: var(--accent);
  border-radius: 999px;
  padding: 2px 12px;
  margin-bottom: 6px;
  vertical-align: middle;
  margin-right: 8px;
}

.fb {
  margin-top: 12px;
  padding: 2px 0 2px 14px;
  border-left: 4px solid var(--line-strong);
}
.fb-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  margin-bottom: 2px;
}
.fb p { margin: 0.25em 0; }
.fb-fact { border-color: var(--accent); }
.fb-fact .fb-label { color: var(--accent-deep); }
.fb-why  { border-color: var(--warn); }
.fb-why  .fb-label { color: var(--warn); }
.fb-how  { border-color: var(--good); }
.fb-how  .fb-label { color: var(--good); }
.fb-pit  { border-color: var(--bad); }
.fb-pit  .fb-label { color: var(--bad); }

/* ---------- 卡片网格 ---------- */
.kgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin-block: 22px;
}
.kcard {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
}
.kcard h3 { margin-top: 0; color: var(--accent-deep); }
.kcard p { margin-block: 0.5em; }
.kcard .kcard-link { font-weight: 700; display: inline-block; margin-top: 6px; }
.kcard-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.8rem; height: 1.8rem;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 0.95rem;
  margin-right: 8px;
  flex: none;
}
.kcard-title { display: flex; align-items: center; }

/* ---------- 首页 Hero ---------- */
.hero { padding-block: 44px 10px; }
.hero h1 { font-size: 2.4rem; max-width: 44rem; }
.hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-block: 26px;
}
.stat {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-left: 6px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px 20px;
}
.stat-num {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent-deep);
  line-height: 1.3;
}
.stat-label { color: var(--ink-2); font-size: 0.95rem; }

/* ---------- 提示框 ---------- */
.callout {
  border-left: 6px solid var(--line-strong);
  background: var(--surface);
  border-radius: 8px;
  padding: 14px 20px;
  margin-block: 1.5em;
}
.callout-title {
  font-weight: 800;
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  display: block;
  margin-bottom: 4px;
}
.callout p { margin: 0.35em 0; }
.callout-tip  { border-color: var(--accent); background: var(--accent-soft); }
.callout-tip  .callout-title { color: var(--accent-deep); }
.callout-warn { border-color: var(--warn); background: var(--warn-soft); }
.callout-warn .callout-title { color: var(--warn); }
.callout-data { border-color: #0b4a8f; background: #e8f0fb; }
.callout-data .callout-title { color: #0b4a8f; }

/* ---------- 表格 ---------- */
.table-scroll { overflow-x: auto; margin-block: 20px; }
table.spec {
  border-collapse: collapse;
  width: 100%;
  min-width: 560px;
  background: var(--surface);
  font-size: 0.98rem;
}
table.spec caption {
  text-align: left;
  font-weight: 800;
  padding-block: 8px;
  color: var(--ink-2);
}
table.spec th, table.spec td {
  border: 1px solid var(--line);
  padding: 10px 14px;
  text-align: left;
  vertical-align: top;
  line-height: 1.6;
}
table.spec th {
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-weight: 800;
}
table.spec tbody tr:nth-child(even) { background: #fbf9f4; }

/* ---------- 好坏对比面板 ---------- */
.do-dont {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-block: 24px;
}
.panel {
  border: 2px solid var(--line-strong);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
}
.panel-head {
  padding: 10px 18px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
}
.panel-bad  { border-color: var(--bad); }
.panel-bad  .panel-head { background: var(--bad-soft); color: var(--bad); }
.panel-good { border-color: var(--good); }
.panel-good .panel-head { background: var(--good-soft); color: var(--good); }
.panel-body { padding: 18px; }
.panel-body ul { padding-left: 1.3em; }

@media (max-width: 900px) {
  .do-dont { grid-template-columns: 1fr; }
}

/* ---------- 手机界面示意图 ---------- */
.phone {
  width: min(320px, 100%);
  background: #1d1d1f;
  border-radius: 30px;
  padding: 10px;
  margin-inline: auto;
}
.phone-screen {
  background: #fff;
  border-radius: 20px;
  overflow: hidden;
}
.m-head {
  background: var(--accent);
  color: #fff;
  padding: 12px 16px;
  font-weight: 800;
}
.mock-bad .m-head { background: #6b7280; }
.m-body { padding: 14px 16px 10px; }
.m-title { font-weight: 800; font-size: 1.12rem; margin: 0 0 8px; }
.m-card {
  border: 1.5px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  margin-block: 8px;
}
.m-label { display: block; font-size: 0.82rem; color: var(--ink-2); }
.m-value { font-weight: 700; }
.m-btn-main {
  display: block;
  text-align: center;
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  padding: 13px 10px;
  font-weight: 800;
  font-size: 1.05rem;
  margin-top: 12px;
}
.mock-bad .m-btn-main { background: #9ca3af; }
.m-tip { font-size: 0.85rem; color: var(--ink-2); margin: 8px 0 4px; }
.m-tab {
  border-top: 1.5px solid var(--line);
  display: flex;
}
.m-tab span {
  flex: 1;
  text-align: center;
  padding: 10px 0;
  font-size: 0.85rem;
  color: var(--ink-2);
  font-weight: 700;
}

/* 弹窗示意 */
.m-modal {
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-block: 10px;
  box-shadow: var(--shadow);
}
.m-modal-title { font-weight: 800; margin-bottom: 4px; }
.m-modal-text { font-size: 0.9rem; color: var(--ink-2); }
.m-modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.m-btn {
  display: inline-block;
  border-radius: 8px;
  padding: 10px 18px;
  font-weight: 800;
  font-size: 0.95rem;
  min-height: 44px;
  line-height: 1.4;
}
.m-btn-primary { background: var(--accent); color: #fff; }
.m-btn-ghost { border: 2px solid var(--line-strong); color: var(--ink); }

/* 验证码示意 */
.m-captcha {
  font-family: "Courier New", monospace;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.35em;
  color: #4b5563;
  background:
    repeating-linear-gradient(0deg, #eef0f3 0 6px, #e2e5ea 6px 12px);
  border: 1.5px solid var(--line);
  border-radius: 8px;
  padding: 12px 18px;
  transform: skewX(-8deg);
  display: inline-block;
  margin-block: 8px;
}
.m-captcha-code { display: inline-block; transform: skewX(10deg) rotate(-4deg); }

/* ---------- 互动演示框 ---------- */
.demo {
  border: 2px dashed var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  padding: 20px 22px;
  margin-block: 28px;
}
.demo > h3:first-child { margin-top: 0; }
.demo-tag {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 800;
  color: #fff;
  background: var(--focus);
  border-radius: 999px;
  padding: 2px 12px;
  letter-spacing: 0.06em;
  margin-right: 8px;
  vertical-align: middle;
}
.demo-hint { color: var(--ink-2); font-size: 0.95rem; margin-top: 2px; }

.big-range {
  width: 100%;
  min-height: 44px;
  accent-color: var(--accent);
}
.big-select {
  font: inherit;
  min-height: 44px;
  padding: 8px 12px;
  border: 2px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}
.badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.88rem;
  border: 1.5px solid currentColor;
}
.badge-fail { background: var(--bad-soft); color: var(--bad); }
.badge-aa   { background: var(--good-soft); color: var(--good); }
.badge-aaa  { background: var(--accent); color: #fff; }

.cd-stage {
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 20px;
  margin-top: 14px;
}
.cd-body { font-size: 1.05rem; margin: 0 0 6px; }
.cd-small { font-size: 14px; margin: 0 0 14px; }
.cd-btn {
  display: inline-block;
  padding: 12px 22px;
  border-radius: 10px;
  font-weight: 800;
  min-height: 44px;
}
.cd-controls {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
  margin-bottom: 6px;
}
.cd-ratio { font-size: 1.02rem; }

/* 视觉模拟 */
.sim-btns { display: flex; flex-wrap: wrap; gap: 10px; margin-block: 12px; }
.sim-btn {
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  min-height: 44px;
  padding: 8px 16px;
  border: 2px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.sim-btn[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.sim-stage {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  align-items: flex-start;
  padding: 18px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #f2efe8;
}
.sim-stage[data-sim="blur"] .phone { filter: blur(2.2px); }
.sim-stage[data-sim="cataract"] .phone {
  filter: sepia(0.45) blur(2.4px) brightness(1.12) saturate(0.8);
}
.sim-stage[data-sim="contrast"] .phone { filter: contrast(0.6) saturate(0.65); }
.sim-stage[data-sim="glare"] .phone { filter: brightness(1.05); }
.sim-stage[data-sim="glare"]::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: radial-gradient(
    ellipse 60% 45% at 28% 18%,
    rgba(255, 255, 255, 0.95),
    rgba(255, 255, 255, 0.45) 45%,
    rgba(255, 255, 255, 0) 70%
  );
  pointer-events: none;
}
.sim-note {
  flex: 1 1 260px;
  background: var(--surface);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 0.98rem;
  align-self: center;
}

/* 触控热区演示 */
.tt-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-block: 10px;
  border-bottom: 1px dashed var(--line);
  flex-wrap: wrap;
}
.tt-row:last-of-type { border-bottom: none; }
.tt-chip {
  flex: 1 1 240px;
  font-size: 0.95rem;
  color: var(--ink-2);
}
.m-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}
.tt-bad  { width: 28px; height: 28px; font-size: 15px; }
.tt-mid  { width: 44px; height: 44px; font-size: 19px; }
.tt-good { min-width: 48px; min-height: 48px; font-size: 19px; }
.tt-stage.zones .m-icon-btn {
  outline: 3px dashed var(--accent);
  outline-offset: 3px;
}
.tt-feedback {
  background: var(--accent-soft);
  border-radius: 8px;
  padding: 10px 16px;
  margin-block: 12px;
  font-weight: 600;
}

/* ---------- 检查清单 ---------- */
.checklist {
  list-style: none;
  padding: 0;
  margin-block: 20px;
}
.checklist li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding-block: 10px;
  border-bottom: 1px dashed var(--line);
}
.checklist input[type="checkbox"] {
  width: 24px; height: 24px;
  flex: none;
  margin-top: 4px;
  accent-color: var(--accent);
}
.checklist label { line-height: 1.7; }

/* ---------- 上一页/下一页 ---------- */
.pager {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-block: 44px 20px;
  flex-wrap: wrap;
}
.pager a {
  flex: 1 1 260px;
  border: 2px solid var(--line-strong);
  border-radius: 10px;
  padding: 14px 18px;
  text-decoration: none;
  background: var(--surface);
}
.pager a:hover { border-color: var(--accent); }
.pager-dir {
  display: block;
  font-size: 0.85rem;
  color: var(--ink-2);
  font-weight: 700;
}
.pager-title { font-weight: 800; color: var(--accent-deep); font-size: 1.05rem; }
.pager .next { text-align: right; }

/* ---------- 页脚 ---------- */
.site-footer {
  background: #efe9da;
  border-top: 2px solid var(--line-strong);
  margin-top: 40px;
  padding-block: 30px;
}
.site-footer p { margin: 0.4em 0; }
.foot-note { color: var(--ink-2); font-size: 0.92rem; max-width: 52rem; }

/* ---------- 响应式 ---------- */
@media (max-width: 720px) {
  html { font-size: 17px; }
  .hero h1 { font-size: 1.8rem; }
  h1 { font-size: 1.7rem; }
  h2 { font-size: 1.32rem; }
  .topbar { justify-content: center; }
  .site-nav a { padding: 8px 11px; font-size: 0.92rem; }
}

/* ---------- 高对比模式 ---------- */
html[data-contrast="high"] {
  --bg: #ffffff;
  --surface: #ffffff;
  --ink: #000000;
  --ink-2: #161616;
  --accent: #00381f;
  --accent-deep: #00281a;
  --accent-soft: #efefef;
  --warn: #4a2500;
  --warn-soft: #f4f4f4;
  --bad: #6e0000;
  --bad-soft: #f2f2f2;
  --good: #05401f;
  --good-soft: #efefef;
  --line: #616161;
  --line-strong: #000000;
  --focus: #000000;
  --shadow: none;
}
html[data-contrast="high"] .site-header { border-bottom-width: 3px; }
html[data-contrast="high"] .ctrl-btn,
html[data-contrast="high"] .sim-btn,
html[data-contrast="high"] .big-select { border-width: 2px; }
html[data-contrast="high"] a { text-decoration-thickness: 2px; }
html[data-contrast="high"] .stat,
html[data-contrast="high"] .fact,
html[data-contrast="high"] .kcard { border-width: 2px; }
html[data-contrast="high"] .badge-aaa { background: #000; color: #fff; }

/* ---------- 动效尊重 ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------- 打印 ---------- */
@media print {
  .site-header, .site-footer, .pager, .demo, .skip-link { display: none !important; }
  body { background: #fff; color: #000; font-size: 11.5pt; }
  .fact, .kcard, .callout { box-shadow: none; }
}
