@import url('https://fonts.googleapis.com/css2?family=Lexend+Mega:wght@100..900&family=Public+Sans:wght@100..900&display=swap');

:root {
  --cream: #f5e6c8;
  --paper: #fbf3e2;
  --tan: #d4a574;
  --ink: #262117;
  --ink-soft: #4d4335;
  --line: rgba(38, 33, 23, .22);
  --rail-w: 260px;
}

*, *::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: 'Public Sans', "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 17px;
  line-height: 1.72;
  overflow-x: hidden;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  opacity: .2;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='g'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/></filter><rect width='160' height='160' filter='url(%23g)' opacity='0.55'/></svg>");
  background-size: 160px 160px;
}

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

section[id] { scroll-margin-top: 26px; }

/* ---------- 顶部 / 左侧导航 ---------- */

.site-head {
  position: relative;
  z-index: 50;
  background: var(--cream);
  border-bottom: 2px solid var(--ink);
  padding: 10px 16px 12px;
}

.head-top {
  display: flex;
  align-items: center;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 4px 0;
  color: var(--ink);
  text-decoration: none;
  font-family: 'Lexend Mega', system-ui, sans-serif;
  font-weight: 800;
  font-size: 19px;
  letter-spacing: .04em;
  line-height: 1.1;
}

.brand .mark {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 6px;
  background: var(--ink);
  color: var(--cream);
  font-style: normal;
  font-size: 15px;
}

.head-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px 12px;
  margin-top: 4px;
}

.head-nav { flex: 1 1 auto; min-width: 0; }

.head-nav p {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 4px;
  margin: 0;
}

.head-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 15px;
  letter-spacing: .02em;
  color: var(--ink-soft);
  text-decoration: none;
}

.head-nav a i {
  width: 6px;
  height: 6px;
  flex: none;
  background: var(--tan);
  border-radius: 1px;
  transform: rotate(45deg);
}

.head-nav a:hover,
.head-nav a:focus-visible {
  background: rgba(212, 165, 116, .3);
  color: var(--ink);
}

.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  flex: none;
  padding: 9px 20px;
  border-radius: 18px;
  background: var(--ink);
  color: var(--cream);
  text-decoration: none;
  font-family: 'Lexend Mega', system-ui, sans-serif;
  font-size: 14px;
  letter-spacing: .16em;
  box-shadow: 3px 3px 0 var(--tan);
}

.cta:hover { background: #3a3126; }

/* ---------- 首屏 ---------- */

.hero {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  min-height: 70vh;
  padding: 54px 18px 62px;
  overflow: hidden;
  border-bottom: 2px solid var(--ink);
}

.hero-dots {
  position: absolute;
  inset: -20px;
  z-index: -2;
  background-image: radial-gradient(var(--tan) 1.4px, transparent 1.6px);
  background-size: 22px 22px;
  opacity: .55;
  animation: drift 26s linear infinite alternate;
}

.hero-leak {
  position: absolute;
  inset: -12%;
  z-index: -1;
  background:
    radial-gradient(40% 44% at 16% 18%, rgba(255, 200, 128, .62), transparent 70%),
    radial-gradient(32% 36% at 84% 76%, rgba(255, 122, 88, .34), transparent 72%),
    linear-gradient(180deg, rgba(245, 230, 200, 0) 42%, rgba(38, 33, 23, .1));
  animation: leak 15s ease-in-out infinite alternate;
}

.hero::after {
  content: "";
  position: absolute;
  left: -10%;
  right: -10%;
  top: 30%;
  height: 24px;
  z-index: 0;
  pointer-events: none;
  mix-blend-mode: screen;
  transform: skewY(-2deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .5), transparent);
  animation: vhs 9s linear infinite;
}

.hero-title {
  position: relative;
  z-index: 2;
  margin: 0;
  max-width: 22ch;
  text-align: center;
  font-family: 'Lexend Mega', system-ui, sans-serif;
  font-weight: 900;
  font-size: clamp(28px, 7.6vw, 60px);
  line-height: 1.1;
  letter-spacing: -.02em;
  text-shadow: 4px 4px 0 rgba(212, 165, 116, .9), 0 0 30px rgba(245, 230, 200, .8);
}

.collage {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.polaroid {
  position: absolute;
  margin: 0;
  width: 108px;
  padding: 7px 7px 24px;
  background: #fdf7ea;
  border: 1px solid rgba(38, 33, 23, .26);
  border-radius: 6px;
  box-shadow: 0 12px 22px rgba(38, 33, 23, .3);
  will-change: transform;
}

.polaroid .shot {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 2px;
  filter: sepia(.34) contrast(1.06) saturate(.82);
}

.p1 { left: 3%; top: 9%; transform: rotate(-7deg); }
.p2 { right: 3%; bottom: 8%; transform: rotate(6deg); }

/* ---------- 主体骨架 ---------- */

main { padding: 0; }

.wrap {
  display: block;
  padding: 0 16px 54px;
}

.paper { min-width: 0; }

.prose { min-width: 0; max-width: 68ch; }

.lede {
  margin: 26px 0 6px;
  padding: 20px 20px 18px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-bottom: 8px solid var(--tan);
  border-radius: 18px;
  box-shadow: 6px 6px 0 rgba(38, 33, 23, .13);
}

.lede h2 {
  margin: 0 0 8px;
  font-family: 'Lexend Mega', system-ui, sans-serif;
  font-size: clamp(19px, 2.7vw, 27px);
  line-height: 1.22;
  letter-spacing: -.01em;
}

.lede .subtitle {
  margin: 0;
  color: var(--ink-soft);
  font-size: 16px;
}

/* ---------- 正文 ---------- */

.prose > section {
  padding: 26px 0 8px;
  border-top: 2px dashed rgba(38, 33, 23, .26);
  margin-top: 22px;
}

.prose h2 {
  margin: 0 0 12px;
  font-family: 'Lexend Mega', system-ui, sans-serif;
  font-size: clamp(20px, 2.5vw, 27px);
  line-height: 1.24;
  letter-spacing: -.01em;
}

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

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

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

.prose li { margin: 0 0 7px; }

.prose a {
  color: #8a4f21;
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

.prose blockquote {
  margin: 0 0 16px;
  padding: 12px 18px;
  background: rgba(212, 165, 116, .2);
  border-left: 5px solid var(--tan);
  border-radius: 0 18px 18px 0;
}

.prose img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 0 14px;
  border-radius: 8px;
  filter: sepia(.28) contrast(1.05) saturate(.9);
}

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

.prose th,
.prose td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
}

/* ---------- 侧栏 ---------- */

.rail { margin: 30px 0 0; }

.rail-nav p {
  display: grid;
  gap: 8px;
  margin: 0;
}

.rail-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-bottom: 4px solid var(--tan);
  border-radius: 18px;
  color: var(--ink);
  text-decoration: none;
  font-size: 15px;
  line-height: 1.3;
}

.rail-nav a b {
  font-family: 'Lexend Mega', system-ui, sans-serif;
  font-size: 11px;
  letter-spacing: .12em;
  color: #9a6a3d;
}

.rail-nav a:hover { background: rgba(212, 165, 116, .28); }

/* ---------- 页脚 ---------- */

.foot {
  border-top: 2px solid var(--ink);
  background: var(--ink);
  color: var(--cream);
  padding: 14px 16px;
}

.foot-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 18px;
}

.foot-brand {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  color: var(--cream);
  text-decoration: none;
  font-family: 'Lexend Mega', system-ui, sans-serif;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: .05em;
}

.foot-nav p {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  margin: 0;
}

.foot-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 2px;
  color: #e6d4b5;
  text-decoration: none;
  font-size: 14px;
}

.foot-nav a:hover { color: #fff3dd; }

.foot-copy {
  margin: 0;
  font-size: 13px;
  letter-spacing: .08em;
  color: #c9b492;
}

/* ---------- 动效 ---------- */

@keyframes leak {
  0% { opacity: .75; transform: translate3d(0, 0, 0) scale(1); }
  50% { opacity: 1; transform: translate3d(1.5%, -1.5%, 0) scale(1.05); }
  100% { opacity: .8; transform: translate3d(-1%, 1%, 0) scale(1.02); }
}

@keyframes vhs {
  0% { top: 4%; opacity: 0; }
  12% { opacity: .85; }
  55% { opacity: .35; }
  100% { top: 94%; opacity: 0; }
}

@keyframes drift {
  from { background-position: 0 0; }
  to { background-position: 44px 44px; }
}

@keyframes shake {
  0%, 100% { transform: rotate(var(--r, 0deg)) translateY(0); }
  35% { transform: rotate(calc(var(--r, 0deg) - 2deg)) translateY(-4px); }
  70% { transform: rotate(calc(var(--r, 0deg) + 2deg)) translateY(2px); }
}

/* ---------- 桌面 ---------- */

@media (min-width: 900px) {
  body { padding-left: var(--rail-w); }

  .site-head {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--rail-w);
    z-index: 55;
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 28px 20px;
    border-right: 2px solid var(--ink);
    border-bottom: 0;
    overflow-y: auto;
  }

  .head-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin: 0;
  }

  .head-nav p {
    flex-direction: column;
    gap: 4px;
  }

  .head-nav a { width: 100%; }

  .cta {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 56;
  }

  .hero { min-height: 70vh; padding: 60px 40px 70px; }

  .polaroid { width: 190px; padding: 9px 9px 30px; }

  .p1 { left: 5%; top: 13%; }
  .p2 { right: 5%; bottom: 12%; }

  .wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 244px;
    align-items: start;
    gap: 44px;
    max-width: 1120px;
    margin: 0 auto;
    padding: 42px 34px 70px;
  }

  .rail {
    position: sticky;
    top: 28px;
    margin: 0;
  }

  .foot { padding: 16px 34px; }

  .foot-line {
    max-width: 1120px;
    margin: 0 auto;
  }

  div[id] { scroll-margin-top: 34px; }
}

@media (min-width: 1240px) {
  .p1 { left: 9%; }
  .p2 { right: 9%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-dots,
  .hero-leak,
  .hero::after { animation: none; }
  .polaroid { will-change: auto; }
}

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