@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800&display=swap');

:root {
  --ink: #1f1f1f;
  --paper: #ffffff;
  --ash: #f5f5f5;
  --line: #e5e5e5;
  --mute: #6d6d6d;
  --r: 4px;
  --bar: 104px;
  --edge: clamp(16px, 3.4vw, 44px);
  --e1: 0 1px 2px rgba(31, 31, 31, .05), 0 2px 6px rgba(31, 31, 31, .04);
  --e2: 0 6px 16px rgba(31, 31, 31, .08), 0 2px 5px rgba(31, 31, 31, .05);
  --e3: 0 16px 36px rgba(31, 31, 31, .13), 0 6px 14px rgba(31, 31, 31, .07);
  --e4: 0 30px 70px rgba(31, 31, 31, .2), 0 12px 26px rgba(31, 31, 31, .09);
}

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

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

html.locked {
  overflow: hidden;
}

body {
  margin: 0;
  background-color: var(--ash);
  background-image: radial-gradient(rgba(31, 31, 31, .045) 1px, transparent 1px);
  background-size: 20px 20px;
  color: var(--ink);
  font-family: Inter, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 17px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: inherit;
  text-decoration: none;
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--e1);
}

.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 8px var(--edge);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -.02em;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: var(--r);
  object-fit: cover;
  box-shadow: var(--e1);
}

.burger {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--r);
  background: var(--ink);
  color: #fff;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--e2);
  transition: transform .2s ease, box-shadow .2s ease;
}

.burger:hover {
  transform: translateY(-1px);
  box-shadow: var(--e3);
}

.burger-bars {
  width: 16px;
  height: 10px;
  background: linear-gradient(#fff 0 2px, transparent 2px 4px, #fff 4px 6px, transparent 6px 8px, #fff 8px 10px);
}

.jump {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 var(--edge);
  border-top: 1px solid var(--line);
}

.jump p {
  display: flex;
  gap: 2px;
  margin: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.jump p::-webkit-scrollbar {
  display: none;
}

.jump a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  white-space: nowrap;
  font-size: 16px;
  font-weight: 600;
  color: var(--mute);
  border-bottom: 2px solid transparent;
  transition: color .18s ease, border-color .18s ease;
}

.jump a:hover,
.jump a.active {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

/* ---------- 首屏 ---------- */
.stage {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  min-height: calc(100vh - var(--bar));
  min-height: calc(100svh - var(--bar));
  overflow: hidden;
  background: #1f1f1f;
  isolation: isolate;
  color: #fff;
}

.stage-media {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  will-change: transform;
}

.stage-img {
  position: absolute;
  top: -20%;
  left: 0;
  width: 100%;
  height: 140%;
  object-fit: cover;
  filter: grayscale(.15);
}

.stage-veil {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(102deg, rgba(31, 31, 31, .95) 0%, rgba(31, 31, 31, .78) 44%, rgba(31, 31, 31, .4) 100%);
}

.stage-dots {
  position: absolute;
  inset: 0;
  z-index: 2;
  background-image: radial-gradient(rgba(255, 255, 255, .2) 1px, transparent 1px);
  background-size: 24px 24px;
  opacity: .55;
  -webkit-mask-image: linear-gradient(to left, rgba(0, 0, 0, .95), transparent 78%);
  mask-image: linear-gradient(to left, rgba(0, 0, 0, .95), transparent 78%);
}

.stage-copy {
  position: relative;
  z-index: 3;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 var(--edge) clamp(40px, 7vh, 84px);
  text-align: right;
}

.stage-mark {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .28em;
  color: rgba(255, 255, 255, .7);
}

.stage-title {
  margin: 0 0 18px;
  font-size: clamp(32px, 6.4vw, 68px);
  line-height: 1.14;
  font-weight: 800;
  letter-spacing: -.03em;
  text-shadow: 0 12px 40px rgba(0, 0, 0, .35);
}

.stage-desc {
  max-width: 620px;
  margin: 0 0 26px auto;
  font-size: clamp(16px, 1.6vw, 18px);
  line-height: 1.7;
  color: rgba(255, 255, 255, .82);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.stage-jump {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 106px;
  padding: 0 20px;
  border: 1px solid rgba(255, 255, 255, .45);
  border-radius: var(--r);
  background: rgba(255, 255, 255, .1);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  font-weight: 600;
  transition: background .2s ease, transform .2s ease;
}

.stage-jump:hover {
  background: rgba(255, 255, 255, .22);
  transform: translateY(-2px);
}

/* ---------- 主体骨架 ---------- */
main {
  position: relative;
  z-index: 5;
}

.wrap {
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(34px, 5vw, 64px) var(--edge) clamp(56px, 8vw, 108px);
}

.layout {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 286px;
  gap: clamp(20px, 3vw, 40px);
  align-items: start;
}

.prose {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.prose > div {
  position: relative;
  z-index: 1;
  margin: 0 0 clamp(18px, 2.6vw, 30px);
  padding: clamp(20px, 3.2vw, 44px);
  background: var(--paper);
  border-radius: var(--r);
  box-shadow: var(--e2);
  scroll-margin-top: calc(var(--bar) + 14px);
  transition: box-shadow .25s ease, transform .25s ease;
}

.prose > div:nth-child(even) {
  margin-left: clamp(0px, 1.8vw, 22px);
  z-index: 2;
}

.prose > div:hover {
  z-index: 3;
  transform: translateY(-2px);
  box-shadow: var(--e3);
}

.prose > div:last-child {
  margin-bottom: 0;
}

/* ---------- 正文元素 ---------- */
.prose h2 {
  margin: 0 0 .7em;
  font-size: clamp(22px, 2.8vw, 30px);
  line-height: 1.3;
  font-weight: 800;
  letter-spacing: -.02em;
}

.prose h3 {
  margin: 1.5em 0 .5em;
  font-size: clamp(19px, 2.2vw, 22px);
  line-height: 1.4;
  font-weight: 700;
}

.prose small {
  display: block;
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .2em;
  color: var(--mute);
}

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

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

.prose a {
  color: #0d0d0d;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  text-decoration-color: #c9c9c9;
}

.prose a:hover {
  text-decoration-color: var(--ink);
}

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

.prose li {
  margin: 0 0 .45em;
}

.prose img {
  margin: 1.2em 0;
  border-radius: var(--r);
  box-shadow: var(--e2);
}

.prose blockquote {
  margin: 1.4em 0;
  padding: 18px 22px;
  background: var(--ash);
  border-left: 3px solid var(--ink);
  border-radius: var(--r);
  box-shadow: var(--e1);
}

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

.prose table {
  display: block;
  width: 100%;
  overflow-x: auto;
  margin: 1.2em 0;
  border-collapse: collapse;
  border-radius: var(--r);
  box-shadow: var(--e1);
}

.prose th,
.prose td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 16px;
}

.prose th {
  background: var(--ash);
  font-weight: 700;
}

.prose code {
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--ash);
  font-size: 15px;
}

.prose pre {
  overflow-x: auto;
  padding: 16px;
  border-radius: var(--r);
  background: var(--ink);
  color: var(--ash);
}

.prose pre code {
  background: none;
  color: inherit;
}

.prose hr {
  margin: 2em 0;
  border: 0;
  border-top: 1px solid var(--line);
}

/* ---------- 右侧栏 ---------- */
.rail {
  position: sticky;
  top: calc(var(--bar) + 14px);
  z-index: 4;
  display: grid;
  gap: 14px;
}

.rail-card {
  padding: 18px 18px 20px;
  background: var(--paper);
  border-radius: var(--r);
  box-shadow: var(--e2);
}

.rail-card-plain {
  box-shadow: var(--e1);
}

.rail-card small {
  display: block;
  margin-bottom: 2px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .2em;
  color: var(--mute);
}

.rail-card h2 {
  margin: 0 0 10px;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -.01em;
}

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

.rail-list li {
  counter-increment: rail;
  border-top: 1px solid var(--line);
}

.rail-list li:first-child {
  border-top: 0;
}

.rail-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 6px 0;
  font-size: 16px;
  line-height: 1.35;
  color: var(--mute);
}

.rail-list a::before {
  content: counter(rail, decimal-leading-zero);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .06em;
  color: #a8a8a8;
}

.rail-list a:hover,
.rail-list a.active {
  color: var(--ink);
}

.rail-list a.active {
  font-weight: 700;
}

.rail-top {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--r);
  background: var(--ash);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.rail-top:hover {
  background: #ececec;
}

/* ---------- 悬浮回到顶部 ---------- */
.lift {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 35;
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: var(--r);
  background: var(--ink);
  color: #fff;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--e3);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}

.lift.on {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

/* ---------- 页脚 ---------- */
.foot {
  position: relative;
  z-index: 5;
  padding: 26px var(--edge);
  background: var(--ink);
  color: #fff;
  box-shadow: 0 -16px 40px rgba(31, 31, 31, .16);
}

.foot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 22px;
  max-width: 1240px;
  margin: 0 auto;
}

.foot-brand {
  margin: 0;
  font-size: clamp(22px, 4.6vw, 40px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -.03em;
}

.foot-brand a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: #fff;
}

.foot-nav p {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 4px;
  margin: 0;
}

.foot-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 8px;
  font-size: 16px;
  color: rgba(255, 255, 255, .76);
}

.foot-nav a:hover {
  color: #fff;
}

.foot-copy {
  margin: 0;
  font-size: 16px;
  color: rgba(255, 255, 255, .58);
}

/* ---------- 全屏菜单 ---------- */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-content: center;
  gap: 22px;
  padding: 84px var(--edge);
  background: rgba(31, 31, 31, .94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: #fff;
  opacity: 0;
  visibility: hidden;
  transition: opacity .28s ease, visibility .28s ease;
}

.drawer.is-open {
  opacity: 1;
  visibility: visible;
}

.drawer nav p {
  display: grid;
  gap: 2px;
  margin: 0;
  text-align: center;
}

.drawer a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 6px 18px;
  border-radius: var(--r);
  font-size: clamp(19px, 4.4vw, 28px);
  font-weight: 700;
  letter-spacing: -.01em;
}

.drawer a:hover {
  background: rgba(255, 255, 255, .12);
}

.drawer-close {
  align-self: start;
  justify-self: center;
  min-height: 44px;
  min-width: 96px;
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, .4);
  border-radius: var(--r);
  background: none;
  color: #fff;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

/* ---------- 进场 ---------- */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(26px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.prose > div.in {
  animation: rise .6s cubic-bezier(.22, .7, .28, 1) backwards;
  animation-delay: var(--d, 0s);
}

/* ---------- 断点 ---------- */
@media (max-width: 900px) {
  :root {
    --bar: 100px;
  }
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .rail {
    position: static;
  }
  .prose > div:nth-child(even) {
    margin-left: 0;
  }
  .stage-copy {
    text-align: left;
  }
  .stage-desc {
    margin-left: 0;
  }
}

@media (max-width: 560px) {
  .topbar-row {
    padding: 6px 16px;
  }
  .brand {
    font-size: 17px;
  }
  .stage-mark {
    font-size: 14px;
    letter-spacing: .2em;
  }
  .stage-title {
    font-size: clamp(28px, 8.4vw, 40px);
  }
  .foot-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .foot-copy {
    order: 3;
  }
}

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

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