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

:root {
  --ink: #1f1726;
  --vio: #56228b;
  --vio-soft: rgba(86, 34, 139, .09);
  --och: #8b4513;
  --och-soft: rgba(139, 69, 19, .08);
  --paper: #f8f4ec;
  --paper-2: #fffaf2;
  --paper-3: #fffdf8;
  --line: #e0d5c5;
  --muted: #4a3f55;
  --r-lg: 26px;
  --r-md: 18px;
  --r-sm: 12px;
  --shadow: 0 14px 34px -22px rgba(31, 23, 38, .75);
  --shadow-soft: 0 8px 22px -16px rgba(31, 23, 38, .55);
}

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

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

body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 10% 4%, rgba(86, 34, 139, .07), transparent 42%),
    radial-gradient(circle at 92% 24%, rgba(139, 69, 19, .08), transparent 38%),
    radial-gradient(circle at 46% 92%, rgba(86, 34, 139, .05), transparent 44%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: 'Space Mono', ui-monospace, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 17px;
  line-height: 1.85;
  letter-spacing: .01em;
}

h1, h2, h3 {
  font-family: 'Syncopate', 'Space Mono', "PingFang SC", "Microsoft YaHei", sans-serif;
  font-weight: 700;
  letter-spacing: .05em;
  line-height: 1.35;
  overflow-wrap: break-word;
}

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

img,
svg,
video {
  max-width: 100%;
  height: auto;
}

/* 顶栏 */
.top {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem .8rem;
  min-width: 0;
  padding: .7rem clamp(1rem, 4vw, 2.2rem);
  background: rgba(248, 244, 236, .93);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  transition: box-shadow .3s ease;
}

.top.is-stuck {
  box-shadow: var(--shadow-soft);
}

.brand {
  order: 1;
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  min-width: 0;
  min-height: 44px;
  text-decoration: none;
  color: var(--ink);
}

.brand .mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border-radius: 58% 42% 47% 53% / 52% 48% 53% 47%;
  background: linear-gradient(142deg, var(--vio), var(--och));
  color: #fff;
  font-size: .85rem;
  font-weight: 700;
  letter-spacing: .02em;
}

.brand-name {
  font-family: 'Syncopate', 'Space Mono', sans-serif;
  font-size: .95rem;
  font-weight: 700;
  letter-spacing: .18em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cta {
  order: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 44px;
  padding: .55rem 1.15rem;
  border-radius: 999px;
  background: var(--vio);
  color: #fff;
  font-size: .92rem;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: var(--shadow-soft);
  transition: background .25s ease, transform .25s ease;
}

.cta:hover {
  background: var(--och);
  transform: translateY(-2px);
}

.top nav {
  order: 3;
  flex: 1 0 100%;
  min-width: 0;
  max-width: 100%;
}

.top nav ol {
  display: flex;
  gap: .45rem;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: .1rem .1rem .25rem;
  list-style: none;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}

.top nav li {
  flex: 0 0 auto;
  scroll-snap-align: start;
}

.top nav a {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: .5rem .95rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--ink);
  font-size: .9rem;
  text-decoration: none;
  white-space: nowrap;
  transition: background .2s ease, color .2s ease, border-color .2s ease, transform .2s ease;
}

.top nav a:hover,
.top nav a.on {
  background: var(--vio);
  border-color: var(--vio);
  color: #fff;
  transform: translateY(-2px);
}

/* 主体 */
.wrap {
  width: min(1160px, 100%);
  max-width: 100%;
  margin: 0 auto;
  padding: clamp(1rem, 3.5vw, 2rem) clamp(1rem, 4vw, 2rem) 3rem;
}

.hero {
  display: grid;
  gap: 1.1rem;
  align-content: center;
  min-height: 45vh;
  padding: clamp(1.2rem, 4vw, 2.4rem) 0 clamp(1rem, 3vw, 1.6rem);
  border-bottom: 1px dashed var(--line);
  margin-bottom: 1.5rem;
}

.hero h1 {
  margin: 0;
  max-width: 22ch;
  font-size: clamp(1.7rem, 5vw, 2.9rem);
  line-height: 1.3;
  letter-spacing: .04em;
}

.kicker {
  margin: 0 0 .5rem;
  font-family: 'Space Mono', monospace;
  font-size: .8rem;
  letter-spacing: .3em;
  color: var(--och);
  text-transform: uppercase;
}

.lede {
  margin: .85rem 0 0;
  max-width: 48ch;
  color: var(--muted);
  font-size: .98rem;
  line-height: 1.8;
}

.hero-art {
  margin: 0;
  min-width: 0;
}

.hero-art .hero-img {
  display: block;
  width: 100%;
  border-radius: 48% 52% 44% 56% / 52% 45% 55% 48%;
  box-shadow: var(--shadow);
  will-change: transform;
}

.body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.4rem;
  min-width: 0;
}

.body > * {
  min-width: 0;
}

/* 侧栏 */
aside {
  align-self: start;
  min-width: 0;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--paper-2);
  box-shadow: var(--shadow-soft);
}

aside h2 {
  margin: 0;
  font-size: .92rem;
  letter-spacing: .16em;
  color: var(--ink);
}

aside hr {
  border: 0;
  border-top: 2px solid transparent;
  border-image: linear-gradient(90deg, var(--vio), var(--och)) 1;
  margin: .55rem 0 .8rem;
}

aside ol {
  counter-reset: s;
  display: grid;
  gap: .1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

aside li {
  counter-increment: s;
  min-width: 0;
}

aside a {
  display: flex;
  align-items: center;
  gap: .5rem;
  min-height: 42px;
  padding: .45rem .55rem;
  border-radius: var(--r-sm);
  color: var(--ink);
  font-size: .9rem;
  line-height: 1.5;
  text-decoration: none;
  overflow-wrap: break-word;
  transition: background .2s ease, color .2s ease;
}

aside a::before {
  content: counter(s, decimal-leading-zero);
  flex: 0 0 auto;
  font-size: .72rem;
  letter-spacing: .08em;
  color: var(--och);
}

aside a:hover {
  background: var(--vio-soft);
  color: var(--vio);
}

/* 正文 */
article {
  min-width: 0;
  max-width: 100%;
  padding: clamp(1.1rem, 3.2vw, 2.4rem);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--paper-3);
  box-shadow: var(--shadow);
  overflow-x: auto;
  overflow-wrap: break-word;
}

article > * {
  max-width: 100%;
}

article div {
  scroll-margin-top: 130px;
  padding-bottom: 1.3rem;
  margin-bottom: 1.7rem;
  border-bottom: 1px dashed var(--line);
}

article div:last-child {
  padding-bottom: 0;
  margin-bottom: 0;
  border-bottom: 0;
}

article h2 {
  margin: 0;
  font-size: clamp(1.25rem, 3.4vw, 1.8rem);
  color: var(--vio);
}

article h2 + hr {
  border: 0;
  width: 62px;
  height: 3px;
  margin: .65rem 0 1rem;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--vio), var(--och));
}

article h3 {
  margin: 1.5rem 0 .4rem;
  font-size: 1.08rem;
  color: var(--och);
}

article p {
  margin: .8em 0;
}

article ul,
article ol {
  margin: .8em 0;
  padding-left: 1.35rem;
}

article li {
  margin: .35em 0;
}

article a {
  color: var(--vio);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}

article a:hover {
  color: var(--och);
}

article strong {
  background: linear-gradient(transparent 62%, rgba(86, 34, 139, .17) 62%);
}

article blockquote {
  margin: 1.1rem 0;
  padding: .8rem 1rem;
  border-left: 3px solid var(--och);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: var(--och-soft);
}

article img {
  border-radius: var(--r-md);
  box-shadow: var(--shadow-soft);
}

article pre,
article code {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

article pre {
  overflow-x: auto;
  padding: .8rem 1rem;
  border-radius: var(--r-sm);
  background: rgba(31, 23, 38, .06);
}

article table {
  width: 100%;
  border-collapse: collapse;
  font-size: .94rem;
}

article th,
article td {
  padding: .55rem .6rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  overflow-wrap: anywhere;
}

/* 页脚 */
footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
  margin-top: 2rem;
  padding: 2.4rem clamp(1rem, 4vw, 2.2rem) 1.5rem;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  background: var(--ink);
  color: #e6dcf0;
  overflow-x: hidden;
}

footer div {
  min-width: 0;
}

.fbrand {
  margin: 0;
  font-family: 'Syncopate', 'Space Mono', sans-serif;
  font-size: 1.15rem;
  letter-spacing: .2em;
  color: #fff;
}

footer ol {
  display: grid;
  gap: .05rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

footer ol a {
  display: block;
  min-height: 42px;
  padding: .5rem 0;
  color: #d3c4e6;
  font-size: .9rem;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  transition: color .2s ease, padding-left .2s ease;
}

footer ol a:hover {
  color: #fff;
  padding-left: .35rem;
}

.sub {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.sub input {
  flex: 1 1 150px;
  min-width: 0;
  max-width: 100%;
  min-height: 46px;
  padding: .5rem 1rem;
  border: 1px solid rgba(255, 255, 255, .26);
  border-radius: 999px;
  background: rgba(255, 255, 255, .07);
  color: #fff;
  font: inherit;
  font-size: .92rem;
}

.sub input::placeholder {
  color: #b9a8cd;
}

.sub button {
  flex: 0 0 auto;
  min-height: 46px;
  padding: .5rem 1.25rem;
  border: 0;
  border-radius: 999px;
  background: var(--och);
  color: #fff;
  font: inherit;
  font-size: .92rem;
  cursor: pointer;
  transition: background .25s ease;
}

.sub button:hover {
  background: var(--vio);
}

.copy {
  grid-column: 1 / -1;
  margin: .5rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, .12);
  text-align: center;
  font-size: .82rem;
  letter-spacing: .08em;
  color: #a99bbb;
}

/* 回到顶部 */
.totop {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 50;
  min-height: 46px;
  padding: .5rem 1.05rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-3);
  color: var(--ink);
  font: inherit;
  font-size: .88rem;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity .25s ease, transform .25s ease;
}

.totop.show {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

/* 入场 */
.js article > div {
  opacity: 0;
  transform: translateY(16px);
}

.js article > div.in {
  opacity: 1;
  transform: none;
  transition: opacity .55s ease, transform .55s ease;
}

@media (max-width: 420px) {
  .top nav a {
    padding: .5rem .78rem;
    font-size: .86rem;
  }

  .cta {
    padding: .55rem .9rem;
    font-size: .86rem;
  }
}

@media (min-width: 760px) {
  .hero.has-art {
    grid-template-columns: 1.4fr .85fr;
    align-items: center;
  }

  footer {
    grid-template-columns: 1.1fr 1fr 1.2fr;
  }
}

@media (min-width: 920px) {
  .top {
    flex-wrap: nowrap;
  }

  .brand {
    flex: 0 0 auto;
  }

  .top nav {
    order: 2;
    flex: 1 1 auto;
  }

  .top nav ol {
    justify-content: flex-end;
    overflow: visible;
  }

  .cta {
    order: 3;
  }

  .body {
    grid-template-columns: 232px minmax(0, 1fr);
    gap: 2.2rem;
  }

  aside {
    position: sticky;
    top: 92px;
  }
}

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

  .js article > div {
    opacity: 1;
    transform: none;
  }

  .hero-art .hero-img {
    transform: none !important;
  }
}

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