:root {
  --ink: #171f26;
  --ink-soft: #3d4954;
  --blue: #c8e0f4;
  --blue-deep: #a3c9e8;
  --pink: #f5e0e8;
  --pink-deep: #e8c8d6;
  --bg: #e9f1f8;
  --bg-hi: #f4f9fd;
  --line: rgba(23, 31, 38, 0.14);
  --raise: -6px -6px 14px rgba(255, 255, 255, 0.92), 6px 6px 16px rgba(23, 31, 38, 0.13);
  --raise-sm: -3px -3px 8px rgba(255, 255, 255, 0.9), 3px 3px 9px rgba(23, 31, 38, 0.12);
  --sink: inset -3px -3px 8px rgba(255, 255, 255, 0.9), inset 3px 3px 9px rgba(23, 31, 38, 0.14);
  --serif: "Playfair Display SC", "Songti SC", "Source Han Serif SC", Georgia, serif;
  --sans: "Karla", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.75;
  font-weight: 400;
}

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

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

h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 700;
  letter-spacing: 0.01em;
}

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

/* ---------- 顶栏 ---------- */
.masthead {
  position: relative;
  z-index: 50;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: linear-gradient(180deg, #eff6fc 0%, rgba(233, 241, 248, 0.95) 100%);
}

.lever {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 0 15px;
  border-radius: 14px;
  background: linear-gradient(145deg, #f4f9fd, #dcebf7);
  box-shadow: var(--raise-sm);
  cursor: pointer;
  list-style: none;
  font-size: 16px;
  line-height: 1;
  user-select: none;
  transition: box-shadow 150ms ease, transform 150ms ease;
}

.lever::-webkit-details-marker {
  display: none;
}

.lever:active {
  box-shadow: var(--sink);
  transform: translateY(1px);
}

details[open] > .lever {
  box-shadow: var(--sink);
}

.bars {
  display: block;
  width: 15px;
  height: 2px;
  margin: 5px 0;
  border-radius: 2px;
  background: var(--ink);
  box-shadow: 0 5px 0 var(--ink), 0 -5px 0 var(--ink);
  flex: 0 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 4px 8px;
  text-decoration: none;
  white-space: nowrap;
}

.brand-txt {
  font-family: var(--serif);
  font-size: 19px;
  letter-spacing: 0.05em;
}

.mark {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  box-shadow: var(--raise-sm);
}

.tools {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.cta {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 14px;
  background: linear-gradient(145deg, #fbe3ec, #e6c6d4);
  box-shadow: var(--raise-sm);
  text-decoration: none;
  font-size: 16px;
  line-height: 1;
  white-space: nowrap;
  transition: box-shadow 150ms ease, transform 150ms ease;
}

.cta:active {
  box-shadow: var(--sink);
  transform: translateY(1px);
}

/* ---------- 全屏遮罩菜单 ---------- */
.sheet {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 30;
  margin: 0;
  padding: 86px 20px 30px;
  list-style: none;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
  background: linear-gradient(165deg, #f3f9fd 0%, #f9edf2 100%);
}

details[open] > .sheet {
  display: flex;
}

.sheet a {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 0 20px;
  border-radius: 15px;
  background: linear-gradient(145deg, #f5fafd, #e1eef9);
  box-shadow: var(--raise-sm);
  text-decoration: none;
  font-size: 17px;
}

.sheet a:active {
  box-shadow: var(--sink);
}

details[open] > .sheet li {
  animation: rise 380ms cubic-bezier(0.22, 0.8, 0.3, 1) both;
}

.sheet li:nth-child(2) { animation-delay: 40ms; }
.sheet li:nth-child(3) { animation-delay: 80ms; }
.sheet li:nth-child(4) { animation-delay: 120ms; }
.sheet li:nth-child(5) { animation-delay: 160ms; }
.sheet li:nth-child(6) { animation-delay: 200ms; }
.sheet li:nth-child(7) { animation-delay: 240ms; }

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- 锚点条 ---------- */
.rail {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(233, 241, 248, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.rail-in {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 8px 14px;
  max-width: 1180px;
  margin: 0 auto;
}

.rail-in::-webkit-scrollbar {
  display: none;
}

.rail a {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 0 13px;
  border-radius: 12px;
  background: linear-gradient(145deg, #f2f8fd, #e0edf8);
  box-shadow: var(--raise-sm);
  text-decoration: none;
  font-size: 16px;
  line-height: 1;
  white-space: nowrap;
}

.rail a.is-on {
  background: linear-gradient(145deg, #d3e6f7, #f7e1ea);
  box-shadow: var(--sink);
}

/* ---------- 首屏 ---------- */
.hero {
  position: relative;
  min-height: calc(100svh - 118px);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-start;
  text-align: right;
  padding: 34px 20px 56px;
  overflow: hidden;
  background: linear-gradient(155deg, #c8e0f4 0%, #e4eef9 46%, #f5e0e8 100%);
}

.hero::after {
  content: "";
  position: absolute;
  left: -6%;
  right: -6%;
  bottom: 0;
  height: 44px;
  background: linear-gradient(90deg, #f5e0e8, #c8e0f4);
  border-top: 1px solid var(--line);
  transform: skewY(-2.2deg);
  transform-origin: right bottom;
}

.hero-copy {
  align-self: flex-end;
  max-width: 40ch;
  position: relative;
  z-index: 1;
}

.hero-h1 {
  margin: 0;
  font-size: clamp(29px, 7.4vw, 62px);
  line-height: 1.14;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}

.hero-desc {
  margin: 16px 0 0 auto;
  max-width: 34ch;
  color: var(--ink-soft);
  font-size: 17px;
}

.hero-fig {
  width: 100%;
  margin: auto 0 0;
  padding-top: 26px;
  position: relative;
  z-index: 1;
}

.hero-img {
  width: 100%;
  height: clamp(150px, 28vh, 300px);
  object-fit: cover;
  border-radius: 16px 16px 4px 4px;
  border: 1px solid rgba(255, 255, 255, 0.6);
}

/* ---------- 主体骨架 ---------- */
.shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 46px 20px 74px;
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}

.side {
  position: sticky;
  top: 66px;
  padding: 16px 15px;
  border-radius: 16px;
  background: linear-gradient(145deg, #f3f8fd, #e2eef8);
  box-shadow: var(--raise);
}

.side-h {
  margin: 0 0 12px;
  font-size: 20px;
  letter-spacing: 0.08em;
}

.side-h span {
  display: inline-block;
  padding-bottom: 3px;
  border-bottom: 3px solid var(--pink-deep);
}

.side-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

.side-list a {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #eef5fb;
  box-shadow: none;
  text-decoration: none;
  font-size: 16px;
  line-height: 1.35;
}

.side-list a.is-on {
  background: linear-gradient(145deg, #f8e7ef, #dfebf7);
  border-color: rgba(23, 31, 38, 0.28);
}

.dot {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--ink-soft);
}

.doc {
  min-width: 0;
}

.doc > article {
  padding: 30px 0 34px;
  border-top: 1px solid var(--line);
  scroll-margin-top: 76px;
}

.doc > article:first-child {
  padding-top: 0;
  border-top: 0;
}

.doc h2 {
  margin: 0 0 16px;
  font-size: clamp(22px, 3.6vw, 31px);
  line-height: 1.3;
}

.doc h2 span {
  display: inline-block;
  padding-bottom: 6px;
  border-bottom: 3px solid var(--pink);
}

.doc h3 {
  margin: 26px 0 8px;
  font-size: 20px;
  line-height: 1.4;
}

.doc h3 span {
  color: var(--ink-soft);
}

.doc p {
  margin: 0 0 15px;
  max-width: 68ch;
}

.doc ul,
.doc ol {
  margin: 0 0 16px;
  padding-left: 1.3em;
  max-width: 66ch;
}

.doc li {
  margin-bottom: 7px;
}

.doc a {
  text-decoration-color: var(--blue-deep);
  text-underline-offset: 3px;
}

.doc strong {
  font-weight: 700;
}

.doc blockquote {
  margin: 0 0 18px;
  padding: 16px 18px;
  border-left: 4px solid var(--pink-deep);
  border-radius: 4px;
  background: var(--bg-hi);
  color: var(--ink-soft);
}

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

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

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

.doc th {
  background: var(--bg-hi);
  font-weight: 600;
}

.doc img {
  border-radius: 8px;
  margin: 0 0 18px;
}

.doc code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 15px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--bg-hi);
}

/* ---------- 滚动揭示 ---------- */
.js .doc > article {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 520ms ease, transform 520ms ease;
}

.js .doc > article.in {
  opacity: 1;
  transform: none;
}

/* ---------- 页脚 ---------- */
.foot {
  max-width: 1180px;
  margin: 0 auto;
  padding: 30px 20px 46px;
  border-top: 1px solid var(--line);
}

.foot-cols {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 16px;
  margin: 0 0 16px;
  font-size: 16px;
  line-height: 1.5;
}

.foot-cols span {
  display: block;
  color: var(--ink-soft);
}

.foot small {
  display: block;
  font-size: 16px;
  color: var(--ink-soft);
}

/* ---------- 窄屏 ---------- */
@media (max-width: 900px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 26px;
    padding-top: 30px;
  }

  .side {
    position: static;
  }

  .side-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  body {
    font-size: 16px;
  }

  .masthead {
    padding: 8px 10px;
    gap: 6px;
  }

  .cta {
    display: none;
  }

  .brand-txt {
    font-size: 16px;
    letter-spacing: 0.02em;
  }

  .lever {
    padding: 0 11px;
    gap: 7px;
    font-size: 16px;
  }

  .lever .bars {
    width: 13px;
  }

  .hero {
    padding: 24px 16px 52px;
    min-height: calc(100svh - 112px);
  }

  .hero-desc {
    max-width: none;
  }

  .foot-cols {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .side-list {
    grid-template-columns: minmax(0, 1fr);
  }
}

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

  .js .doc > article {
    opacity: 1;
    transform: none;
    transition: none;
  }

  details[open] > .sheet li {
    animation: none;
  }

  .lever,
  .cta {
    transition: none;
  }
}

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