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

:root {
  --ink: #1f1726;
  --plum: #56228b;
  --plum-soft: #6d34a6;
  --clay: #8b4513;
  --sand: #f5efe7;
  --dune: #e7ddd0;
  --paper: #fffcf8;
  --line: rgba(31, 23, 38, .14);
  --shadow: 0 22px 48px -32px rgba(31, 23, 38, .62);
  --mono: "Fira Code", ui-monospace, "Courier New", monospace;
  --sans: "Fira Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.72;
  color: var(--ink);
  background: var(--sand);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(58% 42% at 10% -4%, rgba(86, 34, 139, .13), transparent 72%),
    radial-gradient(48% 38% at 96% 12%, rgba(139, 69, 19, .13), transparent 70%),
    radial-gradient(60% 50% at 50% 108%, rgba(86, 34, 139, .08), transparent 72%);
}

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

a { color: var(--plum); }

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 90;
  padding: .8rem 1.1rem;
  background: var(--ink);
  color: #f6efe6;
  border-radius: 0 0 16px 0;
  text-decoration: none;
}
.skip:focus { left: 0; }

/* 顶栏 */
.top {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .55rem clamp(.75rem, 3vw, 1.5rem);
  background: rgba(245, 239, 231, .9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.burger {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  min-height: 44px;
  padding: .5rem .8rem;
  font-family: var(--mono);
  font-size: .78rem;
  letter-spacing: .1em;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 16px 16px 16px 6px;
  cursor: pointer;
  transition: background .25s ease, border-color .25s ease;
}
.burger:hover { background: rgba(86, 34, 139, .1); border-color: rgba(86, 34, 139, .4); }

.burger-bar,
.burger-bar::before {
  display: block;
  width: 16px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  content: "";
  transition: transform .3s ease;
}
.burger-bar { position: relative; }
.burger-bar::before { position: absolute; top: -5px; left: 0; }

.site-nav {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(.4rem, 1.2vw, 1.2rem);
  min-width: 0;
}

.nav-left,
.nav-right {
  flex: 1;
  display: none;
  align-items: center;
  gap: clamp(.2rem, .9vw, .9rem);
  margin: 0;
  padding: 0;
  list-style: none;
}
.nav-left { justify-content: flex-end; }
.nav-right { justify-content: flex-start; }

.nav-left a,
.nav-right a {
  display: inline-block;
  padding: .58rem .5rem;
  font-size: .93rem;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color .25s ease, border-color .25s ease;
  white-space: nowrap;
}
.nav-left a:hover,
.nav-right a:hover { color: var(--clay); border-bottom-color: var(--clay); }

.brand {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .3rem .2rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: .04em;
  white-space: nowrap;
}
.brand-mark { width: 30px; height: 30px; border-radius: 12px 12px 12px 4px; }
.brand-txt { font-size: .98rem; }

.cta {
  flex: none;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: .55rem .95rem;
  font-size: .9rem;
  color: #fbf6f1;
  background: linear-gradient(140deg, var(--plum), #3b1660);
  border-radius: 16px 16px 16px 6px;
  text-decoration: none;
  box-shadow: 0 12px 24px -18px rgba(86, 34, 139, .95);
  transition: transform .25s ease, box-shadow .25s ease;
}
.cta:hover { transform: translateY(-2px); box-shadow: 0 18px 30px -18px rgba(86, 34, 139, .95); }

/* 全屏遮罩菜单 */
.veil {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-content: center;
  padding: 2rem 1.2rem;
  background:
    radial-gradient(70% 60% at 18% 8%, rgba(86, 34, 139, .55), transparent 68%),
    radial-gradient(60% 50% at 88% 92%, rgba(139, 69, 19, .45), transparent 70%),
    var(--ink);
  opacity: 0;
  visibility: hidden;
  transition: opacity .35s ease, visibility .35s ease;
  overflow-y: auto;
}
body.menu-open .veil { opacity: 1; visibility: visible; }
body.menu-open { overflow: hidden; }

.veil-close {
  position: absolute;
  top: 1.1rem;
  right: 1.1rem;
  min-height: 44px;
  padding: .55rem 1.1rem;
  font-family: var(--mono);
  font-size: .8rem;
  letter-spacing: .12em;
  color: #f4eadf;
  background: transparent;
  border: 1px solid rgba(244, 234, 223, .35);
  border-radius: 18px 18px 18px 6px;
  cursor: pointer;
}
.veil-close:hover { background: rgba(244, 234, 223, .14); }

.veil-nav ol {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: vitem;
  text-align: center;
}
.veil-nav li {
  counter-increment: vitem;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .4s ease, transform .4s ease;
}
body.menu-open .veil-nav li { opacity: 1; transform: none; }
body.menu-open .veil-nav li:nth-child(1) { transition-delay: .05s; }
body.menu-open .veil-nav li:nth-child(2) { transition-delay: .1s; }
body.menu-open .veil-nav li:nth-child(3) { transition-delay: .15s; }
body.menu-open .veil-nav li:nth-child(4) { transition-delay: .2s; }
body.menu-open .veil-nav li:nth-child(5) { transition-delay: .25s; }
body.menu-open .veil-nav li:nth-child(6) { transition-delay: .3s; }
body.menu-open .veil-nav li:nth-child(7) { transition-delay: .35s; }

.veil-nav a {
  display: block;
  padding: .62rem 1.2rem;
  font-size: clamp(1.15rem, 4.5vw, 1.5rem);
  color: #f4eadf;
  text-decoration: none;
  border-radius: 18px;
}
.veil-nav a:hover { background: rgba(244, 234, 223, .12); color: #fff; }
.veil-nav a::before {
  content: counter(vitem, decimal-leading-zero);
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .18em;
  display: block;
  color: rgba(244, 234, 223, .55);
}

/* 版心 */
.wrap {
  position: relative;
  z-index: 1;
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 clamp(.9rem, 3vw, 1.6rem) 2.4rem;
}

/* 头图 */
.hero {
  position: relative;
  isolation: isolate;
  display: grid;
  align-items: end;
  justify-items: end;
  min-height: 45vh;
  margin: 1rem 0 1.7rem;
  padding: clamp(1.2rem, 4vw, 2.8rem);
  border-radius: 28px 28px 26px 120px;
  overflow: hidden;
  background: linear-gradient(160deg, #3c1755, #1f1726 58%, #43210f);
  box-shadow: var(--shadow);
}
.hero-img {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hero-veil {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(252deg, rgba(31, 23, 38, .88), rgba(31, 23, 38, .34) 52%, rgba(31, 23, 38, .76));
}
.hero-txt { text-align: right; max-width: 34ch; }
.hero-h1 {
  margin: 0;
  font-size: clamp(1.9rem, 6.4vw, 3.4rem);
  line-height: 1.14;
  letter-spacing: -.01em;
  color: #fdf8f2;
  text-shadow: 0 12px 34px rgba(15, 10, 20, .6);
}
.hero-lead {
  margin: .7rem 0 0;
  font-size: .98rem;
  line-height: 1.62;
  color: rgba(253, 248, 242, .84);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 主体布局 */
.stage {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.4rem;
  align-items: start;
}

.rail-box {
  background: var(--dune);
  border-radius: 22px 22px 22px 8px;
  padding: 1.1rem 1.2rem 1.3rem;
  box-shadow: var(--shadow);
}

.eyebrow {
  display: block;
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .22em;
  color: var(--clay);
}

.rail-title {
  margin: .18rem 0 .8rem;
  font-size: 1.15rem;
  letter-spacing: .04em;
  color: var(--plum);
}

.rail-list {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: ritem;
  border-top: 1px dashed rgba(31, 23, 38, .22);
}
.rail-list li { counter-increment: ritem; }
.rail-list a {
  display: block;
  padding: .52rem 0 .52rem 1.9rem;
  position: relative;
  color: var(--ink);
  text-decoration: none;
  font-size: .93rem;
  border-bottom: 1px dashed rgba(31, 23, 38, .14);
  transition: color .2s ease, padding-left .2s ease;
}
.rail-list a::before {
  content: counter(ritem, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: .58rem;
  font-family: var(--mono);
  font-size: .7rem;
  color: var(--clay);
  letter-spacing: .1em;
}
.rail-list a:hover { color: var(--plum); padding-left: 2.15rem; }

/* 正文 */
.prose { min-width: 0; overflow-wrap: break-word; }

.prose > div {
  background: var(--paper);
  border-radius: 18px;
  padding: clamp(1.15rem, 3vw, 2.3rem);
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
  animation: rise .5s ease both;
}
.prose > div:nth-child(2n) { border-radius: 26px 18px 30px 18px; }
.prose > div:nth-child(3n) { border-radius: 18px 30px 18px 26px; }
.prose > div:nth-child(1) { animation-delay: .03s; }
.prose > div:nth-child(2) { animation-delay: .08s; }
.prose > div:nth-child(3) { animation-delay: .13s; }
.prose > div:nth-child(4) { animation-delay: .18s; }
.prose > div:nth-child(5) { animation-delay: .23s; }
.prose > div:nth-child(6) { animation-delay: .28s; }
.prose > div:nth-child(7) { animation-delay: .33s; }

.prose > div[id] { scroll-margin-top: 92px; }

.prose h2 {
  margin: .2rem 0 1rem;
  font-size: clamp(1.3rem, 2.6vw, 1.8rem);
  line-height: 1.35;
  letter-spacing: -.005em;
  color: var(--plum);
}
.prose h2::after {
  content: "";
  display: block;
  width: 58px;
  height: 6px;
  margin-top: .6rem;
  border-radius: 6px 6px 6px 1px;
  background: linear-gradient(90deg, var(--clay), rgba(139, 69, 19, .18));
}

.prose h3 {
  margin: 1.6rem 0 .55rem;
  font-size: 1.12rem;
  color: var(--ink);
}

.prose small {
  display: block;
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .2em;
  color: var(--clay);
  margin-bottom: .15rem;
}

.prose p { margin: 0 0 1rem; }
.prose strong { color: #3b1660; }
.prose a { color: var(--plum); text-decoration: underline; text-decoration-color: rgba(86, 34, 139, .35); text-underline-offset: 3px; }
.prose a:hover { text-decoration-color: var(--clay); color: var(--clay); }

.prose ul,
.prose ol { margin: 0 0 1rem; padding-left: 1.3rem; }
.prose li { margin-bottom: .45rem; }

.prose blockquote {
  margin: 1.2rem 0;
  padding: .9rem 1.2rem;
  background: var(--dune);
  border-radius: 18px 18px 18px 6px;
  color: #33263c;
}
.prose blockquote p:last-child { margin-bottom: 0; }

.prose figure { margin: 1.2rem 0; }
.prose figcaption { font-size: .84rem; color: #5c4f66; margin-top: .45rem; }
.prose img { border-radius: 18px; }

.prose table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.prose th,
.prose td { padding: .6rem .5rem; text-align: left; border-bottom: 1px solid var(--line); }

.prose code,
.prose pre {
  font-family: var(--mono);
  font-size: .88rem;
}
.prose pre {
  padding: 1rem;
  overflow-x: auto;
  background: var(--ink);
  color: #f2e9dd;
  border-radius: 16px;
}

/* 页脚 */
.foot {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .6rem 1.2rem;
  margin-top: 1rem;
  padding: 1.2rem clamp(1rem, 3vw, 2rem);
  background: var(--ink);
  color: #e9ddce;
  border-radius: 30px 30px 0 0;
}
.foot address {
  font-style: normal;
  font-weight: 600;
  letter-spacing: .05em;
  color: #f6efe6;
}
.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: .2rem 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.foot-links a {
  display: inline-block;
  padding: .6rem 0;
  color: #e9ddce;
  text-decoration: none;
  font-size: .93rem;
}
.foot-links a:hover { color: #fff; text-decoration: underline; text-underline-offset: 4px; }
.fine {
  margin: 0;
  font-family: var(--mono);
  font-size: .78rem;
  letter-spacing: .08em;
  color: rgba(233, 221, 206, .62);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

@media (min-width: 980px) {
  .nav-left,
  .nav-right { display: flex; }
  .burger-txt { display: none; }
  .burger { padding: .5rem .7rem; }
  .stage {
    grid-template-columns: 258px minmax(0, 1fr);
    gap: 2rem;
  }
  .rail { position: sticky; top: 5.4rem; }
}

@media (min-width: 1160px) {
  .hero { min-height: 42vh; }
}

@media (max-width: 560px) {
  body { font-size: 16.5px; }
  .hero { border-radius: 24px 24px 22px 74px; }
  .wrap { padding-bottom: 1.6rem; }
  .foot { border-radius: 22px 22px 0 0; }
  .foot-links { gap: .2rem .8rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

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