/* ==========================================================================
   新宝主站 · 共享样式表  /assets/site.css
   色彩节奏：上浅（宣纸底）— 中深（深海蓝块面）— 下浅（页脚内信息岛）
   ========================================================================== */

/* ---------- 1. 变量 ---------- */
:root {
  /* 品牌色 */
  --deep: #0B2B45;
  --deep-2: #14405F;
  --indigo: #3B3168;
  --wine: #7A2E3B;
  --gold: #D9A24A;
  --gold-soft: #F0D9A8;
  --coral: #E4694B;
  --mist: #8FBDB4;
  --paper: #F6F1E7;
  --warm: #FFFBF3;
  --ink: #1C1F24;
  --slate: #5A6B7A;

  /* 字体 */
  --font-head: "Noto Serif SC", "Source Han Serif SC", "Songti SC", serif;
  --font-body: "Noto Sans SC", "Source Han Sans SC", system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "IBM Plex Mono", "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* 字号刻度 12/14/17/21/28/40/56/76 */
  --fs-12: 12px;
  --fs-14: 14px;
  --fs-17: 17px;
  --fs-21: 21px;
  --fs-28: 28px;
  --fs-40: 40px;
  --fs-56: 56px;
  --fs-76: 76px;

  /* 尺度 */
  --shell: 1240px;
  --measure: 700px;
  --rail: 104px;
  --gutter: 24px;
  --header-h: 84px;
  --radius-lg: 32px;
  --radius-md: 22px;
  --pill: 999px;
}

/* ---------- 2. Reset ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

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

body, h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg, video { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }
a { color: inherit; }
table { border-collapse: collapse; width: 100%; }

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

/* ---------- 3. 页面基座与中文排版 ---------- */
body {
  font-family: var(--font-body);
  font-size: var(--fs-17);
  line-height: 1.85;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(rgba(28, 31, 36, .045) 1px, transparent 1px),
    radial-gradient(120% 70% at 6% -12%, rgba(143, 189, 180, .22), transparent 62%),
    radial-gradient(90% 55% at 102% -4%, rgba(217, 162, 74, .18), transparent 58%);
  background-size: 24px 24px, auto, auto;
  background-repeat: repeat, no-repeat, no-repeat;
  background-attachment: scroll, fixed, fixed;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

#main-content {
  display: block;
  padding-top: var(--header-h);
  min-height: 62vh;
}

h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 700;
  letter-spacing: -.01em;
  line-height: 1.32;
  color: var(--ink);
}

h1 { font-size: clamp(28px, 5vw, 56px); }
h2 { font-size: clamp(23px, 3.4vw, 40px); }
h3 { font-size: clamp(19px, 2.2vw, 28px); }
h4 { font-size: var(--fs-21); }

p + p { margin-top: 1em; }

strong { font-weight: 700; }

::selection { background: rgba(217, 162, 74, .35); color: var(--ink); }

/* 聚焦可见性 */
:focus-visible {
  outline: 3px solid var(--coral);
  outline-offset: 3px;
  border-radius: 8px;
}

/* 跳过导航 */
.skip-link {
  position: absolute;
  left: 16px;
  top: -80px;
  z-index: 200;
  padding: 12px 20px;
  border-radius: var(--pill);
  background: var(--gold);
  color: #22180A;
  font-size: var(--fs-14);
  font-weight: 600;
  text-decoration: none;
  transition: top .2s ease;
}
.skip-link:focus { top: 14px; }

/* ---------- 4. 通用容器 ---------- */
.wrap {
  width: 100%;
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.prose {
  max-width: var(--measure);
  font-size: var(--fs-17);
  line-height: 1.85;
}

.prose > * + * { margin-top: 1.1em; }

.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--slate);
  margin-bottom: 12px;
}

.section-title {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: clamp(23px, 3.4vw, 40px);
  letter-spacing: -.01em;
  line-height: 1.3;
  margin: 0 0 14px;
}

.lede {
  max-width: var(--measure);
  font-size: clamp(17px, 1.6vw, 21px);
  line-height: 1.8;
  color: var(--slate);
}

.mono-num {
  font-family: var(--font-mono);
  font-size: .92em;
  letter-spacing: .04em;
  font-weight: 400;
  color: var(--wine);
}

/* ---------- 5. 页头 ---------- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 80;
  color: var(--warm);
  padding: 18px var(--gutter) 22px;
  background-image: linear-gradient(
    180deg,
    rgba(11, 43, 69, .88) 0%,
    rgba(11, 43, 69, .48) 56%,
    rgba(11, 43, 69, 0) 100%
  );
  background-color: transparent;
  transition: background-color .35s ease, padding .35s ease, box-shadow .35s ease;
}

.site-header[data-state="solid"] {
  background-color: var(--deep);
  background-image: none;
  padding: 10px var(--gutter);
  box-shadow:
    0 1px 0 rgba(240, 217, 168, .24),
    0 22px 44px -30px rgba(11, 43, 69, .95);
}

.header-shell {
  position: relative;
  max-width: var(--shell);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 22px;
  min-height: 48px;
}

/* 品牌 */
.brand-mark {
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
  margin-right: auto;
  text-decoration: none;
  color: inherit;
  padding: 4px 2px;
  border-radius: 12px;
}

.brand-name {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: clamp(19px, 2vw, 23px);
  letter-spacing: -.01em;
  line-height: 1.15;
  color: var(--warm);
}

.brand-tagline {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .16em;
  line-height: 1.3;
  color: var(--gold-soft);
  opacity: .82;
}

/* 导航 */
.primary-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-list {
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav-list a {
  display: inline-block;
  padding: 9px 14px;
  border-radius: var(--pill);
  border: 1px solid transparent;
  font-size: var(--fs-14);
  letter-spacing: .02em;
  text-decoration: none;
  color: rgba(255, 251, 243, .82);
  transition: color .2s ease, background-color .2s ease, border-color .2s ease;
}

.nav-list a:hover {
  color: var(--warm);
  background-color: rgba(240, 217, 168, .13);
}

.nav-list a[aria-current="page"] {
  color: var(--gold-soft);
  background-color: rgba(217, 162, 74, .18);
  border-color: rgba(217, 162, 74, .58);
}

/* 移动端导航按钮 */
.nav-toggle {
  display: none;
  align-items: center;
  gap: 9px;
  padding: 9px 16px;
  border-radius: var(--pill);
  border: 1px solid rgba(240, 217, 168, .38);
  background-color: rgba(240, 217, 168, .1);
  color: var(--warm);
  font-size: var(--fs-14);
  letter-spacing: .06em;
  cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease;
}

.nav-toggle:hover { background-color: rgba(240, 217, 168, .2); }

.nav-toggle-icon {
  position: relative;
  display: inline-block;
  width: 16px;
  height: 12px;
}

.nav-toggle-icon::before,
.nav-toggle-icon::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 2px;
  background-color: currentColor;
  transition: transform .25s ease;
}

.nav-toggle-icon::before { top: 0; }
.nav-toggle-icon::after { bottom: 0; }

.nav-toggle[aria-expanded="true"] .nav-toggle-icon::before {
  transform: translateY(5px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-icon::after {
  transform: translateY(-5px) rotate(-45deg);
}

.nav-toggle-text { line-height: 1; }

/* 右侧常驻小屏入口 */
.edge-entry {
  position: fixed;
  right: 0;
  top: 52%;
  transform: translateY(-50%);
  z-index: 70;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px 13px 15px;
  border: 1px solid rgba(217, 162, 74, .42);
  border-right: none;
  border-radius: 18px 0 0 18px;
  background-color: var(--deep-2);
  background-image: linear-gradient(160deg, var(--deep-2), var(--indigo));
  color: var(--gold-soft);
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  letter-spacing: .12em;
  text-decoration: none;
  box-shadow: -14px 12px 34px -22px rgba(11, 43, 69, .95);
  transition: background-color .24s ease, color .24s ease, padding .24s ease;
}

.edge-entry:hover {
  color: var(--warm);
  background-image: linear-gradient(160deg, var(--indigo), var(--deep-2));
  padding-right: 24px;
}

.edge-entry-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--coral);
  box-shadow: 0 0 0 3px rgba(228, 105, 75, .22);
}

.edge-entry-label { line-height: 1.2; }

/* ---------- 6. 页脚 ---------- */
.site-footer {
  position: relative;
  margin-top: 96px;
  padding: 72px var(--gutter) 30px;
  background-color: var(--deep);
  color: var(--warm);
  overflow: hidden;
}

.site-footer::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(rgba(240, 217, 168, .12) 1px, transparent 1px),
    radial-gradient(120% 70% at 88% 0%, rgba(59, 49, 104, .55), transparent 60%),
    radial-gradient(90% 60% at 0% 100%, rgba(122, 46, 59, .38), transparent 62%);
  background-size: 22px 22px, auto, auto;
  pointer-events: none;
}

.footer-shell {
  position: relative;
  max-width: var(--shell);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) repeat(3, minmax(0, 1fr));
  gap: 44px 36px;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-brand-name {
  font-family: var(--font-head);
  font-size: var(--fs-28);
  font-weight: 700;
  letter-spacing: -.01em;
  line-height: 1.2;
  color: var(--warm);
}

.footer-brand-line {
  font-size: 15px;
  color: var(--gold-soft);
  line-height: 1.7;
}

.footer-stamp {
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  letter-spacing: .14em;
  color: rgba(240, 217, 168, .66);
}

.island {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.island-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .22em;
  color: var(--gold);
  line-height: 1.4;
}

.island-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.island-list a {
  display: inline-block;
  font-size: 15px;
  line-height: 1.5;
  color: rgba(255, 251, 243, .78);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition: color .2s ease, border-color .2s ease;
}

.island-list a:hover {
  color: var(--warm);
  border-bottom-color: var(--coral);
}

.island-list--plain li {
  font-size: var(--fs-14);
  line-height: 1.72;
  color: rgba(255, 251, 243, .64);
  word-break: break-word;
}

.island-note {
  font-size: 13px;
  line-height: 1.7;
  color: rgba(255, 251, 243, .58);
}

.btn-feedback {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 24px;
  border-radius: var(--pill);
  border: 1px solid transparent;
  background-color: var(--coral);
  color: #2A1009;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .02em;
  text-decoration: none;
  transition: background-color .22s ease, box-shadow .22s ease, transform .22s ease;
}

.btn-feedback:hover {
  background-color: #EE7D60;
  box-shadow: 0 16px 30px -20px rgba(228, 105, 75, 1);
  transform: translateY(-1px);
}

.footer-legal {
  position: relative;
  max-width: var(--shell);
  margin: 52px auto 0;
  padding-top: 22px;
  border-top: 1px solid rgba(240, 217, 168, .2);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  letter-spacing: .06em;
  color: rgba(240, 217, 168, .72);
}

/* ---------- 7. 通用按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 24px;
  border-radius: var(--pill);
  border: 1px solid transparent;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .02em;
  line-height: 1.4;
  text-decoration: none;
  cursor: pointer;
  background-color: transparent;
  transition: background-color .22s ease, color .22s ease, border-color .22s ease, transform .22s ease;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn--gold {
  background-color: var(--gold);
  color: #22180A;
}
.btn--gold:hover { background-color: var(--gold-soft); }

.btn--ghost {
  color: var(--deep);
  border-color: rgba(11, 43, 69, .34);
}
.btn--ghost:hover {
  border-color: var(--deep);
  background-color: rgba(11, 43, 69, .06);
}

.btn--coral {
  background-color: var(--coral);
  color: #2A1009;
}
.btn--coral:hover { background-color: #EE7D60; }

.btn--on-dark {
  color: var(--warm);
  border-color: rgba(240, 217, 168, .44);
}
.btn--on-dark:hover {
  background-color: rgba(240, 217, 168, .14);
  border-color: var(--gold-soft);
}

/* ---------- 8. 面包屑 ---------- */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  margin: 0 0 22px;
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  letter-spacing: .06em;
  color: var(--slate);
}

.breadcrumb li { display: inline-flex; align-items: center; }

.breadcrumb li + li::before {
  content: "/";
  margin: 0 10px;
  color: rgba(90, 107, 122, .5);
}

.breadcrumb a {
  color: var(--slate);
  text-decoration: none;
  border-bottom: 1px solid rgba(90, 107, 122, .4);
  padding-bottom: 1px;
  transition: color .2s ease, border-color .2s ease;
}

.breadcrumb a:hover {
  color: var(--coral);
  border-bottom-color: var(--coral);
}

/* ---------- 9. 网格 ---------- */
.grid {
  display: grid;
  gap: 24px;
}

.grid--12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }

/* ---------- 10. 分区色带 ---------- */
.band {
  display: block;
  width: 100%;
  border-radius: var(--pill);
  background-color: var(--slate);
}

.band--entry { height: 6px; background-color: var(--gold); }
.band--section { height: 4px; background-color: var(--mist); }
.band--version { height: 3px; background-color: var(--indigo); }
.band--feedback { height: 5px; background-color: var(--coral); }

/* ---------- 11. 图片容器基础规则 ---------- */
.media-frame {
  position: relative;
  display: block;
  width: 100%;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background-color: var(--deep-2);
  background-image:
    radial-gradient(rgba(240, 217, 168, .16) 1px, transparent 1px),
    linear-gradient(150deg, var(--deep-2) 0%, var(--indigo) 68%, rgba(122, 46, 59, .8) 100%);
  background-size: 18px 18px, auto;
  isolation: isolate;
}

.media-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 90px rgba(11, 43, 69, .45);
  pointer-events: none;
}

.media-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-frame[data-ratio="16-9"] { aspect-ratio: 16 / 9; }
.media-frame[data-ratio="4-3"] { aspect-ratio: 4 / 3; }
.media-frame[data-ratio="3-4"] { aspect-ratio: 3 / 4; }
.media-frame[data-ratio="1-1"] { aspect-ratio: 1 / 1; }

.media-frame--round { border-radius: var(--pill); }
.media-frame--flush { border-radius: var(--radius-md); }

/* ---------- 12. 章节目录索引带 ---------- */
.index-rail {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  letter-spacing: .08em;
}

.index-rail a {
  display: block;
  padding: 8px 0 8px 14px;
  border-left: 2px solid rgba(90, 107, 122, .28);
  color: var(--slate);
  text-decoration: none;
  line-height: 1.5;
  transition: color .22s ease, border-color .22s ease, padding-left .22s ease;
}

.index-rail a:hover {
  color: var(--deep);
  border-left-color: rgba(217, 162, 74, .6);
}

.index-rail a[aria-current="true"] {
  color: var(--deep);
  border-left-color: var(--gold);
  padding-left: 18px;
  font-weight: 500;
}

/* ---------- 13. 显现与返回顶部 ---------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .4s ease-out, transform .4s ease-out;
  will-change: opacity, transform;
}

[data-reveal].is-revealed {
  opacity: 1;
  transform: none;
}

.to-top {
  position: fixed;
  right: 22px;
  bottom: 26px;
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 11px 20px;
  border-radius: var(--pill);
  border: 1px solid rgba(217, 162, 74, .46);
  background-color: var(--deep);
  color: var(--gold-soft);
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  letter-spacing: .14em;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  box-shadow: 0 20px 40px -26px rgba(11, 43, 69, 1);
  transition: opacity .3s ease, transform .3s ease, visibility .3s ease, background-color .22s ease;
}

.to-top[data-visible="true"] {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.to-top:hover { background-color: var(--deep-2); }

/* ---------- 14. 响应式 ---------- */
@media (max-width: 1080px) {
  .footer-shell {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 40px 32px;
  }
}

@media (max-width: 960px) {
  :root { --gutter: 20px; --header-h: 78px; }

  .nav-toggle { display: inline-flex; }

  .primary-nav {
    position: fixed;
    left: 16px;
    right: 16px;
    top: 84px;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 16px;
    background-color: var(--deep);
    background-image: linear-gradient(170deg, var(--deep) 0%, var(--deep-2) 100%);
    border: 1px solid rgba(240, 217, 168, .26);
    border-radius: var(--radius-lg);
    box-shadow: 0 34px 66px -34px rgba(11, 43, 69, .95);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-12px);
    transition: opacity .3s ease, transform .3s ease, visibility .3s ease;
  }

  .primary-nav[data-open="true"] {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .nav-list {
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
  }

  .nav-list a {
    display: block;
    padding: 12px 16px;
    font-size: var(--fs-17);
    border-radius: var(--radius-md);
  }

  .site-header[data-state="solid"] { padding-top: 10px; padding-bottom: 10px; }
}

@media (max-width: 820px) {
  .grid--12 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  .edge-entry {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    top: 46%;
    padding: 18px 9px;
    gap: 12px;
    font-size: 12px;
    letter-spacing: .24em;
    border-radius: 16px 0 0 16px;
  }

  .edge-entry-dot { display: none; }

  .site-footer { margin-top: 72px; padding-top: 56px; }
}

@media (max-width: 640px) {
  :root { --gutter: 18px; }

  body { font-size: 16px; line-height: 1.82; }

  .grid--12 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid { gap: 18px; }

  .footer-shell { grid-template-columns: 1fr; gap: 34px; }

  .footer-legal {
    flex-direction: column;
    justify-content: flex-start;
    gap: 6px;
  }

  .to-top { right: 14px; bottom: 18px; padding: 10px 16px; }

  .btn, .btn-feedback { width: 100%; justify-content: center; }
  .btn-feedback { align-self: stretch; }
}

@media (max-width: 380px) {
  .brand-tagline { letter-spacing: .1em; font-size: 10px; }
}

/* ---------- 15. 动效降级 ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }

  [data-reveal] {
    opacity: 1;
    transform: none;
  }

  .to-top,
  .primary-nav {
    transition: none;
  }
}
