:root {
  --ink: #0F1A24;
  --amber: #E4A11B;
  --paper: #F4F1EA;
  --card: rgba(244, 241, 234, 0.045);
  --hair: rgba(244, 241, 234, 0.09);
  --line: rgba(228, 161, 27, 0.32);
  --muted: rgba(244, 241, 234, 0.74);
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.42);
  --radius: 4px;
  --pad: clamp(16px, 4vw, 40px);
}

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

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

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: "Nunito Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.75;
  letter-spacing: 0.012em;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  font-family: "Varela Round", "Nunito Sans", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-weight: 400;
  line-height: 1.28;
  margin: 0;
}

p { margin: 0; }
ul, ol, menu { margin: 0; padding: 0; }
li { list-style: none; }
figure { margin: 0; }
address { font-style: normal; }

a {
  color: var(--amber);
  text-decoration: none;
}

hr {
  border: 0;
  height: 1px;
  margin: 10px 0 16px;
  background: linear-gradient(90deg, var(--amber), rgba(228, 161, 27, 0));
  opacity: 0.55;
}

.skip {
  position: absolute;
  left: 12px;
  top: -80px;
  z-index: 40;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--amber);
  color: var(--ink);
  font-size: 0.95rem;
  transition: top 0.2s ease;
}

.skip:focus {
  top: 10px;
}

/* ---------- 分层背景 ---------- */
.bg-layers {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.bg-glow {
  position: absolute;
  left: -20%;
  right: -20%;
  top: -34vh;
  height: 92vh;
  background:
    radial-gradient(46% 52% at 50% 42%, rgba(228, 161, 27, 0.34), rgba(228, 161, 27, 0) 72%),
    radial-gradient(30% 40% at 82% 20%, rgba(228, 161, 27, 0.16), rgba(228, 161, 27, 0) 70%);
  filter: blur(6px);
  will-change: transform;
}

.bg-grain {
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    135deg,
    rgba(244, 241, 234, 0.028) 0 1px,
    rgba(244, 241, 234, 0) 1px 3px
  );
  opacity: 0.8;
}

.bg-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(125% 95% at 50% 0%, rgba(15, 26, 36, 0) 34%, rgba(6, 11, 16, 0.78) 100%);
}

/* ---------- 站点头部 ---------- */
.site-head {
  position: relative;
  padding: 22px var(--pad) 12px;
}

.brand-line {
  display: flex;
  align-items: center;
  min-height: 44px;
}

.brand {
  font-family: "Varela Round", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: clamp(1.4rem, 4vw, 1.85rem);
  letter-spacing: 0.05em;
  color: var(--paper);
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-right: 12px;
  text-shadow: 0 0 24px rgba(228, 161, 27, 0.45);
}

.brand::before {
  content: "";
  width: 10px;
  height: 10px;
  margin-right: 10px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 14px rgba(228, 161, 27, 0.9);
}

.nav-wrap {
  margin-top: 8px;
}

.nav-details {
  display: block;
}

.nav-summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(228, 161, 27, 0.12);
  color: var(--paper);
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: background 0.18s ease, color 0.18s ease;
}

.nav-summary::-webkit-details-marker { display: none; }

.nav-summary::after {
  content: "▾";
  font-size: 0.7rem;
  color: var(--amber);
}

.nav-summary:hover,
.nav-summary:focus-visible {
  background: var(--amber);
  color: var(--ink);
}

.nav-summary:hover::after,
.nav-summary:focus-visible::after {
  color: var(--ink);
}

.nav-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 0 4px;
}

.nav-menu a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--hair);
  background: rgba(244, 241, 234, 0.05);
  color: var(--paper);
  font-size: 0.95rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
  transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.nav-menu a:hover,
.nav-menu a:focus-visible {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--ink);
  transform: translateY(-2px);
}

/* ---------- 首屏 ---------- */
.hero {
  position: relative;
  max-width: 1180px;
  margin: 0 auto;
  min-height: 45vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(14px, 4vw, 40px);
  padding: clamp(26px, 6vh, 62px) var(--pad) clamp(22px, 5vh, 44px);
}

.hero h1 {
  font-size: clamp(1.85rem, 5.6vw, 3.3rem);
  padding-left: 16px;
  border-left: 5px solid var(--amber);
  text-wrap: balance;
}

.hero-desc {
  margin-top: 16px;
  max-width: 48ch;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.06rem);
}

.hero-mark {
  color: var(--amber);
  opacity: 0.85;
  width: 76px;
  filter: drop-shadow(0 0 22px rgba(228, 161, 27, 0.45));
  will-change: transform;
}

.hero-mark svg { display: block; width: 100%; height: auto; }

/* ---------- 章节区 ---------- */
.chapters {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 var(--pad) 48px;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 26px clamp(18px, 3vw, 40px);
  align-items: start;
}

.rail {
  position: sticky;
  top: 20px;
  padding: 18px 16px 20px;
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  background: rgba(244, 241, 234, 0.05);
  box-shadow: var(--shadow);
  backdrop-filter: blur(3px);
}

.rail-title {
  font-size: 0.92rem;
  letter-spacing: 0.32em;
  color: var(--amber);
  text-transform: none;
}

.rail hr { margin: 8px 0 12px; }

.rail-list {
  display: grid;
  gap: 2px;
}

.rail-list a {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 6px 10px;
  border-left: 2px solid rgba(228, 161, 27, 0.2);
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.4;
  transition: color 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.rail-list a:hover,
.rail-list a:focus-visible {
  color: var(--paper);
  border-left-color: var(--amber);
  background: rgba(228, 161, 27, 0.1);
}

.prose {
  min-width: 0;
  overflow-wrap: break-word;
}

.prose > div {
  scroll-margin-top: 26px;
  margin-bottom: 24px;
  padding: clamp(20px, 3vw, 32px);
  border: 1px solid var(--hair);
  border-left: 3px solid rgba(228, 161, 27, 0.42);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.prose h2 {
  font-size: clamp(1.3rem, 3vw, 1.75rem);
  color: var(--paper);
}

.prose h2 + hr { margin: 8px 0 18px; }

.prose h3 {
  margin-top: 22px;
  font-size: clamp(1.1rem, 2.4vw, 1.28rem);
  color: var(--amber);
}

.prose p {
  margin-bottom: 15px;
  color: rgba(244, 241, 234, 0.87);
}

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

.prose a {
  color: var(--amber);
  border-bottom: 1px solid rgba(228, 161, 27, 0.45);
}

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

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

.prose li {
  list-style: disc;
  margin-bottom: 6px;
  color: rgba(244, 241, 234, 0.87);
}

.prose ol li { list-style: decimal; }

.prose blockquote {
  margin: 0 0 16px;
  padding: 4px 0 4px 16px;
  border-left: 3px solid var(--amber);
  color: var(--muted);
}

.prose img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.prose strong { color: var(--paper); }

.strip {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.strip span {
  flex: 1 1 0;
  height: 12px;
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(228, 161, 27, 0.55), rgba(228, 161, 27, 0.08));
}

/* ---------- 页脚 ---------- */
.site-foot {
  margin-top: 20px;
  padding: 34px var(--pad) 26px;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(228, 161, 27, 0.07), rgba(228, 161, 27, 0));
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 22px 32px;
}

.foot-brand {
  display: block;
  font-family: "Varela Round", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 1.15rem;
  letter-spacing: 0.05em;
  color: var(--paper);
}

.foot-desc {
  display: block;
  margin-top: 8px;
  max-width: 42ch;
  color: var(--muted);
  font-size: 0.95rem;
}

.foot-links {
  display: grid;
  gap: 2px;
  align-content: start;
}

.foot-links a {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 4px 0;
  color: var(--muted);
  font-size: 0.95rem;
  border-bottom: 1px dashed rgba(244, 241, 234, 0.12);
  transition: color 0.16s ease;
}

.foot-links a:hover,
.foot-links a:focus-visible { color: var(--amber); }

.foot-copy {
  grid-column: 1 / -1;
  padding-top: 16px;
  border-top: 1px dashed rgba(244, 241, 234, 0.13);
  color: rgba(244, 241, 234, 0.55);
  font-size: 0.88rem;
}

/* ---------- 滚动演出 ---------- */
.hero-text,
.hero-mark,
.rail {
  opacity: 1;
}

.reveal .prose > div {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.62s ease, transform 0.62s cubic-bezier(0.2, 0.7, 0.3, 1);
  will-change: transform, opacity;
}

.reveal .prose > div.in {
  opacity: 1;
  transform: translateY(0);
}

.reveal .hero-text,
.reveal .hero-mark {
  opacity: 0;
  transition: opacity 0.8s ease;
}

.reveal .hero-text.in,
.reveal .hero-mark.in { opacity: 1; }

.reveal .hero-mark.in { opacity: 0.85; }

.reveal .rail {
  opacity: 0;
  transition: opacity 0.7s ease;
}

.reveal .rail.in { opacity: 1; }

/* ---------- 断点 ---------- */
@media (max-width: 860px) {
  .chapters {
    grid-template-columns: minmax(0, 1fr);
  }

  .rail {
    position: static;
    top: auto;
  }

  .rail-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2px 8px;
  }

  .strip { margin-top: 2px; }
}

@media (max-width: 560px) {
  body { font-size: 16.5px; }

  .site-foot {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero {
    grid-template-columns: minmax(0, 1fr) 56px;
    align-items: start;
  }

  .hero-mark { width: 56px; margin-top: 6px; }

  .rail-list { grid-template-columns: minmax(0, 1fr); }
}

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

  .reveal .prose > div,
  .reveal .hero-text,
  .reveal .hero-mark,
  .reveal .rail {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .bg-glow { transform: none !important; }
  .hero-mark { transform: none !important; }
  .nav-menu a:hover { transform: none; }
}

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