/* ==========================================================================
   HenryEdu 官网公共样式
   气质：安静、清晰、可信。大留白、卡片、弱阴影、克制动效。
   ========================================================================== */

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 84px;   /* 锚点别被 sticky header 盖住 */
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.35; color: var(--text); font-weight: 600; }
h1 { font-size: clamp(28px, 4.2vw, 40px); letter-spacing: -.01em; margin: 0 0 18px; }
h2 { font-size: clamp(22px, 3vw, 27px); margin: 0 0 14px; }
h3 { font-size: 18px; margin: 0 0 8px; }
p { margin: 0 0 14px; }

code, kbd, samp {
  font-family: var(--mono);
  font-size: .88em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
}

pre {
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.7;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  overflow-x: auto;
  margin: 0 0 18px;
}
pre code { background: none; border: 0; padding: 0; font-size: inherit; }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 24px; }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--surface); color: var(--text);
  padding: 10px 16px; border-radius: var(--radius-sm); z-index: 100;
}
.skip-link:focus { left: 12px; top: 12px; }

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

/* ---------------------------------------------------------------- header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .9);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; align-items: center; gap: 22px;
  min-height: 66px; flex-wrap: wrap;
}
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  background: var(--primary); color: #fff;
  border-radius: 9px;
  font-family: var(--mono); font-size: 19px; font-weight: 600;
  box-shadow: var(--shadow);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 17px; letter-spacing: -.01em; }
.brand-text small { font-size: 11.5px; color: var(--muted); }
.site-nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.site-nav a {
  color: var(--muted); font-size: 14.5px; padding: 7px 11px;
  border-radius: var(--radius-sm);
}
.site-nav a:hover { color: var(--primary-dark); background: var(--primary-soft); text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--primary-dark); background: var(--primary-soft); font-weight: 600; }

/* ---------------------------------------------------------------- footer */
.site-footer {
  margin-top: 72px; padding: 34px 0 42px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted); font-size: 13.5px;
}
.footer-inner { display: flex; flex-wrap: wrap; gap: 8px 28px; align-items: baseline; justify-content: space-between; }
.footer-inner p { margin: 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--primary); }
.footer-note { flex-basis: 100%; color: var(--muted); }

/* ---------------------------------------------------------------- 区块 */
main { display: block; }
.section { padding: 58px 0; }
.section + .section { border-top: 1px solid var(--border); }
.section-tight { padding: 40px 0; }
.section-head { max-width: 660px; margin-bottom: 30px; }
.section-head p { color: var(--muted); margin: 0; }
.eyebrow {
  display: inline-block; font-size: 12.5px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--primary);
  background: var(--primary-soft); border-radius: 999px;
  padding: 4px 11px; margin-bottom: 14px; font-weight: 600;
}

/* ---------------------------------------------------------------- hero */
.hero { padding: 68px 0 54px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 44px; align-items: center; }
.hero h1 { max-width: 15em; }
.hero-lede { font-size: 17px; color: var(--muted); max-width: 40em; margin-bottom: 20px; }
.hero-meta {
  display: flex; flex-wrap: wrap; gap: 8px 10px;
  margin: 0 0 26px; padding: 0; list-style: none;
}
.hero-meta li {
  font-size: 13.5px; color: var(--primary-dark);
  background: var(--primary-soft); border-radius: 999px; padding: 5px 13px;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 14px; }
.hero-hint { font-size: 13px; color: var(--muted); margin: 0; }

/* 首页右侧的“提示阶梯”示意 */
.ladder {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 22px 18px;
}
.ladder h3 { margin-bottom: 4px; }
.ladder > p { color: var(--muted); font-size: 13.5px; margin-bottom: 16px; }
.ladder ol { margin: 0; padding: 0; list-style: none; counter-reset: rung; }
.ladder li {
  position: relative; padding: 9px 0 9px 40px; border-top: 1px dashed var(--border);
  font-size: 14px;
}
.ladder li:first-child { border-top: 0; }
.ladder li::before {
  counter-increment: rung; content: "L" counter(rung);
  position: absolute; left: 0; top: 9px;
  width: 28px; height: 22px; display: grid; place-items: center;
  font-family: var(--mono); font-size: 11.5px; font-weight: 600;
  color: var(--primary-dark); background: var(--primary-soft); border-radius: 6px;
}
.ladder li strong { display: block; font-weight: 600; }
.ladder li span { color: var(--muted); font-size: 13px; }
.ladder li.is-gated::after {
  content: "需先提交一次作答"; display: block; margin-top: 2px;
  font-size: 12px; color: var(--accent);
}

/* ---------------------------------------------------------------- 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 15px; font-weight: 500; line-height: 1;
  padding: 13px 22px; border-radius: var(--radius-sm);
  border: 1px solid transparent; cursor: pointer;
  transition: background-color .16s ease, border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: var(--shadow); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: var(--surface); color: var(--primary-dark); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--primary); background: var(--primary-soft); }
.btn-accent { background: var(--accent); color: #3a2a0c; }
.btn-accent:hover { background: #d8912c; }
.btn-sm { font-size: 13.5px; padding: 9px 15px; }
.btn[aria-disabled="true"], .btn:disabled { opacity: .55; pointer-events: none; }

/* ---------------------------------------------------------------- 卡片 */
.grid { display: grid; gap: 18px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(27,31,35,.06), 0 10px 22px rgba(27,31,35,.07); border-color: #d8dde3; }
.card h3 { display: flex; align-items: center; gap: 9px; }
.card p { color: var(--muted); font-size: 14.5px; margin: 0; }
.card p + p { margin-top: 8px; }
.card-icon {
  flex: none; width: 26px; height: 26px; display: grid; place-items: center;
  border-radius: 7px; background: var(--primary-soft); color: var(--primary-dark);
  font-size: 14px;
}
.card-icon.accent { background: var(--accent-soft); color: #9a6412; }
.card-link { display: inline-block; margin-top: 12px; font-size: 14px; }

.card-flat { box-shadow: none; }
.card-flat:hover { transform: none; box-shadow: var(--shadow); }

.note {
  background: var(--surface-2); border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm); padding: 14px 18px; font-size: 14.5px; color: var(--muted);
}
.note.warn { border-left-color: var(--accent); background: var(--accent-soft); color: #6b4a12; }
.note.plain { border-left-color: var(--border); }
.note strong { color: var(--text); }
.note p:last-child { margin-bottom: 0; }

/* 「它不做什么」清单 */
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.checklist li { position: relative; padding-left: 30px; color: var(--muted); }
.checklist li strong { color: var(--text); }
.checklist li::before {
  content: "✓"; position: absolute; left: 0; top: 0;
  width: 20px; height: 20px; margin-top: 4px; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: #fff; background: var(--success); border-radius: 50%;
}
.checklist.no li::before { content: "—"; background: var(--muted); }
.checklist.no li { color: var(--muted); }

/* ---------------------------------------------------------------- 步骤 */
.steps { counter-reset: step; list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.steps.cols { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.steps li { position: relative; padding: 20px 20px 20px 62px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.steps li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 20px; top: 19px;
  width: 28px; height: 28px; display: grid; place-items: center;
  background: var(--primary); color: #fff; border-radius: 50%;
  font-weight: 600; font-size: 14px;
}
.steps li h3 { font-size: 16px; margin-bottom: 4px; }
.steps li p { margin: 0; color: var(--muted); font-size: 14px; }

/* ---------------------------------------------------------------- 版本条 */
.version-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 15px 20px; font-size: 14.5px;
}
.version-bar .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); flex: none; }
.version-bar .v { font-family: var(--mono); font-weight: 600; color: var(--primary-dark); }
.version-bar .muted { color: var(--muted); }
.version-bar a { margin-left: auto; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- 下载 */
.dl-card { display: flex; flex-direction: column; }
.dl-card .dl-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.dl-card .dl-arch { font-family: var(--mono); color: var(--muted); font-size: 13px; margin: 2px 0 12px; }
.dl-card .btn { margin-top: auto; }
.dl-card.recommended { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary-soft), var(--shadow); }
.badge {
  display: inline-block; font-size: 12px; font-weight: 600; line-height: 1;
  padding: 5px 9px; border-radius: 999px; white-space: nowrap;
}
.badge-primary { background: var(--primary-soft); color: var(--primary-dark); }
.badge-accent { background: var(--accent-soft); color: #9a6412; }
.badge-muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.badge-success { background: #eaf5ec; color: #2f6b3c; }

/* ---------------------------------------------------------------- 表格 */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-weight: 600; color: var(--primary-dark); background: var(--surface-2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.mono, th.mono { font-family: var(--mono); font-size: 13.5px; }

/* ---------------------------------------------------------------- 文档正文 */
.prose { max-width: 780px; }
.prose h2 { margin-top: 44px; padding-top: 8px; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { margin-top: 28px; }
.prose ul, .prose ol { margin: 0 0 16px; padding-left: 22px; }
.prose li { margin-bottom: 6px; }
.prose li > ul, .prose li > ol { margin-top: 6px; }
.prose > p, .prose > ul, .prose > ol { color: #3b4249; }
.prose code { white-space: nowrap; }

.toc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 22px; }
.toc h3 { font-size: 14px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 10px; }
.toc ul { margin: 0; padding-left: 18px; columns: 2; column-gap: 30px; }
.toc li { margin-bottom: 5px; font-size: 14.5px; }

/* ---------------------------------------------------------------- FAQ */
.faq-list { display: grid; gap: 12px; }
details.faq {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 4px 20px;
}
details.faq + details.faq { margin-top: 0; }
details.faq summary {
  cursor: pointer; list-style: none; padding: 14px 0;
  font-weight: 600; font-size: 16px; display: flex; gap: 12px; align-items: baseline;
}
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::before { content: "＋"; color: var(--primary); font-weight: 600; flex: none; }
details.faq[open] summary::before { content: "－"; }
details.faq .faq-body { padding: 0 0 16px 27px; color: var(--muted); }
details.faq .faq-body p:last-child { margin-bottom: 0; }

/* ---------------------------------------------------------------- changelog */
.release {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 24px 26px; margin-bottom: 18px;
  scroll-margin-top: 84px;
}
.release-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px; margin-bottom: 4px; }
.release-head h2 { margin: 0; font-family: var(--mono); font-size: 21px; }
.release-head time { color: var(--muted); font-size: 13.5px; font-family: var(--mono); }
.release-subject { font-weight: 600; margin: 0 0 12px; }
.release-notes { margin: 0; padding-left: 20px; color: var(--muted); font-size: 14.5px; }
.release-notes li { margin-bottom: 7px; }
.release-notes li strong { color: var(--text); }
.release-empty { color: var(--muted); font-size: 14px; margin: 0; }
.release-hash { margin-top: 12px; font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* ---------------------------------------------------------------- 404 */
.center-page { min-height: 62vh; display: grid; place-items: center; text-align: center; }
.center-page .code {
  font-family: var(--mono); font-size: 16px; color: var(--accent);
  letter-spacing: .2em; margin-bottom: 6px;
}

/* ---------------------------------------------------------------- 滚动淡入 */
.js .reveal { opacity: 0; transform: translateY(10px); transition: opacity .5s ease, transform .5s ease; }
.js .reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .001ms !important; animation-duration: .001ms !important; }
  .js .reveal { opacity: 1; transform: none; }
}

/* ---------------------------------------------------------------- 响应式 */
@media (max-width: 920px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 30px; }
  .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .steps.cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toc ul { columns: 1; }
}

@media (max-width: 640px) {
  body { font-size: 15.5px; }
  .header-inner { gap: 10px; padding-top: 10px; padding-bottom: 10px; }
  .site-nav { margin-left: 0; width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .site-nav a { white-space: nowrap; }
  .hero { padding: 44px 0 36px; }
  .section { padding: 42px 0; }
  .cols-2, .cols-3, .cols-4 { grid-template-columns: minmax(0, 1fr); }
  .steps.cols { grid-template-columns: minmax(0, 1fr); }
  .version-bar a { margin-left: 0; }
}
