@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700&display=swap');

:root {
  --ink: #000000;
  --paper: #ffffff;
  --rail: 236px;
  --bar: 40px;
  --r: 28px;
  --gap: clamp(1.2rem, 4vw, 4rem);
  --pad: clamp(1.2rem, 5vw, 5.5rem);
}

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

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

body {
  margin: 0;
  font-family: "Noto Sans SC", system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 17px;
  line-height: 1.75;
  color: var(--ink);
  background-color: var(--paper);
  background-image: radial-gradient(rgba(0, 0, 0, 0.13) 1px, transparent 1px);
  background-size: 22px 22px;
  overflow-x: hidden;
}

a {
  color: inherit;
}

img {
  max-width: 100%;
}

h2,
h3 {
  text-wrap: balance;
}

/* 顶部细条 */
.ticker {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--bar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  background: var(--ink);
  color: var(--paper);
  z-index: 60;
  overflow: hidden;
}

.ticker-in {
  margin: 0;
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.34em;
}

/* 左侧固定竖排导航 */
.masthead {
  position: fixed;
  top: var(--bar);
  left: 0;
  bottom: 0;
  width: var(--rail);
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
  padding: 1.6rem 1.1rem 2rem;
  background: var(--paper);
  border-right: 2px solid var(--ink);
  z-index: 50;
  overflow-y: auto;
}

.mark {
  display: inline-block;
  align-self: flex-start;
  font-size: 1.06rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
  padding: 0.45rem 0;
  border-bottom: 2px solid var(--ink);
}

.rail {
  min-width: 0;
}

.rail-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
}

.rail-link {
  display: block;
  min-height: 44px;
  padding: 0.62rem 0.3rem;
  font-size: 0.92rem;
  line-height: 1.5;
  text-decoration: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.14);
  transition: background 0.18s ease, color 0.18s ease, padding-left 0.18s ease;
}

.rail-link:hover,
.rail-link:focus-visible,
.rail-link.is-on {
  background: var(--ink);
  color: var(--paper);
  padding-left: 0.85rem;
}

/* 主区域 */
.main {
  margin-left: var(--rail);
  padding-top: var(--bar);
}

.doc {
  margin: 0;
}

/* 首屏 */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding: var(--pad);
  background: var(--ink);
  border-bottom: 2px solid var(--ink);
  overflow: hidden;
  isolation: isolate;
}

.hero-media {
  position: absolute;
  inset: 0;
  z-index: -2;
}

.hero-media .hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: grayscale(1) contrast(1.06);
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.28) 0%, rgba(0, 0, 0, 0.55) 52%, rgba(0, 0, 0, 0.9) 100%);
}

.hero-in {
  position: relative;
  width: 100%;
}

.hero-h1 {
  margin: 0;
  max-width: 16ch;
  color: var(--paper);
  font-size: clamp(2.9rem, 8.6vw, 9rem);
  font-weight: 900;
  line-height: 0.94;
  letter-spacing: -0.05em;
  overflow-wrap: anywhere;
}

/* 正文 + 左侧栏 */
.stage {
  display: grid;
  grid-template-columns: minmax(0, 236px) minmax(0, 1fr);
  gap: var(--gap);
  align-items: start;
  padding: var(--pad);
  border-bottom: 2px solid var(--ink);
}

.side {
  position: sticky;
  top: calc(var(--bar) + 1rem);
  padding: 1.25rem 1.05rem 1.4rem;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: var(--r);
}

.side-h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.045em;
}

.side .subtitle {
  margin: 0.4rem 0 1rem;
  padding-bottom: 0.8rem;
  border-bottom: 2px solid var(--ink);
  font-size: 0.76rem;
  letter-spacing: 0.2em;
  opacity: 0.65;
}

.side-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.side-link {
  display: block;
  min-height: 44px;
  padding: 0.55rem 0.25rem;
  font-size: 0.9rem;
  line-height: 1.5;
  text-decoration: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
  transition: background 0.18s ease, color 0.18s ease, padding-left 0.18s ease;
}

.side-link:hover,
.side-link:focus-visible,
.side-link.is-on {
  background: var(--ink);
  color: var(--paper);
  padding-left: 0.7rem;
}

/* 正文排印 */
.prose {
  min-width: 0;
  max-width: 84ch;
}

.prose > article {
  margin: 0 0 clamp(1.4rem, 3vw, 2.6rem);
  padding: clamp(1.3rem, 3.6vw, 3.2rem);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: var(--r);
  scroll-margin-top: calc(var(--bar) + 1.5rem);
}

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

.prose h2 {
  margin: 0;
  font-size: clamp(1.7rem, 4.4vw, 2.9rem);
  font-weight: 900;
  line-height: 1.06;
  letter-spacing: -0.045em;
  overflow-wrap: anywhere;
}

.prose h3 {
  margin: 1.8rem 0 0.4rem;
  font-size: 1.14rem;
  font-weight: 700;
  line-height: 1.5;
}

.prose p {
  margin: 0.9rem 0 0;
  font-size: 1.02rem;
  line-height: 1.85;
}

.prose .subtitle {
  margin: 0.5rem 0 1.1rem;
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  opacity: 0.62;
}

.prose ul,
.prose ol {
  margin: 1rem 0 0;
  padding-left: 1.2rem;
}

.prose li {
  margin: 0.4rem 0;
  line-height: 1.8;
}

.prose li::marker {
  font-weight: 700;
}

.prose a {
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.prose strong {
  font-weight: 700;
}

.prose blockquote {
  margin: 1.2rem 0;
  padding: 0.15rem 0 0.15rem 1rem;
  border-left: 4px solid var(--ink);
  font-weight: 500;
}

.prose blockquote p {
  margin: 0.3rem 0;
}

.prose figure {
  margin: 1.2rem 0;
}

.prose img {
  display: block;
  width: auto;
  height: auto;
  margin: 1.2rem 0;
  border: 2px solid var(--ink);
  border-radius: 18px;
}

.prose figcaption {
  font-size: 0.85rem;
  opacity: 0.7;
}

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

.prose th,
.prose td {
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--ink);
  text-align: left;
  font-size: 0.95rem;
  line-height: 1.6;
}

.prose th {
  font-weight: 700;
  background: var(--ink);
  color: var(--paper);
}

.prose code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.9em;
}

/* 页脚 */
.foot {
  margin-left: var(--rail);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem 2rem;
  padding: 1.5rem var(--pad) 2rem;
  background: var(--paper);
  border-top: 2px solid var(--ink);
}

.foot article {
  margin: 0;
}

.foot-a p {
  margin: 0;
  font-size: 0.84rem;
  letter-spacing: 0.12em;
}

.foot-b {
  flex: 1 1 260px;
  min-width: 0;
}

.foot-b p {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.1rem 0.9rem;
  justify-content: flex-end;
}

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

.foot-link:hover,
.foot-link:focus-visible {
  border-bottom-color: var(--ink);
}

/* 入场微动效 */
.rail-link,
.side-link,
.foot-link {
  animation: rise 0.5s ease both;
}

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

.rail-link:nth-child(1),
.side-link:nth-child(1) { animation-delay: 0.04s; }
.rail-link:nth-child(2),
.side-link:nth-child(2) { animation-delay: 0.08s; }
.rail-link:nth-child(3),
.side-link:nth-child(3) { animation-delay: 0.12s; }
.rail-link:nth-child(4),
.side-link:nth-child(4) { animation-delay: 0.16s; }
.rail-link:nth-child(5),
.side-link:nth-child(5) { animation-delay: 0.2s; }
.rail-link:nth-child(6),
.side-link:nth-child(6) { animation-delay: 0.24s; }
.rail-link:nth-child(7),
.side-link:nth-child(7) { animation-delay: 0.28s; }

/* 内页锚点补偿 */
.prose article[id] {
  scroll-margin-top: calc(var(--bar) + 1.5rem);
}

/* 移动端 */
@media (max-width: 900px) {
  .ticker {
    position: static;
  }

  .masthead {
    position: sticky;
    top: 0;
    bottom: auto;
    width: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 1rem;
    padding: 0.7rem 1rem;
    border-right: 0;
    border-bottom: 2px solid var(--ink);
    overflow: visible;
  }

  .mark {
    padding: 0.5rem 0;
    border-bottom: 0;
  }

  .rail {
    flex: 1 1 100%;
    order: 3;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .rail-list {
    flex-direction: row;
    gap: 0.3rem;
    padding-bottom: 0.15rem;
  }

  .rail-link {
    white-space: nowrap;
    min-height: 44px;
    padding: 0.55rem 0.85rem;
    font-size: 0.85rem;
    border: 1px solid rgba(0, 0, 0, 0.22);
    border-radius: 999px;
    animation: none;
  }

  .rail-link:hover,
  .rail-link:focus-visible,
  .rail-link.is-on {
    padding-left: 0.85rem;
  }

  .main {
    margin-left: 0;
    padding-top: 0;
  }

  .hero {
    min-height: 74svh;
    align-items: center;
    padding: 1.2rem;
  }

  .stage {
    grid-template-columns: 1fr;
    gap: 1.1rem;
    padding: 1.1rem;
  }

  .side {
    position: static;
    border-radius: 20px;
  }

  .prose {
    max-width: none;
  }

  .prose > article {
    border-radius: 20px;
    padding: 1.25rem 1.1rem 1.5rem;
    scroll-margin-top: 8rem;
  }

  .prose article[id] {
    scroll-margin-top: 8rem;
  }

  .foot {
    margin-left: 0;
    padding: 1.2rem 1.1rem 1.6rem;
  }

  .foot-b p {
    justify-content: flex-start;
  }
}

@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}
