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

:root {
  --paper: #f5e6c8;
  --paper-soft: #fbf2de;
  --sepia: #d4a574;
  --sepia-deep: #b07f4c;
  --ink: #262117;
  --ink-soft: #4a3f2f;
  --faded: #7d6b52;
  --line: rgba(38, 33, 23, 0.18);
  --line-soft: rgba(38, 33, 23, 0.1);
  --rail: 224px;
  --shadow: 0 14px 30px -18px rgba(38, 33, 23, 0.55);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 82% 4%, rgba(212, 165, 116, 0.55), transparent 42%),
    radial-gradient(circle at 8% 82%, rgba(212, 165, 116, 0.32), transparent 46%),
    linear-gradient(180deg, #f7ead0 0%, #f2e2c2 55%, #ecdcba 100%);
  color: var(--ink);
  font-family: 'Inter', 'Noto Sans SC', system-ui, -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 17px;
  line-height: 1.72;
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 96% 12%, rgba(255, 214, 150, 0.55), transparent 38%),
    radial-gradient(ellipse at 2% 64%, rgba(255, 236, 200, 0.5), transparent 34%);
  mix-blend-mode: screen;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.13;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23g)' opacity='0.6'/%3E%3C/svg%3E");
}

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

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

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

h1,
h2,
h3 {
  font-family: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0;
}

p {
  margin: 0;
}

main,
footer {
  position: relative;
  z-index: 1;
}

/* 左侧固定导航轨 */
.rail {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: var(--rail);
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 26px 18px 22px;
  background: rgba(247, 236, 214, 0.94);
  border-right: 1px dashed var(--line);
  backdrop-filter: blur(6px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 2px;
  min-height: 44px;
}

.brand-mark,
.brand-logo {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px;
  font-weight: 700;
  filter: sepia(0.2) contrast(1.05);
  border: 3px solid var(--paper-soft);
  box-shadow: 0 0 0 1px var(--line);
  object-fit: cover;
}

.brand-name {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.brand:hover .brand-mark,
.brand:hover .brand-logo {
  animation: vhs 0.6s steps(3, end) 1;
}

@keyframes vhs {
  0% { transform: skewX(0deg) translateX(0); }
  35% { transform: skewX(-6deg) translateX(1px); filter: sepia(0.6) contrast(1.2) saturate(1.3); }
  70% { transform: skewX(4deg) translateX(-1px); }
  100% { transform: skewX(0deg) translateX(0); }
}

.rail nav {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.rail nav p {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rail nav a {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 9px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(251, 242, 222, 0.6);
  font-size: 16px;
  font-weight: 500;
  color: var(--ink-soft);
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.rail nav a:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
  transform: translateX(2px);
}

.call {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--ink);
  background: var(--sepia);
  color: var(--ink);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.04em;
  text-align: center;
}

.call:hover {
  background: var(--ink);
  color: var(--paper);
}

/* 主区 */
main {
  margin-left: var(--rail);
  padding: 0 44px 0;
  max-width: 1280px;
}

.hero {
  min-height: 45vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  gap: 16px;
  text-align: right;
  padding: 44px 0 38px;
  border-bottom: 1px dashed var(--line);
}

.hero h1 {
  font-size: clamp(2.4rem, 6.4vw, 5.4rem);
  font-weight: 700;
  max-width: 15ch;
  color: var(--ink);
  text-shadow: 1px 1px 0 rgba(212, 165, 116, 0.65);
}

.hero .lead {
  max-width: 48ch;
  font-size: 17px;
  color: var(--faded);
  line-height: 1.65;
}

.wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 268px;
  gap: 52px;
  align-items: start;
  padding: 8px 0 60px;
}

.stage {
  min-width: 0;
}

.prose {
  padding-bottom: 24px;
}

.prose > section {
  padding: 38px 0 30px;
  border-top: 1px solid var(--line-soft);
  scroll-margin-top: 28px;
}

.prose > section:first-child {
  border-top: 0;
  padding-top: 26px;
}

.prose h2 {
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  margin: 4px 0 16px;
}

.prose h3 {
  font-size: 1.22rem;
  margin: 26px 0 10px;
}

.prose h2 > span,
.prose h3 > span {
  display: inline-block;
  padding-bottom: 5px;
  border-bottom: 2px solid var(--sepia);
}

.prose p {
  margin: 0 0 16px;
  color: var(--ink-soft);
  font-size: 17.5px;
  line-height: 1.78;
}

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

.prose a:hover {
  color: var(--ink);
}

.prose ul,
.prose ol {
  margin: 0 0 18px;
  padding-left: 1.4em;
  color: var(--ink-soft);
}

.prose li {
  margin-bottom: 8px;
  line-height: 1.7;
}

.prose blockquote {
  margin: 22px 0;
  padding: 16px 20px;
  background: rgba(251, 242, 222, 0.75);
  border-left: 4px solid var(--sepia);
  border-radius: 4px;
  box-shadow: var(--shadow);
  color: var(--ink-soft);
}

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

.prose img {
  display: block;
  margin: 22px auto;
  padding: 10px 10px 26px;
  background: #fffdf7;
  border-radius: 4px;
  box-shadow: var(--shadow);
  filter: sepia(0.16) contrast(1.05) saturate(0.86);
  transform: rotate(-0.5deg);
}

.prose figure {
  margin: 22px 0;
}

.prose hr {
  border: 0;
  border-top: 1px dashed var(--line);
  margin: 26px 0;
}

/* 右侧边栏 */
.side {
  position: sticky;
  top: 28px;
  padding: 20px 18px 22px;
  background: rgba(251, 242, 222, 0.72);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: var(--shadow);
}

.side h2 {
  font-size: 16px;
  letter-spacing: 0.14em;
  color: var(--faded);
  margin: 0 0 10px;
}

.side h2 + * {
  margin-bottom: 22px;
}

.side h2 > span {
  display: inline-block;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--sepia);
}

.side-list,
.side-link {
  display: flex;
  flex-direction: column;
}

.side-list a,
.side-link a {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 6px 2px;
  border-bottom: 1px dotted var(--line);
  font-size: 16px;
  color: var(--ink-soft);
  transition: color 0.2s ease, padding-left 0.2s ease;
}

.side-list a:hover,
.side-link a:hover {
  color: var(--ink);
  padding-left: 4px;
}

/* 页脚 */
footer {
  margin-left: var(--rail);
  padding: 54px 44px 30px;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 26px 30px;
  background: var(--ink);
  color: var(--paper);
}

.f-brand {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: clamp(1.6rem, 3.4vw, 2.6rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--paper);
}

.f-nav {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 2px 4px;
}

.f-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 4px 8px;
  border-radius: 999px;
  color: rgba(245, 230, 200, 0.82);
  font-size: 16px;
}

.f-nav a:hover {
  background: rgba(245, 230, 200, 0.14);
  color: var(--paper);
}

.f-key {
  color: rgba(245, 230, 200, 0.7);
  font-size: 16px;
  line-height: 1.6;
  align-self: start;
}

footer small {
  grid-column: 1 / -1;
  padding-top: 18px;
  border-top: 1px solid rgba(245, 230, 200, 0.22);
  text-align: center;
  font-size: 16px;
  color: rgba(245, 230, 200, 0.66);
}

.totop {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--ink);
  background: rgba(245, 230, 200, 0.96);
  color: var(--ink);
  font-family: inherit;
  font-size: 16px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.3s ease, background 0.25s ease;
}

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

.totop:hover {
  background: var(--ink);
  color: var(--paper);
}

/* 入场 */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.22, 0.7, 0.3, 1);
}

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

@media (max-width: 1100px) {
  :root {
    --rail: 200px;
  }

  main {
    padding: 0 28px;
  }

  .wrap {
    gap: 32px;
    grid-template-columns: minmax(0, 1fr) 238px;
  }

  footer {
    padding-left: 28px;
    padding-right: 28px;
  }
}

@media (max-width: 860px) {
  .rail {
    position: sticky;
    top: 0;
    inset: auto;
    width: 100%;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow: hidden;
  }

  .brand {
    flex: 0 0 auto;
    padding: 0;
  }

  .brand-name {
    font-size: 16px;
    max-width: 7em;
  }

  .brand-mark,
  .brand-logo {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
    font-size: 18px;
  }

  .rail nav {
    flex: 1 1 auto;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
  }

  .rail nav p {
    flex-direction: row;
    gap: 8px;
  }

  .rail nav a {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 8px 14px;
    white-space: nowrap;
  }

  .call {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 8px 14px;
  }

  main {
    margin-left: 0;
    padding: 0 16px;
    max-width: none;
  }

  .hero {
    min-height: 45vh;
    padding: 34px 0 26px;
  }

  .hero h1 {
    font-size: clamp(2rem, 9vw, 3.2rem);
    text-align: right;
  }

  .hero .lead {
    font-size: 16px;
  }

  .wrap {
    grid-template-columns: minmax(0, 1fr);
    gap: 26px;
    padding-bottom: 44px;
  }

  .side {
    position: static;
    order: 2;
  }

  .prose > div {
    scroll-margin-top: 86px;
  }

  .prose p {
    font-size: 17px;
  }

  footer {
    margin-left: 0;
    grid-template-columns: 1fr;
    padding: 38px 18px 26px;
    gap: 16px;
  }

  .f-nav a {
    padding: 6px 10px;
  }

  .totop {
    right: 12px;
    bottom: 12px;
  }
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

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

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