@import url('https://fonts.googleapis.com/css2?family=Lexend+Mega:wght@100..900&family=Public+Sans:wght@100..900&display=swap');

:root {
  --paper: #fdfbf7;
  --paper-2: #f5f5f5;
  --ink: #1a1a1a;
  --rule: #e0e0e0;
  --muted: #575757;
  --rail: 264px;
  --font-body: "Public Sans", -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-display: "Lexend Mega", "Public Sans", -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.75;
  letter-spacing: 0.01em;
  overflow-x: hidden;
  overflow-x: clip;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  opacity: 0.2;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23g)' opacity='0.42'/%3E%3C/svg%3E");
  background-size: 140px 140px;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: -0.02em;
  margin: 0;
}

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

a {
  color: var(--ink);
}

:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.layout {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  align-items: start;
}

.sheet {
  min-width: 0;
}

/* ---- 左侧索引栏 ---- */
.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 26px 20px 22px;
  background: rgba(245, 245, 245, 0.9);
  backdrop-filter: blur(6px);
  border-right: 1px solid var(--rule);
  z-index: 40;
}

.nav-toggle {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.brand {
  display: block;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -0.03em;
  text-decoration: none;
  color: var(--ink);
  padding: 4px 0 10px;
  border-bottom: 2px solid var(--ink);
}

.brand:hover {
  background: var(--ink);
  color: var(--paper);
}

.menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 66px;
  min-height: 44px;
  padding: 0 14px;
  font-size: 16px;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 28px;
  cursor: pointer;
  user-select: none;
}

.rail-nav {
  flex: 1 1 auto;
  overflow-y: auto;
  margin-top: 2px;
}

.rail-nav ol {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: idx;
}

.rail-nav li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  counter-increment: idx;
}

.rail-nav li::before {
  content: counter(idx, decimal-leading-zero);
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--muted);
  flex: 0 0 auto;
}

.rail-nav a {
  display: block;
  flex: 1 1 auto;
  min-height: 44px;
  padding: 10px 6px 10px 2px;
  font-size: 16px;
  line-height: 1.5;
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
}

.rail-nav a:hover {
  background: var(--ink);
  color: var(--paper);
}

.cta {
  display: block;
  margin-top: 14px;
  min-height: 48px;
  padding: 12px 16px;
  text-align: center;
  font-size: 16px;
  text-decoration: none;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 28px;
}

.cta:hover {
  background: var(--paper);
  color: var(--ink);
}

/* ---- 主视觉 ---- */
main {
  min-width: 0;
  overflow-wrap: break-word;
}

.hero {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: flex-end;
  min-height: 45vh;
  padding: 76px 30px 34px;
  background: var(--ink);
  overflow: hidden;
}

.hero .hero-frame {
  position: absolute;
  inset: 0;
  z-index: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  backdrop-filter: none;
}

.hero .hero-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgba(26, 26, 26, 0.55);
}

.hero-copy {
  position: relative;
  z-index: 2;
  width: 100%;
}

.hero h1 {
  color: var(--paper);
  font-size: clamp(28px, 3.9vw, 52px);
  letter-spacing: -0.035em;
  max-width: 22ch;
  text-wrap: balance;
}

/* ---- 正文 ---- */
main > section:not(.hero) {
  width: 100%;
  max-width: 74ch;
  margin-inline: auto;
  padding: 30px 30px 6px;
}

main > section[id] {
  scroll-margin-top: 20px;
}

main h2 {
  font-size: clamp(21px, 2.1vw, 27px);
  margin: 26px 0 10px;
  padding-top: 18px;
  border-top: 2px solid var(--ink);
}

main h3 {
  font-size: 19px;
  margin: 22px 0 8px;
}

main p {
  margin: 0 0 1em;
}

main ul,
main ol {
  margin: 0 0 1.1em;
  padding-left: 1.3em;
}

main li {
  margin: 0.35em 0;
}

main a {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

main a:hover {
  text-decoration-thickness: 3px;
  background: var(--paper-2);
}

main figure,
main aside {
  margin: 1.2em 0;
  padding: 16px;
  background: rgba(245, 245, 245, 0.7);
  border: 1px solid var(--rule);
  border-radius: 28px;
  backdrop-filter: blur(8px);
}

main figcaption {
  font-size: 16px;
  color: var(--muted);
  padding-top: 8px;
}

main blockquote {
  margin: 1.2em 0;
  padding: 4px 0 4px 16px;
  border-left: 3px solid var(--ink);
  color: #333;
}

main table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
  margin: 0 0 1.2em;
}

main th,
main td {
  border-bottom: 1px solid var(--rule);
  padding: 9px 8px;
  text-align: left;
  vertical-align: top;
}

main pre {
  overflow-x: auto;
  padding: 14px;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: 12px;
}

main code {
  font-size: 15px;
}

/* ---- 结语卡 ---- */
main > section.signoff {
  margin: 44px auto 56px;
  padding: 26px 24px 24px;
  background: rgba(245, 245, 245, 0.78);
  border: 1px solid var(--rule);
  border-radius: 28px;
  backdrop-filter: blur(8px);
}

.signoff h2 {
  border-top: 0;
  padding-top: 0;
  margin: 0;
  font-size: clamp(20px, 2.3vw, 26px);
}

.subtitle {
  margin: 10px 0 0;
  padding-left: 12px;
  border-left: 3px solid var(--ink);
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
}

.signoff aside {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  backdrop-filter: none;
}

.jump {
  margin-top: 18px;
}

.jump ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 18px;
}

.jump a {
  display: block;
  min-height: 42px;
  padding: 9px 0;
  font-size: 16px;
  text-decoration: none;
  border-bottom: 1px dotted var(--rule);
}

.jump a:hover {
  background: var(--ink);
  color: var(--paper);
}

/* ---- 页脚 ---- */
footer {
  display: grid;
  grid-template-columns: 1.5fr 1fr 0.8fr;
  gap: 26px;
  margin-top: 24px;
  padding: 42px 30px 24px;
  border-top: 2px solid var(--ink);
  background: var(--paper-2);
}

footer section {
  min-width: 0;
}

.foot-mark {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(26px, 3.5vw, 44px);
  line-height: 1;
  letter-spacing: -0.05em;
}

.foot-desc {
  margin: 0;
  font-size: 16px;
  color: var(--muted);
}

.foot-nav ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.foot-nav a {
  display: block;
  min-height: 40px;
  padding: 8px 4px;
  font-size: 16px;
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
}

.foot-nav a:hover {
  background: var(--ink);
  color: var(--paper);
}

.to-top {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  font-size: 16px;
  text-decoration: none;
  border: 1px solid var(--ink);
  border-radius: 28px;
}

.to-top:hover {
  background: var(--ink);
  color: var(--paper);
}

.copyright {
  grid-column: 1 / -1;
  margin: 20px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
  font-size: 16px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

/* ---- 滚动显现 ---- */
.js .reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.16s linear, transform 0.16s ease-out;
}

.js .reveal.in {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .js .reveal {
    transition: none;
    opacity: 1;
    transform: none;
  }
}

/* ---- 窄屏 ---- */
@media (max-width: 900px) {
  .layout {
    display: block;
  }
  .rail {
    position: fixed;
    inset: 0 0 auto 0;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: rgba(253, 251, 247, 0.96);
    border-right: 0;
    border-bottom: 1px solid var(--rule);
    z-index: 50;
  }
  .brand {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 8px 0;
    font-size: 16px;
    border-bottom: 0;
  }
  .menu-btn {
    display: inline-flex;
    flex: 0 0 auto;
  }
  .rail-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 72vh;
    overflow-y: auto;
    padding: 6px 14px 18px;
    background: var(--paper);
    border-bottom: 2px solid var(--ink);
    flex: none;
  }
  .nav-toggle:checked ~ .rail-nav {
    display: block;
  }
  .sheet {
    padding-top: 59px;
  }
  .hero {
    min-height: 46vh;
    padding: 58px 18px 26px;
  }
  main > section:not(.hero) {
    padding: 26px 18px 4px;
  }
  main > section.signoff {
    padding: 24px 18px 20px;
  }
  main > section[id] {
    scroll-margin-top: 76px;
  }
  .jump ol {
    grid-template-columns: 1fr;
  }
  footer {
    grid-template-columns: 1fr;
    gap: 22px;
    padding: 32px 18px 22px;
  }
  .foot-mark {
    font-size: clamp(28px, 9vw, 40px);
  }
}

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