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

:root{
  --paper:#fdfbf7;
  --matte:#f5f5f5;
  --ink:#1a1a1a;
  --line:#e0e0e0;
  --muted:#4a4a4a;
  --ui:'Cabin',"Helvetica Neue",Arial,"PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif;
  --read:Georgia,"Songti SC","Noto Serif SC","Times New Roman",serif;
}

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

html{
  scroll-behavior:smooth;
  -webkit-text-size-adjust:100%;
  background:var(--paper);
}

body{
  margin:0;
  background:var(--paper);
  color:var(--ink);
  font-family:var(--ui);
  font-size:17px;
  line-height:1.7;
}

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

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

/* ---------- 顶部导航 ---------- */
.topbar{
  position:sticky;
  top:0;
  z-index:30;
  background:var(--paper);
  border-bottom:1px solid var(--ink);
}

.nav{
  display:flex;
  align-items:center;
  gap:.35rem;
  max-width:1180px;
  margin:0 auto;
  padding:0 .9rem;
  min-height:66px;
}

.nav-side{
  display:flex;
  flex:1 1 0;
  min-width:0;
  flex-wrap:wrap;
  align-items:center;
  gap:0;
  margin:0;
  padding:0;
  list-style:none;
}

.nav-left{justify-content:flex-start}
.nav-right{justify-content:flex-end}

.nav-side li{display:block}

.nav-side a{
  display:flex;
  align-items:center;
  min-height:44px;
  padding:.3rem .55rem;
  color:var(--muted);
  font-size:16px;
  line-height:1.35;
  letter-spacing:.02em;
  text-decoration:none;
  border-bottom:2px solid transparent;
}

.nav-side a:hover{
  color:var(--ink);
  background:var(--matte);
  border-bottom-color:var(--ink);
}

.brand{
  display:flex;
  align-items:center;
  min-height:44px;
  padding:.3rem .6rem;
  font-family:'Amatic SC',var(--ui);
  font-size:1.85rem;
  font-weight:700;
  letter-spacing:.08em;
  line-height:1;
  white-space:nowrap;
  text-decoration:none;
  color:var(--ink);
}

.brand:hover{background:var(--matte)}

/* ---------- Hero ---------- */
.hero{
  position:relative;
  overflow:hidden;
  display:flex;
  flex-direction:column;
  justify-content:center;
  align-items:center;
  gap:clamp(1.4rem,4vw,2.6rem);
  min-height:100svh;
  padding:clamp(2.4rem,7vw,4.5rem) 1rem 0;
  text-align:center;
  border-bottom:1px solid var(--ink);
}

.hero-ghost{
  position:absolute;
  inset:0;
  z-index:0;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:1rem;
  overflow:hidden;
  font-family:var(--read);
  font-weight:700;
  font-size:clamp(4.2rem,21vw,15rem);
  line-height:.9;
  letter-spacing:.06em;
  color:var(--ink);
  opacity:.075;
  word-break:break-all;
  will-change:transform;
}

.hero-stack{
  position:relative;
  z-index:1;
  display:flex;
  flex-direction:column;
  gap:1rem;
  max-width:44rem;
}

.hero-title{
  margin:0;
  font-family:var(--read);
  font-size:clamp(1.95rem,6vw,3.4rem);
  font-weight:700;
  line-height:1.24;
  letter-spacing:.01em;
}

.hero-lead{
  margin:0 auto;
  max-width:34rem;
  font-family:var(--read);
  font-size:17px;
  line-height:1.8;
  color:var(--muted);
}

.hero-img{
  position:relative;
  z-index:1;
  display:block;
  width:100%;
  max-width:880px;
  max-height:30vh;
  object-fit:cover;
  border:1px solid var(--line);
  border-radius:4px;
  background:var(--matte);
}

/* ---------- 主体 ---------- */
main{
  max-width:1080px;
  margin:0 auto;
  padding:clamp(2rem,5vw,3.4rem) 1rem clamp(2.6rem,6vw,4rem);
  display:grid;
  grid-template-columns:206px minmax(0,1fr);
  gap:clamp(1.4rem,3.5vw,2.6rem);
  align-items:start;
}

.rail{
  position:sticky;
  top:86px;
  border:1px solid var(--line);
  border-radius:4px;
  background:var(--matte);
  padding:.9rem .8rem 1rem;
}

.rail-title{
  margin:0 0 .55rem;
  font-family:var(--ui);
  font-size:16px;
  font-weight:600;
  letter-spacing:.22em;
  line-height:1.5;
  border-bottom:1px solid var(--ink);
  padding-bottom:.45rem;
}

.rail-title span{display:block}

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

.rail-list a{
  display:block;
  padding:.45rem .15rem;
  min-height:40px;
  font-size:16px;
  line-height:1.5;
  color:var(--muted);
  text-decoration:none;
  border-bottom:1px dashed var(--line);
}

.rail-list li:last-child a{border-bottom:0}

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

/* ---------- 正文 ---------- */
.prose{
  max-width:720px;
  min-width:0;
}

.prose section{
  scroll-margin-top:88px;
}

.prose section + section{
  margin-top:clamp(2rem,5vw,3rem);
  padding-top:clamp(1.6rem,4vw,2.4rem);
  border-top:1px solid var(--line);
}

.prose h2{
  margin:0 0 1rem;
  font-family:var(--read);
  font-size:clamp(1.42rem,3.6vw,1.72rem);
  font-weight:700;
  line-height:1.35;
  letter-spacing:.01em;
}

.prose h2 span{display:block}

.prose h3{
  margin:1.8rem 0 .7rem;
  font-family:var(--read);
  font-size:1.2rem;
  font-weight:700;
  line-height:1.45;
}

.prose h3 span{display:block}

.prose p,
.prose li{
  font-family:var(--read);
  font-size:17px;
  line-height:1.88;
  color:var(--ink);
}

.prose p{margin:0 0 1.05rem}

.prose ul,
.prose ol{
  margin:0 0 1.05rem;
  padding-left:1.35rem;
}

.prose li{margin-bottom:.4rem}

.prose a{
  color:var(--ink);
  text-decoration:underline;
  text-underline-offset:3px;
}

.prose a:hover{background:var(--matte)}

.prose blockquote{
  margin:1.4rem 0;
  padding:.7rem 1rem;
  border-left:3px solid var(--ink);
  background:var(--matte);
  border-radius:0 4px 4px 0;
}

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

.prose img{
  max-width:100%;
  height:auto;
  border:1px solid var(--line);
  border-radius:4px;
  background:var(--matte);
}

.prose table{
  width:100%;
  border-collapse:collapse;
  font-size:16px;
}

.prose th,
.prose td{
  border:1px solid var(--line);
  padding:.5rem .6rem;
  text-align:left;
  line-height:1.6;
}

.prose th{background:var(--matte)}

.prose code{
  font-family:ui-monospace,SFMono-Regular,Menlo,monospace;
  font-size:.94em;
  background:var(--matte);
  padding:.08em .3em;
  border-radius:4px;
}

/* ---------- 页脚 ---------- */
footer{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:1.2rem 1.6rem;
  padding:clamp(2rem,5vw,3rem) clamp(1rem,5vw,3rem) 1.4rem;
  border-top:1px solid var(--ink);
  background:var(--matte);
}

.foot-mark{
  grid-column:1 / -1;
  margin:0 0 .4rem;
  font-family:var(--read);
  font-size:clamp(2.2rem,11vw,6.4rem);
  font-weight:700;
  line-height:.94;
  letter-spacing:.05em;
  word-break:break-all;
  border-bottom:1px dashed var(--line);
  padding-bottom:.6rem;
}

.foot-mark span{display:block}

footer dl{
  margin:0;
  min-width:0;
}

footer dt{
  font-size:16px;
  letter-spacing:.2em;
  line-height:1.5;
  margin:0 0 .4rem;
  padding-bottom:.3rem;
  border-bottom:1px solid var(--ink);
}

footer dd{
  margin:0;
}

footer dd a{
  display:block;
  padding:.4rem 0;
  min-height:40px;
  font-size:16px;
  line-height:1.5;
  color:var(--muted);
  text-decoration:none;
  word-break:break-word;
}

footer dd a:hover{
  color:var(--ink);
  background:var(--paper);
}

.foot-copy{
  grid-column:1 / -1;
  margin:1rem 0 0;
  padding-top:.9rem;
  border-top:1px solid var(--line);
  text-align:center;
  font-size:16px;
  line-height:1.6;
  color:var(--muted);
}

/* ---------- 窄屏 ---------- */
@media (max-width:820px){
  .nav{
    flex-wrap:wrap;
    padding:.45rem .7rem;
    min-height:0;
    gap:.25rem;
  }
  .brand{
    order:-1;
    width:100%;
    justify-content:center;
    border-bottom:1px solid var(--line);
    padding-bottom:.45rem;
    margin-bottom:.25rem;
  }
  .nav-side{flex:1 1 100%}
  .nav-left{justify-content:center}
  .nav-right{justify-content:center}
  .nav-side a{padding:.3rem .45rem; font-size:16px}

  .hero{
    min-height:calc(100svh - 132px);
    padding-top:2rem;
  }
  .hero-img{max-height:26vh}

  main{
    grid-template-columns:minmax(0,1fr);
    padding-top:1.6rem;
  }

  .rail{
    position:static;
  }

  .rail-list{
    display:flex;
    flex-wrap:wrap;
    gap:0 .5rem;
  }

  .rail-list li{flex:0 1 auto}

  .rail-list a{
    border-bottom:0;
    padding:.4rem .5rem;
    background:var(--paper);
    border:1px solid var(--line);
    border-radius:4px;
    margin:.2rem 0;
  }

  footer{gap:1rem .8rem}
  footer dd a{font-size:16px}
}

@media (max-width:420px){
  .hero-ghost{opacity:.06}
  footer dt{letter-spacing:.1em}
}

@media (prefers-reduced-motion:reduce){
  html{scroll-behavior:auto}
  .hero-ghost{will-change:auto}
}

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