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

:root {
  --paper: #f5e6c8;
  --paper-2: #eed9b6;
  --ink: #262117;
  --amber: #d4a574;
  --amber-d: #8a5f33;
  --line: rgba(38, 33, 23, 0.22);
  --mono: "Space Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", monospace;
}

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

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

body {
  margin: 0;
  overflow-x: hidden;
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 90% -8%, rgba(212, 165, 116, 0.5), transparent 52%),
    radial-gradient(circle at 4% 6%, rgba(212, 165, 116, 0.32), transparent 44%);
  background-attachment: fixed;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  opacity: 0.16;
  background-image: url("data:image/svg+xml,%3Csvg width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
}

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

a {
  color: inherit;
  text-decoration: none;
}

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

/* 顶栏 */
.top {
  z-index: 50;
  background: rgba(245, 230, 200, 0.96);
  border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.top__bar {
  max-width: 1140px;
  margin: 0 auto;
  padding: 10px 16px;
  display: grid;
  align-items: center;
  gap: 4px 12px;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "brand cta"
    "navl navl"
    "navr navr";
}

.brand {
  grid-area: brand;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand__mark {
  display: inline-flex;
  width: 22px;
  height: 22px;
  color: var(--amber-d);
}

.brand__mark svg,
.brand__mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand__t { border-bottom: 2px solid var(--amber); }

.top__nav--l { grid-area: navl; }
.top__nav--r {
  grid-area: navr;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
}

.top__nav p {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
}

.top__nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 10px;
  font-size: 16px;
  border-bottom: 1px solid transparent;
}

.top__nav a:hover { border-bottom-color: var(--ink); }

.top__nav a.cta {
  min-height: 44px;
  padding: 0 14px;
  background: var(--ink);
  color: var(--paper);
  border-bottom-color: transparent;
  transition: background 0.18s ease, transform 0.18s ease;
}

.top__nav a.cta:hover {
  background: var(--amber-d);
  transform: translateY(-1px);
}

/* 下拉分组 */
.more {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
}

.more__t::after {
  content: "";
  display: inline-block;
  margin-left: 6px;
  width: 6px;
  height: 6px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}

.more__p {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 60;
  min-width: 168px;
  display: none;
  flex-direction: column;
  padding: 6px;
  background: var(--ink);
  color: var(--paper);
}

.more:hover .more__p,
.more:focus-within .more__p { display: flex; }

.more__p a {
  min-height: 44px;
  color: var(--paper);
  border-bottom: 1px solid rgba(245, 230, 200, 0.2);
}

.more__p a:last-child { border-bottom: 0; }

.more__p a:hover {
  background: rgba(245, 230, 200, 0.14);
  border-bottom-color: rgba(245, 230, 200, 0.2);
}

/* 骨架 */
.page {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 16px;
}

.sheet {
  display: grid;
  grid-template-columns: 1fr;
  padding-bottom: 28px;
}

/* 头部区块 */
.hero {
  order: 1;
  grid-column: 1;
  position: relative;
  overflow: hidden;
  min-height: 44vh;
  display: flex;
  align-items: center;
  padding: 26px 0 22px;
  background-image:
    radial-gradient(circle at 84% 8%, rgba(212, 165, 116, 0.55), transparent 46%),
    radial-gradient(circle at 6% 92%, rgba(212, 165, 116, 0.32), transparent 42%);
}

.hero__ghost {
  position: absolute;
  inset: 0;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  padding: 0 4px;
  overflow: hidden;
  font-size: clamp(58px, 15vw, 132px);
  line-height: 0.82;
  font-weight: 700;
  letter-spacing: -0.05em;
  word-break: break-all;
  color: rgba(38, 33, 23, 0.1);
  pointer-events: none;
}

.hero__row {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
}

.hero__mark {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  color: var(--amber-d);
  border: 1px solid var(--line);
  background: rgba(245, 230, 200, 0.6);
}

.hero__mark svg,
.hero__mark img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.hero__h {
  margin: 0;
  font-size: clamp(30px, 7vw, 54px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  font-weight: 700;
}

/* 侧栏 */
.rail {
  order: 2;
  grid-column: 1;
  padding: 18px 0 6px;
  border-top: 1px solid var(--line);
}

.rail small {
  display: block;
  margin-bottom: 4px;
  font-size: 16px;
  letter-spacing: 0.2em;
  color: var(--amber-d);
}

.rail__h {
  margin: 0 0 10px;
  font-size: 18px;
  letter-spacing: 0.02em;
}

.rail__links {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0 14px;
}

.rail__links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 16px;
  border-bottom: 1px solid var(--line);
}

.rail__links a:hover {
  color: var(--amber-d);
  border-bottom-color: var(--amber-d);
}

/* 正文 */
.body {
  order: 3;
  grid-column: 1;
  max-width: 760px;
  padding-bottom: 20px;
  counter-reset: sec;
}

.body section {
  position: relative;
  counter-increment: sec;
  padding: 34px 0 10px;
  border-top: 1px solid var(--line);
  scroll-margin-top: 104px;
}

.body section::before {
  content: counter(sec, decimal-leading-zero);
  position: absolute;
  top: 14px;
  right: 0;
  font-size: clamp(34px, 7vw, 58px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.05em;
  color: rgba(38, 33, 23, 0.13);
}

.body section:last-child { padding-bottom: 0; }

.body small {
  display: block;
  margin-bottom: 6px;
  font-size: 16px;
  letter-spacing: 0.2em;
  color: var(--amber-d);
}

.body h2 {
  margin: 2px 0 12px;
  padding-right: 3.2em;
  font-size: clamp(21px, 3.6vw, 29px);
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.body h3 {
  margin: 22px 0 8px;
  font-size: 18px;
  line-height: 1.4;
}

.body p { margin: 0 0 14px; }

.body ul,
.body ol {
  margin: 0 0 16px;
  padding-left: 1.3em;
}

.body li { margin-bottom: 8px; }

.body strong {
  background: linear-gradient(transparent 62%, rgba(212, 165, 116, 0.75) 62%);
}

.body blockquote {
  margin: 18px 0;
  padding: 12px 16px;
  border-left: 3px solid var(--amber);
  background: rgba(212, 165, 116, 0.24);
}

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

.body a {
  border-bottom: 1px solid var(--amber-d);
}

.body a:hover { background: rgba(212, 165, 116, 0.4); }

.body img {
  margin: 16px 0;
  border: 1px solid var(--line);
}

.body table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
}

.body th,
.body td {
  padding: 8px 10px;
  border: 1px solid var(--line);
  text-align: left;
  font-size: 16px;
  vertical-align: top;
}

.body th { background: rgba(212, 165, 116, 0.35); }

.body code,
.body pre {
  font-family: var(--mono);
  background: rgba(212, 165, 116, 0.28);
}

.body code { padding: 1px 4px; }

.body pre {
  padding: 12px;
  overflow-x: auto;
}

/* 子页卡片 */
.kids {
  order: 4;
  grid-column: 1;
  padding: 26px 0 10px;
  border-top: 1px solid var(--line);
  scroll-margin-top: 104px;
}

.kids small {
  display: block;
  font-size: 16px;
  letter-spacing: 0.2em;
  color: var(--amber-d);
}

.kids h2 {
  margin: 2px 0 14px;
  font-size: 22px;
}

.cards {
  display: grid;
  gap: 12px;
}

.card {
  display: block;
  padding: 16px;
  background: var(--paper-2);
  transition: transform 0.18s ease, background 0.18s ease;
}

.card:hover {
  transform: translateY(-3px);
  background: var(--amber);
}

.card__t {
  display: block;
  margin-bottom: 6px;
  font-size: 17px;
  font-weight: 700;
}

.card__d {
  display: block;
  font-size: 16px;
  line-height: 1.6;
  opacity: 0.85;
}

/* 页脚 */
.foot {
  margin-top: 24px;
  padding: 34px 16px 22px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  background: var(--ink);
  color: var(--paper);
  border-top: 4px solid var(--amber);
}

.foot__a { margin: 0; }

.foot__brand {
  display: block;
  margin-bottom: 10px;
  font-size: clamp(28px, 8vw, 58px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  word-break: break-all;
}

.foot__desc {
  display: block;
  max-width: 34em;
  font-size: 16px;
  line-height: 1.7;
  color: rgba(245, 230, 200, 0.78);
}

.foot__b {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0 8px;
  align-content: start;
}

.foot__b a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 6px;
  font-size: 16px;
  color: rgba(245, 230, 200, 0.9);
  border-bottom: 1px solid transparent;
}

.foot__b a:hover {
  color: var(--paper);
  border-bottom-color: var(--amber);
}

.foot__c {
  display: block;
  padding-top: 12px;
  font-size: 16px;
  color: rgba(245, 230, 200, 0.6);
  border-top: 1px solid rgba(245, 230, 200, 0.2);
}

/* 动效 */
.reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.reveal.in {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: no-preference) {
  .hero__ghost { animation: tracking 9s ease-in-out infinite; }

  @keyframes tracking {
    0%, 90%, 100% { transform: translateX(0) skewX(0); }
    92% { transform: translateX(-3px) skewX(-1.2deg); }
    95% { transform: translateX(2px) skewX(0.8deg); }
    98% { transform: translateX(-1px) skewX(0); }
  }
}

/* 宽屏 */
@media (min-width: 700px) {
  .cards { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
}

@media (min-width: 861px) {
  .top {
    position: sticky;
    top: 0;
  }

  .top__bar {
    padding: 6px 20px;
    gap: 16px;
    grid-template-columns: 1fr auto 1fr;
    grid-template-areas: "navl brand navr";
  }

  .top__nav--l,
  .top__nav--l p { justify-content: flex-end; }

  .top__nav--r { justify-content: flex-end; }
}

@media (min-width: 900px) {
  .sheet {
    grid-template-columns: 212px minmax(0, 1fr);
    column-gap: 40px;
    align-items: start;
  }

  .hero,
  .body,
  .kids { grid-column: 2; }

  .rail {
    order: 0;
    grid-column: 1;
    grid-row: 1;
    position: sticky;
    top: 96px;
    padding: 4px 0 0 16px;
    border-top: 0;
    border-left: 3px solid var(--ink);
  }

  .rail__links {
    flex-direction: column;
    gap: 0;
  }

  .rail__links a {
    display: block;
    min-height: 0;
    padding: 9px 0;
    border-bottom: 1px dotted var(--line);
  }
}

@media (min-width: 820px) {
  .foot {
    grid-template-columns: 1.3fr 1fr;
    padding: 44px 20px 22px;
  }

  .foot__c { grid-column: 1 / -1; }
}

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

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  * { animation: none !important; }
}

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