/* =====================================================================
   乐盈指南 · 全站共享样式 /assets/site.css
   纸张叠层 · 印刷边框 · 等宽索引 · 深海蓝 + 暖金
   ===================================================================== */

/* ---------- 0. Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body, h1, h2, h3, h4, h5, p, ul, ol, li, figure, blockquote, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg, video { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
hr { border: 0; border-top: 1px solid rgba(20, 24, 28, .12); margin: 0; }

/* ---------- 1. 变量 ---------- */
:root {
  --blue-900: #0F2A44;
  --blue-800: #1B3E5E;
  --gold: #D9A441;
  --gold-bright: #F0CE84;
  --violet: #6E5C86;
  --mint: #4FA98A;
  --wine: #7A2F35;
  --paper: #F7F5F0;
  --ink: #14181C;
  --grey: #8FA3B5;

  --rail-w: 220px;
  --head-h: 62px;
  --shell: 1120px;

  --r-archive: 4px;
  --r-service: 12px;
  --r-news: 16px;

  --font-body: "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  --font-display: "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", "Courier New", monospace;

  --layer-shadow: 6px 6px 0 rgba(15, 42, 68, .10);
  --ease: .18s ease;
}

/* ---------- 2. 基础排版 ---------- */
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
@media (min-width: 1024px) {
  body { padding-left: var(--rail-w); }
}
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.28;
  color: inherit;
}
h1 { font-size: clamp(30px, 4.6vw, 44px); }
h2 { font-size: clamp(24px, 3.4vw, 32px); }
h3 { font-size: clamp(19px, 2.2vw, 22px); }
h4 { font-size: 17px; font-weight: 700; letter-spacing: 0; }
p { max-width: 68ch; }
strong, b { font-weight: 700; }
.mono, time, code {
  font-family: var(--font-mono);
  letter-spacing: .08em;
  font-variant-numeric: tabular-nums;
}

/* ---------- 3. 焦点与无障碍 ---------- */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--blue-800); outline-offset: 2px; border-radius: 2px; }
.site-rail :focus-visible,
.site-foot :focus-visible,
.section--dark :focus-visible { outline-color: var(--gold-bright); }

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 200;
  padding: 10px 16px;
  border-radius: var(--r-archive);
  background: var(--gold);
  color: var(--blue-900);
  font-size: 14px;
  font-weight: 700;
  transform: translateY(-200%);
  transition: transform var(--ease);
}
.skip-link:focus { transform: translateY(0); }

/* ---------- 4. 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .02em;
  text-align: center;
  cursor: pointer;
  transition: background-color var(--ease), color var(--ease), border-color var(--ease), transform var(--ease);
}
.btn--gold { background: var(--gold); color: var(--blue-900); border-color: var(--gold); }
.btn--gold:hover { background: var(--gold-bright); border-color: var(--gold-bright); transform: translateY(-1px); }
.btn--line { background: transparent; color: var(--gold-bright); border-color: rgba(240, 206, 132, .5); }
.btn--line:hover { color: #fff; border-color: var(--gold-bright); transform: translateY(-1px); }
.btn--block { width: 100%; }

/* ---------- 5. 侧边轨道（站点头部） ---------- */
.site-rail {
  position: sticky;
  top: 0;
  z-index: 80;
  --progress: 0;
  background: var(--blue-900);
  color: var(--paper);
  border-bottom: 1px solid rgba(240, 206, 132, .24);
}
.site-rail__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  height: var(--head-h);
  padding: 0 clamp(14px, 4vw, 22px);
}
.brand { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.brand__name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.02em;
  color: #fff;
}
.brand__tag {
  font-size: 11px;
  letter-spacing: .06em;
  color: var(--gold-bright);
  opacity: .88;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 40px;
  flex: 0 0 auto;
  border: 1px solid rgba(240, 206, 132, .45);
  border-radius: var(--r-archive);
  transition: border-color var(--ease), background-color var(--ease);
}
.nav-toggle:hover { border-color: var(--gold-bright); background: rgba(27, 62, 94, .8); }
.nav-toggle__bars { display: grid; gap: 4px; width: 20px; }
.nav-toggle__bars i {
  display: block;
  height: 2px;
  background: var(--gold-bright);
  transition: transform var(--ease), opacity var(--ease);
}
.site-rail[data-open] .nav-toggle__bars i:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.site-rail[data-open] .nav-toggle__bars i:nth-child(2) { opacity: 0; }
.site-rail[data-open] .nav-toggle__bars i:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.rail-nav {
  position: fixed;
  top: var(--head-h);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 22px clamp(16px, 5vw, 24px) 28px;
  background: var(--blue-900);
  border-right: 1px solid rgba(240, 206, 132, .18);
  transform: translateX(-102%);
  visibility: hidden;
  transition: transform .24s ease, visibility .24s ease;
}
.site-rail[data-open] .rail-nav { transform: none; visibility: visible; }
@media (max-width: 1023px) {
  body.is-nav-open { overflow: hidden; }
}

.rail-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--grey);
  margin-bottom: 8px;
  max-width: none;
}
.rail-label--tight { margin-top: 4px; }

.nav-list { display: grid; gap: 2px; }
.nav-link {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 12px 12px;
  border-radius: var(--r-archive);
  border-left: 2px solid transparent;
  color: rgba(247, 245, 240, .84);
  transition: color var(--ease), background-color var(--ease), border-color var(--ease), transform var(--ease);
}
.nav-link__idx {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .08em;
  color: var(--gold);
  opacity: .78;
}
.nav-link__txt { font-size: 15px; font-weight: 600; }
.nav-link:hover {
  color: #fff;
  background: rgba(27, 62, 94, .9);
  border-left-color: var(--gold-bright);
  transform: translateX(1px);
}
.nav-link[aria-current="page"] {
  color: #fff;
  background: var(--blue-800);
  border-left-color: var(--gold);
  box-shadow: inset 0 0 0 1px rgba(240, 206, 132, .35);
}
.nav-link[aria-current="page"] .nav-link__idx { color: var(--gold-bright); opacity: 1; }

.tag-rail {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
}
.tag-rail > li { flex: 0 0 auto; }
.tag-chip {
  display: inline-block;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid rgba(240, 206, 132, .35);
  background: rgba(27, 62, 94, .72);
  color: var(--gold-bright);
  font-size: 12px;
  letter-spacing: .04em;
  white-space: nowrap;
  transition: border-color var(--ease), color var(--ease), transform var(--ease);
}
.tag-chip:hover { border-color: var(--gold-bright); color: #fff; transform: translateY(-1px); }

.rail-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  border: 1px dashed rgba(143, 163, 181, .45);
  border-radius: var(--r-archive);
  font-size: 12px;
  color: var(--grey);
}
.status-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 3px rgba(79, 169, 138, .22);
}
.rail-status__text { color: var(--grey); }
.rail-status__num {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--gold-bright);
}

.rail-foot {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(143, 163, 181, .28);
  display: grid;
  gap: 10px;
}
.rail-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.7;
  letter-spacing: .04em;
  color: var(--grey);
  word-break: break-all;
  max-width: none;
}

.rail-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: rgba(143, 163, 181, .22);
}
.rail-progress__fill {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--gold);
  transform: scaleX(var(--progress, 0));
  transform-origin: left center;
  transition: transform .12s linear;
}

@media (min-width: 1024px) {
  .site-rail {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    right: auto;
    width: var(--rail-w);
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-bottom: 0;
    border-right: 1px solid rgba(240, 206, 132, .24);
  }
  .site-rail__head {
    display: block;
    height: auto;
    padding: 26px 20px 18px;
    border-bottom: 1px solid rgba(143, 163, 181, .28);
  }
  .nav-toggle { display: none; }
  .rail-nav {
    position: static;
    top: auto;
    left: auto;
    right: auto;
    bottom: auto;
    transform: none;
    visibility: visible;
    flex: 1 1 auto;
    padding: 18px 16px 20px;
    background: transparent;
    border-right: 0;
  }
  .nav-link { padding: 9px 10px; }
  .tag-rail { flex-wrap: wrap; overflow: visible; padding-bottom: 0; }
  .rail-progress {
    left: auto;
    right: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    height: auto;
  }
  .rail-progress__fill {
    height: 100%;
    transform: scaleY(var(--progress, 0));
    transform-origin: center top;
  }
}

/* ---------- 6. 页脚 ---------- */
.site-foot {
  position: relative;
  margin-top: clamp(48px, 8vw, 96px);
  padding: clamp(36px, 6vw, 72px) clamp(18px, 5vw, 48px) 24px;
  background: var(--blue-900);
  color: rgba(247, 245, 240, .86);
  border-top: 1px solid rgba(240, 206, 132, .3);
}
.site-foot::before {
  content: "";
  position: absolute;
  top: 0;
  left: clamp(18px, 5vw, 48px);
  width: 96px;
  height: 4px;
  background: var(--gold);
}
.foot-grid {
  max-width: var(--shell);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
}
@media (min-width: 720px) {
  .foot-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 36px; }
}
@media (min-width: 1024px) {
  .foot-grid { gap: 48px; }
}
.foot-col { display: flex; flex-direction: column; gap: 12px; }
.foot-col__title {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--gold-bright);
  max-width: none;
}
.foot-brand {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.02em;
  color: #fff;
}
.foot-sub {
  font-size: 12px;
  letter-spacing: .06em;
  color: var(--gold);
  opacity: .92;
}
.foot-links { display: grid; gap: 8px; }
.foot-link {
  font-size: 15px;
  color: rgba(247, 245, 240, .84);
  border-bottom: 1px solid transparent;
  align-self: flex-start;
  transition: color var(--ease), border-color var(--ease);
}
.foot-link:hover { color: #fff; border-bottom-color: var(--gold); }
.foot-icp {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .06em;
  color: var(--grey);
  max-width: none;
}
.foot-contact {
  font-size: 14px;
  line-height: 1.7;
  color: rgba(247, 245, 240, .88);
  max-width: 40ch;
}
.foot-contact__key {
  display: inline-block;
  min-width: 46px;
  margin-right: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--grey);
}
.foot-note {
  font-size: 13px;
  line-height: 1.8;
  color: var(--grey);
  max-width: 44ch;
}
.foot-bottom {
  max-width: var(--shell);
  margin: 36px auto 0;
  padding-top: 16px;
  border-top: 1px solid rgba(143, 163, 181, .28);
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--grey);
}
.foot-bottom__meta, .foot-bottom__stamp { max-width: none; }

.to-top {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--blue-800);
  color: var(--gold-bright);
  border: 1px solid rgba(240, 206, 132, .5);
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity var(--ease), transform var(--ease), visibility var(--ease), border-color var(--ease);
}
.to-top[data-visible] { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { border-color: var(--gold-bright); color: #fff; }
.to-top__arrow { font-family: var(--font-mono); line-height: 1; }
@media (min-width: 1024px) {
  .to-top { right: 28px; bottom: 28px; }
}

/* ---------- 7. 通用版式 ---------- */
.shell {
  width: 100%;
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0 clamp(18px, 5vw, 40px);
}
.section { padding: clamp(48px, 8vw, 96px) 0; }
.section--paper { background: var(--paper); }
.section--soft { background: #EFEAE2; }
.section--violet { background: #EDE7F2; }
.section--dark { background: var(--blue-900); color: rgba(247, 245, 240, .88); }
.section--dark h1, .section--dark h2, .section--dark h3 { color: #fff; }
.stack-up { position: relative; margin-top: -24px; }

.section-head { max-width: 72ch; margin-bottom: clamp(24px, 4vw, 44px); }
.eyebrow {
  display: block;
  margin-bottom: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--gold);
  max-width: none;
}
.section--dark .eyebrow { color: var(--gold-bright); }
.lede {
  font-size: clamp(16px, 1.5vw, 18px);
  line-height: 1.9;
  color: rgba(20, 24, 28, .82);
  max-width: 62ch;
}
.section--dark .lede { color: rgba(247, 245, 240, .82); }

.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 22px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--grey);
}
.crumbs__item { max-width: none; }
.crumbs__item a { color: var(--grey); transition: color var(--ease); }
.crumbs__item a:hover { color: var(--gold); }
.crumbs__sep { opacity: .5; }
.crumbs__current { color: var(--ink); }
.section--dark .crumbs__current { color: var(--paper); }

/* ---------- 8. 标签 / 叠层卡 / 图片容器 ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--r-archive);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  background: rgba(110, 92, 134, .14);
  color: #4B3F61;
  border: 1px solid rgba(110, 92, 134, .3);
}
.tag--violet { background: rgba(110, 92, 134, .14); color: #4B3F61; border-color: rgba(110, 92, 134, .3); }
.tag--mint { background: rgba(79, 169, 138, .16); color: #2A6A55; border-color: rgba(79, 169, 138, .38); }
.tag--wine { background: rgba(122, 47, 53, .14); color: var(--wine); border-color: rgba(122, 47, 53, .32); }
.tag--gold { background: rgba(217, 164, 65, .20); color: #7A5A12; border-color: rgba(217, 164, 65, .48); }

.paper-layer {
  position: relative;
  background: var(--paper);
  border: 1px solid rgba(20, 24, 28, .12);
  border-radius: var(--r-archive);
  box-shadow: var(--layer-shadow);
}
.section--dark .paper-layer { background: var(--blue-800); border-color: rgba(240, 206, 132, .26); }

.media-frame {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(20, 24, 28, .12);
  border-radius: var(--r-archive);
  background: var(--blue-800);
}
.media-frame img { width: 100%; height: 100%; object-fit: cover; }
.media-frame--wide { aspect-ratio: 16 / 9; }
.media-frame--tall { aspect-ratio: 3 / 4; }
.media-frame--square { aspect-ratio: 1 / 1; }
.media-frame--offset { box-shadow: 8px 8px 0 rgba(217, 164, 65, .28); }
.media-frame__tag {
  position: absolute;
  left: 12px;
  bottom: 12px;
  padding: 4px 8px;
  border-radius: var(--r-archive);
  background: rgba(15, 42, 68, .86);
  color: var(--gold-bright);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .08em;
}

/* ---------- 9. 网格 ---------- */
.grid { display: grid; gap: clamp(18px, 3vw, 32px); grid-template-columns: 1fr; }
@media (min-width: 720px) {
  .grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid--asym { grid-template-columns: minmax(0, 5fr) minmax(0, 3fr); }
}

/* ---------- 10. 进场与章节锚点 ---------- */
[data-section] { scroll-margin-top: calc(var(--head-h) + 20px); }
html.js-ready [data-reveal] { opacity: 0; transform: translateY(12px); }
html.js-ready [data-reveal].is-in {
  opacity: 1;
  transform: none;
  transition: opacity .5s ease, transform .5s ease;
}
[data-index-link][aria-current="true"] { color: var(--gold); }

/* ---------- 11. 动效偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  html.js-ready [data-reveal] { opacity: 1; transform: none; }
}
