:root {
  --paper: #fdfbf7;
  --paper-2: #f5f5f5;
  --ink: #1a1a1a;
  --line: #e0e0e0;
  --muted: #57534d;
  --rail: 212px;
  --bar: 46px;
}

*,
*::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: 'EB Garamond', 'Crimson Text', Georgia, 'Songti SC', 'Noto Serif CJK SC', 'Source Han Serif SC', serif;
  font-size: 17px;
  line-height: 1.78;
  letter-spacing: 0.01em;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  opacity: 0.17;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 140px 140px;
}

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

a {
  color: inherit;
}

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

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 80;
  background: var(--ink);
  color: var(--paper);
  padding: 0.55rem 0.9rem;
  text-decoration: none;
}

.skip:focus {
  left: 0.6rem;
  top: 0.6rem;
}

/* 顶栏 */
.mast {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--bar);
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0 0.85rem;
  background: var(--paper);
  border-bottom: 1px solid var(--ink);
  z-index: 40;
}

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

.mark img {
  display: block;
  width: 26px;
  height: 26px;
}

.mark-txt {
  font-size: 15px;
  letter-spacing: 0.14em;
}

.ticker {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 15px;
  letter-spacing: 0.34em;
  color: var(--muted);
}

/* 左侧竖排导航 */
.rail {
  position: fixed;
  left: 0;
  top: var(--bar);
  bottom: 0;
  width: var(--rail);
  padding: 1.4rem 1rem 2rem;
  overflow-y: auto;
  background: var(--paper);
  border-right: 1px solid var(--line);
  z-index: 30;
}

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

.rail li {
  counter-increment: rail;
}

.rail a {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 44px;
  padding: 0.42rem 0.1rem;
  font-size: 16px;
  line-height: 1.3;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.rail a::before {
  content: counter(rail, decimal-leading-zero);
  flex: 0 0 1.7em;
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.rail a:hover {
  background: var(--paper-2);
}

.rail li:nth-child(2) a,
.rail li:nth-child(4) a,
.rail li:nth-child(6) a {
  border-top: 1px solid var(--ink);
}

/* 主体 */
main {
  display: block;
  padding-top: var(--bar);
}

#main {
  scroll-margin-top: var(--bar);
}

.hero {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--bar));
  padding: 2.2rem 1.15rem 0;
}

.hero h1 {
  margin: 0 0 1rem;
  max-width: 22ch;
  font-size: clamp(2.1rem, 6.6vw, 4.4rem);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.015em;
}

.lede {
  margin: 0 0 2rem;
  max-width: 48ch;
  font-size: 1.05rem;
  color: var(--muted);
}

.hero-fig {
  display: grid;
  place-items: center;
  margin: 0;
  margin-top: auto;
  min-height: 120px;
  max-height: 56vh;
  overflow: hidden;
  background: var(--paper-2);
  border-top: 1px solid var(--line);
}

.shot {
  grid-area: 1 / 1;
  max-width: 100%;
  max-height: 56vh;
  width: auto;
  height: auto;
  object-fit: contain;
  opacity: 0;
}

.shot.on {
  opacity: 1;
}

/* 正文与侧栏 */
.sheet {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  margin-top: 2.4rem;
  padding: 0 1.15rem;
  border-top: 1px solid var(--ink);
}

.sheet-main {
  min-width: 0;
  padding: 2rem 0;
}

.sheet-main div {
  padding: 2rem 0;
  border-top: 1px solid var(--line);
  scroll-margin-top: calc(var(--bar) + 1rem);
}

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

.sheet-main h2 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.45rem, 3.6vw, 2.05rem);
  font-weight: 600;
  line-height: 1.28;
  letter-spacing: -0.01em;
}

.sheet-main h3 {
  margin: 1.6rem 0 0.5rem;
  font-size: 1.16rem;
  font-weight: 600;
  line-height: 1.4;
}

.sheet-main p {
  margin: 0 0 1.05rem;
  max-width: 68ch;
}

.sheet-main ul,
.sheet-main ol {
  margin: 0 0 1.1rem;
  padding-left: 1.35rem;
  max-width: 66ch;
}

.sheet-main li {
  margin: 0.25rem 0;
}

.sheet-main blockquote {
  margin: 1.4rem 0;
  padding: 0.1rem 0 0.1rem 1rem;
  border-left: 2px solid var(--ink);
  color: var(--muted);
}

.sheet-main figure {
  margin: 1.4rem 0;
}

.sheet-main figcaption {
  margin-top: 0.4rem;
  font-size: 0.95rem;
  color: var(--muted);
}

.sheet-main strong {
  font-weight: 700;
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 1.3rem 0;
}

.sheet-main h2 + hr,
.sheet-side h2 + hr {
  border-top: 1px solid var(--ink);
  margin: 0.2rem 0 1.2rem;
}

.sheet-main h3 + hr {
  border-top: 1px solid var(--line);
  margin: 0.2rem 0 1rem;
}

.sheet-side {
  padding: 1.6rem 0 2.4rem;
  border-top: 1px solid var(--line);
}

.sheet-side h2 {
  margin: 0 0 0.3rem;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.22em;
}

.sheet-side ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sheet-side a {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 0.28rem 0;
  font-size: 16px;
  text-decoration: none;
  border-bottom: 1px dotted var(--line);
}

.sheet-side a:hover {
  background: var(--paper-2);
}

/* 页脚 */
footer {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.1rem;
  margin-top: 2.4rem;
  padding: 2rem 1.15rem 1.4rem;
  border-top: 1px solid var(--ink);
}

.foot-name {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: 0.14em;
}

footer nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.2rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

footer nav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  font-size: 16px;
  color: var(--muted);
  text-decoration: none;
}

footer nav a:hover {
  color: var(--ink);
  text-decoration: underline;
}

.foot-copy {
  grid-column: 1 / -1;
  margin: 0;
  padding-top: 0.8rem;
  border-top: 1px solid var(--line);
  font-size: 0.95rem;
  color: var(--muted);
}

/* 滚动出现 */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(10px);
}

.js [data-reveal].in {
  opacity: 1;
  transform: none;
  transition: opacity 0.24s linear, transform 0.28s ease-out;
}

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

  .js [data-reveal],
  .js [data-reveal].in {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* 窄屏 */
@media (max-width: 899px) {
  .mast {
    position: static;
    height: auto;
    min-height: 52px;
  }

  .rail {
    position: static;
    width: auto;
    top: auto;
    bottom: auto;
    padding: 0.5rem 0.85rem 0.75rem;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--ink);
  }

  .rail ol {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 0.9rem;
  }

  .rail a {
    font-size: 15px;
    min-height: 44px;
  }

  .rail li:nth-child(2) a,
  .rail li:nth-child(4) a,
  .rail li:nth-child(6) a {
    border-top: 0;
  }

  main {
    padding-top: 0;
  }

  .hero {
    min-height: 0;
    padding-top: 1.8rem;
  }

  .hero-fig {
    min-height: 0;
    max-height: none;
  }

  .shot {
    max-height: none;
  }

  .sheet {
    margin-top: 1.6rem;
  }
}

/* 宽屏 */
@media (min-width: 900px) {
  main {
    padding-left: var(--rail);
  }

  .hero {
    padding: 3rem 2.6rem 0;
  }

  .sheet {
    grid-template-columns: minmax(0, 1fr) 218px;
    gap: 0 3rem;
    margin-top: 3rem;
    padding: 0 2.6rem;
  }

  .sheet-side {
    align-self: start;
    position: sticky;
    top: calc(var(--bar) + 1.4rem);
    padding: 2.4rem 0 2.4rem 1.4rem;
    border-top: 0;
    border-left: 1px solid var(--line);
  }

  footer {
    grid-template-columns: 1fr auto;
    align-items: start;
    padding-left: calc(var(--rail) + 2.6rem);
    padding-right: 2.6rem;
  }
}

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