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

:root {
  --ink: #000000;
  --paper: #ffffff;
  --muted: rgba(0, 0, 0, 0.64);
  --line: rgba(0, 0, 0, 0.16);
  --r: 4px;
  --shell: clamp(1.15rem, 4vw, 3.5rem);
  --blk: clamp(2.6rem, 7vw, 6.5rem);
  --font: 'Poppins', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui, sans-serif;
  --display: 'Righteous', 'Poppins', 'PingFang SC', '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(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.72;
  font-weight: 400;
  overflow-x: hidden;
}

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

a {
  color: inherit;
}

button {
  font: inherit;
}

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

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  line-height: 1.03;
  letter-spacing: -0.04em;
}

p {
  margin: 0 0 1.1em;
}

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

section[id] {
  scroll-margin-top: 6.75rem;
}

/* 顶部细条 */
.ticker {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  height: 2.75rem;
  padding: 0 var(--shell);
  background: var(--ink);
  color: var(--paper);
  overflow: hidden;
  white-space: nowrap;
}

.mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 2.75rem;
  height: 2.75rem;
  text-decoration: none;
}

.mark-img {
  width: 24px;
  height: 24px;
  filter: invert(1);
}

.mark-txt {
  font-family: var(--display);
  font-size: 1rem;
  letter-spacing: 0.16em;
  color: var(--paper);
}

.tick-key {
  font-size: 0.76rem;
  letter-spacing: 0.24em;
  color: rgba(255, 255, 255, 0.72);
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 锚点栏 */
.stage {
  display: block;
}

.rail {
  position: sticky;
  top: 2.75rem;
  z-index: 40;
  background: var(--paper);
  border-bottom: 1px solid var(--ink);
  padding: 0 var(--shell);
}

.rail-label {
  display: none;
  margin: 0;
}

.rail-nav {
  display: flex;
  gap: 0.3rem;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

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

.rail-group {
  display: flex;
  gap: 0.3rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rail-group li {
  flex: 0 0 auto;
}

.rail-group a {
  display: flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 0.8rem;
  border-radius: var(--r);
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
}

.rail-group a:hover,
.rail-group a:focus-visible {
  background: var(--ink);
  color: var(--paper);
}

.g2 {
  margin-left: 0.5rem;
  padding-left: 0.5rem;
  border-left: 1px solid var(--line);
}

/* 正文骨架 */
.doc {
  min-width: 0;
  padding: 0 var(--shell) var(--blk);
}

.doc > section {
  padding: var(--blk) 0;
  border-bottom: 1px solid var(--line);
}

.doc > section:last-child {
  border-bottom: 0;
}

.doc > section h2 {
  font-size: clamp(1.7rem, 4.4vw, 3rem);
  margin-bottom: 1.1rem;
}

.doc > section h3 {
  font-family: var(--display);
  font-size: clamp(1.25rem, 2.7vw, 1.6rem);
  letter-spacing: -0.02em;
  margin: 2rem 0 0.6rem;
}

.doc > section p,
.doc > section li {
  max-width: 64ch;
}

.doc > section strong {
  font-weight: 700;
}

.doc > section ul,
.doc > section ol {
  margin: 0 0 1.2rem;
  padding: 0;
  list-style: none;
}

.doc > section li {
  position: relative;
  padding-left: 1.5rem;
  margin: 0.45rem 0;
}

.doc > section li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.68em;
  width: 0.62rem;
  height: 0.62rem;
  background: var(--ink);
  border-radius: 2px;
}

.doc blockquote {
  margin: 1.6rem 0;
  padding: 0.85rem 0 0.85rem 1.15rem;
  border-left: 5px solid var(--ink);
  font-size: 1.05rem;
  font-weight: 500;
}

.doc table {
  width: 100%;
  margin: 1.2rem 0;
  border-collapse: collapse;
  font-size: 0.98rem;
}

.doc th,
.doc td {
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.doc img {
  margin: 1.2rem 0;
  border-radius: var(--r);
}

.doc code {
  font-size: 0.94em;
  background: rgba(0, 0, 0, 0.06);
  padding: 0.12em 0.34em;
  border-radius: 2px;
}

/* 首屏 */
.doc > .hero {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2rem;
  min-height: 70vh;
  padding: 3.5rem 0 2.5rem;
  border-bottom: 1px solid var(--ink);
}

.ghost {
  position: absolute;
  left: -0.05em;
  top: 50%;
  z-index: 0;
  transform: translate3d(0, calc(-50% + var(--py, 0px)), 0);
  font-family: var(--display);
  font-size: clamp(4rem, 19vw, 15rem);
  line-height: 0.8;
  letter-spacing: -0.06em;
  white-space: nowrap;
  color: rgba(0, 0, 0, 0.07);
  pointer-events: none;
  will-change: transform;
}

.hero-copy {
  position: relative;
  z-index: 1;
  text-align: center;
}

.hero h1 {
  font-size: clamp(2.6rem, 9.5vw, 6.75rem);
  letter-spacing: -0.055em;
}

.hero-fig {
  position: relative;
  z-index: 1;
  margin: 0;
  border-radius: var(--r);
  overflow: hidden;
  background: var(--ink);
}

.hero-img {
  width: 100%;
  max-height: 54vh;
  object-fit: cover;
}

/* 引言块 */
.doc > .lead {
  padding: var(--blk) 0;
  border-bottom: 1px solid var(--ink);
}

.lead h2 {
  font-size: clamp(1.9rem, 5.2vw, 3.4rem);
}

.subtitle {
  max-width: 46ch;
  margin: 1rem 0 0;
  font-size: clamp(1.05rem, 2.4vw, 1.35rem);
  line-height: 1.5;
  color: var(--muted);
}

/* 页脚 */
.foot {
  margin: 0;
  padding: var(--blk) var(--shell) 1.5rem;
  background: var(--ink);
  color: var(--paper);
}

.foot-cols {
  display: grid;
  gap: 2rem;
  max-width: 70rem;
}

.foot-brand {
  display: block;
  font-style: normal;
}

.foot-brand strong {
  display: block;
  font-family: var(--display);
  font-size: clamp(1.6rem, 5vw, 2.6rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.foot-brand span {
  display: block;
  margin-top: 0.7rem;
  font-size: 0.86rem;
  letter-spacing: 0.16em;
  color: rgba(255, 255, 255, 0.62);
}

.foot-nav ul {
  display: grid;
  gap: 0.15rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.foot-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  font-size: 1rem;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

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

.foot-base {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.24);
  text-align: center;
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  color: rgba(255, 255, 255, 0.7);
}

.foot-base p {
  margin: 0;
}

/* 回到顶部 */
.totop {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 60;
  min-height: 2.75rem;
  padding: 0 1.05rem;
  border: 0;
  border-radius: var(--r);
  background: var(--ink);
  color: var(--paper);
  font-size: 0.84rem;
  letter-spacing: 0.12em;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
}

.totop[hidden] {
  display: none;
}

/* 动效 */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.is-in {
  opacity: 1;
  transform: none;
}

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

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .ghost {
    transform: translate3d(0, -50%, 0);
  }
}

/* 中等屏幕 */
@media (min-width: 48rem) {
  .foot-cols {
    grid-template-columns: 1.15fr 1fr;
    gap: 4rem;
  }
}

/* 宽屏：左栏锚点 + 右侧内容 */
@media (min-width: 64rem) {
  .stage {
    display: grid;
    grid-template-columns: 16rem minmax(0, 1fr);
    align-items: start;
  }

  .rail {
    top: 2.75rem;
    height: calc(100vh - 2.75rem);
    padding: 3rem 1.5rem 2.5rem var(--shell);
    border-right: 1px solid var(--ink);
    border-bottom: 0;
    overflow-y: auto;
  }

  .rail-label {
    display: block;
    margin: 0 0 1.35rem;
    font-family: var(--display);
    font-size: 0.72rem;
    letter-spacing: 0.32em;
    color: var(--muted);
  }

  .rail-nav {
    flex-direction: column;
    gap: 1.15rem;
    overflow: visible;
  }

  .rail-group {
    flex-direction: column;
    gap: 0.15rem;
  }

  .rail-group a {
    min-height: 2.6rem;
    padding: 0 0.55rem;
    font-size: 0.98rem;
  }

  .g2 {
    margin-left: 0;
    padding-left: 0;
    padding-top: 1.15rem;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .doc > .hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: center;
    gap: 3rem;
    padding: 4rem 0;
    min-height: 70vh;
  }

  .doc > .hero:not(:has(.hero-fig)) {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-fig,
  .hero-img {
    min-height: 42vh;
  }

  .hero-img {
    max-height: 60vh;
  }

  .doc > section p,
  .doc > section li {
    font-size: 1.0625rem;
  }
}

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