/* 首页样式：按 03-ui/home-ui-desktop.png 的分区预算落位（1440 基准）。
   颜色/字号/圆角/阴影全部取自 tokens.css。 */

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink-2);
  font-family:'PingFang SC','Microsoft YaHei','Noto Sans SC',-apple-system,BlinkMacSystemFont,'Segoe UI',Arial,sans-serif;
  font-size: var(--fs-4);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
section[id] { scroll-margin-top: 84px; }
a { color: inherit; }
h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button { font: inherit; }

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

.wrap {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 90;
  background: var(--ink);
  color: var(--on-dark);
  padding: 8px 14px;
  border-radius: var(--r-1);
  text-decoration: none;
}
.skip-link:focus { top: 10px; }

/* ── M0 顶部导航 ─────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  height: 70px;
  background: var(--bg-header);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 70px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  flex: none;
}
.logo { width: 30px; height: 30px; color: var(--accent); flex: none; }
.brand-name {
  font-family: var(--font-serif);
  font-size: var(--fs-8);
  font-weight: 700;
  letter-spacing: 0.01em;
}
.main-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  font-size: var(--fs-3);
  color: var(--ink);
  white-space: nowrap;
}
.main-nav::-webkit-scrollbar { display: none; }
.main-nav a {
  position: relative;
  text-decoration: none;
  padding: 4px 0;
  color: var(--ink);
  transition: color var(--dur) ease;
}
.main-nav a:hover { color: var(--accent); }
.main-nav a[aria-current="page"] { color: var(--accent); font-weight: 600; }
.main-nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -15px;
  width: 26px;
  height: 3px;
  border-radius: 2px;
  background: var(--accent);
  transform: translateX(-50%);
}

/* ── M1 首屏 ─────────────────────────────────────────────── */
.hero {
  position: relative;
  height: 389px;
  overflow: hidden;
  background: var(--bg);
}
.hero-inner {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  height: 100%;
}
.hero-copy { width: 560px; max-width: 100%; }
.hero h1 {
  font-family: var(--font-serif);
  font-size: var(--fs-11);
  line-height: 1.12;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.01em;
}
.hero-lead {
  margin-top: 14px;
  width: 540px;
  max-width: 100%;
  font-size: var(--fs-5);
  line-height: 1.82;
  color: var(--ink-2);
}
.hero-actions { margin-top: 20px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 24px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  font-size: var(--fs-4);
  font-weight: 600;
  text-decoration: none;
  transition: background var(--dur) ease, color var(--dur) ease, transform var(--dur) ease;
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-dark); transform: translateY(-1px); }
.btn-ghost {
  background: var(--surface);
  color: var(--accent);
  border-color: var(--accent);
}
.btn-ghost:hover { background: var(--accent-soft); }
.hero-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
  margin-top: 18px;
  font-size: var(--fs-2);
  color: var(--ink-3);
}
.hero-meta li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 18px;
  min-height: 26px;
}
.hero-meta li:first-child { padding-left: 0; }
.hero-meta li + li { border-left: 1px solid var(--line); }
.hero-meta svg { width: 17px; height: 17px; color: var(--accent); flex: none; }
.hero-meta a { text-decoration: none; color: var(--ink-3); }
.hero-meta a:hover { color: var(--accent); }
.hero-art {
  position: absolute;
  top: 0;
  bottom: 0;
  right: max(0px, calc((100% - 1440px) / 2));
  /* 宽度不能只看百分比：右缘贴容器（超宽屏跟着内收），宽度却随视口放大，
     两条基准不同步，1081–1280 与 ≥1600 会让图片左缘穿进 560px 文案列
     （1920 压 205px、2560 压 550px、3440 压 1026px）。三个上限依次保证：
     ① 文案列 + 左右 gutter + 12px 间隙留位（中等屏）
     ② 不超过 1440 容器的 54%（超宽屏；1440 基准值仍是 777.6px，compare 基线不变）
     ③ 常规屏保持原 54% */
  width: min(54%, calc(100% - 620px), calc(var(--container) * 0.54));
  z-index: 1;
}
.hero-art img { width: 100%; height: 100%; object-fit: cover; }

/* ── 通用区块标题 ─────────────────────────────────────────── */
.sec-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-serif);
  font-size: var(--fs-9);
  line-height: 34px;
  font-weight: 700;
  color: var(--ink);
}
.sec-title::before {
  content: "";
  width: 4px;
  height: 24px;
  border-radius: 2px;
  background: var(--accent);
  flex: none;
}

/* ── M2 按门类查找 ───────────────────────────────────────── */
.categories { padding: 40px 0 0; }
.cat-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 12px;
  margin-top: 18px;
}
.cat-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 12px 10px 6px;
  border-radius: var(--r-2);
  background: var(--surface-2);
  text-decoration: none;
  transition: transform var(--dur) ease, box-shadow var(--dur) ease;
}
.cat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-card); }
.cat-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--r-1);
  overflow: hidden;
  background: var(--band);
}
.cat-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cat-thumb--emoji {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  line-height: 1;
  background: var(--surface-2);
}
.cat-num {
  position: absolute;
  top: 8px;
  left: 11px;
  font-family: var(--font-serif);
  font-size: var(--fs-1);
  color: var(--accent);
  opacity: 0.75;
}
.cat-name {
  font-family: var(--font-serif);
  font-size: var(--fs-6);
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
  text-align: center;
}
.cat-desc {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: -4px;
  max-width: 100%;
  font-size: var(--fs-1);
  line-height: 1.4;
  color: var(--muted);
  text-align: center;
}

/* ── M3 常见入门条目 ─────────────────────────────────────── */
.items { position: relative; padding: 32px 0 0; }
.items .more {
  position: absolute;
  top: 42px;
  right: var(--gutter);
  font-size: var(--fs-3);
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.items .more span { display: inline-block; transition: transform var(--dur) ease; }
.items .more:hover span { transform: translateX(3px); }
.item-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 16px;
}
.item-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 106px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  background: var(--surface);
  text-decoration: none;
  transition: border-color var(--dur) ease, box-shadow var(--dur) ease;
}
.item-card:hover { border-color: var(--accent); box-shadow: var(--shadow-card); }
.item-thumb {
  flex: none;
  width: 28%;
  aspect-ratio: 4 / 3;
  border-radius: var(--r-1);
  overflow: hidden;
  background: var(--surface-2);
}
.item-thumb img { width: 100%; height: 100%; object-fit: cover; }
.item-thumb--emoji {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  line-height: 1;
  background: var(--surface-2);
}
.item-body { min-width: 0; }
.item-name {
  display: block;
  font-family: var(--font-serif);
  font-size: var(--fs-6);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.35;
}
.item-spec {
  display: block;
  margin-top: 5px;
  font-size: var(--fs-2);
  line-height: 1.6;
  color: var(--muted);
}

/* ── M4 四步动手 ─────────────────────────────────────────── */
.path { padding: 34px 0 0; }
.step-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-top: 18px;
}
.step {
  min-height: 186px;
  padding: 18px 20px 20px;
  border-radius: var(--r-2);
  background: var(--surface-2);
}
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--band);
  color: var(--accent);
  font-family: var(--font-serif);
  font-size: var(--fs-2);
  font-weight: 700;
}
.step-title {
  margin-top: 10px;
  font-family: var(--font-serif);
  font-size: var(--fs-6);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.35;
}
.step-desc {
  margin-top: 8px;
  font-size: var(--fs-2);
  line-height: 1.75;
  color: var(--ink-3);
}

/* ── M5 收录范围 ─────────────────────────────────────────── */
.scope { padding: 34px 0 0; }
.scope-inner {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr) 258px;
  gap: 22px;
  align-items: center;
  margin-top: 16px;
  padding: 14px 22px;
  border-radius: var(--r-3);
  background: var(--band-soft);
}
.scope-art { width: 100%; }
.scope-art svg { width: 100%; height: auto; display: block; }
.scope-body p { font-size: var(--fs-2); line-height: 1.8; color: var(--ink-3); }
.scope-body p + p { margin-top: 6px; }
.scope-note-label { color: var(--accent); font-weight: 600; }
.scope-side {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  background: var(--band);
}
.scope-side h3 {
  font-family: var(--font-serif);
  font-size: var(--fs-4);
  font-weight: 700;
  color: var(--accent);
}
.scope-side p {
  margin-top: 4px;
  font-size: var(--fs-1);
  line-height: 1.75;
  color: var(--ink-3);
}

/* ── M6 动手前四个判断 ───────────────────────────────────── */
.tips { padding: 36px 0 0; }
.tip-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-top: 22px;
}
.tip { display: flex; gap: 12px; align-items: center; min-height: 112px; }
.tip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  flex: none;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--accent);
}
.tip-icon svg { width: 22px; height: 22px; }
.tip-title {
  font-family: var(--font-serif);
  font-size: var(--fs-5);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.4;
}
.tip-desc {
  margin-top: 4px;
  font-size: var(--fs-2);
  line-height: 1.7;
  color: var(--ink-3);
}

/* ── M7 CTA ─────────────────────────────────────────────── */
.cta { padding: 14px 0; }
.cta-band {
  position: relative;
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 118px;
  padding: 18px 32px;
  border-radius: var(--r-3);
  background: var(--band);
  overflow: hidden;
}
.cta-art { flex: none; width: 84px; color: var(--accent); }
.cta-art svg { width: 100%; height: auto; display: block; }
.cta-copy { flex: 1 1 auto; min-width: 0; }
.cta-copy h2 {
  font-family: var(--font-serif);
  font-size: var(--fs-8);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.35;
}
.cta-copy p {
  margin-top: 4px;
  font-size: var(--fs-2);
  color: var(--ink-3);
}
.cta-actions { display: flex; align-items: center; gap: 12px; flex: none; }
.cta-actions .btn { min-height: 42px; padding: 9px 22px; }
.cta-crane {
  position: absolute;
  right: 16px;
  bottom: 6px;
  width: 74px;
  opacity: 0.5;
  color: var(--accent);
  pointer-events: none;
}

/* ── M8 页脚 ─────────────────────────────────────────────── */
.site-footer {
  padding: 52px 0 32px;
  border-top: 1px solid var(--line);
  background: var(--bg);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 34px;
  align-items: flex-start;
}
.footer-brand-col { flex: 1 1 300px; min-width: 220px; }
.footer-col { flex: 1 1 180px; min-width: 160px; }
.footer-icp {
  margin-top: 8px;
  font-size: var(--fs-1);
  color: var(--muted);
  white-space: nowrap;
}
.footer-brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.footer-brand .logo { width: 28px; height: 28px; }
.footer-brand span {
  font-family: var(--font-serif);
  font-size: var(--fs-7);
  font-weight: 700;
}
.footer-desc {
  margin-top: 12px;
  max-width: 330px;
  font-size: var(--fs-1);
  line-height: 1.8;
  color: var(--muted);
}
.footer-col h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-serif);
  font-size: var(--fs-3);
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
}
.footer-col h3::before { content: ""; width: 3px; height: 14px; background: var(--accent); border-radius: 2px; }
.footer-links {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px 18px;
  font-size: var(--fs-1);
  color: var(--ink-3);
}
.footer-links a { text-decoration: none; }
.footer-links a:hover { color: var(--accent); }
.footer-about p { font-size: var(--fs-1); line-height: 1.8; color: var(--muted); }
.footer-copy {
  flex: 1 1 100%;
  font-size: var(--fs-1);
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
}

/* ── 响应式 ─────────────────────────────────────────────── */
@media (max-width: 1280px) {
  :root { --gutter: 32px; }
  .main-nav { gap: 18px; }
  .hero h1 { font-size: var(--fs-12); }
}

@media (max-width: 1080px) {
  .hero { height: auto; min-height: 0; }
  .hero-inner { padding-top: 36px; padding-bottom: 36px; }
  .hero-art {
    position: relative;
    right: auto;
    width: auto;
    height: 300px;
    margin: 0 var(--gutter) 6px;
    border-radius: var(--r-3);
    overflow: hidden;
    order: 2;
  }
  .hero { display: flex; flex-direction: column; }
  .hero-inner { order: 1; }
  .hero-copy { width: 100%; }
  .hero-lead { width: 100%; }
  .hero-art img { border-radius: var(--r-3); }
  .cat-grid { grid-template-columns: repeat(4, 1fr); }
  .item-grid { grid-template-columns: repeat(2, 1fr); }
  .step-grid, .tip-grid { grid-template-columns: repeat(2, 1fr); }
  .step { min-height: 0; }
  .scope-inner { grid-template-columns: 150px minmax(0, 1fr); }
  .scope-side { grid-column: 1 / -1; }
  .cta-crane { display: none; }
  .footer-copy { text-align: left; }
}

@media (max-width: 860px) {
  .site-header, .header-inner { height: auto; min-height: 64px; }
  .header-inner { flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; gap: 0; }
  .main-nav {
    order: 3;
    flex: 1 1 100%;
    justify-content: flex-start;
    gap: 18px;
    margin-top: 6px;
    padding-bottom: 4px;
  }
  .main-nav a { padding: 3px 0; }
  .main-nav a[aria-current="page"]::after { bottom: -6px; }
  .items .more { position: static; display: inline-block; margin-top: 12px; }
  .scope-inner { grid-template-columns: 1fr; padding: 18px; }
  .scope-art { width: 160px; }
}

@media (max-width: 620px) {
  :root { --gutter: 20px; }
  .hero h1 { font-size: var(--fs-13); }
  .hero-lead { font-size: var(--fs-4); }
  .hero-art { height: 220px; margin-bottom: 0; }
  .hero-meta li { padding: 0 10px; font-size: var(--fs-1); }
  .hero-meta li + li { border-left: 0; }
  .hero-meta { gap: 6px 0; }
  .cat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .cat-name { font-size: var(--fs-4); }
  .item-grid { grid-template-columns: 1fr; }
  .item-thumb { width: 30%; }
  .step-grid, .tip-grid { grid-template-columns: 1fr; }
  .cta-band { flex-direction: column; align-items: flex-start; padding: 20px; }
  .cta-actions { width: 100%; }
  .cta-actions .btn { flex: 1; }
  .footer-brand-col, .footer-col { flex: 1 1 100%; min-width: 0; }
  .footer-copy { text-align: left; white-space: normal; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
