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

:root{
  --sand:#f4ede2;
  --sand-2:#e9dfcd;
  --ink:#172623;
  --ink-2:#3e4f49;
  --ink-3:#6d7c76;
  --teal:#5cc6b0;
  --teal-d:#1c7f6e;
  --clay:#d4c4a8;
  --terra:#c67b5c;
  --line:rgba(23,38,35,.14);
  --glass:rgba(255,252,246,.60);
  --r:4px;
}

*{box-sizing:border-box}

html{
  scroll-behavior:smooth;
  -webkit-text-size-adjust:100%;
}

body{
  margin:0;
  overflow-x:clip;
  font:400 17px/1.7 "DM Sans",system-ui,-apple-system,"PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif;
  color:var(--ink);
  background-color:var(--sand);
  background-image:
    radial-gradient(58vw 46vh at 88% -8%,rgba(92,198,176,.22),transparent 68%),
    radial-gradient(46vw 42vh at 2% 104%,rgba(212,196,168,.62),transparent 70%);
  background-attachment:fixed;
  background-repeat:no-repeat;
  -webkit-font-smoothing:antialiased;
}

/* 全局抗溢出基线 */
img,svg,video,iframe,canvas{max-width:100%}
img,video{height:auto}
table,pre{max-width:100%}

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

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

/* 顶部细条 */
.strip{
  position:relative;
  z-index:2;
  padding:8px 20px;
  text-align:center;
  border-bottom:1px solid var(--line);
  background:rgba(244,237,226,.82);
  color:var(--ink-2);
  font-size:14px;
  letter-spacing:.32em;
  overflow-wrap:break-word;
}
.strip p{margin:0}

.shell{
  position:relative;
  z-index:1;
  max-width:1280px;
  margin:0 auto;
  padding:0 28px 0 0;
  display:grid;
  grid-template-columns:108px minmax(0,1fr) 248px;
  gap:0 40px;
}

/* 左侧竖排导航 */
.rail{
  position:sticky;
  top:0;
  align-self:start;
  height:100vh;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:20px;
  padding:18px 0 22px;
  border-right:1px solid var(--line);
  background:linear-gradient(180deg,rgba(255,252,246,.72),rgba(255,252,246,.18));
  backdrop-filter:blur(10px);
  -webkit-backdrop-filter:blur(10px);
}

.mark{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  flex:0 0 auto;
  width:44px;
  height:44px;
  border-radius:var(--r);
  border:1px solid var(--line);
  background:var(--glass);
  color:var(--ink);
  text-decoration:none;
  overflow:hidden;
  transition:transform .3s ease-out,box-shadow .3s ease-out;
}
.mark:hover{
  transform:translateY(-2px);
  box-shadow:0 8px 18px -12px rgba(23,38,35,.7);
}
.mark img{width:100%;height:100%;object-fit:cover;display:block}
.mono{font-size:19px;font-weight:700;letter-spacing:.02em;color:var(--teal-d)}

.nav{width:100%;min-width:0}
.nav ul{
  list-style:none;
  margin:0;
  padding:0 10px;
  display:flex;
  flex-direction:column;
  gap:2px;
}
.nav a{
  display:flex;
  align-items:center;
  min-height:44px;
  padding:9px 8px;
  border-radius:var(--r);
  color:var(--ink-2);
  text-decoration:none;
  font-size:14px;
  line-height:1.35;
  letter-spacing:.02em;
  transition:background .25s ease-out,color .25s ease-out,transform .25s ease-out;
}
.nav a:hover{
  background:rgba(92,198,176,.22);
  color:var(--ink);
  transform:translateX(2px);
}
.nav a[aria-current]{
  background:rgba(92,198,176,.34);
  color:var(--ink);
  font-weight:500;
}

/* 正文 */
.main{min-width:0}
.prose{
  max-width:760px;
  padding:0 0 72px;
  overflow-wrap:break-word;
}

.hero{
  min-height:70vh;
  display:flex;
  flex-direction:column;
  justify-content:center;
  align-items:flex-start;
  padding:64px 0 48px;
  border:0;
  background:none;
  box-shadow:none;
  backdrop-filter:none;
}
.hero h1{
  margin:0;
  font-size:clamp(32px,4.4vw,56px);
  line-height:1.16;
  letter-spacing:.004em;
  font-weight:700;
  overflow-wrap:break-word;
}
.hero-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:48px;
  height:48px;
  margin-right:14px;
  vertical-align:-8px;
  border:1px solid var(--line);
  border-radius:var(--r);
  background:var(--glass);
  backdrop-filter:blur(8px);
  -webkit-backdrop-filter:blur(8px);
}
.hero-sub{
  max-width:48ch;
  margin:22px 0 0;
  color:var(--ink-2);
  font-size:17px;
  line-height:1.75;
}

.prose section{
  scroll-margin-top:96px;
  margin:0 0 22px;
  padding:34px 28px;
  border:1px solid var(--line);
  border-radius:var(--r);
  background:var(--glass);
  backdrop-filter:blur(12px);
  -webkit-backdrop-filter:blur(12px);
  box-shadow:0 16px 34px -26px rgba(23,38,35,.75);
}
.prose section:last-child{margin-bottom:0}

.prose h2{
  margin:.1em 0 .8em;
  font-size:clamp(22px,2.5vw,29px);
  line-height:1.32;
  letter-spacing:.005em;
  overflow-wrap:break-word;
}
.prose h2::after{
  content:"";
  display:block;
  width:44px;
  height:2px;
  margin-top:12px;
  background:var(--teal);
  border-radius:2px;
}
.prose h3{
  margin:1.5em 0 .55em;
  font-size:20px;
  line-height:1.4;
  overflow-wrap:break-word;
}
.prose h4{
  margin:1.3em 0 .4em;
  font-size:17px;
  letter-spacing:.04em;
}
.prose small{
  display:block;
  margin-bottom:9px;
  color:var(--terra);
  font-size:12.5px;
  letter-spacing:.3em;
  line-height:1.5;
}
.prose p{margin:0 0 1.05em}
.prose p:last-child{margin-bottom:0}
.prose ul,
.prose ol{margin:0 0 1.1em;padding-left:1.35em}
.prose li{margin:.35em 0}
.prose li::marker{color:var(--teal-d)}
.prose strong{font-weight:700}
.prose a{
  color:var(--teal-d);
  text-decoration:underline;
  text-decoration-thickness:1px;
  text-underline-offset:3px;
  overflow-wrap:break-word;
  transition:background .2s ease-out,color .2s ease-out;
}
.prose a:hover{background:rgba(92,198,176,.28);color:var(--ink)}
.prose blockquote{
  margin:1.3em 0;
  padding:.45em 0 .45em 1.1em;
  border-left:3px solid var(--terra);
  color:var(--ink-2);
}
.prose blockquote p:last-child{margin-bottom:0}

/* 表格与代码：自身横向滚动，绝不撑破页面 */
.prose table{
  display:block;
  width:100%;
  max-width:100%;
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
  margin:1.2em 0;
  border-collapse:collapse;
  font-size:15.5px;
}
.prose th,
.prose td{
  padding:9px 10px;
  border-bottom:1px solid var(--line);
  text-align:left;
  vertical-align:top;
  overflow-wrap:anywhere;
}
.prose th{background:rgba(212,196,168,.42);font-weight:700}

.prose img,
.prose svg,
.prose video,
.prose iframe{
  display:block;
  max-width:100%;
  height:auto;
  margin:1.2em 0;
  border-radius:var(--r);
}
.prose hr{
  border:0;
  border-top:1px solid var(--line);
  margin:2em 0;
}
.prose pre{
  display:block;
  max-width:100%;
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
  margin:1.2em 0;
  padding:14px 16px;
  border-radius:var(--r);
  background:rgba(23,38,35,.08);
  font-size:14.5px;
  line-height:1.6;
}
.prose code{
  font-size:.9em;
  padding:.1em .35em;
  border-radius:3px;
  background:rgba(23,38,35,.08);
  overflow-wrap:anywhere;
}
.prose pre code{padding:0;background:none;white-space:pre}

/* 右侧侧栏 */
.side{
  position:sticky;
  top:26px;
  align-self:start;
  min-width:0;
  margin-top:34px;
  padding:20px 16px;
  border:1px solid var(--line);
  border-radius:var(--r);
  background:var(--glass);
  backdrop-filter:blur(10px);
  -webkit-backdrop-filter:blur(10px);
  box-shadow:0 14px 30px -26px rgba(23,38,35,.8);
}
.side small{
  display:block;
  margin-bottom:6px;
  color:var(--terra);
  font-size:12.5px;
  letter-spacing:.3em;
}
.side h2{
  margin:0 0 12px;
  font-size:18px;
  line-height:1.4;
}
.toc{
  list-style:none;
  margin:0;
  padding:0;
  display:flex;
  flex-direction:column;
  gap:2px;
}
.toc a{
  display:flex;
  align-items:center;
  min-height:40px;
  padding:8px 10px;
  border-radius:var(--r);
  color:var(--ink-2);
  font-size:15px;
  text-decoration:none;
  overflow-wrap:break-word;
  transition:background .25s ease-out,color .25s ease-out;
}
.toc a:hover{background:rgba(92,198,176,.24);color:var(--ink)}
.toc a[aria-current]{
  background:rgba(92,198,176,.34);
  color:var(--ink);
  font-weight:500;
}
.side-fig{margin:0 0 16px}
.side-fig img{
  display:block;
  width:100%;
  max-width:100%;
  height:auto;
  border-radius:var(--r);
}

/* 页脚 */
.foot{
  position:relative;
  z-index:1;
  margin-top:36px;
  border-top:1px solid var(--line);
  background:linear-gradient(180deg,rgba(212,196,168,.38),rgba(244,237,226,.95));
}
.foot-cta{
  max-width:1280px;
  margin:0 auto;
  padding:68px 28px 56px;
  text-align:center;
}
.foot-cta h2{
  margin:0;
  font-size:clamp(28px,5vw,52px);
  line-height:1.14;
  letter-spacing:.01em;
  overflow-wrap:break-word;
}
.cta{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:48px;
  margin-top:26px;
  padding:12px 28px;
  border-radius:var(--r);
  background:var(--ink);
  color:var(--sand);
  font-size:16px;
  letter-spacing:.06em;
  text-decoration:none;
  transition:background .3s ease-out,transform .3s ease-out,box-shadow .3s ease-out;
}
.cta:hover{
  background:var(--teal-d);
  transform:translateY(-2px);
  box-shadow:0 14px 26px -18px rgba(23,38,35,.9);
}
.foot-bar{
  max-width:1280px;
  margin:0 auto;
  padding:18px 28px 26px;
  border-top:1px solid var(--line);
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  font-size:14px;
}
.foot-bar p{margin:0;color:var(--ink-3);letter-spacing:.04em}
.foot-bar a{
  display:inline-flex;
  align-items:center;
  min-height:40px;
  padding:4px 2px;
  color:var(--ink-2);
  text-decoration:none;
  border-bottom:1px solid transparent;
  transition:color .25s ease-out,border-color .25s ease-out;
}
.foot-bar a:hover{color:var(--ink);border-color:var(--teal)}

/* 滚动显现 */
.rv{opacity:0;transform:translateY(16px)}
.rv.in{
  opacity:1;
  transform:none;
  transition:opacity .7s ease-out,transform .7s ease-out;
}

@media (max-width:900px){
  .strip{
    position:relative;
    z-index:3;
    padding:7px 16px;
    font-size:13px;
    letter-spacing:.26em;
  }
  .shell{
    display:block;
    width:100%;
    padding:0;
    overflow-x:clip;
  }
  .rail{
    position:sticky;
    top:0;
    z-index:20;
    height:auto;
    width:100%;
    flex-direction:row;
    flex-wrap:nowrap;
    align-items:center;
    gap:10px;
    padding:8px 14px;
    border-right:0;
    border-bottom:1px solid var(--line);
    background:rgba(244,237,226,.9);
    backdrop-filter:blur(12px);
    -webkit-backdrop-filter:blur(12px);
  }
  .mark{flex:0 0 auto}
  .nav{
    flex:1 1 auto;
    min-width:0;
    max-width:100%;
    overflow:hidden;
  }
  .nav ul{
    flex-direction:row;
    gap:2px;
    padding:0;
    max-width:100%;
    overflow-x:auto;
    -webkit-overflow-scrolling:touch;
    scrollbar-width:none;
  }
  .nav ul::-webkit-scrollbar{display:none}
  .nav a{
    white-space:nowrap;
    padding:10px 12px;
    min-height:44px;
    font-size:15px;
  }
  .nav a:hover{transform:none}
  .main{
    width:100%;
    min-width:0;
    overflow-x:clip;
  }
  .prose{
    max-width:none;
    width:100%;
    padding:0 18px 44px;
  }
  .hero{
    min-height:auto;
    padding:38px 0 26px;
  }
  .hero-badge{
    width:38px;
    height:38px;
    margin-right:10px;
    vertical-align:-5px;
  }
  .prose article{
    scroll-margin-top:78px;
    padding:24px 18px;
    margin-bottom:16px;
  }
  .side{
    position:static;
    width:auto;
    margin:0 18px 26px;
  }
  .foot-cta{padding:48px 20px 40px}
  .foot-bar{padding:16px 20px 24px}
}

@media (max-width:520px){
  .prose h2{font-size:22px}
  .prose h3{font-size:18px}
  .hero-badge{width:34px;height:34px}
  .hero-badge svg{width:26px;height:26px}
  .prose table{font-size:14.5px}
  .foot-bar{justify-content:flex-start}
}

@media (prefers-reduced-motion:reduce){
  html{scroll-behavior:auto}
  .rv{opacity:1;transform:none}
  *{transition-duration:.01ms !important;animation-duration:.01ms !important}
}

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