/* =========================================================
   银河指南 · 共享样式表  /assets/site.css
   ========================================================= */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--head-h) + var(--strip-h) + 20px);
}

body {
  margin: 0;
  background-color: var(--void);
  background-image:
    radial-gradient(1200px 620px at 80% -10%, rgba(42, 31, 74, 0.55), transparent 68%),
    radial-gradient(900px 520px at 6% 110%, rgba(14, 23, 48, 0.85), transparent 70%);
  background-repeat: no-repeat;
  color: var(--star);
  font-family: var(--f-body);
  font-size: clamp(16px, 0.5vw + 14px, 18px);
  line-height: 1.75;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
}

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

[hidden] {
  display: none !important;
}

/* ---------- 2. 设计令牌 ---------- */
:root {
  /* 色彩 */
  --void: #070B18;
  --night: #0E1730;
  --dust: #2A1F4A;
  --cyan: #4FE3D0;
  --gold: #F2C14E;
  --star: #F4F6FB;
  --haze: #A7B0C8;
  --orbit: #2E3A5C;
  --coral: #FF7A6B;
  --node: #7FA8B8;

  /* 字体 */
  --f-display: "Noto Serif SC", "Source Han Serif SC", "Songti SC", Georgia, "Times New Roman", serif;
  --f-body: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;

  /* 尺寸 */
  --shell: 1280px;
  --pad: clamp(20px, 4.6vw, 64px);
  --head-h: 64px;
  --strip-h: 42px;
  --radius: 4px;
}

/* ---------- 3. 基础排版 ---------- */
h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--f-display);
  font-weight: 600;
  line-height: 1.26;
  letter-spacing: 0.04em;
  color: var(--star);
}

h1 {
  font-size: clamp(32px, 4.4vw, 64px);
  letter-spacing: 0.03em;
}

h2 {
  font-size: clamp(24px, 2.8vw, 44px);
}

h3 {
  font-size: clamp(20px, 1.9vw, 32px);
}

h4 {
  font-size: clamp(17px, 1.2vw, 24px);
}

p {
  margin: 0;
}

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

strong {
  color: var(--star);
  font-weight: 600;
}

small {
  font-size: 13px;
  color: var(--node);
}

a {
  color: var(--cyan);
  text-decoration: none;
  text-underline-offset: 3px;
  transition: color 0.2s ease, opacity 0.2s ease;
}

a:hover {
  color: var(--star);
}

::selection {
  background: rgba(79, 227, 208, 0.28);
  color: var(--star);
}

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

/* ---------- 4. 布局骨架 ---------- */
.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--pad);
}

.grid-12 {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: clamp(20px, 3vw, 44px);
}

.grid-12 > .g-lead {
  grid-column: 1 / 8;
}

.grid-12 > .g-body {
  grid-column: 6 / 13;
}

.prose {
  max-width: 34em;
  color: var(--haze);
}

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

.prose strong {
  color: var(--star);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------- 5. 通用组件 ---------- */
.skip-link {
  position: absolute;
  left: 16px;
  top: -72px;
  z-index: 300;
  padding: 10px 18px;
  background: var(--cyan);
  color: #06120f;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
  border-radius: 2px;
  text-decoration: none;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 10px;
  color: #06120f;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-family: var(--f-body);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1.3;
  border: 1px solid transparent;
  border-radius: 2px;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.btn--cyan {
  background: var(--cyan);
  color: #06120f;
  font-weight: 600;
}

.btn--cyan:hover {
  background: #87f2e4;
  color: #06120f;
}

.btn--line {
  border-color: var(--orbit);
  color: var(--haze);
  background: transparent;
}

.btn--line:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

.btn--sm {
  padding: 7px 14px;
  font-size: 13px;
  letter-spacing: 0.06em;
}

.panel {
  position: relative;
  background: var(--night);
  border: 1px solid var(--orbit);
  border-radius: 6px;
  padding: clamp(22px, 3vw, 40px);
}

.panel--dust {
  background: linear-gradient(165deg, var(--dust), var(--night) 72%);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border: 1px solid var(--orbit);
  border-radius: 999px;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--haze);
  white-space: nowrap;
}

.tag::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--cyan);
  flex: none;
}

.spec-label {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  color: var(--haze);
  text-transform: uppercase;
}

.spec-label::before {
  content: "";
  width: 24px;
  height: 1px;
  background: var(--cyan);
  align-self: center;
  flex: none;
}

.num-node {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding-inline: 8px;
  border: 1px solid var(--orbit);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(242, 193, 78, 0.14), transparent 72%);
  font-family: var(--f-mono);
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--gold);
  flex: none;
}

.orbit-rule {
  position: relative;
  height: 1px;
  margin-block: clamp(32px, 5vw, 64px);
  background: linear-gradient(90deg, var(--orbit), rgba(46, 58, 92, 0.15) 78%, transparent);
}

.orbit-rule::before {
  content: "";
  position: absolute;
  left: 0;
  top: -3px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px rgba(79, 227, 208, 0.75);
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--node);
}

.breadcrumb a {
  color: var(--haze);
  text-decoration: none;
}

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

.breadcrumb span[aria-current] {
  color: var(--cyan);
}

.media-frame {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: var(--frame-ratio, 3 / 2);
  overflow: hidden;
  border: 1px solid var(--orbit);
  border-radius: 6px;
  background:
    linear-gradient(160deg, rgba(42, 31, 74, 0.9), rgba(14, 23, 48, 0.95) 62%),
    var(--night);
}

.media-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(340px 180px at 22% 18%, rgba(79, 227, 208, 0.14), transparent 72%),
    radial-gradient(280px 200px at 82% 88%, rgba(242, 193, 78, 0.1), transparent 74%);
  pointer-events: none;
}

.media-frame img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-frame--wide {
  --frame-ratio: 16 / 9;
}

.media-frame--tall {
  --frame-ratio: 2 / 3;
}

.media-frame--square {
  --frame-ratio: 1 / 1;
}

/* ---------- 6. 头部 · 北极星舱体 ---------- */
.sky-head {
  position: sticky;
  top: 0;
  z-index: 120;
  background: linear-gradient(180deg, #0E1730 0%, #0A1124 100%);
  border-bottom: 1px solid var(--orbit);
}

.sky-head::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(79, 227, 208, 0.55), transparent);
  pointer-events: none;
}

.sky-head__inner {
  position: relative;
}

.progress-rail {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: rgba(127, 168, 184, 0.16);
  overflow: hidden;
}

.progress-rail__bar {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--cyan), var(--gold));
}

.sky-head__top {
  display: flex;
  align-items: center;
  gap: clamp(10px, 1.6vw, 26px);
  height: var(--head-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: var(--star);
  flex: none;
}

.brand:hover {
  color: var(--star);
}

.brand__mark {
  position: relative;
  width: 26px;
  height: 26px;
  flex: none;
  border: 1px solid rgba(79, 227, 208, 0.85);
  border-radius: 50%;
  display: inline-block;
}

.brand__mark::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(79, 227, 208, 0.4);
  border-radius: 50%;
}

.brand__mark::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 10px rgba(242, 193, 78, 0.9);
}

.brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand__name {
  font-family: var(--f-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--star);
}

.brand__sub {
  margin-top: 3px;
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: 0.32em;
  color: var(--node);
}

.cmd-nav {
  margin-inline-start: auto;
}

.cmd-nav__list {
  display: flex;
  align-items: center;
  gap: 2px;
}

.cmd-nav__link {
  position: relative;
  display: inline-block;
  padding: 8px 14px;
  font-size: 14px;
  letter-spacing: 0.06em;
  color: var(--haze);
  text-decoration: none;
  border-radius: 2px;
  white-space: nowrap;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.cmd-nav__link:hover {
  color: var(--star);
  background: rgba(42, 31, 74, 0.68);
}

.cmd-nav__link[aria-current="page"] {
  color: var(--cyan);
}

.cmd-nav__link[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 2px;
  height: 1px;
  background: var(--cyan);
  box-shadow: 0 0 8px rgba(79, 227, 208, 0.9);
}

.head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-inline-start: clamp(10px, 1.6vw, 24px);
  flex: none;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 42px;
  height: 40px;
  margin-inline-start: auto;
  border: 1px solid var(--orbit);
  border-radius: 2px;
  cursor: pointer;
  flex: none;
  transition: border-color 0.2s ease;
}

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

.nav-toggle__bar {
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--star);
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(1) {
  transform: translateY(5.5px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(3) {
  transform: translateY(-5.5px) rotate(-45deg);
}

/* ---------- 7. 章节索引条 ---------- */
.chapter-strip {
  border-top: 1px solid rgba(46, 58, 92, 0.6);
  height: var(--strip-h);
  overflow: hidden;
}

.chapter-strip[hidden] {
  display: none;
}

.chapter-strip__inner {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2vw, 26px);
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.chapter-strip__inner::-webkit-scrollbar {
  display: none;
}

.chapter-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 0;
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--node);
  white-space: nowrap;
  cursor: pointer;
  border-radius: 2px;
  transition: color 0.2s ease;
}

.chapter-chip::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
  transition: box-shadow 0.2s ease;
}

.chapter-chip:hover {
  color: var(--star);
}

.chapter-chip__num {
  font-size: 11px;
  color: var(--gold);
  opacity: 0.7;
}

.chapter-chip__label {
  font-family: var(--f-body);
  letter-spacing: 0.08em;
}

.chapter-chip[aria-current="true"] {
  color: var(--cyan);
}

.chapter-chip[aria-current="true"]::before {
  box-shadow: 0 0 9px rgba(79, 227, 208, 0.95);
}

.chapter-chip[aria-current="true"] .chapter-chip__num {
  color: var(--cyan);
  opacity: 1;
}

/* ---------- 8. 页脚 ---------- */
.sky-foot {
  position: relative;
  margin-top: clamp(72px, 11vw, 160px);
  background: var(--night);
  border-top: 1px solid var(--orbit);
  overflow: hidden;
}

.sky-foot::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(760px 340px at 10% -6%, rgba(42, 31, 74, 0.85), transparent 70%),
    radial-gradient(540px 280px at 92% 104%, rgba(79, 227, 208, 0.09), transparent 72%);
  pointer-events: none;
}

.foot-grid {
  position: relative;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1.35fr;
  gap: clamp(28px, 4vw, 64px);
  padding-block: clamp(48px, 7vw, 88px) clamp(30px, 4vw, 52px);
}

.foot-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.foot-brand__name {
  margin: 4px 0 0;
  font-family: var(--f-display);
  font-size: 20px;
  letter-spacing: 0.2em;
  color: var(--star);
}

.foot-brand__line {
  max-width: 20em;
  font-size: 15px;
  line-height: 1.7;
  color: var(--haze);
}

.foot-brand__meta {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  line-height: 1.9;
  color: var(--node);
}

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

.foot-col__title {
  margin: 0 0 16px;
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--cyan);
}

.foot-list {
  display: grid;
  gap: 9px;
}

.foot-list a {
  display: inline-block;
  font-size: 14px;
  letter-spacing: 0.04em;
  color: var(--haze);
  text-decoration: none;
  transition: color 0.2s ease, transform 0.2s ease;
}

.foot-list a:hover {
  color: var(--cyan);
  transform: translateX(3px);
}

.foot-list--plain li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 14px;
  line-height: 1.7;
}

.foot-key {
  flex: none;
  width: 34px;
  padding-top: 2px;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--node);
}

.foot-val {
  color: var(--haze);
  word-break: break-word;
}

.foot-legal {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 28px;
  padding-block: 20px 34px;
  border-top: 1px solid var(--orbit);
  font-size: 13px;
  color: var(--node);
}

.foot-legal__copy {
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--node);
}

.foot-legal__links {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.foot-legal__links a {
  font-size: 13px;
  color: var(--haze);
  text-decoration: none;
}

.foot-legal__links a:hover {
  color: var(--cyan);
}

.foot-legal__icp {
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--node);
}

/* ---------- 9. 响应式 ---------- */
@media (max-width: 1180px) {
  .cmd-nav__link {
    padding: 8px 9px;
    font-size: 13px;
    letter-spacing: 0.03em;
  }

  .cmd-nav__link[aria-current="page"]::after {
    left: 9px;
    right: 9px;
  }

  .brand__sub {
    display: none;
  }
}

@media (max-width: 980px) {
  :root {
    --head-h: 58px;
  }

  .nav-toggle {
    display: flex;
    order: 3;
  }

  .cmd-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin: 0;
    padding: 8px var(--pad) 20px;
    background: #0B1226;
    border-bottom: 1px solid var(--orbit);
    box-shadow: 0 26px 48px -28px rgba(0, 0, 0, 0.9);
    z-index: 140;
  }

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

  .cmd-nav__list {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }

  .cmd-nav__link {
    display: block;
    padding: 13px 4px;
    font-size: 15px;
    letter-spacing: 0.06em;
    border-bottom: 1px solid rgba(46, 58, 92, 0.55);
  }

  .cmd-nav__link[aria-current="page"]::after {
    left: 4px;
    right: auto;
    width: 20px;
    bottom: 8px;
  }

  .head-actions {
    order: 2;
    margin-inline-start: auto;
  }

  .brand {
    order: 1;
  }

  .grid-12 > .g-lead,
  .grid-12 > .g-body {
    grid-column: 1 / -1;
  }

  .foot-grid {
    grid-template-columns: 1fr 1fr;
  }

  .foot-brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .head-actions .btn--line {
    display: none;
  }

  .head-actions .btn--cyan {
    padding: 6px 11px;
    font-size: 12px;
    letter-spacing: 0.04em;
  }

  .brand__mark {
    width: 22px;
    height: 22px;
  }

  .brand__name {
    font-size: 15px;
    letter-spacing: 0.14em;
  }
}

@media (max-width: 640px) {
  .foot-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .foot-legal {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .foot-legal__links {
    gap: 16px;
  }

  .mean {
    max-width: 100%;
  }

  .prose {
    max-width: 100%;
  }
}

/* ---------- 10. 动效降级 ---------- */
@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;
    scroll-behavior: auto !important;
  }
}
