:root {
  --ink: #172623;
  --ink-soft: #334a43;
  --teal: #5cc6b0;
  --teal-deep: #3d9e8b;
  --sand: #d4c4a8;
  --clay: #c67b5c;
  --paper: #f7f2e8;
  --paper-2: #eee5d3;
  --line: rgba(23, 38, 35, 0.16);
  --shell: 1200px;
  --oft: 68px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: Inter, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.78;
  color: var(--ink);
  background:
    radial-gradient(1100px 520px at 82% -8%, rgba(212, 196, 168, 0.55), transparent 70%),
    linear-gradient(180deg, var(--paper) 0%, #f9f5ec 40%, var(--paper) 100%);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.55;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.32'/%3E%3C/svg%3E");
}

p { margin: 0 0 1em; }

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

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

ul, ol { padding-left: 1.25em; }

h1, h2, h3, h4 {
  font-family: "Playfair Display", Georgia, "Songti SC", serif;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
}

/* 顶部导航 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(23, 38, 35, 0.97);
  color: var(--sand);
  box-shadow: 0 2px 0 rgba(92, 198, 176, 0.35), 0 10px 24px -18px rgba(0, 0, 0, 0.65);
}

.sitenav {
  position: relative;
  max-width: var(--shell);
  margin: 0 auto;
  min-height: var(--oft);
  padding: 0 clamp(14px, 3vw, 28px);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
}

.sitenav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-r { justify-content: flex-end; padding-right: 58px; }

.sitenav a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 10px;
  font-size: 16px;
  color: var(--sand);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color 0.22s ease-out, border-color 0.22s ease-out;
}

.sitenav a:hover,
.sitenav a:focus-visible {
  color: var(--teal);
  border-bottom-color: var(--teal);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-self: center;
  padding: 0 8px;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0.07em;
  color: var(--teal) !important;
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 0 !important;
}

.brand-mark { width: 26px; height: 26px; object-fit: contain; }

.burger {
  position: absolute;
  right: clamp(14px, 3vw, 28px);
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  min-width: 44px;
  min-height: 44px;
  padding: 0 11px;
  font: inherit;
  font-size: 16px;
  color: var(--sand);
  background: transparent;
  border: 1px solid rgba(212, 196, 168, 0.45);
  border-radius: 0;
  cursor: pointer;
  transition: background 0.2s ease-out, color 0.2s ease-out;
}

.burger:hover { background: rgba(92, 198, 176, 0.18); color: var(--teal); }

body.navopen { overflow: hidden; }

body.navopen .topbar {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: #16221f;
  box-shadow: none;
}

body.navopen .sitenav {
  height: 100%;
  max-width: none;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto 1fr;
  align-content: start;
  gap: 26px;
  padding-top: calc(var(--oft) + 26px);
  padding-bottom: 40px;
  overflow-y: auto;
}

body.navopen .brand {
  grid-column: 1 / -1;
  font-size: 26px;
}

body.navopen .sitenav ul {
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 2px;
  justify-content: flex-start;
}

body.navopen .nav-l { justify-content: flex-end; text-align: right; }
body.navopen .nav-r { justify-content: flex-start; padding-right: 0; }

body.navopen .sitenav a {
  min-height: 52px;
  font-size: 19px;
  border-bottom: 0;
}

/* 页内锚点条 */
.anchor {
  position: sticky;
  top: var(--oft);
  z-index: 15;
  background: rgba(212, 196, 168, 0.62);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(4px);
}

.anchor nav {
  max-width: var(--shell);
  margin: 0 auto;
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
}

.anchor nav::-webkit-scrollbar { display: none; }

.anchor ul {
  display: flex;
  gap: 1px;
  margin: 0;
  padding: 0 clamp(10px, 3vw, 24px);
  list-style: none;
  white-space: nowrap;
}

.anchor a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  font-size: 16px;
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease-out, border-color 0.2s ease-out;
}

.anchor a:hover,
.anchor a:focus-visible {
  color: var(--ink);
  border-bottom-color: var(--clay);
}

/* 主体骨架 */
.shell {
  position: relative;
  z-index: 1;
  max-width: var(--shell);
  margin: 0 auto;
  padding: clamp(18px, 3vw, 34px) clamp(14px, 3vw, 28px) 64px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 292px;
  gap: clamp(22px, 3vw, 46px);
  align-items: start;
}

.doc { min-width: 0; }

/* 首屏 */
.hero {
  display: grid;
  grid-template-columns: auto minmax(0, auto);
  justify-content: center;
  align-content: center;
  gap: 4px 14px;
  min-height: 45vh;
  margin-bottom: 26px;
  padding: 30px 22px;
  text-align: center;
  border-bottom: 3px solid var(--teal);
  background:
    repeating-linear-gradient(0deg, transparent 0 43px, rgba(23, 38, 35, 0.07) 43px 44px),
    repeating-linear-gradient(90deg, transparent 0 43px, rgba(23, 38, 35, 0.07) 43px 44px),
    linear-gradient(155deg, #eae0cc 0%, #f7f2e8 62%, #f4ecdd 100%);
}

.hero-mark {
  grid-row: 1;
  align-self: center;
  color: var(--clay);
  line-height: 0;
}

.hero h1 {
  grid-row: 1;
  grid-column: 2;
  margin: 0;
  font-size: clamp(28px, 4.6vw, 46px);
  letter-spacing: 0.005em;
}

.lede {
  grid-column: 1 / -1;
  margin: 10px 0 0;
  max-width: 44ch;
  font-size: 17px;
  color: var(--ink-soft);
}

/* 正文 */
.doc > section {
  padding: 30px 0 8px;
  border-top: 1px solid var(--line);
  scroll-margin-top: calc(var(--oft) + 58px);
}

.doc > section:first-of-type { border-top: 0; padding-top: 8px; }

.doc h2 {
  margin: 0 0 14px;
  font-size: clamp(23px, 2.7vw, 31px);
}

.doc h2::before {
  content: "";
  display: block;
  width: 46px;
  height: 3px;
  margin-bottom: 12px;
  background: var(--teal);
}

.doc h2 > span,
.rail h2 > span {
  background: linear-gradient(transparent 64%, rgba(92, 198, 176, 0.42) 64%);
  padding: 0 1px;
}

.doc h3 { margin: 26px 0 10px; font-size: 21px; }

.doc p { margin: 0 0 1.05em; }

.doc ul, .doc ol { margin: 0 0 1.1em; }

.doc li { margin-bottom: 0.4em; }

.doc blockquote {
  margin: 20px 0;
  padding: 14px 20px;
  background: rgba(212, 196, 168, 0.34);
  border-left: 4px solid var(--clay);
  color: var(--ink-soft);
}

.doc blockquote p:last-child { margin-bottom: 0; }

.doc table {
  width: 100%;
  margin: 18px 0;
  border-collapse: collapse;
  font-size: 16px;
}

.doc th, .doc td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.doc th { background: var(--paper-2); font-weight: 600; }

.doc img { margin: 18px 0; box-shadow: 0 14px 26px -22px rgba(23, 38, 35, 0.8); }

.doc hr { border: 0; border-top: 1px solid var(--line); margin: 26px 0; }

/* 侧栏 */
.rail {
  position: sticky;
  top: calc(var(--oft) + 62px);
  display: grid;
  gap: 20px;
  font-size: 16px;
  z-index: 1;
}

.rail nav,
.rail-top {
  padding: 6px 4px 12px;
  background: linear-gradient(180deg, rgba(255, 253, 248, 0.95), rgba(240, 232, 216, 0.8));
  border-bottom: 2px solid var(--teal);
  box-shadow: 0 12px 22px -24px rgba(23, 38, 35, 0.9);
}

.rail h2 {
  margin: 0 0 6px;
  padding: 6px 10px 0;
  font-size: 19px;
}

.rail ul { margin: 0; padding: 0; list-style: none; }

.rail a {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 3px 10px;
  color: var(--ink-soft);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: background 0.2s ease-out, color 0.2s ease-out, border-color 0.2s ease-out;
}

.rail a:hover,
.rail a:focus-visible {
  color: var(--ink);
  background: rgba(92, 198, 176, 0.2);
  border-left-color: var(--teal);
}

.to-top { font-weight: 500; }

/* 页脚 */
.foot {
  position: relative;
  z-index: 1;
  margin-top: 20px;
  padding: 46px max(clamp(14px, 3vw, 28px), calc((100vw - var(--shell)) / 2 + 24px)) 22px;
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr;
  gap: 8px 40px;
  background: var(--ink);
  color: var(--sand);
}

.foot p { margin: 0; }

.foot-brand {
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(38px, 6.6vw, 74px);
  line-height: 1.02;
  letter-spacing: 0.02em;
  color: var(--teal);
}

.foot-col a {
  display: flex;
  align-items: center;
  min-height: 40px;
  color: var(--sand);
  font-size: 16px;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease-out, border-color 0.2s ease-out;
}

.foot-col a:hover,
.foot-col a:focus-visible {
  color: var(--teal);
  border-bottom-color: var(--teal);
}

.foot-copy {
  grid-column: 1 / -1;
  margin-top: 22px;
  padding-top: 14px;
  font-size: 16px;
  color: rgba(212, 196, 168, 0.75);
  border-top: 1px solid rgba(212, 196, 168, 0.25);
}

/* 动效 */
@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.75s ease-out, transform 0.75s ease-out;
  }
  .reveal.in { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* 断点 */
@media (max-width: 1080px) {
  .sitenav a { padding: 0 8px; font-size: 16px; }
  .nav-r { padding-right: 56px; }
}

@media (max-width: 980px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail {
    position: static;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
}

@media (max-width: 900px) {
  .sitenav { grid-template-columns: 1fr; }
  .sitenav ul { display: none; }
  body.navopen .sitenav ul { display: flex; }
  body.navopen .sitenav { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  body { font-size: 17px; }
  .foot { grid-template-columns: 1fr; }
  .foot-copy { margin-top: 18px; }
}

@media (max-width: 520px) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .hero-mark { grid-row: 1; grid-column: 1; justify-self: center; }
  .hero h1 { grid-column: 1; grid-row: 2; }
  .lede { grid-column: 1; }
  .rail { grid-template-columns: 1fr; }
}

button[aria-expanded]{min-width:44px;min-height:44px}
