:root {
  --bg: #fbfaf7;
  --surface: #fff;
  --muted-surface: #f4f0e8;
  --ink: #211e1b;
  --muted: #5f5850;
  --line: #e5ded2;
  --accent: #9b3c2a;
  --accent-dark: #733020;
  --max: 1160px;
  --gutter: clamp(20px, 4.5vw, 42px);
  --serif: "Noto Serif SC", "Songti SC", SimSun, Georgia, serif;
  --sans: "DM Sans", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font: 16px/1.75 var(--sans);
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: .25em; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
h1, h2, h3, p, figure { margin: 0; }
h1, h2, h3 { line-height: 1.25; }
h1, h2 { font-family: var(--serif); }
h2 { font-size: clamp(28px, 3.3vw, 39px); }
h3 { font-size: clamp(17px, 2.1vw, 20px); }
p { color: var(--muted); }
section[id] { scroll-margin-top: 24px; }

.wrap {
  width: min(100%, calc(var(--max) + 2 * var(--gutter)));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip {
  position: absolute;
  z-index: 5;
  top: -100px;
  left: 16px;
  padding: 8px 12px;
  background: var(--surface);
}
.skip:focus { top: 12px; }

.site-header { border-bottom: 1px solid var(--line); }
.header-inner {
  display: grid;
  grid-template-columns: 1fr auto 132px;
  align-items: center;
  gap: 30px;
  min-height: 80px;
}

.brand {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 13px;
  text-decoration: none;
  white-space: nowrap;
}

.brand span { font: 700 25px/1.1 var(--serif); }
.brand small {
  border-left: 1px solid var(--line);
  padding-left: 13px;
  color: var(--muted);
  font-size: 13px;
}

nav { display: flex; align-items: center; gap: clamp(16px, 3vw, 32px); }
nav a { font-size: 14px; text-decoration: none; white-space: nowrap; }
nav a:hover, nav .active, nav [aria-current="page"] { color: var(--accent); text-decoration: underline; }

.header-contact {
  justify-self: end;
  padding: 8px 14px;
  border: 1px solid var(--accent);
  border-radius: 5px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 650;
  white-space: nowrap;
  text-decoration: none;
}
.header-contact:hover, .header-contact[aria-current="page"] { background: #f4e7e1; }

.hero { padding: clamp(50px, 7.4vw, 104px) 0 clamp(52px, 6.6vw, 92px); border-bottom: 1px solid var(--line); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(240px, .84fr); gap: clamp(26px, 6vw, 98px); align-items: center; }
.hero h1 { font-size: clamp(37px, 5.25vw, 74px); letter-spacing: -.035em; }
.hero h1 span { display: block; color: var(--accent); }
.lede { max-width: 570px; color: var(--muted); font-size: clamp(16px, 1.7vw, 20px); line-height: 1.8; }
.hero .lede { margin: 24px 0 28px; }
.profile h1 { font-size: clamp(44px, 6vw, 84px); }
.profile-summary { margin-top: 12px; color: var(--accent); font-size: clamp(22px, 2.7vw, 33px); line-height: 1.4; font-weight: 650; }

.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.btn {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 17px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 650;
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
  text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost { border-color: #c9bdb0; }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.portrait { width: 100%; max-width: 355px; justify-self: end; }
.portrait-frame {
  overflow: hidden;
  aspect-ratio: 1.05;
  background: #e9e9eb;
  border-radius: 8px;
}
.portrait-frame img { width: 100%; height: 100%; object-fit: cover; object-position: center 7%; }

.section { padding-block: clamp(40px, 6.1vw, 76px); }
.section h2 { margin-bottom: 25px; }
.section-tinted { background: var(--muted-surface); }
.label { color: var(--accent); font-size: 13px; font-weight: 650; }
.text-link { color: var(--accent); text-decoration: underline; }
.text-link:hover { color: var(--accent-dark); }
.text-link span { white-space: nowrap; }

.example-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.example { background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: clamp(18px, 3.3vw, 30px); }
.example h3 { margin-block: 7px 9px; }
.example a { display: inline-flex; margin-top: 15px; }
.guide-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 24px; }
.guide-list article { border-top: 1px solid var(--line); padding-top: 15px; }
.guide-list a { text-decoration: none; }
.guide-list a:hover { text-decoration: underline; color: var(--accent); }
.guide-list p { margin-top: 8px; }
.section-tail { margin-top: 18px; }

.page-intro { border-bottom: 1px solid var(--line); padding-block: clamp(48px, 6.7vw, 87px) clamp(31px, 5vw, 61px); }
.page-intro h1 { max-width: 920px; font-size: clamp(35px, 4.8vw, 60px); letter-spacing: -.025em; }
.page-intro .lede { margin-top: 14px; max-width: 720px; }
.page-intro .actions { margin-top: 22px; }

.detail-stack { padding-block: 12px 34px; }
.detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.45fr);
  gap: clamp(24px, 5vw, 65px);
  border-bottom: 1px solid var(--line);
  padding-block: 28px;
}
.detail:last-child { border-bottom: 0; }
.detail-title h2 { font-size: clamp(25px, 3vw, 35px); margin-block: 7px 10px; }
.detail-body p + p, .prose p + p { margin-top: 10px; }
.detail-body p + a { display: inline-flex; margin-top: 13px; }
.detail-body h3 { margin-bottom: 8px; }
.detail-body strong { color: var(--ink); }
.source-note { font-size: 14px; }
.short-copy, .prose { max-width: 740px; }
.short-copy { margin-bottom: 12px; }
.prose h3 { margin-block: 20px 8px; }
.prose a { display: inline-flex; margin-top: 14px; }

.article { box-sizing: content-box; width: auto; max-width: 760px; padding-block: 30px 65px; }
.article .byline { padding-bottom: 17px; border-bottom: 1px solid var(--line); font-size: 14px; }
.article h2 { font-size: clamp(24px, 3vw, 33px); margin-block: 26px 10px; }
.article p, .article li { color: var(--muted); }
.article li + li { margin-top: 6px; }
.article ol, .article ul, .contact-page ol { padding-left: 1.4em; }
.article .actions { margin-top: 24px; }
.article-note > p + p { margin-top: 12px; }
.article .byline + p { margin-top: 18px; }
.qa-cases li + li { margin-top: 11px; }
.article pre {
  margin-block: 14px;
  padding: 14px 17px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--muted-surface);
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.article pre code { font-family: "IBM Plex Mono", Consolas, "Microsoft YaHei", monospace; }

.attention-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(30px, 6vw, 86px);
  padding-block: clamp(38px, 6vw, 82px);
}
.attention-heading .label { margin-bottom: 16px; }
.attention-heading .label span { color: var(--muted); }
.attention-heading h1 { font-size: clamp(36px, 5.1vw, 68px); }
.attention-heading .lede { margin-block: 15px 22px; text-wrap: balance; }
.attention-heading .attention-byline { font-size: 14px; }
.attention-cover { width: min(100%, 380px); justify-self: end; }
.attention-layout {
  display: grid;
  grid-template-columns: minmax(155px, 215px) minmax(0, 735px);
  align-items: start;
  gap: clamp(24px, 5vw, 76px);
  border-top: 1px solid var(--line);
  padding-block: clamp(28px, 5vw, 58px) 64px;
}
.attention-toc {
  position: sticky;
  top: 24px;
  display: block;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--muted-surface);
}
.attention-toc p { font-size: 14px; font-weight: 700; color: var(--ink); }
.attention-toc ol { margin: 6px 0 0; padding-inline-start: 1.4em; }
.attention-toc li { color: var(--muted); font-size: 13px; }
.attention-toc a { display: block; padding-block: 5px; white-space: normal; }
.attention-prose { font-size: clamp(16px, 1.5vw, 18px); line-height: 1.86; }
.attention-prose a { color: var(--accent-dark); }
.attention-prose .btn-primary { color: #fff; }
.attention-prose p + p { margin-top: 0.85em; }
.attention-summary {
  border-inline-start: 3px solid var(--accent);
  padding-inline-start: clamp(14px, 2vw, 22px);
}
.attention-summary p { color: var(--ink); }
.attention-section { margin-top: clamp(30px, 5vw, 58px); }
.attention-section h2 {
  margin-bottom: 12px;
  font-size: clamp(24px, 3vw, 35px);
  scroll-margin-top: 24px;
}
.attention-section h3 { margin-block: 18px 7px; }
.attention-figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
}
.attention-section .attention-figure { width: min(100%, 520px); margin: 23px auto; }
.attention-figure figcaption { margin-top: 8px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.attention-formula {
  padding: 9px 12px;
  border-radius: 5px;
  background: var(--muted-surface);
  color: var(--ink);
  overflow-wrap: anywhere;
}
.attention-formula + p { margin-top: 0.85em; }
.attention-reference { margin-inline-start: 3px; font: 0.7em/0 var(--sans); vertical-align: super; }
.attention-sources { margin-top: 0; padding-inline-start: 1.45em; overflow-wrap: anywhere; }
.attention-sources li { padding-block: 4px; scroll-margin-top: 24px; }
.attention-sources :target a { text-decoration-thickness: 2px; }
.attention-prose .actions { margin-top: 26px; }

.explainer-entry-links { display: flex; flex-wrap: wrap; gap: 10px 24px; }
.explainer-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(18px, 3vw, 30px);
}
.explainer-card {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}
.explainer-card a { display: block; text-decoration: none; }
.explainer-card a:hover h2 { color: var(--accent); text-decoration: underline; }
.explainer-card img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: contain;
  background: var(--muted-surface);
  border-radius: 4px;
}
.explainer-card h2 { margin: 14px 0 8px; font-size: clamp(19px, 2.3vw, 26px); text-wrap: balance; }
.explainer-card p { font-size: 15px; }
.explainer-article .attention-heading h1 { text-wrap: balance; overflow-wrap: anywhere; }
.explainer-article .attention-heading .explainer-title-compact { font-size: clamp(30px, 4.2vw, 54px); }
.explainer-opening { margin-top: 22px; }
.explainer-article .attention-section .attention-figure { width: min(100%, var(--figure-width, 520px)); }
.explainer-table {
  margin-block: 18px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 5px;
}
.explainer-table:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.explainer-table table {
  width: 100%;
  min-width: 440px;
  border-collapse: collapse;
  text-align: left;
  background: var(--surface);
  font-size: 15px;
  line-height: 1.6;
}
.explainer-table caption {
  padding: 11px 13px;
  background: var(--muted-surface);
  color: var(--ink);
  font-weight: 700;
  text-align: left;
}
.explainer-table th, .explainer-table td {
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  vertical-align: top;
}
.explainer-table thead th { background: var(--bg); }
.explainer-table tbody th { font-weight: 600; }
.explainer-code {
  margin-block: 16px;
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--muted-surface);
  color: var(--ink);
  font: inherit;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.explainer-code code { font-size: 0.9em; }
.explainer-neighbors {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 8px 20px;
  margin-top: 26px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.explainer-neighbors a { white-space: normal; text-decoration: underline; }


.contact-band { background: #2a2420; color: #fffbf6; padding-block: clamp(30px, 5.5vw, 56px); }
.contact-inner { display: flex; align-items: center; justify-content: space-between; gap: 18px 32px; }
.contact-band h2 { font-size: clamp(26px, 3vw, 39px); }
.contact-band p { color: #e3d6ca; margin-top: 7px; }
.contact-band .btn { background: #fff6eb; color: #592e23; flex-shrink: 0; }
.contact-band .btn:hover { background: #f7dfd3; }

.direct-contact { margin-bottom: clamp(22px, 4vw, 36px); }
.direct-contact h2 { margin-bottom: 8px; font-size: clamp(24px, 3vw, 33px); }
.direct-contact p { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 16px; }
.direct-contact a { color: var(--accent); font-size: clamp(22px, 3vw, 29px); font-weight: 650; }
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(24px, 5vw, 55px); }
.contact-grid h2 { font-size: clamp(24px, 3vw, 33px); }
.contact-grid li { margin-bottom: 6px; }
.contact-panel { padding: clamp(18px, 3.4vw, 32px); border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.contact-panel p { margin-bottom: 17px; }
.contact-panel .text-link { display: inline-flex; margin-top: 17px; }

.site-footer { border-top: 1px solid var(--line); padding-block: 23px; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 28px; }
.footer-inner p { display: flex; gap: 12px; align-items: baseline; font-size: 13px; }
.footer-inner strong { color: var(--ink); font: 700 20px/1.2 var(--serif); }
.footer-inner div { display: flex; flex-wrap: wrap; gap: 10px 20px; }
.footer-inner a { color: var(--muted); font-size: 13px; text-decoration: none; }
.footer-inner a:hover { color: var(--accent); text-decoration: underline; }
.footer-friends a { text-decoration: underline; }
.site-icp { margin: 18px auto 0; padding-inline: var(--gutter); text-align: center; font-size: 13px; }
.site-icp a { color: var(--muted); text-decoration: none; }
.site-icp a:hover { color: var(--accent); text-decoration: underline; }

@media (max-width: 910px) {
  .header-inner { grid-template-columns: auto 1fr auto; gap: 16px; }
  nav { justify-content: center; gap: 16px; }
  .brand small { display: none; }
  .explainer-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .header-inner { grid-template-columns: 1fr auto; column-gap: 8px; row-gap: 12px; padding-block: 12px; }
  .brand small { display: inline; }
  nav { grid-area: 2 / 1 / 3 / -1; justify-content: space-between; gap: 6px; }
  nav a { font-size: 13px; }
  .header-contact { grid-area: 1 / 2; padding: 6px 9px; font-size: 13px; }

  .hero { padding-block: 40px 34px; }
  .hero-grid { grid-template-columns: 1fr; align-items: start; gap: 24px; }
  .hero .lede { margin-block: 14px 19px; }
  .portrait { justify-self: start; max-width: 355px; }
  .portrait-frame { aspect-ratio: 1.3; }

  .section h2 { margin-bottom: 18px; }
  .example-grid, .guide-list, .detail, .contact-grid { grid-template-columns: 1fr; }
  .detail, .contact-grid { gap: 14px; }
  .contact-inner { flex-wrap: wrap; }

  .attention-hero, .attention-layout { grid-template-columns: minmax(0, 1fr); }
  .attention-heading h1 { font-size: clamp(30px, 9.2vw, 52px); }
  .explainer-article .attention-heading .explainer-title-compact { font-size: clamp(25px, 7.7vw, 52px); }
  .attention-cover { max-width: 320px; justify-self: center; }
  .attention-toc { grid-area: auto; position: static; width: 100%; padding: 14px 18px; }
  .attention-toc a { padding-block: 7px; }
}

@media (max-width: 520px) {
  .explainer-list { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 480px) {
  .explainer-table::before {
    content: "横向滑动可查看完整表格";
    position: sticky;
    left: 0;
    display: block;
    padding: 6px 13px;
    color: var(--muted);
    font-size: 13px;
  }
}

