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

:root {
  --ink: #000000;
  --paper: #ffffff;
  --soft: #f2f2f2;
  --line: #d9d9d9;
  --rail: 17rem;
  --pad: clamp(1.15rem, 4vw, 4.5rem);
  --display: 'Newsreader', Georgia, 'Songti SC', SimSun, serif;
  --body: 'Roboto', -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --r: 28px;
}

* { 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(--body);
  font-size: 1.125rem;
  font-weight: 400;
  line-height: 1.7;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
p { overflow-wrap: break-word; }

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

/* ---------- 左侧固定栏 ---------- */
.rail {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--rail);
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 2.4rem;
  padding: 2.1rem 1.5rem;
  background: var(--paper);
  border-right: 1px solid var(--ink);
  overflow-y: auto;
}

.brand {
  display: block;
  min-height: 44px;
  padding: 0.3rem 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1.14;
  letter-spacing: -0.035em;
}

.jump p {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}

.jump a {
  display: block;
  min-height: 44px;
  padding: 0.62rem 0.1rem;
  font-size: 1rem;
  line-height: 1.35;
  border-bottom: 1px solid transparent;
  transition: border-color 0.22s ease, padding-left 0.22s ease;
}

.jump a:hover,
.jump a:focus-visible {
  border-bottom-color: var(--ink);
  padding-left: 0.42rem;
}

/* ---------- 主体 ---------- */
.page {
  margin-left: var(--rail);
  padding: 0 var(--pad);
}

.stage {
  position: relative;
  overflow: hidden;
  min-height: 70vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: center;
  align-items: center;
  gap: 1.1rem 2.6rem;
  padding: clamp(3rem, 9vw, 7rem) 0 clamp(3rem, 8vw, 6rem);
}

.stage h1 {
  position: relative;
  z-index: 1;
  grid-column: 1;
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.7rem, 9vw, 8rem);
  line-height: 0.94;
  letter-spacing: -0.05em;
  overflow-wrap: anywhere;
}

.standfirst {
  position: relative;
  z-index: 1;
  grid-column: 1;
  margin: 0;
  max-width: 36ch;
  font-weight: 300;
  font-size: 1.0625rem;
  line-height: 1.62;
}

.glyph {
  position: relative;
  z-index: 1;
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  margin: 0;
  width: clamp(5rem, 10vw, 9rem);
  aspect-ratio: 1;
  padding: 1rem;
  border-radius: var(--r);
  background: var(--ink);
  color: #ffffff;
  transform: rotate(-6deg);
  transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.glyph:hover { transform: rotate(0deg) scale(1.05); }
.glyph svg { width: 100%; height: 100%; display: block; }

.ghost {
  position: absolute;
  right: 0;
  bottom: -0.16em;
  z-index: 0;
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.2rem, 11vw, 8.5rem);
  line-height: 1;
  letter-spacing: -0.06em;
  color: #e9e9e9;
  white-space: nowrap;
  pointer-events: none;
}

/* ---------- 正文 + 侧栏 ---------- */
.spread {
  display: grid;
  grid-template-columns: minmax(0, 16rem) minmax(0, 1fr);
  gap: clamp(1.25rem, 3.5vw, 3.5rem);
  padding: clamp(2rem, 5vw, 3.5rem) 0 4.5rem;
  border-top: 2px solid var(--ink);
}

.side {
  position: sticky;
  top: 2rem;
  align-self: start;
  margin: 0;
  padding: 1.7rem 1.5rem 1.4rem;
  border-radius: var(--r);
  background: var(--ink);
  color: #ffffff;
}

.side h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.35rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.side hr {
  width: 2.4rem;
  margin: 0.85rem 0 1rem;
  border: 0;
  border-top: 3px solid #ffffff;
}

.toc {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.toc a {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  min-height: 40px;
  padding: 0.5rem 0;
  font-size: 0.98rem;
  line-height: 1.4;
  border-bottom: 1px solid #3a3a3a;
  transition: opacity 0.2s ease;
}

.toc a:hover { opacity: 0.62; }

.num {
  min-width: 1.3em;
  font-family: var(--display);
  font-size: 0.85rem;
  color: #a3a3a3;
}

.prose {
  min-width: 0;
  font-size: 1.125rem;
  line-height: 1.78;
}

.prose > div {
  padding: clamp(2rem, 5vw, 4rem) 0;
  border-top: 1px solid var(--line);
}

.prose > div:first-child {
  padding-top: 0;
  border-top: 0;
}

.prose h2,
.prose h3 {
  font-family: var(--display);
  letter-spacing: -0.045em;
  overflow-wrap: anywhere;
}

.prose h2 {
  margin: 0;
  font-weight: 700;
  font-size: clamp(1.9rem, 4.6vw, 3.4rem);
  line-height: 1.02;
}

.prose h2 + hr,
.prose h3 + hr {
  width: 3.4rem;
  margin: 1rem 0 1.7rem;
  border: 0;
  border-top: 6px solid var(--ink);
}

.prose h3 {
  margin: 2.2rem 0 0.6rem;
  font-weight: 600;
  font-size: clamp(1.3rem, 2.6vw, 1.85rem);
  line-height: 1.22;
}

.prose p { margin: 0 0 1.15rem; max-width: 64ch; }
.prose ul,
.prose ol { margin: 0 0 1.3rem; padding-left: 1.35rem; max-width: 64ch; }
.prose li { margin: 0.42rem 0; }
.prose strong { font-weight: 700; }
.prose a { border-bottom: 1px solid var(--ink); }

.prose blockquote {
  margin: 2rem 0;
  padding: 1.5rem 1.75rem;
  border-radius: var(--r);
  background: var(--soft);
  font-family: var(--display);
  font-size: 1.25rem;
  line-height: 1.55;
}

.prose blockquote p { max-width: none; margin: 0; }

.prose figure { margin: 2rem 0; }
.prose img { border-radius: var(--r); }

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
  margin: 0 0 1.5rem;
}

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

/* ---------- 页脚 ---------- */
.end {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem 2rem;
  margin: 0 var(--pad) 2rem calc(var(--rail) + var(--pad));
  padding: 1.9rem 1.75rem;
  border-radius: var(--r);
  background: var(--ink);
  color: #ffffff;
}

.end a {
  display: inline-block;
  min-height: 44px;
  padding: 0.55rem 0;
  line-height: 1.6;
}

.end-mark { font-family: var(--display); font-weight: 700; font-size: 1.05rem; letter-spacing: -0.02em; }

.end-nav { flex: 1 1 18rem; }

.end-nav p {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 1rem;
}

.end-nav a {
  font-size: 1rem;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.end-nav a:hover { border-bottom-color: #ffffff; }

.end-meta {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  font-size: 1rem;
}

.end-meta a { border-bottom: 1px solid #ffffff; }

/* ---------- 动效 ---------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: no-preference) {
  .jump a,
  .toc li {
    animation: rise 0.5s ease both;
  }
  .jump a:nth-child(2), .toc li:nth-child(2) { animation-delay: 0.05s; }
  .jump a:nth-child(3), .toc li:nth-child(3) { animation-delay: 0.1s; }
  .jump a:nth-child(4), .toc li:nth-child(4) { animation-delay: 0.15s; }
  .jump a:nth-child(5), .toc li:nth-child(5) { animation-delay: 0.2s; }
  .jump a:nth-child(6), .toc li:nth-child(6) { animation-delay: 0.25s; }
  .jump a:nth-child(7), .toc li:nth-child(7) { animation-delay: 0.3s; }
}

/* ---------- 窄屏 ---------- */
@media (max-width: 900px) {
  .rail {
    position: sticky;
    inset: 0 0 auto 0;
    width: auto;
    flex-direction: row;
    align-items: center;
    gap: 0.9rem;
    padding: 0.55rem var(--pad);
    border-right: 0;
    border-bottom: 1px solid var(--ink);
    overflow: visible;
  }

  .brand {
    flex: 0 0 auto;
    max-width: 42%;
    font-size: 1.12rem;
    padding: 0.4rem 0;
  }

  .jump {
    flex: 1 1 auto;
    overflow-x: auto;
    scrollbar-width: none;
  }

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

  .jump p { flex-direction: row; gap: 0.1rem; }

  .jump a {
    white-space: nowrap;
    padding: 0.62rem 0.66rem;
    font-size: 1rem;
  }

  .page { margin-left: 0; }

  .stage {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
    padding-top: 2.2rem;
    gap: 1.2rem;
  }

  .glyph {
    grid-column: 1;
    grid-row: auto;
    align-self: start;
    width: 4.6rem;
    padding: 0.72rem;
  }

  .ghost { bottom: -0.1em; }

  .spread {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.2rem;
  }

  .side {
    position: static;
    order: 2;
    margin-top: 0.5rem;
  }

  .prose { order: 1; }

  .end {
    margin: 0 var(--pad) 1.6rem;
    padding: 1.5rem 1.35rem;
    gap: 0.7rem 1.2rem;
  }

  .end-nav { flex: 1 1 100%; order: 3; }
  .end-mark { order: 1; }
  .end-meta { order: 2; }
}

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

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