/* 瑞士极简 · 黑白 · 网格 */
:root {
  --ink: #000000;
  --paper: #ffffff;
  --mute: #767676;
  --soft: #d8d8d8;
  --pad: clamp(1rem, 4vw, 2.5rem);
  --gap: 2rem;
}

*,
*::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: "IBM Plex Sans", "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 1.0625rem;
  line-height: 1.7;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

a {
  color: inherit;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

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

/* 顶部条 */
.top {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem var(--pad);
  background: var(--paper);
  border-bottom: 2px solid var(--ink);
}

.top__brand {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-size: 1rem;
  white-space: nowrap;
}

.top__brand img {
  width: 26px;
  height: 26px;
  object-fit: contain;
}

.pills {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.25rem 0;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

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

.pill {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0.35rem 1rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
  text-decoration: none;
  font-size: 1rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 0.22s ease, color 0.22s ease;
}

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

/* 主网格：正文左栏 + 右侧栏 */
main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 2.5rem 3rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--pad) 4rem;
}

/* 首屏 */
.masthead {
  grid-column: 1 / -1;
  position: relative;
  display: grid;
  align-content: end;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0 calc(var(--pad) * -1);
  padding: 5rem var(--pad) 2.5rem;
  background: var(--ink);
  color: var(--paper);
  overflow: hidden;
}

.masthead__fig {
  position: absolute;
  inset: 0;
  margin: 0;
}

.masthead__fig img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.masthead__fig::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.58);
}

.masthead__ghost {
  position: absolute;
  top: 1.5rem;
  left: var(--pad);
  right: 0;
  margin: 0;
  font-size: clamp(3.5rem, 17vw, 13rem);
  line-height: 0.84;
  font-weight: 700;
  letter-spacing: -0.055em;
  white-space: nowrap;
  color: transparent;
  -webkit-text-stroke: 2px rgba(255, 255, 255, 0.45);
  pointer-events: none;
  user-select: none;
}

.masthead__box {
  position: relative;
  z-index: 1;
  max-width: 1200px;
}

.masthead__h1 {
  margin: 0 0 1.1rem;
  font-size: clamp(2.3rem, 7.5vw, 5rem);
  line-height: 1.02;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.masthead__desc {
  margin: 0;
  max-width: 48ch;
  font-weight: 300;
  font-size: 1.0625rem;
  color: rgba(255, 255, 255, 0.86);
}

/* 右侧栏 */
.rail {
  grid-column: 2;
  grid-row: 2 / span 40;
  align-self: start;
  position: sticky;
  top: 5.5rem;
  margin-top: 2.5rem;
}

.toc {
  border-top: 2px solid var(--ink);
  padding-top: 1rem;
}

.toc h2 {
  margin: 0 0 0.7rem;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.toc hr {
  border: 0;
  border-top: 1px solid var(--ink);
  margin: 0 0 0.6rem;
}

.toc__list {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: toc;
}

.toc__list li {
  counter-increment: toc;
  border-bottom: 1px solid var(--soft);
}

.toc__list a {
  display: block;
  position: relative;
  padding: 0.62rem 0 0.62rem 2.1rem;
  text-decoration: none;
  line-height: 1.45;
  transition: padding-left 0.2s ease;
}

.toc__list a::before {
  content: counter(toc, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 0.68rem;
  font-size: 1rem;
  color: var(--mute);
  font-variant-numeric: tabular-nums;
}

.toc__list a:hover,
.toc__list a:focus-visible {
  padding-left: 2.4rem;
  text-decoration: underline;
  text-underline-offset: 0.22em;
}

/* 正文区块 */
main > section:not(.masthead):not(.rail):not(.tail) {
  max-width: 64ch;
  border-top: 2px solid var(--ink);
  padding-top: 2rem;
  scroll-margin-top: 7rem;
}

main h2 {
  margin: 0 0 1rem;
  font-size: clamp(1.4rem, 3.2vw, 2rem);
  line-height: 1.18;
  letter-spacing: -0.025em;
  font-weight: 600;
}

main h2 + hr {
  border: 0;
  border-top: 1px solid var(--ink);
  margin: 0 0 1.6rem;
}

main h3 {
  margin: 2rem 0 0.75rem;
  font-size: 1.25rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

p {
  margin: 0 0 1.15rem;
}

ul,
ol {
  margin: 0 0 1.25rem;
  padding-left: 1.4rem;
}

li {
  margin: 0.35rem 0;
}

main a {
  text-decoration: underline;
  text-underline-offset: 0.22em;
}

figure {
  margin: 1.5rem 0;
}

figcaption {
  margin-top: 0.6rem;
  font-size: 1rem;
  color: var(--mute);
}

blockquote {
  margin: 1.5rem 0;
  padding-left: 1.25rem;
  border-left: 3px solid var(--ink);
  font-weight: 300;
}

hr {
  border: 0;
  border-top: 1px solid var(--ink);
}

/* 收尾条 */
.tail {
  border-top: 2px solid var(--ink);
  padding-top: 1.5rem;
  margin-top: 0.5rem;
}

.tail__box {
  display: block;
}

.tail__a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 2px solid var(--ink);
}

/* 页脚 */
.foot {
  background: var(--ink);
  color: var(--paper);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2rem var(--gap);
  padding: 3rem var(--pad) 0;
}

.foot__s {
  min-width: 0;
}

.foot__brand {
  margin: 0 0 0.75rem;
  font-size: 1.1875rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.foot__desc {
  margin: 0;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.72);
}

.fnav dl {
  margin: 0;
}

.fnav dt {
  margin: 0 0 0.7rem;
  color: rgba(255, 255, 255, 0.6);
}

.fnav dd {
  margin: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.24);
}

.fnav dd a {
  display: block;
  min-height: 44px;
  padding: 0.58rem 0;
  text-decoration: none;
  transition: background-color 0.22s ease, color 0.22s ease, padding-left 0.22s ease;
}

.fnav dd a:hover,
.fnav dd a:focus-visible {
  background: var(--paper);
  color: var(--ink);
  padding-left: 0.55rem;
}

.foot__top {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.35rem 1.1rem;
  border: 1px solid var(--paper);
  border-radius: 999px;
  text-decoration: none;
  transition: background-color 0.22s ease, color 0.22s ease;
}

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

.foot__bar {
  grid-column: 1 / -1;
  margin-top: 2.5rem;
  padding: 1.25rem 0 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.25);
  text-align: center;
}

.foot__bar p {
  margin: 0;
  color: rgba(255, 255, 255, 0.7);
}

/* 滚动揭示 */
.will-reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}

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

@media (max-width: 820px) {
  main {
    grid-template-columns: minmax(0, 1fr);
    gap: 2rem;
  }

  .rail {
    grid-column: 1;
    grid-row: auto;
    position: static;
    margin-top: 2rem;
  }

  .masthead {
    padding-top: 4rem;
  }

  .masthead__ghost {
    font-size: clamp(3rem, 19vw, 7rem);
  }

  .foot {
    grid-template-columns: 1fr 1fr;
    padding-top: 2.5rem;
  }

  .foot__s--brand,
  .foot__s--top {
    grid-column: 1 / -1;
  }
}

@media (max-width: 480px) {
  .foot {
    grid-template-columns: minmax(0, 1fr);
  }

  .foot__s--brand,
  .foot__s--top {
    grid-column: auto;
  }
}

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

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

  .pill,
  .toc__list a,
  .fnav dd a,
  .foot__top {
    transition: none;
  }
}

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