/* ============================================================
   江南JN · 站点共享样式  /assets/site.css
   暖纸底 + 深青胶囊 + 沙金数据 + 墨蓝长卷段
   ============================================================ */

:root {
  /* 色彩 */
  --paper-100: #FAF5EA;
  --paper-200: #F1E9D8;
  --river-700: #0F6C58;
  --river-900: #0A4438;
  --river-200: #BBD9CD;
  --sand-500: #C98A2E;
  --sand-700: #8A5A12;
  --ink-900: #0E2233;
  --ink-700: #16324A;
  --seal-600: #B3402F;
  --text-900: #15211E;
  --text-600: #4B5C55;
  --line-300: #D9CFBB;

  /* 字体 */
  --font-body: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Noto Sans SC", "Source Han Sans SC", "PingFang SC", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* 尺度 */
  --shell: 1180px;
  --radius-s: 3px;
  --radius-m: 10px;
  --radius-pill: 999px;
  --ease: cubic-bezier(.22, .68, .28, 1);
  --shadow-paper: 6px 6px 0 0 var(--paper-200);
}

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

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

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.8;
  color: var(--text-900);
  background-color: var(--paper-100);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p, figure, dl, dd, blockquote { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img, svg, video { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
strong, b { font-weight: 700; }

::selection { background: var(--river-200); color: var(--river-900); }

:focus-visible {
  outline: 2px solid var(--sand-500);
  outline-offset: 3px;
  border-radius: var(--radius-s);
}

#main-content { scroll-margin-top: 6rem; }

/* ---------- 跳转链 ---------- */
.skip-link {
  position: fixed;
  top: .6rem;
  left: .6rem;
  z-index: 200;
  transform: translateY(-180%);
  padding: .55rem 1.05rem;
  border: 1px solid var(--river-700);
  border-radius: var(--radius-pill);
  background: var(--paper-100);
  color: var(--river-900);
  font-size: .9rem;
  font-weight: 700;
  transition: transform .22s var(--ease);
}
.skip-link:focus,
.skip-link:focus-visible { transform: translateY(0); }

/* ---------- 页头：悬浮胶囊 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 90;
  background: var(--paper-100);
  border-bottom: 1px solid transparent;
  transition: border-color .24s var(--ease), box-shadow .24s var(--ease);
}
.site-header[data-scrolled="true"] {
  border-bottom-color: var(--line-300);
  box-shadow: 0 12px 30px -26px rgba(14, 34, 51, .6);
}

.header-rail {
  width: min(var(--shell), 100% - 1.6rem);
  margin-inline: auto;
  padding-block: .75rem;
  transition: padding .24s var(--ease);
}
.site-header[data-scrolled="true"] .header-rail { padding-block: .42rem; }

.nav-capsule {
  position: relative;
  display: flex;
  align-items: center;
  gap: .9rem;
  padding: .45rem .5rem .45rem 1rem;
  background: var(--river-900);
  color: var(--paper-100);
  border-radius: var(--radius-pill);
  box-shadow: inset 0 0 0 1px rgba(201, 138, 46, .35), 0 18px 36px -30px rgba(10, 68, 56, .95);
  transition: box-shadow .24s var(--ease), padding .24s var(--ease), border-radius .24s var(--ease);
}
.site-header[data-scrolled="true"] .nav-capsule {
  box-shadow: inset 0 0 0 1px rgba(201, 138, 46, .6), 0 10px 22px -22px rgba(10, 68, 56, .95);
}

.brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex: none;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border: 1px solid rgba(201, 138, 46, .7);
  border-radius: 8px;
  background: rgba(250, 245, 234, .07);
  color: var(--sand-500);
  font-family: var(--font-mono);
  font-size: .78rem;
  letter-spacing: .06em;
  line-height: 1;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.02rem;
  letter-spacing: -.01em;
}
.brand-sub {
  font-size: .66rem;
  letter-spacing: .22em;
  color: var(--river-200);
  transition: opacity .24s var(--ease);
}
.site-header[data-scrolled="true"] .brand-sub { opacity: .55; }

.nav-toggle {
  display: none;
  align-items: center;
  gap: .5rem;
  margin-left: auto;
  padding: .42rem .75rem;
  border: 1px solid rgba(250, 245, 234, .3);
  border-radius: var(--radius-pill);
  color: var(--paper-100);
  font-size: .78rem;
  letter-spacing: .14em;
}
.nav-toggle-icon { display: grid; gap: 4px; width: 16px; }
.nav-toggle-bar {
  display: block;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform .2s var(--ease);
}
.nav-capsule[data-open="true"] .nav-toggle-bar:first-child { transform: translateY(3px) rotate(45deg); }
.nav-capsule[data-open="true"] .nav-toggle-bar:last-child { transform: translateY(-3px) rotate(-45deg); }

.nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .55rem;
  flex: 1 1 auto;
  min-width: 0;
}
.nav-list {
  display: flex;
  align-items: center;
  gap: .12rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.nav-link {
  display: inline-block;
  padding: .42rem .72rem;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  color: rgba(250, 245, 234, .82);
  font-size: .92rem;
  white-space: nowrap;
  transition: color .18s var(--ease), background-color .18s var(--ease), box-shadow .18s var(--ease);
}
.nav-link:hover { color: var(--paper-100); background: rgba(250, 245, 234, .1); }
.nav-link[aria-current="page"] {
  background: var(--paper-100);
  color: var(--river-900);
  font-weight: 700;
  box-shadow: inset 0 0 0 1px var(--sand-500);
}

.nav-cta {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .44rem .95rem;
  border-radius: var(--radius-pill);
  background: var(--sand-500);
  color: #1D1508;
  font-size: .86rem;
  font-weight: 700;
  letter-spacing: .04em;
  white-space: nowrap;
  transition: background-color .18s var(--ease), color .18s var(--ease), transform .18s var(--ease);
}
.nav-cta::after {
  content: "›";
  font-family: var(--font-mono);
  font-size: 1.05rem;
  line-height: 1;
}
.nav-cta:hover {
  background: var(--paper-100);
  color: var(--river-900);
  transform: translateY(-1px);
}

.scroll-progress {
  height: 3px;
  background: var(--paper-200);
  overflow: hidden;
}
.scroll-progress-bar {
  display: block;
  width: 100%;
  height: 100%;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--river-700) 0%, var(--sand-500) 100%);
  transition: transform .12s linear;
}

/* ---------- 容器与网格 ---------- */
.container {
  width: min(var(--shell), 100% - 2.2rem);
  margin-inline: auto;
}
.container--narrow {
  width: min(760px, 100% - 2.2rem);
  margin-inline: auto;
}
.grid { display: grid; gap: clamp(1rem, 2.4vw, 2rem); }
.grid--split { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.grid--duo { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ---------- 章节骨架 ---------- */
.chapter {
  position: relative;
  padding-block: clamp(2.4rem, 5.5vw, 4.8rem);
}
.chapter--paper { background: var(--paper-200); }
.chapter--ink { background: var(--ink-900); color: var(--paper-100); }

.chapter-head {
  display: grid;
  gap: .7rem;
  margin-bottom: clamp(1.4rem, 3vw, 2.4rem);
}
.band {
  display: block;
  width: 100%;
  height: 8px;
  border-radius: 2px;
  background: var(--river-700);
}
.band--sand { background: var(--sand-500); }
.band--ink { background: var(--ink-900); }

.chapter-index {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: clamp(.92rem, 1.5vw, 1.1rem);
  letter-spacing: .24em;
  color: var(--sand-700);
}
.chapter-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(1.7rem, 4.4vw, 3.1rem);
  line-height: 1.12;
  letter-spacing: -.02em;
  text-wrap: balance;
}
.chapter-title::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: .72em;
  margin-right: .4em;
  border-radius: 1px;
  background: var(--river-700);
  transform: translateY(.02em);
}
.chapter-lede {
  max-width: 36em;
  font-size: clamp(1rem, 1.3vw, 1.1rem);
  line-height: 1.85;
  color: var(--text-600);
}
.chapter--ink .chapter-index { color: var(--sand-500); }
.chapter--ink .chapter-title::before { background: var(--sand-500); }
.chapter--ink .chapter-lede { color: rgba(250, 245, 234, .78); }

/* ---------- 正文与数字 ---------- */
.prose {
  display: grid;
  gap: 1.2em;
  max-width: 40em;
  font-size: 1rem;
  line-height: 1.85;
}
.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}

/* ---------- 印刷样张卡片 ---------- */
.sheet {
  padding: clamp(1.1rem, 2.4vw, 1.8rem);
  background: var(--paper-100);
  border: 1px solid var(--line-300);
  box-shadow: var(--shadow-paper);
}
.sheet--ink {
  background: var(--ink-900);
  color: var(--paper-100);
  border-color: var(--ink-700);
  box-shadow: 6px 6px 0 0 var(--ink-700);
}

/* ---------- 标签与印章 ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .26rem .6rem;
  border-radius: 2px;
  background: var(--river-200);
  color: var(--river-900);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .12em;
  line-height: 1.6;
}
.tag--sand { background: rgba(201, 138, 46, .2); color: var(--sand-700); }
.tag--ink { background: var(--ink-700); color: var(--paper-100); }

.seal {
  display: inline-block;
  padding: .28rem .55rem;
  border-radius: 2px;
  background: var(--seal-600);
  color: var(--paper-100);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .14em;
  line-height: 1.5;
  transform: rotate(-1.5deg);
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .68rem 1.2rem;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-size: .94rem;
  font-weight: 700;
  line-height: 1.4;
  transition: background-color .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
.btn:hover { transform: translateY(-1px); }
.btn--primary { background: var(--river-700); color: var(--paper-100); border-color: var(--river-700); }
.btn--primary:hover { background: var(--river-900); border-color: var(--river-900); }
.btn--sand { background: var(--sand-500); color: var(--ink-900); }
.btn--sand:hover { background: var(--paper-100); color: var(--river-900); border-color: var(--river-700); }
.btn--ghost { background: transparent; border-color: var(--line-300); color: var(--river-900); }
.btn--ghost:hover { background: var(--paper-200); border-color: var(--river-700); }

/* ---------- 面包屑 ---------- */
.breadcrumb { font-size: .82rem; color: var(--text-600); }
.breadcrumb-list { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.breadcrumb-list li { display: flex; align-items: center; gap: .35rem; }
.breadcrumb-list li + li::before { content: "／"; color: var(--line-300); }
.breadcrumb-link { color: var(--river-700); border-bottom: 1px solid transparent; }
.breadcrumb-link:hover { border-bottom-color: var(--river-700); }
.breadcrumb-current { color: var(--text-600); }

/* ---------- 图片容器（页面阶段放图） ---------- */
.media-frame {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line-300);
  background: var(--river-200);
}
.media-frame > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.media-frame--wide { aspect-ratio: 21 / 9; }
.media-frame--square { aspect-ratio: 1 / 1; }
.media-frame--tall { aspect-ratio: 3 / 4; }
.media-caption {
  margin-top: .55rem;
  font-size: .8rem;
  letter-spacing: .04em;
  color: var(--sand-700);
}

/* ---------- 水文刻度线 ---------- */
.water-scale {
  height: 12px;
  border-bottom: 1px solid var(--line-300);
  background-image: repeating-linear-gradient(90deg, var(--line-300) 0 1px, transparent 1px 12px);
  background-repeat: repeat-x;
  background-size: auto 7px;
  background-position: 0 100%;
}
.chapter--ink .water-scale {
  border-bottom-color: rgba(250, 245, 234, .3);
  background-image: repeating-linear-gradient(90deg, rgba(250, 245, 234, .3) 0 1px, transparent 1px 12px);
}

/* ---------- 侧栏目录 ---------- */
.toc {
  position: sticky;
  top: 6rem;
  padding-left: 1rem;
  border-left: 2px solid var(--line-300);
}
.toc-title {
  margin-bottom: .7rem;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .24em;
  color: var(--sand-700);
}
.toc-list { display: grid; gap: .15rem; }
.toc-link {
  display: block;
  margin-left: -1.15rem;
  padding: .3rem .1rem .3rem 1.1rem;
  border-left: 2px solid transparent;
  font-size: .9rem;
  color: var(--text-600);
  transition: color .18s var(--ease), border-color .18s var(--ease);
}
.toc-link:hover { color: var(--river-700); }
.toc-link.is-active {
  color: var(--river-700);
  font-weight: 700;
  border-left-color: var(--river-700);
}

/* ---------- 折叠问答组 ---------- */
.fold-tools {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  margin-bottom: 1rem;
}
.fold { border-top: 1px solid var(--line-300); }
.fold:last-child { border-bottom: 1px solid var(--line-300); }
.fold__trigger {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.05rem .2rem;
  text-align: left;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.02rem;
  line-height: 1.5;
  color: var(--text-900);
  transition: color .18s var(--ease);
}
.fold__trigger:hover { color: var(--river-700); }
.fold__label { flex: 1 1 auto; }
.fold__icon {
  position: relative;
  flex: none;
  width: 14px;
  height: 14px;
  color: var(--sand-700);
}
.fold__icon::before,
.fold__icon::after {
  content: "";
  position: absolute;
  background: currentColor;
  border-radius: 1px;
}
.fold__icon::before {
  top: 50%;
  left: 0;
  width: 100%;
  height: 2px;
  transform: translateY(-50%);
}
.fold__icon::after {
  left: 50%;
  top: 0;
  width: 2px;
  height: 100%;
  transform: translateX(-50%);
  transition: transform .18s var(--ease), opacity .18s var(--ease);
}
.fold[data-open="true"] .fold__icon::after {
  transform: translateX(-50%) rotate(90deg);
  opacity: 0;
}
.fold__panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .18s var(--ease);
}
.fold[data-open="true"] .fold__panel { grid-template-rows: 1fr; }
.fold__panel > * { overflow: hidden; min-height: 0; }
.fold__body {
  max-width: 52em;
  padding: 0 .2rem 1.2rem;
  font-size: .98rem;
  line-height: 1.85;
  color: var(--text-600);
}
.chapter--ink .fold,
.chapter--ink .fold:last-child { border-color: rgba(250, 245, 234, .25); }
.chapter--ink .fold__trigger { color: var(--paper-100); }
.chapter--ink .fold__trigger:hover { color: var(--sand-500); }
.chapter--ink .fold__body { color: rgba(250, 245, 234, .78); }

/* ---------- 显现动效 ---------- */
.has-js [data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .55s var(--ease), transform .55s var(--ease);
}
.has-js [data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

/* ---------- 页脚：深水色带 ---------- */
.site-footer {
  margin-top: clamp(2rem, 4vw, 3.5rem);
  padding-top: clamp(2.2rem, 4.5vw, 3.4rem);
  background: var(--river-900);
  border-top: 6px solid var(--sand-500);
  color: rgba(250, 245, 234, .78);
}
.footer-rail {
  width: min(var(--shell), 100% - 1.6rem);
  margin-inline: auto;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr .95fr;
  gap: clamp(1.4rem, 3vw, 3rem);
  padding-bottom: clamp(1.6rem, 3vw, 2.6rem);
}
.footer-brand-link {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  color: var(--paper-100);
}
.brand-mark--footer {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  font-size: .72rem;
}
.footer-brand-name {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.05rem;
  letter-spacing: -.01em;
}
.footer-version {
  margin-top: .75rem;
  font-size: .78rem;
  letter-spacing: .16em;
  color: var(--sand-500);
}
.footer-note {
  margin-top: .5rem;
  max-width: 26em;
  font-size: .9rem;
  line-height: 1.75;
  color: rgba(250, 245, 234, .64);
}
.footer-title {
  margin-bottom: .85rem;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .24em;
  color: var(--river-200);
}
.footer-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .1rem .9rem;
}
.footer-list--legal {
  margin-top: .9rem;
  padding-top: .9rem;
  border-top: 1px solid rgba(250, 245, 234, .16);
}
.footer-link {
  display: inline-block;
  padding: .22rem 0;
  border-bottom: 1px solid transparent;
  font-size: .92rem;
  color: rgba(250, 245, 234, .8);
  transition: color .18s var(--ease), border-color .18s var(--ease);
}
.footer-link:hover {
  color: var(--paper-100);
  border-bottom-color: var(--sand-500);
}
.footer-dl { display: grid; gap: .55rem; }
.footer-dl-row {
  display: grid;
  grid-template-columns: 3.2em minmax(0, 1fr);
  gap: .6rem;
  align-items: start;
  font-size: .9rem;
}
.footer-dl-row dt {
  padding-top: .12rem;
  font-size: .78rem;
  letter-spacing: .1em;
  color: var(--river-200);
}
.footer-dl-row dd {
  color: rgba(250, 245, 234, .86);
  overflow-wrap: anywhere;
}
.footer-mono { font-size: .86rem; }
.footer-hours {
  margin-top: .9rem;
  font-size: .78rem;
  letter-spacing: .06em;
  color: var(--sand-500);
}
.footer-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .5rem 1.4rem;
  padding-block: 1.1rem 1.4rem;
  border-top: 1px solid rgba(250, 245, 234, .16);
  font-size: .8rem;
  letter-spacing: .04em;
  color: rgba(250, 245, 234, .58);
}
.footer-copy { margin: 0; }
.footer-icp {
  font-family: var(--font-mono);
  letter-spacing: 0;
  color: rgba(250, 245, 234, .74);
}

/* ---------- 平板 ---------- */
@media (max-width: 1080px) {
  .grid--split { grid-template-columns: minmax(0, 1fr); }
  .toc {
    position: static;
    padding: .9rem 0 0;
    border-left: 0;
    border-top: 1px solid var(--line-300);
  }
  .toc-link { margin-left: 0; padding-left: .1rem; border-left: 0; border-bottom: 2px solid transparent; }
  .toc-link.is-active { border-bottom-color: var(--river-700); }
}

/* ---------- 移动端 ---------- */
@media (max-width: 960px) {
  .nav-capsule {
    gap: .5rem;
    padding: .4rem .45rem .4rem .8rem;
    border-radius: 20px;
  }
  .brand-sub { display: none; }
  .nav-toggle { display: inline-flex; }

  .nav {
    position: absolute;
    top: calc(100% + .6rem);
    left: 0;
    right: 0;
    z-index: 5;
    display: none;
    flex: 0 0 auto;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: .6rem;
    padding: .7rem;
    background: var(--river-900);
    border: 1px solid rgba(250, 245, 234, .2);
    border-radius: 20px;
    box-shadow: 0 26px 50px -30px rgba(6, 26, 22, .95);
  }
  .nav-capsule[data-open="true"] .nav { display: flex; }

  .nav-list {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: .1rem;
  }
  .nav-link {
    display: block;
    padding: .68rem .8rem;
    border-radius: 12px;
    font-size: 1rem;
  }
  .nav-link[aria-current="page"] { box-shadow: none; }
  .nav-cta {
    align-self: flex-start;
    margin-left: .2rem;
    padding: .55rem 1.05rem;
  }

  .footer-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .footer-brand { grid-column: 1 / -1; }
  .footer-contact { grid-column: 1 / -1; }
  .grid--duo { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  .header-rail,
  .footer-rail { width: calc(100% - 1.2rem); }
  .brand-name { font-size: .96rem; }
  .chapter-title { font-size: clamp(1.5rem, 7vw, 2.1rem); }
  .footer-grid { grid-template-columns: minmax(0, 1fr); }
  .footer-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-meta { flex-direction: column; align-items: flex-start; }
  .sheet { box-shadow: 4px 4px 0 0 var(--paper-200); }
  .sheet--ink { box-shadow: 4px 4px 0 0 var(--ink-700); }
}

/* ---------- 降低动态效果 ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .has-js [data-reveal] {
    opacity: 1;
    transform: none;
  }
  .btn:hover,
  .nav-cta:hover { transform: none; }
}
