/* =========================================================
   28圈官网 · 共享样式表  /assets/site.css
   高原夜空下的数字经卷：矿物色 / 等宽索引 / 克制动效
   ========================================================= */

/* ---------- 1. Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
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; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
img, svg, video { display: block; max-width: 100%; }
table { border-collapse: collapse; width: 100%; }
:focus-visible { outline: 2px solid var(--c-bright); outline-offset: 3px; border-radius: 3px; }

/* ---------- 2. 设计令牌 ---------- */
:root {
  /* 经幡五色 · 矿物色体系 */
  --c-noir:       #0C0E13;   /* 高原夜黑 */
  --c-indigo:     #131E3A;   /* 藏蓝 */
  --c-crimson:    #8E1E27;   /* 深红 */
  --c-turquoise:  #1E7C6C;   /* 松石绿 */
  --c-gold:       #C99A3C;   /* 金 */
  --c-stone:      #6E6A63;   /* 岩灰 */
  --c-cream:      #F1EBDD;   /* 米白 */
  --c-clay:       #B2653F;   /* 陶土 */
  --c-moss:       #4F6B48;   /* 苔绿 */
  --c-bright:     #49B79E;   /* 亮松石 */

  --ink:          var(--c-cream);
  --ink-soft:     rgba(241, 235, 221, .72);
  --ink-faint:    rgba(241, 235, 221, .46);
  --hair:         rgba(201, 154, 60, .24);
  --hair-soft:    rgba(241, 235, 221, .10);
  --panel:        rgba(19, 30, 58, .55);
  --panel-solid:  #111A2F;

  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 26px;

  --shell: 1320px;
  --gutter: clamp(18px, 4vw, 44px);
  --header-h: 62px;
  --ease: cubic-bezier(.22, .61, .36, 1);

  --font-display: "PingFang SC", "Noto Sans SC", "Source Han Sans SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --font-body: var(--font-display);
  --font-mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
}
@media (min-width: 1021px) { :root { --header-h: 76px; } }

/* ---------- 3. 页面底色与底纹 ---------- */
body {
  background-color: var(--c-noir);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.85;
  font-weight: 400;
  letter-spacing: .01em;
  min-height: 100vh;
  overflow-x: hidden;
}
/* 高原夜色光晕：左上深红、右上松石、底部金 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(110% 62% at 8% -8%, rgba(142, 30, 39, .22), transparent 58%),
    radial-gradient(90% 55% at 96% 4%, rgba(30, 124, 108, .18), transparent 60%),
    radial-gradient(70% 50% at 50% 108%, rgba(201, 154, 60, .10), transparent 66%);
}
/* 数字网格底纹 */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .5;
  background-image:
    linear-gradient(rgba(241, 235, 221, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(241, 235, 221, .035) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(80% 62% at 50% 18%, #000 0%, transparent 78%);
  mask-image: radial-gradient(80% 62% at 50% 18%, #000 0%, transparent 78%);
}

main, .site-header, .site-footer { position: relative; z-index: 1; }
main { padding-top: var(--header-h); }
/* 需要出血到头部之下的首屏区块 */
.bleed-top { margin-top: calc(var(--header-h) * -1); }

/* ---------- 4. 中文排版 ---------- */
h1, h2, h3 { font-family: var(--font-display); font-weight: 800; line-height: 1.28; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
h2 { font-size: clamp(1.5rem, 3.4vw, 2.4rem); }
h3 { font-size: clamp(1.15rem, 2.2vw, 1.5rem); }
p { max-width: 68ch; }
strong { font-weight: 800; color: var(--ink); }
code, kbd, samp, .mono { font-family: var(--font-mono); font-size: .92em; }

/* ---------- 5. 通用容器与小标 ---------- */
.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--c-gold);
}
.eyebrow::before {
  content: "";
  width: 24px;
  height: 1px;
  background: var(--c-gold);
  opacity: .7;
}
.rule {
  height: 1px;
  border: 0;
  background: linear-gradient(90deg, var(--hair), transparent 70%);
}

/* ---------- 6. 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5em;
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  padding: 13px 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: background-color .22s var(--ease), color .22s var(--ease),
              border-color .22s var(--ease), transform .22s var(--ease);
}
.btn--primary { background: var(--c-crimson); color: var(--c-cream); }
.btn--primary:hover { background: #A3252F; transform: translateY(-1px); }
.btn--ghost { border-color: var(--hair); color: var(--ink-soft); }
.btn--ghost:hover { border-color: var(--c-gold); color: var(--c-gold); }
.btn--quiet {
  background: rgba(30, 124, 108, .16);
  border-color: rgba(73, 183, 158, .35);
  color: var(--c-bright);
}
.btn--quiet:hover { background: rgba(30, 124, 108, .28); }
.btn:active { transform: translateY(0); }

/* ---------- 7. 面包屑 ---------- */
.breadcrumb { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-faint); }
.breadcrumb ol { display: flex; flex-wrap: wrap; gap: 8px; }
.breadcrumb li { display: flex; align-items: center; gap: 8px; }
.breadcrumb li + li::before { content: "/"; color: var(--c-stone); }
.breadcrumb a { color: var(--ink-soft); }
.breadcrumb a:hover { color: var(--c-bright); }
.breadcrumb [aria-current="page"] { color: var(--c-gold); }

/* ---------- 8. 卡片与图片容器 ---------- */
.card {
  position: relative;
  background: linear-gradient(160deg, rgba(19, 30, 58, .72), rgba(12, 14, 19, .72));
  border: 1px solid var(--hair-soft);
  border-radius: var(--r-md);
  padding: clamp(18px, 2.6vw, 28px);
}
.media-frame {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-lg);
  border: 1px solid var(--hair-soft);
  background: linear-gradient(150deg, #16223F, #0C0E13);
}
.media-frame > img,
.media-frame > svg {
  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::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(241, 235, 221, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(241, 235, 221, .05) 1px, transparent 1px);
  background-size: 32px 32px;
  mix-blend-mode: overlay;
}

/* ---------- 9. 图虫与索引色带 ---------- */
.flag-band {
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg,
    var(--c-crimson) 0 20%,
    var(--c-gold) 20% 40%,
    var(--c-turquoise) 40% 60%,
    #2B4A8F 60% 80%,
    var(--c-clay) 80% 100%);
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.6;
  padding: 3px 9px;
  border-radius: 4px;
  border: 1px solid var(--hair-soft);
  color: var(--ink-faint);
}
.tag--new  { color: var(--c-bright); border-color: rgba(73, 183, 158, .4); background: rgba(73, 183, 158, .08); }
.tag--diff { color: #E0A177; border-color: rgba(178, 101, 63, .5); background: rgba(178, 101, 63, .1); }

/* ---------- 10. 头部 ---------- */
.skip-link {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, -140%);
  z-index: 120;
  padding: 11px 20px;
  border-radius: 0 0 var(--r-sm) var(--r-sm);
  background: var(--c-gold);
  color: #1B1405;
  font-size: 14px;
  font-weight: 700;
  transition: transform .2s var(--ease);
}
.skip-link:focus-visible { transform: translate(-50%, 0); }

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 90;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background-color .3s var(--ease),
              border-color .3s var(--ease),
              box-shadow .3s var(--ease);
}
.site-header[data-scrolled] {
  background: rgba(12, 14, 19, .95);
  border-bottom-color: var(--hair);
  box-shadow: 0 18px 44px -32px rgba(0, 0, 0, .95);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  backdrop-filter: saturate(140%) blur(12px);
}

.header__inner {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  height: var(--header-h);
  padding-inline: var(--gutter);
  display: flex;
  align-items: center;
  gap: clamp(10px, 2vw, 26px);
}

.header__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}
.header__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  margin-left: auto;
}

/* 品牌 */
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand__mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--c-cream);
  background: linear-gradient(145deg, var(--c-crimson), #5E1219);
  box-shadow: inset 0 0 0 1px rgba(201, 154, 60, .42);
}
.brand__text {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 800;
  letter-spacing: .02em;
  color: var(--ink);
}

/* 版本角标 */
.version-badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1;
  padding: 6px 9px;
  border-radius: 4px;
  color: var(--c-gold);
  border: 1px solid rgba(201, 154, 60, .38);
  background: rgba(201, 154, 60, .08);
  white-space: nowrap;
}
.version-badge--sm { font-size: 11px; padding: 5px 8px; margin-top: 14px; }

/* 主导航 */
.nav {
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
}
.nav__list { display: flex; align-items: center; gap: clamp(4px, 1.1vw, 16px); }
.nav__link {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  padding: 10px 5px;
  font-size: 15px;
  color: var(--ink-soft);
  transition: color .2s var(--ease);
}
.nav__link:hover { color: var(--c-cream); }
.nav__index {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--c-stone);
  transition: color .2s var(--ease);
}
.nav__label { white-space: nowrap; }
.nav__link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 3px;
  height: 2px;
  border-radius: 2px;
  background: var(--c-bright);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform .24s var(--ease);
}
.nav__link:hover::after { transform: scaleX(.45); }
.nav__link[aria-current="page"] { color: var(--c-cream); }
.nav__link[aria-current="page"]::after { transform: scaleX(1); }
.nav__link[aria-current="page"] .nav__index { color: var(--c-bright); }

/* 移动导航按钮 */
.nav-toggle {
  display: none;
  align-items: center;
  gap: 9px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--hair);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1;
  transition: background-color .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease);
}
.nav-toggle:hover { border-color: var(--c-gold); color: var(--c-gold); }
.nav-toggle__bars { display: grid; gap: 4px; width: 16px; }
.nav-toggle__bars > span {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}
.nav-toggle[aria-expanded="true"] { border-color: var(--c-bright); color: var(--c-bright); }

/* 阅读进度 */
.progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  overflow: hidden;
}
.progress__bar {
  display: block;
  height: 100%;
  width: 100%;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--c-crimson), var(--c-gold) 45%, var(--c-turquoise) 100%);
  transition: transform .18s linear;
}

/* ---------- 11. 页脚 ---------- */
.site-footer {
  margin-top: clamp(72px, 11vw, 150px);
  background: linear-gradient(180deg, rgba(19, 30, 58, 0) 0%, #101A31 22%, #0A0F1C 100%);
  border-top: 1px solid var(--hair);
}
.site-footer::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg,
    var(--c-crimson) 0 20%,
    var(--c-gold) 20% 40%,
    var(--c-turquoise) 40% 60%,
    #2B4A8F 60% 80%,
    var(--c-clay) 80% 100%);
  opacity: .85;
}
.footer__inner {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding: clamp(30px, 5vw, 54px) var(--gutter) clamp(18px, 3vw, 28px);
}

/* 版本切换器 */
.footer__switcher {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 28px;
  padding-bottom: clamp(20px, 3vw, 30px);
  border-bottom: 1px solid var(--hair-soft);
}
.footer__switcher-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: min(100%, 300px);
}
.footer__switcher-label {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--c-gold);
}
.footer__note {
  font-size: 14px;
  line-height: 1.75;
  color: var(--ink-faint);
  max-width: 52ch;
}
.version-switcher { display: flex; flex-wrap: wrap; gap: 8px; }
.version-chip {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1;
  padding: 10px 15px;
  border-radius: 999px;
  color: var(--ink-soft);
  border: 1px solid var(--hair-soft);
  background: rgba(241, 235, 221, .03);
  transition: color .2s var(--ease), border-color .2s var(--ease), background-color .2s var(--ease);
}
.version-chip:hover { color: var(--c-cream); border-color: var(--hair); }
.version-chip.is-active {
  background: var(--c-gold);
  border-color: var(--c-gold);
  color: #1B1405;
  font-weight: 700;
}

/* 页脚栏目网格 */
.footer__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 26px 24px;
  padding: clamp(26px, 4vw, 46px) 0;
}
.footer__brandcol { grid-column: 1 / -1; }
.footer__blurb {
  font-size: 14.5px;
  line-height: 1.8;
  color: var(--ink-faint);
  max-width: 34ch;
  margin-top: 14px;
}
.footer__col-title {
  position: relative;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .06em;
  color: var(--ink);
  padding-left: 11px;
  margin-bottom: 14px;
}
.footer__col-title::before {
  content: "";
  position: absolute;
  left: 0;
  top: .45em;
  width: 3px;
  height: 12px;
  border-radius: 2px;
  background: var(--c-turquoise);
}
.footer__list { display: flex; flex-direction: column; gap: 10px; }
.footer__link {
  display: inline-block;
  font-size: 14.5px;
  color: var(--ink-soft);
  transition: color .2s var(--ease), transform .2s var(--ease);
}
.footer__link:hover { color: var(--c-bright); transform: translateX(4px); }
.footer__list--plain li {
  font-size: 13.5px;
  line-height: 1.8;
  color: var(--ink-faint);
  overflow-wrap: anywhere;
}

/* 底部固定说明 */
.footer__legal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 22px;
  padding-top: clamp(16px, 2.4vw, 24px);
  border-top: 1px solid var(--hair-soft);
}
.footer__legal-item {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--c-stone);
  max-width: none;
}

/* ---------- 12. 章节索引（页面阶段使用） ---------- */
.index-link {
  display: flex;
  gap: 10px;
  font-size: 14px;
  color: var(--ink-faint);
  padding: 7px 0;
  transition: color .2s var(--ease);
}
.index-link:hover { color: var(--c-cream); }
.index-link[aria-current] { color: var(--c-bright); }

/* ---------- 13. 返回顶部 ---------- */
.to-top {
  position: fixed;
  right: clamp(14px, 3vw, 30px);
  bottom: clamp(14px, 3vw, 30px);
  z-index: 70;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--c-gold);
  background: rgba(19, 30, 58, .92);
  border: 1px solid var(--hair);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity .24s var(--ease), transform .24s var(--ease),
              visibility .24s, color .2s var(--ease), border-color .2s var(--ease);
}
.to-top[data-visible] { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { color: var(--c-cream); border-color: var(--c-gold); }

/* ---------- 14. 响应式 ---------- */
@media (max-width: 1020px) {
  .nav-toggle { display: inline-flex; }

  .nav {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    z-index: 85;
    display: block;
    padding: 12px var(--gutter) 26px;
    max-height: calc(100vh - var(--header-h));
    max-height: calc(100dvh - var(--header-h));
    overflow-y: auto;
    background: linear-gradient(180deg, rgba(12, 14, 19, .99) 0%, #131E3A 100%);
    border-bottom: 1px solid var(--hair);
    box-shadow: 0 30px 50px -26px rgba(0, 0, 0, .9);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-10px);
    transition: opacity .22s var(--ease), transform .26s var(--ease), visibility 0s linear .26s;
  }
  .nav[data-open] {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
    transition-delay: 0s, 0s, 0s;
  }
  .nav__list { flex-direction: column; align-items: stretch; gap: 0; }
  .nav__item { border-bottom: 1px solid var(--hair-soft); }
  .nav__item:last-child { border-bottom: 0; }
  .nav__link {
    width: 100%;
    justify-content: flex-start;
    padding: 15px 4px;
    font-size: 17px;
  }
  .nav__link::after { bottom: 8px; }
  .nav__link:hover::after { transform: scaleX(0); }
  .nav__link[aria-current="page"]::after { transform: scaleX(.18); }
}
@media (min-width: 760px) {
  .footer__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
  .footer__grid { grid-template-columns: 1.5fr 1fr 1fr 1fr 1.3fr; }
  .footer__brandcol { grid-column: auto; }
}
@media (max-width: 420px) {
  .brand__text { font-size: 17px; }
  .brand__mark { width: 30px; height: 30px; font-size: 12px; }
  .header__cta { padding: 10px 14px; font-size: 13.5px; }
  .nav-toggle { padding: 9px 11px; }
  .nav-toggle__label { display: none; }
}

/* ---------- 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;
  }
  .progress { display: none; }
  .to-top { transition: none; }
  .btn--primary:hover { transform: none; }
  .footer__link:hover { transform: none; }
}
