@import url('https://fonts.googleapis.com/css2?family=Amatic+SC:wght@400;700&family=Cabin:wght@400;500;600;700&display=swap');

:root {
  --cream: #f5e6c8;
  --tan: #d4a574;
  --ink: #262117;
  --paper: #fbf3e0;
  --line: rgba(38, 33, 23, 0.18);
  --line-soft: rgba(38, 33, 23, 0.1);
  --glass: rgba(250, 240, 219, 0.55);
  --side: 212px;
  --strip: 36px;
}

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

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

body {
  margin: 0;
  padding-top: var(--strip);
  min-height: 100vh;
  font-family: 'Cabin', "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 17px;
  line-height: 1.75;
  color: var(--ink);
  background:
    radial-gradient(95% 55% at 88% -5%, #faeeda 0%, rgba(250, 238, 218, 0) 62%),
    radial-gradient(80% 60% at -10% 105%, #ecdcba 0%, rgba(236, 220, 186, 0) 66%),
    var(--cream);
  background-attachment: fixed;
}

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

a { color: var(--ink); }

/* ---------- 胶片底层 ---------- */
.grain {
  position: fixed;
  inset: 0;
  z-index: 44;
  pointer-events: none;
  opacity: 0.16;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='150' height='150'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='150' height='150' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
}

.leak {
  position: fixed;
  inset: 0;
  z-index: 43;
  pointer-events: none;
  mix-blend-mode: screen;
}

.leak-a {
  background: radial-gradient(58% 42% at 102% 0%, rgba(255, 198, 126, 0.62), rgba(255, 198, 126, 0) 72%);
  animation: leakPulse 16s ease-in-out infinite alternate;
}

.leak-b {
  background: radial-gradient(46% 38% at -6% 104%, rgba(206, 122, 92, 0.34), rgba(206, 122, 92, 0) 74%);
  animation: leakPulse 21s ease-in-out infinite alternate-reverse;
}

@keyframes leakPulse {
  from { opacity: 0.42; transform: translate3d(0, 0, 0); }
  to { opacity: 0.92; transform: translate3d(-8px, 6px, 0); }
}

/* ---------- 顶部细条 ---------- */
.strip {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--strip);
  display: flex;
  align-items: center;
  padding: 0 18px;
  z-index: 60;
  background: rgba(38, 33, 23, 0.82);
  color: var(--cream);
  border-bottom: 1px solid rgba(245, 230, 200, 0.22);
  backdrop-filter: blur(6px);
}

.strip p {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.16em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.86;
}

/* ---------- 左侧竖排导航 ---------- */
.side {
  position: fixed;
  top: var(--strip);
  bottom: 0;
  left: 0;
  width: var(--side);
  z-index: 55;
  padding: 26px 16px 30px;
  overflow-y: auto;
  background: linear-gradient(180deg, rgba(250, 240, 219, 0.82), rgba(245, 230, 200, 0.66));
  border-right: 1px solid var(--line);
  backdrop-filter: blur(10px) saturate(0.85);
}

.brand {
  display: flex;
  align-items: center;
  min-height: 44px;
  margin-bottom: 26px;
  padding: 4px 2px;
  font-family: "Songti SC", "STSong", 'Amatic SC', serif;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1.25;
  text-decoration: none;
  color: var(--ink);
  border-bottom: 2px solid var(--tan);
}

.side nav p {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.side nav a {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 10px 8px 14px;
  font-size: 16px;
  letter-spacing: 0.06em;
  text-decoration: none;
  color: var(--ink);
  border-left: 2px solid transparent;
  border-radius: 4px;
  transition: transform 0.22s ease, background 0.22s ease, border-color 0.22s ease;
}

.side nav a::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 50%;
  width: 4px;
  height: 4px;
  margin-top: -2px;
  border-radius: 50%;
  background: var(--tan);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.side nav a:hover {
  transform: translateX(3px);
  background: rgba(212, 165, 116, 0.22);
  border-left-color: var(--tan);
}

.side nav a:hover::before { opacity: 1; }

/* ---------- 主体 ---------- */
main {
  margin-left: var(--side);
  max-width: 1180px;
  padding: 0 40px 72px;
}

main section[id],
.content section[id] { scroll-margin-top: calc(var(--strip) + 20px); }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  align-items: center;
  gap: 44px;
  min-height: calc(100vh - var(--strip) - 40px);
  padding: 48px 0 56px;
  animation: fadeUp 0.9s ease both;
}

.hero-copy {
  text-align: right;
}

.hero-copy h1 {
  margin: 0;
  font-family: "Songti SC", "STSong", 'Amatic SC', serif;
  font-size: clamp(2.1rem, 5.4vw, 3.6rem);
  font-weight: 700;
  line-height: 1.24;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 0 rgba(251, 243, 224, 0.8);
}

.hero-mark {
  display: block;
  width: 84px;
  height: 3px;
  margin: 22px 0 0 auto;
  background: linear-gradient(90deg, rgba(212, 165, 116, 0), var(--tan));
}

.polaroid {
  position: relative;
  margin: 0;
  padding: 14px 14px 12px;
  background: var(--paper);
  border: 1px solid rgba(38, 33, 23, 0.22);
  border-radius: 4px;
  box-shadow: 0 22px 42px -22px rgba(38, 33, 23, 0.55), 0 2px 0 rgba(255, 255, 255, 0.5) inset;
  transform: rotate(-1.6deg);
  transition: transform 0.5s ease, box-shadow 0.5s ease;
}

.polaroid:hover {
  transform: rotate(0.6deg) scale(1.012);
  box-shadow: 0 30px 52px -24px rgba(38, 33, 23, 0.6);
}

.polaroid img,
.polaroid-blank {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 2px;
  filter: sepia(0.34) contrast(1.05) saturate(0.82);
}

.polaroid-blank {
  display: block;
  background:
    radial-gradient(60% 50% at 30% 20%, rgba(255, 210, 150, 0.75), rgba(255, 210, 150, 0) 70%),
    linear-gradient(160deg, #e3cda6, #c9ab80);
}

.polaroid figcaption {
  padding-top: 10px;
  font-family: 'Amatic SC', "Songti SC", serif;
  font-size: 17px;
  letter-spacing: 0.3em;
  text-align: center;
  color: rgba(38, 33, 23, 0.62);
}

.badge {
  position: absolute;
  top: -14px;
  left: -12px;
  z-index: 2;
  padding: 6px 12px;
  font-size: 13px;
  letter-spacing: 0.18em;
  color: var(--paper);
  background: rgba(38, 33, 23, 0.86);
  border-radius: 3px;
  transform: rotate(-2.5deg);
  box-shadow: 0 6px 14px -8px rgba(38, 33, 23, 0.8);
}

/* ---------- 正文区 ---------- */
.stage {
  display: grid;
  grid-template-columns: 194px minmax(0, 1fr);
  gap: 30px;
  align-items: start;
  padding: 8px 0 0;
}

.toc {
  position: sticky;
  top: calc(var(--strip) + 18px);
  padding: 16px 12px 18px;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 4px;
  backdrop-filter: blur(9px) saturate(0.9);
  box-shadow: 0 16px 30px -26px rgba(38, 33, 23, 0.7);
}

.toc h2 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.24em;
}

.toc hr {
  margin: 0 0 10px;
  border: 0;
  border-top: 1px solid var(--line);
}

.toc p {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.toc a {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 7px 8px 7px 10px;
  font-size: 16px;
  line-height: 1.4;
  text-decoration: none;
  color: rgba(38, 33, 23, 0.86);
  border-left: 2px solid transparent;
  border-radius: 3px;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.toc a:hover {
  color: var(--ink);
  border-left-color: var(--tan);
  background: rgba(212, 165, 116, 0.2);
}

.content {
  padding: 30px 32px 38px;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 4px;
  backdrop-filter: blur(10px) saturate(0.92);
  box-shadow: 0 26px 48px -34px rgba(38, 33, 23, 0.8);
  overflow-wrap: break-word;
}

.content section {
  padding: 4px 0 30px;
  animation: fadeUp 0.65s ease both;
}

.content section + section {
  margin-top: 26px;
  border-top: 1px dashed var(--line-soft);
  padding-top: 30px;
}

.content section:nth-child(1) { animation-delay: 0.04s; }
.content section:nth-child(2) { animation-delay: 0.09s; }
.content section:nth-child(3) { animation-delay: 0.14s; }
.content section:nth-child(4) { animation-delay: 0.19s; }
.content section:nth-child(5) { animation-delay: 0.24s; }
.content section:nth-child(6) { animation-delay: 0.29s; }
.content section:nth-child(7) { animation-delay: 0.34s; }

.content h2 {
  margin: 0 0 10px;
  font-family: "Songti SC", "STSong", 'Amatic SC', serif;
  font-size: 26px;
  line-height: 1.35;
  letter-spacing: 0.03em;
}

.content h2 + hr {
  width: 58px;
  margin: 0 0 18px;
  border: 0;
  border-top: 2px solid var(--tan);
}

.content h3 {
  margin: 22px 0 8px;
  font-size: 19px;
  letter-spacing: 0.02em;
}

.content h3 + hr {
  width: 38px;
  margin: 0 0 12px;
  border: 0;
  border-top: 1px solid var(--line);
}

.content p {
  margin: 0 0 16px;
  line-height: 1.8;
}

.content a {
  text-decoration: underline;
  text-decoration-color: var(--tan);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.content a:hover { background: rgba(212, 165, 116, 0.28); }

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

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

.content figure {
  margin: 20px 0;
  padding: 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.content figure img { filter: sepia(0.3) contrast(1.04) saturate(0.82); border-radius: 2px; }

.content figcaption {
  padding-top: 8px;
  font-size: 15px;
  color: rgba(38, 33, 23, 0.66);
}

.content blockquote {
  margin: 18px 0;
  padding: 10px 18px;
  border-left: 3px solid var(--tan);
  background: rgba(251, 243, 224, 0.6);
  color: rgba(38, 33, 23, 0.88);
}

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

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

.outro {
  padding: 34px 0 0;
  display: flex;
  justify-content: flex-end;
}

.totop {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 20px;
  font-size: 16px;
  letter-spacing: 0.2em;
  text-decoration: none;
  color: var(--ink);
  background: rgba(251, 243, 224, 0.6);
  border: 1px solid var(--line);
  border-radius: 4px;
  transition: background 0.22s ease, transform 0.22s ease;
}

.totop:hover {
  background: rgba(212, 165, 116, 0.34);
  transform: translateY(-2px);
}

/* ---------- 页脚 ---------- */
footer {
  margin-left: var(--side);
  padding: 44px 40px 22px;
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 30px;
  background: rgba(38, 33, 23, 0.07);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(6px);
}

.foot-brand { margin: 0; }

.huge {
  margin: 0;
  font-family: "Songti SC", "STSong", 'Amatic SC', serif;
  font-size: clamp(2.6rem, 9vw, 5.4rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.08em;
  color: rgba(38, 33, 23, 0.9);
  text-shadow: 0 1px 0 rgba(251, 243, 224, 0.9);
}

.foot-links h2 {
  margin: 0 0 8px;
  font-size: 16px;
  letter-spacing: 0.24em;
}

.foot-links hr {
  margin: 0 0 12px;
  border: 0;
  border-top: 1px solid var(--line);
}

.foot-links p {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
}

.foot-links a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  font-size: 16px;
  text-decoration: none;
  color: rgba(38, 33, 23, 0.82);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.foot-links a:hover {
  color: var(--ink);
  border-bottom-color: var(--tan);
}

.fine {
  grid-column: 1 / -1;
  margin: 8px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
  font-size: 15px;
  letter-spacing: 0.14em;
  color: rgba(38, 33, 23, 0.66);
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- 窄屏 ---------- */
@media (max-width: 900px) {
  .side {
    position: static;
    width: auto;
    padding: 14px 16px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow: visible;
  }

  .brand { margin-bottom: 12px; font-size: 21px; }

  .side nav p {
    flex-direction: row;
    gap: 4px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .side nav a {
    min-height: 44px;
    padding: 8px 12px;
    white-space: nowrap;
    border-left: 0;
    border-bottom: 2px solid transparent;
  }

  .side nav a:hover { transform: none; border-left-color: transparent; border-bottom-color: var(--tan); }
  .side nav a::before { display: none; }

  main { margin-left: 0; padding: 0 16px 48px; max-width: 100%; }

  .hero {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
    gap: 26px;
    padding: 26px 0 34px;
  }

  .hero-copy { order: -1; text-align: left; }
  .hero-mark { margin: 16px auto 0 0; }
  .hero-copy h1 { font-size: clamp(1.9rem, 8vw, 2.6rem); }

  .polaroid { transform: rotate(-1deg); max-width: 420px; }

  .stage { grid-template-columns: minmax(0, 1fr); gap: 20px; }

  .toc { position: static; }

  .content { padding: 22px 18px 26px; }

  .content h2 { font-size: 22px; }

  footer {
    margin-left: 0;
    grid-template-columns: minmax(0, 1fr);
    padding: 32px 16px 18px;
    gap: 22px;
  }

  .totop { width: 100%; justify-content: center; }
}

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

  .leak,
  .hero,
  .content div { animation: none !important; }

  *,
  *::before,
  *::after { transition-duration: 0.001ms !important; }
}

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