@import url('https://fonts.googleapis.com/css2?family=Cormorant:wght@400;500;600;700&family=Montserrat:wght@300;400;500;600;700&display=swap');

:root {
  --teal: #5cc6b0;
  --teal-d: #3b9a86;
  --sand: #d4c4a8;
  --ink: #172623;
  --clay: #c67b5c;
  --olive: #6b7b3c;
  --paper: #f7f0e5;
  --paper-2: #efe5d6;
  --line: rgba(23, 38, 35, 0.15);
  --rail: 250px;
  --serif: 'Cormorant', 'Songti SC', 'Noto Serif SC', Georgia, serif;
  --sans: 'Montserrat', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}

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

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

body {
  margin: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  font: 400 17px/1.8 var(--sans);
  color: var(--ink);
  background-color: var(--paper);
  background-image: linear-gradient(180deg, #f9f3e9 0%, #f2e9da 55%, #ecdfcc 100%);
}

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

img {
  max-width: 100%;
}

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

/* 左侧固定竖排导航 */
.rail {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--rail);
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 26px 20px 22px;
  background: var(--ink);
  color: var(--sand);
  border-right: 1px solid rgba(212, 196, 168, 0.16);
  z-index: 40;
  overflow: hidden;
}

.rail::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.16;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='r'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23r)'/%3E%3C/svg%3E");
}

.mark {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  overflow: hidden;
  color: var(--teal);
  background: rgba(92, 198, 176, 0.07);
  border: 1px solid rgba(92, 198, 176, 0.45);
  border-radius: 22px 6px 22px 6px;
  font: 600 14px/1.15 var(--sans);
  letter-spacing: 0.04em;
  text-align: center;
  text-decoration: none;
  transition: background 0.35s ease-out, color 0.35s ease-out;
}

.mark:hover {
  background: var(--teal);
  color: var(--ink);
}

.mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rail-nav {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 18px;
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.rail-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  min-width: 0;
  max-width: 100%;
}

.rail-links a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 6px 11px;
  font-size: 15px;
  line-height: 1.3;
  color: var(--sand);
  text-decoration: none;
  border: 1px solid rgba(212, 196, 168, 0.22);
  border-radius: 14px 5px 14px 5px;
  transition: color 0.3s ease-out, background 0.3s ease-out, border-color 0.3s ease-out;
}

.rail-links a:hover,
.rail-links a[aria-current] {
  color: var(--ink);
  background: var(--teal);
  border-color: var(--teal);
}

.rail-groups {
  border-top: 1px dashed rgba(212, 196, 168, 0.28);
  padding-top: 12px;
}

.rail-groups summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
  padding: 0 2px;
  font-size: 13px;
  letter-spacing: 0.18em;
  color: rgba(212, 196, 168, 0.78);
  cursor: pointer;
  list-style: none;
}

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

.rail-groups summary::after {
  content: "+";
  font-size: 16px;
  color: var(--teal);
}

.rail-groups[open] summary::after {
  content: "−";
}

.grp {
  padding: 12px 0 0;
}

.grp-name {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--teal);
}

.grp-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin: 0;
}

.grp-links a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 2px 0;
  font-size: 14px;
  color: rgba(212, 196, 168, 0.92);
  text-decoration: none;
  border-bottom: 1px solid rgba(92, 198, 176, 0.4);
}

.grp-links a:hover {
  color: var(--teal);
}

.rail-search {
  display: flex;
  gap: 6px;
  margin: 0;
  min-width: 0;
  max-width: 100%;
}

.rail-search input {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 8px 12px;
  font: 400 14px/1.4 var(--sans);
  color: var(--sand);
  background: rgba(212, 196, 168, 0.08);
  border: 1px solid rgba(212, 196, 168, 0.24);
  border-radius: 12px 4px 12px 4px;
}

.rail-search input::placeholder {
  color: rgba(212, 196, 168, 0.55);
}

.rail-search button {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 8px 14px;
  font: 600 14px/1.4 var(--sans);
  color: var(--ink);
  background: var(--teal);
  border: 0;
  border-radius: 12px 4px 12px 4px;
  cursor: pointer;
  transition: background 0.3s ease-out;
}

.rail-search button:hover {
  background: #7fd8c4;
}

main,
.foot {
  margin-left: var(--rail);
  min-width: 0;
  max-width: 100%;
}

/* 首屏 */
.hero {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  min-height: 70vh;
  padding: 96px 7vw 56px;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.hero h1 {
  margin: 0;
  max-width: 15ch;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2.5rem, 7vw, 6rem);
  line-height: 1.02;
  letter-spacing: -0.01em;
  text-align: right;
  color: var(--ink);
  overflow-wrap: break-word;
}

/* 目录 + 引题 + 图 */
.stage {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 34px 42px;
  align-items: start;
  padding: 64px 7vw 40px;
  min-width: 0;
}

.toc {
  position: sticky;
  top: 28px;
  margin: 0;
  padding: 2px 0 2px 16px;
  border-left: 2px solid var(--teal);
  min-width: 0;
}

.toc-title {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: var(--teal-d);
}

.toc-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc-list li {
  margin: 0;
}

.toc-list a {
  display: flex;
  align-items: center;
  min-height: 40px;
  font-size: 15px;
  line-height: 1.4;
  color: #3f5148;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.3s ease-out, border-color 0.3s ease-out;
}

.toc-list a:hover {
  color: var(--ink);
  border-bottom-color: var(--clay);
}

.stage-main {
  padding-top: 4px;
  min-width: 0;
}

.stage-main h2 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: 1.06;
  color: var(--ink);
  overflow-wrap: break-word;
}

.subtitle {
  margin: 0;
  max-width: 48ch;
  padding-left: 14px;
  font-size: 17px;
  line-height: 1.75;
  color: #44564d;
  border-left: 3px solid var(--sand);
}

.stage-fig {
  position: relative;
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 170px;
  min-width: 0;
  margin: 6px 0 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 28px 28px 28px 6px;
  background: linear-gradient(118deg, var(--paper-2) 0%, #e6d8c2 55%, #ddccb1 100%);
}

.stage-fig::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.22;
  background-image: radial-gradient(circle at 78% 22%, rgba(92, 198, 176, 0.55), transparent 46%),
    radial-gradient(circle at 18% 82%, rgba(198, 123, 92, 0.45), transparent 52%);
}

.fig-img {
  position: relative;
  display: block;
  width: 100%;
  height: 240px;
  object-fit: cover;
}

.stage-fig figcaption {
  position: relative;
  padding: 12px 22px;
  font-size: 12px;
  letter-spacing: 0.24em;
  color: #576a5f;
  overflow-wrap: break-word;
}

/* 正文 */
.doc {
  display: grid;
  gap: 26px;
  padding: 20px 7vw 100px;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: break-word;
  word-break: break-word;
}

.doc > article {
  position: relative;
  min-width: 0;
  padding: 30px 32px 34px;
  background: #faf5ec;
  border: 1px solid var(--line);
  border-radius: 28px;
  scroll-margin-top: 96px;
}

.doc > article[id] {
  scroll-margin-top: 96px;
}

.doc h2 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.6rem, 2.7vw, 2.15rem);
  line-height: 1.14;
  color: var(--ink);
  overflow-wrap: break-word;
}

.doc h2 + p {
  color: #45584f;
}

.doc h3 {
  margin: 22px 0 6px;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.28rem;
  line-height: 1.3;
  overflow-wrap: break-word;
}

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

.doc p:last-child,
.doc ul:last-child,
.doc ol:last-child {
  margin-bottom: 0;
}

.doc a {
  color: var(--teal-d);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  overflow-wrap: break-word;
}

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

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

.doc li {
  margin: 5px 0;
}

.doc strong {
  font-weight: 600;
  color: #0f1c19;
}

.doc blockquote {
  margin: 16px 0;
  padding: 12px 18px;
  background: #f3e9da;
  border-left: 3px solid var(--clay);
  border-radius: 0 18px 18px 0;
}

.doc figure {
  margin: 18px 0;
  min-width: 0;
}

.doc img {
  max-width: 100%;
  height: auto;
  border-radius: 18px;
}

.doc aside {
  margin: 16px 0;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 20px 6px 20px 6px;
  background: #f5ecdd;
}

.doc table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 16px;
  table-layout: fixed;
}

.doc th,
.doc td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  overflow-wrap: break-word;
}

.is-hidden {
  display: none;
}

/* 页脚 */
.foot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  padding: 46px 7vw;
  background: var(--ink);
  color: var(--sand);
}

.foot > article {
  min-width: 0;
}

.foot-form form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

.foot input {
  flex: 1 1 200px;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 10px 14px;
  font: 400 15px/1.4 var(--sans);
  color: var(--sand);
  background: rgba(212, 196, 168, 0.1);
  border: 1px solid rgba(212, 196, 168, 0.3);
  border-radius: 16px 5px 16px 5px;
}

.foot input::placeholder {
  color: rgba(212, 196, 168, 0.6);
}

.foot button {
  min-height: 44px;
  padding: 10px 24px;
  font: 600 15px/1.4 var(--sans);
  color: var(--ink);
  background: var(--teal);
  border: 0;
  border-radius: 16px 5px 16px 5px;
  cursor: pointer;
  transition: background 0.3s ease-out;
}

.foot button:hover {
  background: #7fd8c4;
}

.foot-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  min-width: 0;
  font-size: 14px;
}

.foot-meta p {
  margin: 0;
}

.foot-meta a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  color: var(--sand);
  text-decoration: none;
  border-bottom: 1px solid rgba(92, 198, 176, 0.45);
  transition: color 0.3s ease-out;
}

.foot-meta a:hover {
  color: var(--teal);
}

/* 动效 */
.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

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

.js .toc-list li {
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.js .toc-list.in li {
  opacity: 1;
  transform: none;
}

.js .toc-list.in li:nth-child(1) { transition-delay: 0.02s; }
.js .toc-list.in li:nth-child(2) { transition-delay: 0.07s; }
.js .toc-list.in li:nth-child(3) { transition-delay: 0.12s; }
.js .toc-list.in li:nth-child(4) { transition-delay: 0.17s; }
.js .toc-list.in li:nth-child(5) { transition-delay: 0.22s; }
.js .toc-list.in li:nth-child(6) { transition-delay: 0.27s; }
.js .toc-list.in li:nth-child(7) { transition-delay: 0.32s; }

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

  .js .reveal,
  .js .toc-list li {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

/* 移动端 */
@media (max-width: 900px) {
  .rail {
    position: static;
    width: 100%;
    max-width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 12px;
    padding: 12px 16px 14px;
    border-right: 0;
    border-bottom: 1px solid rgba(212, 196, 168, 0.22);
    overflow: hidden;
  }

  .mark {
    width: 44px;
    height: 44px;
    border-radius: 16px 4px 16px 4px;
    font-size: 12px;
  }

  .rail-nav {
    flex: 1 1 100%;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    overflow: visible;
  }

  .rail-links {
    flex: 1 1 100%;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
  }

  .rail-links a {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .rail-groups {
    display: none;
  }

  .rail-search {
    flex: 1 1 100%;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    order: 2;
  }

  main,
  .foot {
    margin-left: 0;
    width: 100%;
    max-width: 100%;
  }

  .hero {
    min-height: 58vh;
    padding: 44px 20px 32px;
  }

  .hero h1 {
    max-width: 12ch;
    font-size: clamp(2.2rem, 10vw, 3.4rem);
  }

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

  .toc {
    position: static;
  }

  .doc {
    gap: 18px;
    padding: 14px 16px 64px;
  }

  .doc > article {
    padding: 22px 18px 26px;
    border-radius: 22px;
    scroll-margin-top: 24px;
  }

  .doc > article[id] {
    scroll-margin-top: 24px;
  }

  .foot {
    grid-template-columns: minmax(0, 1fr);
    padding: 34px 20px;
  }

  .stage-fig {
    border-radius: 22px;
  }

  .fig-img {
    height: 180px;
  }
}

@media (max-width: 420px) {
  .doc > article {
    padding: 20px 15px 24px;
  }
}

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