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

:root{
  --ink:#000000;
  --paper:#ffffff;
  --hair:rgba(0,0,0,.14);
  --hair-soft:rgba(0,0,0,.07);
  --nav-w:238px;
  --gut:clamp(20px,4.4vw,68px);
}

*,*::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:'Noto Sans SC',-apple-system,'Segoe UI',system-ui,'Helvetica Neue',sans-serif;
  font-size:17px;
  line-height:1.75;
  font-weight:400;
  letter-spacing:.012em;
}

img{max-width:100%;border:0}

::selection{background:var(--ink);color:var(--paper)}

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

/* ---------- 侧栏 / 顶栏导航 ---------- */
.sidenav{
  position:sticky;
  top:0;
  z-index:60;
  display:grid;
  grid-template-columns:auto minmax(0,1fr);
  align-items:center;
  gap:10px;
  padding:8px 12px;
  background:var(--paper);
  border-bottom:1px solid var(--ink);
}

.mark{
  display:flex;
  align-items:center;
  justify-content:center;
  width:44px;
  height:44px;
  border:1px solid var(--ink);
  text-decoration:none;
  color:var(--ink);
  overflow:hidden;
  transition:background .22s ease,color .22s ease;
}
.mark:hover{background:var(--ink);color:var(--paper)}
.mark__img{width:100%;height:100%;object-fit:cover;display:block}
.mark__txt{font-size:18px;font-weight:700;line-height:1}

.pills{
  list-style:none;
  margin:0;
  padding:0;
  display:flex;
  gap:8px;
  overflow-x:auto;
  scrollbar-width:none;
  -webkit-overflow-scrolling:touch;
}
.pills::-webkit-scrollbar{display:none}

.pills li{flex:0 0 auto}

.pills a{
  display:inline-flex;
  align-items:center;
  gap:8px;
  min-height:44px;
  padding:0 16px;
  border:1px solid var(--ink);
  border-radius:999px;
  color:var(--ink);
  text-decoration:none;
  font-size:16px;
  line-height:1;
  white-space:nowrap;
  transition:background .22s ease,color .22s ease;
  background:var(--paper);
}
.pills a:hover,
.pills a:focus-visible,
.pills a.is-on{background:var(--ink);color:var(--paper)}

.pill__idx{
  font-size:11px;
  font-weight:500;
  letter-spacing:.16em;
  opacity:.72;
}
.pill__txt{font-weight:500}

/* ---------- Hero ---------- */
.hero{
  min-height:calc(100svh - 61px);
  display:grid;
  align-content:center;
  gap:var(--gut);
  padding:calc(var(--gut) * .8) var(--gut) calc(var(--gut) * 1.1);
  border-bottom:1px solid var(--ink);
  background-image:
    repeating-linear-gradient(to right,var(--hair-soft) 0 1px,transparent 1px 32px),
    repeating-linear-gradient(to bottom,var(--hair-soft) 0 1px,transparent 1px 32px);
}

.hero__text{max-width:42ch}

.hero__h1{
  margin:0 0 .5em;
  font-size:clamp(2.15rem,7.2vw,4.3rem);
  line-height:1.06;
  font-weight:700;
  letter-spacing:-.022em;
}

.hero__desc{
  margin:0 0 1.6em;
  max-width:34ch;
  font-size:1.02rem;
  line-height:1.7;
}

.hero__cta{
  display:inline-flex;
  align-items:center;
  min-height:48px;
  padding:0 26px;
  border:1px solid var(--ink);
  border-radius:999px;
  background:var(--ink);
  color:var(--paper);
  text-decoration:none;
  font-size:16px;
  font-weight:500;
  letter-spacing:.06em;
  transition:background .22s ease,color .22s ease,transform .22s ease;
}
.hero__cta:hover{background:var(--paper);color:var(--ink)}
.hero__cta:active{transform:translateY(1px)}

.hero__fig{
  margin:0;
  min-height:42vh;
  border:1px solid var(--ink);
  overflow:hidden;
  background-color:var(--paper);
  background-image:repeating-linear-gradient(45deg,var(--hair-soft) 0 1px,transparent 1px 12px);
}
.hero__img{
  display:block;
  width:100%;
  height:100%;
  min-height:42vh;
  object-fit:cover;
}

/* ---------- 正文区 ---------- */
.reading{
  display:grid;
  gap:calc(var(--gut) * .9);
  padding:calc(var(--gut) * .95) var(--gut);
}

main div{scroll-margin-top:84px}

.body{
  min-width:0;
  max-width:44rem;
}

.body div{
  padding-top:2.2rem;
}
.body div + div{
  border-top:1px solid var(--hair);
  margin-top:2.4rem;
}

.body h2{
  margin:0 0 .35em;
  font-size:clamp(1.45rem,3.1vw,1.95rem);
  line-height:1.28;
  font-weight:700;
  letter-spacing:-.012em;
}

.body h3{
  margin:2rem 0 .5em;
  font-size:1.14rem;
  line-height:1.45;
  font-weight:700;
}

.body p{margin:0 0 1.15em}

.subtitle{
  margin:0 0 1.5em;
  font-size:.94rem;
  line-height:1.65;
  letter-spacing:.09em;
  opacity:.62;
}

.body ul,
.body ol{
  margin:0 0 1.2em;
  padding-left:1.35em;
}
.body li{margin-bottom:.5em}
.body li::marker{font-weight:500}

.body a{
  color:var(--ink);
  text-decoration:underline;
  text-underline-offset:3px;
  text-decoration-thickness:1px;
}
.body a:hover{background:var(--ink);color:var(--paper);text-decoration:none}

.body blockquote{
  margin:1.6em 0;
  padding:.2em 0 .2em 1.2em;
  border-left:3px solid var(--ink);
  font-weight:300;
}

.body figure{margin:1.6em 0}
.body figcaption{
  margin-top:.6em;
  font-size:.86rem;
  letter-spacing:.06em;
  opacity:.62;
}

.body img{
  display:block;
  width:100%;
  height:auto;
  border:1px solid var(--ink);
}

.body table{
  width:100%;
  border-collapse:collapse;
  margin:0 0 1.3em;
  font-size:.95rem;
}
.body th,
.body td{
  border:1px solid var(--hair);
  padding:.6em .7em;
  text-align:left;
  vertical-align:top;
}
.body th{font-weight:700;background:#f4f4f4}

.body code{
  font-family:ui-monospace,SFMono-Regular,Menlo,monospace;
  font-size:.9em;
  background:#f2f2f2;
  padding:.1em .35em;
}

.body hr{
  border:0;
  border-top:1px solid var(--hair);
  margin:2.2em 0;
}

/* ---------- 右侧 aside ---------- */
.rail{
  order:-1;
  border-top:2px solid var(--ink);
  padding-top:.9rem;
}

.rail__h2{
  margin:0;
  font-size:.9rem;
  font-weight:700;
  letter-spacing:.2em;
}

.rail .subtitle{margin:.5em 0 1rem}

.rail__list{
  list-style:none;
  margin:0;
  padding:0;
  display:grid;
  gap:0;
}

.rail__list li{
  animation:railIn .42s ease both;
}
.rail__list li:nth-child(1){animation-delay:.03s}
.rail__list li:nth-child(2){animation-delay:.07s}
.rail__list li:nth-child(3){animation-delay:.11s}
.rail__list li:nth-child(4){animation-delay:.15s}
.rail__list li:nth-child(5){animation-delay:.19s}
.rail__list li:nth-child(6){animation-delay:.23s}
.rail__list li:nth-child(7){animation-delay:.27s}

.rail__list a{
  display:flex;
  align-items:center;
  gap:9px;
  min-height:44px;
  padding:.35em 0;
  border-bottom:1px solid var(--hair);
  color:var(--ink);
  text-decoration:none;
  font-size:15px;
  transition:padding-left .22s ease;
}
.rail__list a:hover{padding-left:6px;text-decoration:underline}

@keyframes railIn{
  from{opacity:0;transform:translateX(-8px)}
  to{opacity:1;transform:none}
}

/* ---------- 页脚 ---------- */
.foot{
  display:grid;
  gap:20px;
  margin-top:calc(var(--gut) * 1.6);
  padding:calc(var(--gut) * .9) var(--gut);
  border-top:1px solid var(--ink);
  font-size:15px;
}

.foot__about{
  margin:0;
  max-width:38ch;
  line-height:1.7;
}
.foot__about strong{
  display:block;
  font-size:1.05rem;
  letter-spacing:.02em;
  margin-bottom:.25em;
}

.foot__links{
  margin:0;
  display:flex;
  flex-wrap:wrap;
  gap:4px 20px;
}
.foot__links a{
  display:inline-flex;
  align-items:center;
  min-height:40px;
  color:var(--ink);
  text-decoration:none;
  border-bottom:1px solid transparent;
  transition:border-color .22s ease;
}
.foot__links a:hover{border-bottom-color:var(--ink)}

.foot__copy{
  grid-column:1 / -1;
  padding-top:14px;
  border-top:1px solid var(--hair);
  font-size:13px;
  letter-spacing:.1em;
  opacity:.7;
}

/* ---------- 滚动浮现 ---------- */
.reveal{
  opacity:0;
  transform:translateY(14px);
  transition:opacity .48s ease,transform .48s ease;
}
.reveal.in{opacity:1;transform:none}

/* ---------- 桌面版 ---------- */
@media (min-width:900px){
  body{padding-left:var(--nav-w)}

  .sidenav{
    position:fixed;
    inset:0 auto 0 0;
    width:var(--nav-w);
    display:flex;
    flex-direction:column;
    align-items:stretch;
    gap:0;
    padding:26px 22px 30px;
    border-bottom:0;
    border-right:1px solid var(--ink);
  }

  .mark{margin-bottom:auto}

  .pills{
    flex-direction:column;
    overflow:visible;
    gap:10px;
    margin:auto 0;
  }
  .pills li{flex:0 0 auto}
  .pills a{
    display:flex;
    width:100%;
    min-height:46px;
    padding:0 18px;
    font-size:16px;
  }

  .hero{
    min-height:100svh;
    grid-template-columns:1.05fr .95fr;
    align-items:center;
    padding-right:0;
    padding-top:var(--gut);
    padding-bottom:var(--gut);
  }

  .hero__fig{
    align-self:stretch;
    min-height:64vh;
    border-right:0;
  }
  .hero__img{min-height:64vh}

  main div{scroll-margin-top:24px}

  .reading{
    grid-template-columns:minmax(0,1fr) 232px;
    align-items:start;
    gap:calc(var(--gut) * 1.1);
    padding:calc(var(--gut) * 1.1) var(--gut) var(--gut)
  }

  .body{max-width:none}

  .rail{
    order:0;
    position:sticky;
    top:96px;
  }

  .foot{
    grid-template-columns:1.15fr .85fr;
    gap:32px;
  }
  .foot__links{justify-content:flex-start}
}

@media (min-width:1280px){
  .reading{grid-template-columns:minmax(0,46rem) 244px;justify-content:start}
}

/* ---------- 降低动效 ---------- */
@media (prefers-reduced-motion:reduce){
  html{scroll-behavior:auto}
  *,
  *::before,
  *::after{
    animation-duration:.001ms !important;
    animation-delay:0ms !important;
    transition-duration:.001ms !important;
  }
  .reveal{opacity:1;transform:none}
}

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