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

:root {
  --coral: #FF8A7A;
  --coral-deep: #EE7060;
  --cream: #FFF6EC;
  --cream-2: #FFEEDF;
  --card: #FFFBF5;
  --ink: #3D3A4B;
  --ink-soft: rgba(61, 58, 75, .66);
  --line: rgba(61, 58, 75, .16);
  --r: 18px;
  --r-lg: 24px;
}

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

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

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: 'Nunito', 'DM Sans', system-ui, -apple-system, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  font-size: 17px;
  line-height: 1.72;
  letter-spacing: .012em;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

h1, h2, h3, h4 {
  font-family: 'Nunito', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-weight: 900;
  line-height: 1.24;
  letter-spacing: .006em;
  margin: 0;
}

hr {
  border: 0;
  height: 5px;
  width: 66px;
  border-radius: 99px;
  background: var(--coral);
  margin: 12px 0 18px;
}

/* ---------- 顶部横向导航 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: rgba(255, 246, 236, .94);
  border-bottom: 2px solid var(--line);
  backdrop-filter: blur(10px);
}

.brandmark {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 15px;
  border: 2px solid var(--ink);
  background: var(--coral);
  color: #fff;
  font-weight: 900;
  font-size: 19px;
  text-decoration: none;
  overflow: hidden;
  transform: rotate(-4deg);
  transition: transform .25s ease, background .25s ease;
}

.brandmark:hover { transform: rotate(0deg) scale(1.05); background: var(--coral-deep); }
.brandmark img { width: 100%; height: 100%; object-fit: cover; border-radius: 12px; }

.topnav {
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.topnav::-webkit-scrollbar { height: 0; }
.topnav ul {
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.topnav a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 13px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 16px;
  text-decoration: none;
  white-space: nowrap;
  transition: background .2s ease, color .2s ease;
}

.topnav a:hover,
.topnav a:focus-visible { background: rgba(255, 138, 122, .24); }

/* ---------- 首屏 ---------- */
.hero {
  position: relative;
  min-height: 70vh;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  isolation: isolate;
  perspective: 1px;
  background: var(--cream-2);
}

.hero-layer {
  position: absolute;
  inset: -14% 0;
  z-index: 0;
  will-change: transform;
}

.hero-sky {
  background:
    radial-gradient(58% 58% at 18% 16%, #FFD9CE 0%, rgba(255, 217, 206, 0) 62%),
    radial-gradient(52% 52% at 86% 8%, #FFE9C9 0%, rgba(255, 233, 201, 0) 58%),
    linear-gradient(180deg, #FFF1E4 0%, #FFE1D4 100%);
}

.hero-photo { z-index: 1; }
.hero-photo .hero-img { width: 100%; height: 100%; object-fit: cover; opacity: .9; }

.hero-veil {
  z-index: 2;
  background: linear-gradient(180deg,
    rgba(255, 246, 236, .22) 0%,
    rgba(61, 58, 75, .10) 42%,
    rgba(61, 58, 75, .64) 100%);
}

.hero-copy {
  position: relative;
  z-index: 3;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px 62px;
  color: #fff;
  text-align: left;
}

.badge {
  display: inline-block;
  margin-bottom: 14px;
  padding: 6px 15px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, .72);
  background: var(--coral);
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: .04em;
  transform: rotate(-2deg);
}

.hero h1 {
  font-size: clamp(2rem, 7vw, 3.5rem);
  max-width: 20ch;
  text-shadow: 0 3px 18px rgba(61, 58, 75, .38);
}

/* ---------- 主体网格 ---------- */
.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 42px 20px 76px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 232px;
  gap: 34px;
  align-items: start;
}

/* ---------- 右侧锚点栏 ---------- */
.rail {
  position: sticky;
  top: 76px;
  align-self: start;
  padding: 12px;
  border: 2px solid var(--line);
  border-radius: var(--r);
  background: linear-gradient(180deg, #FFFDF9 0%, var(--cream-2) 100%);
}

.railnav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.railnav a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 12px;
  border-left: 3px solid transparent;
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 16px;
  text-decoration: none;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}

.railnav a:hover,
.railnav a:focus-visible {
  background: rgba(255, 138, 122, .18);
  border-left-color: var(--coral);
  color: var(--ink);
}

/* ---------- 章节正文 ---------- */
.chapter { min-width: 0; }
.prose { min-width: 0; }

.prose > div {
  position: relative;
  margin: 0 0 22px;
  padding: 30px 22px;
  border: 2px solid var(--line);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, #FFFDF9 0%, var(--card) 100%);
  scroll-margin-top: 156px;
}

.prose > div:nth-child(even) {
  background: linear-gradient(180deg, #FFF4EA 0%, #FFEDE0 100%);
  border-color: rgba(255, 138, 122, .38);
}

.prose > div::before {
  content: "";
  position: absolute;
  top: -2px;
  left: 22px;
  width: 54px;
  height: 4px;
  border-radius: 99px;
  background: var(--coral);
}

.prose h2 { font-size: clamp(1.4rem, 4vw, 1.95rem); margin: 0 0 0; }
.prose h3 { font-size: 1.16rem; margin: 1.4em 0 .5em; }
.prose h3 + hr { height: 4px; width: 40px; margin: 8px 0 14px; }

.prose p { line-height: 1.78; margin: 0 0 .95em; }

.prose ul,
.prose ol { margin: 0 0 1em; padding-left: 1.3em; }
.prose li { margin: 0 0 .45em; line-height: 1.7; }

.prose a {
  color: var(--coral-deep);
  text-underline-offset: 3px;
  text-decoration-thickness: 2px;
}

.prose img {
  border-radius: var(--r);
  border: 2px solid var(--line);
  margin: 6px 0 16px;
}

.prose blockquote {
  margin: 0 0 1em;
  padding: 14px 18px;
  border-left: 5px solid var(--coral);
  border-radius: 0 var(--r) var(--r) 0;
  background: rgba(255, 138, 122, .12);
}

.prose blockquote p:last-child { margin-bottom: 0; }
.prose strong { font-weight: 800; }
.prose table { width: 100%; border-collapse: collapse; font-size: 16px; }
.prose th, .prose td { border: 2px solid var(--line); padding: 8px 10px; text-align: left; }

/* ---------- 页脚 ---------- */
.foot {
  border-top: 2px solid var(--line);
  background: var(--cream-2);
  padding: 36px 20px 22px;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 6px 20px;
  max-width: 1080px;
  margin: 0 auto;
}

.foot p { margin: 0; font-size: 16px; }
.f-brand { font-weight: 900; font-size: 18px; letter-spacing: .02em; }

.foot p a {
  display: flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
  color: var(--ink-soft);
  font-weight: 700;
  transition: color .2s ease, transform .2s ease;
}

.foot p a:hover { color: var(--coral-deep); transform: translateX(3px); }

.foot small {
  grid-column: 1 / -1;
  margin-top: 10px;
  padding-top: 14px;
  border-top: 2px solid rgba(61, 58, 75, .13);
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.6;
}

/* ---------- 回到顶部 ---------- */
.totop {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 70;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: var(--coral);
  color: #fff;
  font-family: inherit;
  font-weight: 800;
  font-size: 16px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity .28s ease, transform .28s ease, background .2s ease;
}

.totop.on { opacity: 1; pointer-events: auto; transform: none; }
.totop:hover { background: var(--coral-deep); }

/* ---------- 进入动效 ---------- */
.js .prose > div { opacity: 0; transform: translateY(30px); }
.js .prose > div > * { opacity: 0; transform: translateY(14px); }

.js .prose > div.in {
  opacity: 1;
  transform: none;
  transition: opacity .5s ease, transform .6s cubic-bezier(.2, .8, .25, 1);
}

.js .prose > div.in > * {
  opacity: 1;
  transform: none;
  transition: opacity .45s ease, transform .5s cubic-bezier(.2, .8, .25, 1);
}

.js .prose > div.in > *:nth-child(2) { transition-delay: .05s; }
.js .prose > div.in > *:nth-child(3) { transition-delay: .1s; }
.js .prose > div.in > *:nth-child(4) { transition-delay: .15s; }
.js .prose > div.in > *:nth-child(5) { transition-delay: .2s; }
.js .prose > div.in > *:nth-child(6) { transition-delay: .25s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .prose > div,
  .js .prose > div > * { opacity: 1; transform: none; transition: none; }
  .brandmark, .foot p a, .totop { transition: none; }
}

/* ---------- 断点 ---------- */
@media (max-width: 860px) {
  .hero { min-height: 62vh; }
  .hero-copy { padding: 0 16px 48px; }

  .wrap {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    padding: 18px 16px 58px;
  }

  .rail {
    top: 62px;
    z-index: 40;
    padding: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    background: rgba(255, 251, 245, .97);
  }

  .rail::-webkit-scrollbar { height: 0; }
  .railnav ul { flex-direction: row; gap: 6px; }
  .railnav a {
    white-space: nowrap;
    border-left: 0;
    background: rgba(61, 58, 75, .055);
  }

  .prose > div { padding: 24px 17px; scroll-margin-top: 132px; }
  .prose > div::before { left: 17px; }

  .foot {
    grid-template-columns: 1fr 1fr;
    padding: 28px 16px 18px;
    gap: 4px 14px;
  }

  .f-brand { grid-column: 1 / -1; }
}

@media (max-width: 420px) {
  body { font-size: 16px; }
  .topbar { padding: 8px 12px; gap: 8px; }
  .topnav a { padding: 0 11px; font-size: 15px; }
}

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