/* ============================================================
   新莆京娱 · 全站共享样式 /assets/site.css
   品牌轨道 + 编号章节 + 纵向注释
   ============================================================ */

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

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

body { margin: 0; }

h1, h2, h3, h4, h5, h6, p, ul, ol, li, figure, blockquote, dl, dd { margin: 0; padding: 0; }

ul, ol { list-style: none; }

img, svg, video { display: block; max-width: 100%; }

a { color: inherit; }

button, input, select, textarea { font: inherit; color: inherit; }

button { background: none; border: 0; padding: 0; cursor: pointer; }

table { border-collapse: collapse; width: 100%; }

/* ---------- tokens ---------- */
:root {
  --ink: #0B0A14;
  --ink-soft: #170F24;
  --red: #8E1B2E;
  --red-action: #C8203C;
  --gold: #E8B44A;
  --gold-soft: #F6E6BB;
  --blue: #232B54;
  --neon: #6B4CE6;
  --surface: #1B1829;
  --text: #EDE9F3;
  --muted: #A79FB8;
  --line: #43406B;
  --line-soft: #2B2544;

  --rail-w: 248px;
  --bar-h: 77px;
  --shell: 1180px;
  --measure: 36em;

  --font-body: "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --font-num: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --r-card: 28px 28px 28px 8px;
  --r-chip: 14px 14px 14px 3px;
}

/* ---------- base ---------- */
body {
  min-height: 100%;
  padding-top: var(--bar-h);
  background-color: var(--ink);
  background-image:
    radial-gradient(900px 620px at 84% -6%, rgba(142, 27, 46, 0.34), transparent 68%),
    radial-gradient(760px 540px at 4% 104%, rgba(107, 76, 230, 0.20), transparent 70%);
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.85;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

@media (max-width: 767px) {
  body { background-attachment: scroll; }
}

@media (min-width: 1024px) {
  body { padding-top: 0; padding-left: var(--rail-w); }
}

h1, h2, h3, h4 {
  font-weight: 900;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--text);
}

h1 { font-size: clamp(34px, 5.4vw, 62px); }
h2 { font-size: clamp(26px, 3.4vw, 40px); }
h3 { font-size: clamp(20px, 2.2vw, 26px); }
h4 { font-size: 18px; }

p { text-wrap: pretty; }

::selection { background: var(--red-action); color: #fff; }

:focus-visible {
  outline: 2px solid var(--neon);
  outline-offset: 3px;
  border-radius: 6px;
}

#main-content { display: block; }
#main-content:focus { outline: none; }

/* ---------- skip link ---------- */
.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 300;
  padding: 10px 18px;
  border-radius: 12px 12px 12px 4px;
  background: var(--gold);
  color: #170F24;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transform: translateY(-220%);
  transition: transform 200ms var(--ease);
}

.skip-link:focus {
  transform: translateY(0);
}

/* ---------- 品牌轨道 ---------- */
.site-rail {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 120;
  display: flex;
  flex-direction: column;
  max-height: 100vh;
  overflow-y: auto;
  padding: 10px 16px 12px;
  background: linear-gradient(180deg, rgba(23, 15, 36, 0.98) 0%, rgba(11, 10, 20, 0.99) 100%);
  border-bottom: 1px solid var(--line-soft);
  color: var(--text);
}

.site-rail__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 54px;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-decoration: none;
  color: var(--text);
}

.brand__mark {
  display: block;
  font-size: 22px;
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.brand__mark::after {
  content: "";
  display: block;
  width: 44px;
  height: 2px;
  margin-top: 6px;
  background: linear-gradient(90deg, var(--gold), rgba(232, 180, 74, 0));
}

.brand__sub {
  display: block;
  font-size: 11px;
  font-weight: 300;
  line-height: 1.4;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.nav-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: none;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-chip);
  background: rgba(35, 43, 84, 0.45);
  color: var(--gold-soft);
  font-size: 13px;
  letter-spacing: 0.08em;
  transition: border-color 220ms var(--ease), color 220ms var(--ease);
}

.nav-toggle:hover { border-color: var(--neon); }

.nav-toggle__bars {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 18px;
}

.nav-toggle__bars span {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 240ms var(--ease), opacity 200ms var(--ease);
}

.site-rail[data-open] .nav-toggle__bars span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.site-rail[data-open] .nav-toggle__bars span:nth-child(2) { opacity: 0; }
.site-rail[data-open] .nav-toggle__bars span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.nav-toggle__text { font-weight: 500; }

/* ---------- 命令栏导航 ---------- */
.site-nav { display: none; margin-top: 14px; }

.site-rail[data-open] .site-nav { display: block; }

.site-nav__list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.site-nav__item { display: block; }

.site-nav__link {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 10px 12px 10px 16px;
  border-radius: 12px 12px 12px 4px;
  color: var(--muted);
  font-size: 15px;
  text-decoration: none;
  transition: color 220ms var(--ease), background-color 220ms var(--ease);
}

.site-nav__link::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 50%;
  width: 3px;
  height: 0;
  border-radius: 3px;
  background: var(--gold);
  transform: translateY(-50%);
  transition: height 260ms var(--ease);
}

.site-nav__link:hover {
  color: var(--text);
  background-color: rgba(35, 43, 84, 0.42);
}

.site-nav__link:hover::before { height: 16px; }

.site-nav__link[aria-current="page"] {
  color: var(--text);
  background: linear-gradient(90deg, rgba(200, 32, 60, 0.40), rgba(200, 32, 60, 0) 82%);
}

.site-nav__link[aria-current="page"]::before { height: 24px; }

.site-nav__idx {
  font-family: var(--font-num);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--line);
  transition: color 220ms var(--ease);
}

.site-nav__link[aria-current="page"] .site-nav__idx { color: var(--gold); }

.site-nav__label { font-weight: 500; }

/* ---------- 轨道引导块 ---------- */
.rail-cta {
  display: none;
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid rgba(232, 180, 74, 0.36);
  border-radius: 20px 20px 20px 6px;
  background: linear-gradient(140deg, rgba(142, 27, 46, 0.30), rgba(35, 43, 84, 0.24));
  color: var(--gold-soft);
  text-decoration: none;
  transition: border-color 240ms var(--ease), transform 240ms var(--ease);
}

.site-rail[data-open] .rail-cta { display: block; }

.rail-cta:hover { border-color: var(--gold); }

.rail-cta__label {
  display: block;
  font-size: 11px;
  font-weight: 300;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.rail-cta__text {
  display: block;
  margin-top: 4px;
  font-size: 14px;
  font-weight: 700;
}

/* ---------- 进度光带 ---------- */
.rail-progress {
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--gold), var(--red-action));
  transform-origin: left center;
  transform: scaleX(var(--p, 0));
  pointer-events: none;
}

/* ---------- 桌面：轨道改为左竖栏 ---------- */
@media (min-width: 1024px) {
  .site-rail {
    top: 0;
    left: 0;
    right: auto;
    bottom: 0;
    width: var(--rail-w);
    max-height: none;
    overflow: visible;
    padding: 34px 20px 26px;
    border-bottom: 0;
    border-right: 1px solid var(--line-soft);
    background: linear-gradient(168deg, #170F24 0%, #0B0A14 56%, #160d21 100%);
  }

  .site-rail__bar {
    display: block;
    min-height: 0;
  }

  .brand__mark { font-size: 26px; }
  .brand__sub { margin-top: 6px; }

  .nav-toggle { display: none; }

  .site-nav {
    display: block;
    flex: 1 1 auto;
    margin-top: 32px;
  }

  .rail-cta { display: block; margin-top: auto; }

  .rail-progress {
    left: auto;
    right: -1px;
    top: 0;
    bottom: 0;
    width: 2px;
    height: 100%;
    background: linear-gradient(180deg, var(--gold), var(--red-action));
    transform-origin: top center;
    transform: scaleY(var(--p, 0));
  }
}

/* ---------- 页脚 ---------- */
.site-foot {
  position: relative;
  margin-top: clamp(80px, 12vh, 150px);
  background: linear-gradient(180deg, #170F24 0%, #0B0A14 92%);
  border-top: 1px solid rgba(232, 180, 74, 0.34);
}

.site-foot__inner {
  width: 100%;
  max-width: var(--shell);
  margin: 0 auto;
  padding: clamp(46px, 6vw, 82px) 24px clamp(30px, 4vw, 52px);
}

.site-foot__grid {
  display: grid;
  gap: clamp(32px, 4vw, 56px);
}

@media (min-width: 880px) {
  .site-foot__grid { grid-template-columns: 1.2fr 1.5fr 1.3fr; }
}

.foot-brand__mark {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -0.01em;
  color: var(--text);
}

.foot-brand__mark::after {
  content: "";
  display: block;
  width: 56px;
  height: 2px;
  margin-top: 10px;
  background: linear-gradient(90deg, var(--gold), rgba(232, 180, 74, 0));
}

.foot-brand__line {
  margin-top: 16px;
  max-width: 22em;
  font-size: 15px;
  color: var(--text);
}

.foot-brand__note {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 300;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.foot-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
}

.foot-nav__group { min-width: 0; }

.foot-nav__title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--gold);
}

.foot-nav__list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.foot-nav__list a {
  position: relative;
  display: inline-block;
  font-size: 15px;
  color: var(--muted);
  text-decoration: none;
  transition: color 220ms var(--ease);
}

.foot-nav__list a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 220ms var(--ease);
}

.foot-nav__list a:hover { color: var(--gold-soft); }
.foot-nav__list a:hover::after { transform: scaleX(1); }

.foot-meta { min-width: 0; }

.foot-meta__list {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.foot-meta__list li { display: grid; gap: 2px; }

.foot-meta__key {
  font-size: 11px;
  font-weight: 300;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.foot-meta__val {
  font-size: 14px;
  color: var(--text);
}

.copy-btn {
  display: inline-block;
  justify-self: start;
  padding: 0 0 2px;
  font-size: 14px;
  text-align: left;
  color: var(--gold-soft);
  border-bottom: 1px dashed rgba(232, 180, 74, 0.5);
  transition: color 220ms var(--ease), border-color 220ms var(--ease);
}

.copy-btn:hover {
  color: var(--gold);
  border-color: var(--gold);
}

.copy-btn.is-copied {
  color: #7BE0B0;
  border-color: rgba(123, 224, 176, 0.6);
}

.site-foot__base {
  border-top: 1px solid var(--line-soft);
  background: rgba(11, 10, 20, 0.6);
}

.site-foot__base-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px 28px;
  width: 100%;
  max-width: var(--shell);
  margin: 0 auto;
  padding: 20px 24px 28px;
  font-size: 13px;
  color: var(--muted);
}

.site-foot__base-note {
  font-weight: 300;
  letter-spacing: 0.04em;
}

/* ---------- 通用布局件 ---------- */
.shell {
  width: 100%;
  max-width: var(--shell);
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}

.chapter {
  position: relative;
  padding: clamp(72px, 11vh, 140px) 0;
}

.chapter__head {
  display: flex;
  align-items: flex-start;
  gap: clamp(16px, 3vw, 38px);
  margin-bottom: clamp(26px, 3.6vw, 44px);
}

.chapter__num {
  flex: none;
  font-family: var(--font-num);
  font-size: clamp(46px, 7vw, 96px);
  font-weight: 700;
  line-height: 0.88;
  letter-spacing: -0.04em;
  color: var(--gold);
  opacity: 0.95;
}

.chapter__title { font-size: clamp(26px, 3.6vw, 42px); }

.chapter__kicker {
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 300;
  letter-spacing: 0.2em;
  color: var(--muted);
}

.lede {
  max-width: 30em;
  font-size: clamp(17px, 1.6vw, 20px);
  line-height: 1.8;
  color: var(--text);
}

.prose p {
  max-width: var(--measure);
  color: var(--text);
}

.prose p + p { margin-top: 1.15em; }

.prose strong { color: var(--gold-soft); font-weight: 700; }
.prose em { font-style: normal; color: var(--gold); }

.rule-gold {
  height: 1px;
  border: 0;
  margin: 0;
  background: linear-gradient(90deg, rgba(232, 180, 74, 0.9), rgba(232, 180, 74, 0));
}

.divider {
  height: 1px;
  border: 0;
  margin: 0;
  background: var(--line-soft);
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding-top: clamp(24px, 4vw, 48px);
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.breadcrumb a {
  color: var(--muted);
  text-decoration: none;
  transition: color 200ms var(--ease);
}

.breadcrumb a:hover { color: var(--gold); }

.breadcrumb__sep { color: var(--line); }

.breadcrumb [aria-current="page"] { color: var(--gold-soft); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 26px;
  border: 1px solid transparent;
  border-radius: 999px 999px 999px 8px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: transform 240ms var(--ease), border-color 240ms var(--ease),
              background-color 240ms var(--ease), color 240ms var(--ease);
}

.btn:hover { transform: translateY(-2px); }

.btn--primary {
  background: linear-gradient(118deg, #C8203C 0%, #8E1B2E 100%);
  border-color: rgba(232, 180, 74, 0.42);
  color: #fff;
}

.btn--primary:hover { border-color: var(--gold); }

.btn--ghost {
  background: rgba(35, 43, 84, 0.36);
  border-color: var(--line);
  color: var(--gold-soft);
}

.btn--ghost:hover { border-color: var(--neon); color: #fff; }

/* ---------- 卡片 ---------- */
.card {
  position: relative;
  padding: clamp(22px, 3vw, 38px);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: linear-gradient(158deg, rgba(27, 24, 41, 0.96) 0%, rgba(23, 15, 36, 0.92) 100%);
  transition: border-color 260ms var(--ease), transform 260ms var(--ease);
}

.card:hover { border-color: var(--neon); }

.card--index { border-radius: 24px 24px 24px 6px; }

.card--data {
  background: linear-gradient(158deg, rgba(35, 43, 84, 0.55), rgba(27, 24, 41, 0.95));
}

.card--compare { border-radius: 36px 12px 36px 12px; }

.card__label {
  font-family: var(--font-num);
  font-size: 12px;
  letter-spacing: 0.16em;
  color: var(--gold);
}

.card__title {
  margin-top: 10px;
  font-size: clamp(19px, 2vw, 24px);
  font-weight: 700;
  line-height: 1.4;
}

.card__meta {
  margin-top: 14px;
  font-size: 14px;
  color: var(--muted);
}

/* ---------- 标签 ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-chip);
  background: rgba(35, 43, 84, 0.55);
  color: var(--gold-soft);
  font-size: 12px;
  letter-spacing: 0.12em;
  transition: background-color 220ms var(--ease), border-color 220ms var(--ease), color 220ms var(--ease);
}

.tag:hover { border-color: var(--neon); }

.tag[data-active="true"] {
  background: var(--red);
  border-color: var(--red-action);
  color: #fff;
}

/* ---------- 数据块 ---------- */
.metric {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric__value {
  font-family: var(--font-num);
  font-size: clamp(30px, 4vw, 46px);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--gold-soft);
}

.metric__label {
  font-size: 13px;
  letter-spacing: 0.12em;
  color: var(--muted);
}

/* ---------- 纵向注释 ---------- */
.anno {
  writing-mode: vertical-rl;
  font-size: 13px;
  font-weight: 300;
  letter-spacing: 0.16em;
  color: var(--muted);
}

/* ---------- 图片容器 ---------- */
.media {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 32px 32px 32px 10px;
  background:
    radial-gradient(120% 90% at 78% 12%, rgba(142, 27, 46, 0.55), transparent 62%),
    radial-gradient(90% 80% at 12% 96%, rgba(107, 76, 230, 0.42), transparent 66%),
    linear-gradient(150deg, #232B54 0%, #170F24 58%, #0B0A14 100%);
}

.media--wide { aspect-ratio: 21 / 9; }
.media--square { aspect-ratio: 1 / 1; }
.media--tall { aspect-ratio: 3 / 4; }
.media--free { aspect-ratio: auto; min-height: 220px; }

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

.media__caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 18px 22px;
  background: linear-gradient(0deg, rgba(11, 10, 20, 0.88), rgba(11, 10, 20, 0));
  color: var(--gold-soft);
  font-size: 13px;
  letter-spacing: 0.06em;
}

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

@media (min-width: 760px) {
  .grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1000px) {
  .grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- 显现协议 ---------- */
html.js [data-reveal] {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 320ms var(--ease), transform 320ms var(--ease);
}

html.js [data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html.js [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
  }
}
