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

:root {
  --ink: #000000;
  --paper: #ffffff;
  --mute: #3d3d3d;
  --soft: #f2f2f2;
  --rule: #000000;
  --rail: 112px;
  --body: "Nunito Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --head: "Varela Round", "Nunito Sans", "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(--body);
  font-size: 17px;
  line-height: 1.75;
  font-weight: 400;
  overflow-x: hidden;
}

img { max-width: 100%; }

h1, h2, h3 {
  font-family: var(--head);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.14;
}

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

/* ---------- 左侧竖排导航 ---------- */

.rail {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--rail);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0 22px;
  border-right: 2px solid var(--rule);
  background: var(--paper);
  z-index: 30;
}

.mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--head);
  font-size: 20px;
  line-height: 1;
  text-decoration: none;
}

.mark img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.mark:hover { background: var(--paper); color: var(--ink); }

.rail-nav { width: 100%; }

.rail-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 100%;
  overflow-y: auto;
}

.rail-list a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 8px 6px;
  font-size: 16px;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  color: var(--ink);
  border-left: 4px solid transparent;
  transition: background .18s ease, border-color .18s ease;
}

.rail-list a:hover,
.rail-list a:focus-visible {
  background: var(--soft);
  border-left-color: var(--ink);
}

/* ---------- 主体骨架 ---------- */

.main { margin-left: var(--rail); }

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 34px 90px;
}

.sheet {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 236px;
  grid-template-areas: "col side";
  gap: 54px;
  align-items: start;
}

.col {
  grid-area: col;
  min-width: 0;
}

/* ---------- 页首 / 大图 ---------- */

.mast {
  text-align: right;
  border-top: 8px solid var(--rule);
  padding-top: 14px;
}

.mast h1 {
  margin: 0.14em 0 0.05em;
  font-size: clamp(2.1rem, 6.2vw, 3.7rem);
  line-height: 1.03;
  letter-spacing: -0.025em;
}

.hero {
  position: relative;
  margin: 22px 0 0;
  height: 45vh;
  min-height: 230px;
  max-height: 430px;
  background: var(--ink);
  clip-path: polygon(0 0, 100% 0, 100% 90%, 0 100%);
  overflow: hidden;
}

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

.hero-empty {
  background: var(--ink);
  clip-path: polygon(0 0, 100% 0, 100% 88%, 0 100%);
}

.hero-tag {
  position: absolute;
  right: 16px;
  bottom: 26px;
  padding: 3px 16px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 999px;
}

/* ---------- 正文 ---------- */

.col > div {
  margin-top: 38px;
  padding-top: 30px;
  border-top: 1px solid var(--rule);
}

.col > div:first-of-type {
  margin-top: 30px;
}

.col h2 {
  font-size: clamp(1.45rem, 3.4vw, 2.05rem);
  margin: 0.1em 0 0.55em;
  max-width: 24ch;
}

.col h3 {
  font-size: clamp(1.2rem, 2.4vw, 1.45rem);
  margin: 1.5em 0 0.4em;
}

.col p { margin: 0 0 1.1em; }

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

.col > div:first-of-type > p:first-child::first-letter {
  float: left;
  font-family: var(--head);
  font-size: 3.6em;
  line-height: 0.82;
  padding: 0.06em 0.12em 0 0;
}

.col ul,
.col ol {
  padding-left: 1.2em;
  margin: 0 0 1.2em;
}

.col li { margin-bottom: 0.4em; }

.col a {
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.col a:hover { background: var(--ink); color: var(--paper); }

.col blockquote {
  margin: 26px 0;
  padding: 4px 0 4px 20px;
  border-left: 5px solid var(--rule);
  font-family: var(--head);
  font-size: 1.2em;
  line-height: 1.5;
}

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

.col figure { margin: 26px 0; }

.col figcaption {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--rule);
  font-size: 16px;
  color: var(--mute);
}

.col img { border-radius: 10px; display: block; }

.col table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
  margin: 0 0 1.2em;
}

.col th,
.col td {
  border-bottom: 1px solid var(--rule);
  padding: 8px 10px;
  text-align: left;
}

.col hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 26px 0;
}

/* ---------- 右侧栏 ---------- */

.side {
  grid-area: side;
  position: sticky;
  top: 26px;
  align-self: start;
  margin-top: 22px;
  padding-left: 18px;
  border-left: 2px solid var(--rule);
}

.side-kicker {
  display: block;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--mute);
}

.side-title {
  margin: 0.1em 0 0.8em;
  font-size: 1.35rem;
}

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

.side-list a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 12px;
  font-size: 16px;
  text-decoration: none;
  border-bottom: 2px solid var(--rule);
  border-radius: 10px;
  background: var(--soft);
  transition: background .18s ease, color .18s ease, transform .18s ease;
}

.side-list a:hover,
.side-list a:focus-visible {
  background: var(--ink);
  color: var(--paper);
  transform: translateX(-3px);
}

.side-top {
  margin: 18px 0 0;
  font-size: 16px;
}

.side-top a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  text-underline-offset: 4px;
}

/* ---------- 页脚 ---------- */

.foot {
  margin-left: var(--rail);
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  border-top: 8px solid var(--rule);
  padding: 18px 34px 30px;
}

.mark-sm {
  width: 40px;
  height: 40px;
  font-size: 18px;
}

.foot-nav { min-width: 0; }

.foot-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}

.foot-list li { margin: 0; }

.foot-list a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 10px;
  font-size: 16px;
  text-decoration: none;
  border-radius: 10px;
  border-bottom: 2px solid transparent;
  transition: border-color .18s ease, background .18s ease;
}

.foot-list a:hover,
.foot-list a:focus-visible {
  background: var(--soft);
  border-bottom-color: var(--rule);
}

.foot-copy {
  margin-left: auto;
  font-size: 16px;
  color: var(--mute);
}

.foot-copy p { margin: 0; }

/* ---------- 动效 ---------- */

.js .rail-list li {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .5s ease, transform .5s ease;
  transition-delay: calc(var(--i, 0) * 55ms);
}

.js .rail-list li.in { opacity: 1; transform: none; }

.js .col > div,
.js .side {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .55s ease, transform .55s ease;
}

.js .col > div.in,
.js .side.in { opacity: 1; transform: none; }

/* ---------- 移动端 ---------- */

@media (max-width: 900px) {
  .rail {
    position: sticky;
    top: 0;
    inset: auto;
    width: auto;
    height: 58px;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 0 10px;
    border-right: 0;
    border-bottom: 2px solid var(--rule);
  }

  .rail-nav { flex: 1; min-width: 0; }

  .rail-list {
    flex-direction: row;
    gap: 2px;
    overflow-x: auto;
    overflow-y: hidden;
    max-height: none;
    scrollbar-width: none;
  }

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

  .rail-list a {
    white-space: nowrap;
    padding: 0 12px;
    min-height: 44px;
    border-left: 0;
    border-bottom: 3px solid transparent;
  }

  .rail-list a:hover,
  .rail-list a:focus-visible { border-bottom-color: var(--ink); }

  .main,
  .foot { margin-left: 0; }

  .wrap { padding: 0 18px 60px; }

  .sheet {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "col" "side";
    gap: 0;
  }

  .mast h1 { font-size: clamp(1.9rem, 8.4vw, 2.7rem); }

  .hero {
    height: 38vh;
    min-height: 190px;
    clip-path: polygon(0 0, 100% 0, 100% 90%, 0 100%);
  }

  main div[id] { scroll-margin-top: 72px; }

  .side {
    position: static;
    margin-top: 40px;
    padding: 18px 0 0;
    border-left: 0;
    border-top: 2px solid var(--rule);
  }

  .side-list { grid-template-columns: 1fr 1fr; }

  .foot {
    padding: 16px 18px 28px;
    gap: 10px;
    border-top-width: 6px;
  }

  .foot-copy {
    margin-left: 0;
    width: 100%;
  }
}

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

  .js .rail-list li,
  .js .col > div,
  .js .side {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

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