/* ============ 9博平台 · 数字工坊 / site.css ============ */

*,
*::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, figure, blockquote, dl, dd { margin: 0; }

ul, ol { margin: 0; padding: 0; list-style: none; }

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

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

a { color: inherit; }

address { font-style: normal; }

:root {
  --ink-950: #08111B;
  --ink-900: #0B1622;
  --ink-800: #122235;
  --glass: rgba(27, 49, 71, 0.78);
  --slate-600: #63788A;
  --mist-300: #A9BAC6;
  --paper-100: #F4EEE2;
  --amber-400: #F2B544;
  --amber-200: #F8D98A;
  --vermilion-500: #E4572E;
  --teal-400: #2FD3C0;
  --white-050: #F7FAFC;

  --font-display: 'Barlow Condensed', 'DIN Alternate', 'Noto Sans SC', 'Source Han Sans SC', 'PingFang SC', sans-serif;
  --font-body: 'Noto Sans SC', 'Source Han Sans SC', 'PingFang SC', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;

  --rail-w: 184px;
  --shell-h: 64px;
  --maxw: 1280px;
  --gutter: clamp(20px, 4vw, 64px);
  --dur: 200ms;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

body {
  background-color: var(--ink-900);
  background-image:
    linear-gradient(180deg, rgba(18, 34, 53, 0.72) 0%, rgba(11, 22, 34, 0) 42%),
    linear-gradient(180deg, var(--ink-900), var(--ink-900));
  color: var(--white-050);
  font-family: var(--font-body);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.85;
  padding-left: var(--rail-w);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

::selection {
  background: var(--vermilion-500);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--teal-400);
  outline-offset: 3px;
}

#main-content {
  display: block;
  scroll-margin-top: 96px;
}

/* ---------- 跳转链接 ---------- */
.skip-link {
  position: absolute;
  top: -72px;
  left: 8px;
  z-index: 200;
  padding: 10px 18px;
  background: var(--amber-400);
  color: var(--ink-950);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
  border-radius: 2px;
  transition: top 160ms var(--ease);
}

.skip-link:focus {
  top: 8px;
}

/* ---------- 侧边轨道 ---------- */
.rail {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--rail-w);
  z-index: 80;
  display: flex;
  background: linear-gradient(180deg, rgba(18, 34, 53, 0.94) 0%, rgba(8, 17, 27, 0.98) 100%);
  border-right: 1px solid rgba(99, 120, 138, 0.22);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.rail__inner {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  padding: 28px 18px 24px;
}

.rail__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--white-050);
}

.rail__mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  background: var(--amber-400);
  color: var(--ink-950);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  clip-path: polygon(0 0, 100% 0, 100% 72%, 72% 100%, 0 100%);
  transition: background var(--dur) var(--ease);
}

.rail__brand:hover .rail__mark {
  background: var(--amber-200);
}

.rail__brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.rail__brand-name {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.3;
  color: var(--white-050);
}

.rail__brand-sub {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.2em;
  line-height: 1.3;
  color: var(--slate-600);
  text-transform: uppercase;
}

.rail__edition {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 8px;
  background: rgba(242, 181, 68, 0.07);
  border: 1px solid rgba(242, 181, 68, 0.28);
}

.rail__edition-key {
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.16em;
  color: var(--amber-400);
}

.rail__edition-val {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--amber-200);
  white-space: nowrap;
}

/* ---------- 移动端开关 ---------- */
.nav-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(27, 49, 71, 0.6);
  border: 1px solid rgba(169, 186, 198, 0.34);
  border-radius: 2px;
  color: var(--mist-300);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}

.nav-toggle:hover {
  color: var(--amber-400);
  border-color: rgba(242, 181, 68, 0.6);
}

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

.nav-toggle__bar {
  display: block;
  width: 100%;
  height: 1.5px;
  background: currentColor;
  transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
}

.rail[data-open] .nav-toggle__bar:nth-child(1) {
  transform: translateY(2.75px) rotate(45deg);
}

.rail[data-open] .nav-toggle__bar:nth-child(2) {
  transform: translateY(-2.75px) rotate(-45deg);
}

.nav-toggle__label {
  line-height: 1;
}

/* ---------- 导航 ---------- */
.nav {
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(99, 120, 138, 0.45) transparent;
}

.nav::-webkit-scrollbar { width: 4px; }
.nav::-webkit-scrollbar-thumb { background: rgba(99, 120, 138, 0.45); }

.nav__list {
  display: flex;
  flex-direction: column;
}

.nav__item { margin: 0; }

.nav__link {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 9px 0 9px 14px;
  border-left: 1px solid rgba(99, 120, 138, 0.3);
  color: var(--mist-300);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.45;
  text-decoration: none;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}

.nav__link:hover,
.nav__link:focus-visible {
  color: var(--white-050);
  border-left-color: var(--amber-400);
  background: linear-gradient(90deg, rgba(242, 181, 68, 0.13), transparent 86%);
}

.nav__link[aria-current="page"] {
  color: var(--amber-400);
  border-left-color: var(--vermilion-500);
  font-weight: 700;
  background: linear-gradient(90deg, rgba(228, 87, 46, 0.14), transparent 86%);
}

.nav__idx {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 400;
  letter-spacing: 0.06em;
  color: var(--slate-600);
  transition: color var(--dur) var(--ease);
}

.nav__link:hover .nav__idx { color: var(--amber-200); }
.nav__link[aria-current="page"] .nav__idx { color: var(--vermilion-500); }

.nav__label { min-width: 0; }

.nav__foot {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 16px;
  margin-top: auto;
  border-top: 1px solid rgba(99, 120, 138, 0.2);
}

.nav__foot .btn {
  width: 100%;
  padding: 10px 6px;
  font-size: 12px;
}

.nav__note {
  font-size: 11px;
  line-height: 1.65;
  color: var(--slate-600);
}

/* ---------- 滚动进度 ---------- */
.rail__progress {
  position: absolute;
  top: 0;
  right: -1px;
  width: 2px;
  height: 100%;
  background: rgba(99, 120, 138, 0.16);
  pointer-events: none;
  overflow: hidden;
}

.rail__progress-fill {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, var(--amber-400), var(--vermilion-500));
  transform: scaleY(var(--progress, 0));
  transform-origin: top center;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border: 1px solid transparent;
  border-radius: 2px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.4;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.btn--solid {
  background: var(--vermilion-500);
  border-color: var(--vermilion-500);
  color: #fff;
}

.btn--solid:hover {
  background: #F26A41;
  border-color: #F26A41;
  color: #fff;
}

.btn--ghost {
  background: transparent;
  border-color: rgba(169, 186, 198, 0.38);
  color: var(--mist-300);
}

.btn--ghost:hover {
  border-color: var(--amber-400);
  color: var(--amber-200);
  background: rgba(242, 181, 68, 0.07);
}

.btn--block { width: 100%; }

/* ---------- 页脚 ---------- */
.site-foot {
  position: relative;
  margin-top: clamp(48px, 7vw, 96px);
  background: var(--ink-950);
  border-top: 1px solid rgba(99, 120, 138, 0.22);
  color: var(--mist-300);
}

.site-foot::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: repeating-linear-gradient(90deg, rgba(242, 181, 68, 0.55) 0 1px, rgba(99, 120, 138, 0) 1px 26px);
  pointer-events: none;
}

.site-foot__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(44px, 6vw, 76px) var(--gutter) 0;
}

.site-foot__top {
  display: grid;
  gap: 14px;
  padding-bottom: clamp(26px, 3.6vw, 42px);
  border-bottom: 1px solid rgba(99, 120, 138, 0.2);
}

.site-foot__wordmark {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.4vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--white-050);
}

.site-foot__summary {
  max-width: 56ch;
  font-size: 14px;
  line-height: 1.75;
  color: var(--slate-600);
}

.site-foot__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(24px, 3.4vw, 48px);
  padding: clamp(28px, 4vw, 46px) 0;
}

.site-foot__col { min-width: 0; }

.site-foot__col-title {
  position: relative;
  display: block;
  padding-bottom: 10px;
  margin-bottom: 14px;
  border-bottom: 1px solid rgba(99, 120, 138, 0.22);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  line-height: 1.4;
  color: var(--amber-400);
  text-transform: uppercase;
}

.site-foot__col-title::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 1px;
  margin-right: 8px;
  vertical-align: middle;
  background: var(--amber-400);
}

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

.site-foot__link {
  display: inline-block;
  padding: 5px 0;
  border-bottom: 1px solid transparent;
  font-size: 14px;
  line-height: 1.6;
  color: var(--mist-300);
  text-decoration: none;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.site-foot__link:hover {
  color: var(--amber-200);
  border-bottom-color: rgba(242, 181, 68, 0.65);
}

.site-foot__contact-line {
  padding: 3px 0;
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.02em;
  line-height: 1.7;
  color: var(--white-050);
  word-break: break-word;
}

.site-foot__address {
  margin-top: 10px;
  padding-left: 10px;
  border-left: 1px solid rgba(99, 120, 138, 0.4);
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--slate-600);
}

.site-foot__base {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  padding: 18px 0 26px;
  border-top: 1px solid rgba(99, 120, 138, 0.2);
  font-size: 12px;
  line-height: 1.6;
  color: var(--slate-600);
}

.site-foot__copyright,
.site-foot__footnote { margin: 0; }

.site-foot__icp {
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  color: var(--mist-300);
}

/* ---------- 通用布局 ---------- */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

.wrap--narrow {
  max-width: 720px;
}

.prose {
  max-width: 720px;
  font-size: 17px;
  font-weight: 400;
  line-height: 1.85;
  color: var(--mist-300);
}

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

.prose strong { color: var(--white-050); font-weight: 700; }

.prose a {
  color: var(--teal-400);
  text-decoration: none;
  border-bottom: 1px solid rgba(47, 211, 192, 0.45);
}

.prose a:hover { border-bottom-color: var(--teal-400); }

.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--amber-400);
}

/* ---------- 面包屑 ---------- */
.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 24px 0 0;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--slate-600);
}

.crumbs a {
  color: var(--mist-300);
  text-decoration: none;
  transition: color var(--dur) var(--ease);
}

.crumbs a:hover { color: var(--amber-400); }

.crumbs [aria-current="page"] { color: var(--white-050); }

.crumbs__sep {
  color: rgba(99, 120, 138, 0.65);
}

/* ---------- 章节头 ---------- */
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 14px;
  padding-bottom: 14px;
  margin-bottom: clamp(24px, 3vw, 40px);
  border-bottom: 1px solid rgba(99, 120, 138, 0.24);
}

.section-head__idx {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--vermilion-500);
}

.section-head__title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 2.6vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.15;
  color: var(--white-050);
}

/* ---------- 标签 ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  background: rgba(242, 181, 68, 0.1);
  border: 1px solid rgba(242, 181, 68, 0.34);
  color: var(--amber-200);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  line-height: 1.5;
  text-transform: uppercase;
  clip-path: polygon(0 0, 100% 0, 100% 68%, 74% 100%, 0 100%);
}

.tag--hot {
  background: var(--vermilion-500);
  border-color: var(--vermilion-500);
  color: #fff;
}

.tag--teal {
  background: rgba(47, 211, 192, 0.1);
  border-color: rgba(47, 211, 192, 0.36);
  color: var(--teal-400);
}

/* ---------- 网格与卡片 ---------- */
.grid {
  display: grid;
  gap: clamp(16px, 2.2vw, 28px);
}

.grid--2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

.card {
  position: relative;
  padding: clamp(18px, 2.4vw, 28px);
  background: var(--ink-800);
  border: 1px solid rgba(99, 120, 138, 0.2);
  border-left: 2px solid var(--slate-600);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), border-left-color var(--dur) var(--ease);
}

.card:hover,
.card:focus-within {
  background: #16293F;
  border-color: rgba(99, 120, 138, 0.36);
  border-left-color: var(--amber-400);
}

/* ---------- 图片容器 ---------- */
.figure { margin: 0; }

.figure__media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background-color: var(--ink-800);
  background-image: var(--figure-src, none);
  background-size: cover;
  background-position: center;
  border: 1px solid rgba(99, 120, 138, 0.22);
}

.figure__media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(45deg, rgba(242, 181, 68, 0.05) 0 2px, rgba(0, 0, 0, 0) 2px 12px);
  pointer-events: none;
}

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

.figure__media--wide { aspect-ratio: 21 / 9; }
.figure__media--tall { aspect-ratio: 4 / 5; }
.figure__media--square { aspect-ratio: 1 / 1; }

.figure__caption {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.03em;
  line-height: 1.65;
  color: var(--slate-600);
}

/* ---------- 线 ---------- */
.rule {
  height: 1px;
  border: 0;
  margin: 0;
  background: rgba(99, 120, 138, 0.24);
}

.rule--ticks {
  height: 8px;
  background: repeating-linear-gradient(90deg, rgba(99, 120, 138, 0.55) 0 1px, rgba(0, 0, 0, 0) 1px 16px);
}

/* ---------- 纸感分区 ---------- */
.zone--paper {
  padding: clamp(32px, 5vw, 72px) 0;
  background: var(--paper-100);
  color: var(--ink-900);
}

.zone--paper .section-head { border-bottom-color: rgba(11, 22, 34, 0.2); }
.zone--paper .section-head__title { color: var(--ink-900); }
.zone--paper .section-head__idx { color: var(--vermilion-500); }
.zone--paper .prose { color: #2A3A47; }
.zone--paper .figure__caption { color: #5B6E7D; }
.zone--paper .figure__media { border-color: rgba(11, 22, 34, 0.16); }
.zone--paper .eyebrow { color: #9A6300; }

/* ---------- 移动端 / 平板 ---------- */
@media (max-width: 1080px) {
  body {
    padding-left: 0;
    padding-top: var(--shell-h);
  }

  .rail {
    top: 0;
    left: 0;
    right: 0;
    bottom: auto;
    width: auto;
    height: var(--shell-h);
    border-right: 0;
    border-bottom: 1px solid rgba(99, 120, 138, 0.22);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .rail__inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 var(--gutter);
  }

  .rail__brand-name { font-size: 15px; }
  .rail__brand-sub { font-size: 10px; }
  .rail__edition { display: none; }

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

  .nav {
    position: fixed;
    inset: var(--shell-h) 0 0 0;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 24px var(--gutter) 48px;
    background: rgba(8, 17, 27, 0.985);
    border-top: 1px solid rgba(99, 120, 138, 0.2);
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-100%);
    transition: transform var(--dur) var(--ease), opacity 160ms linear, visibility 0s linear var(--dur);
  }

  .rail[data-open] .nav {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    transition: transform var(--dur) var(--ease), opacity 160ms linear;
  }

  .nav__list { gap: 0; }

  .nav__link {
    padding: 15px 0 15px 16px;
    border-left-width: 2px;
    font-size: 15px;
  }

  .nav__idx { font-size: 11px; }

  .nav__foot { margin-top: 10px; }

  .nav__foot .btn {
    padding: 14px 10px;
    font-size: 14px;
  }

  .nav__note { font-size: 12px; }

  .rail__progress {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 2px;
  }

  .rail__progress-fill {
    transform: scaleX(var(--progress, 0));
    transform-origin: left center;
  }

  .site-foot { margin-top: clamp(40px, 8vw, 72px); }

  .site-foot__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px 24px;
  }

  .site-foot__base {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
}

@media (max-width: 620px) {
  body { font-size: 16px; }

  .prose { font-size: 16px; line-height: 1.8; }

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

  .site-foot__wordmark { font-size: clamp(1.9rem, 9vw, 2.6rem); }

  .nav__link { font-size: 14.5px; }
}

/* ---------- 减少动效 ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

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

  .nav,
  .rail[data-open] .nav,
  .rail__progress-fill {
    transition: none !important;
  }
}
