/* ===== M6 共享外壳样式 /assets/site.css ===== */

:root {
  --ink: #05070A;
  --panel: #0B1016;
  --grid-line: #101820;
  --snow: #E8F4F6;
  --silver: #9AA9B4;
  --cyan: #00E5FF;
  --orange: #FF6A2B;
  --lime: #B6FF3B;
  --indigo: #6C4DFF;
  --teal: #12303A;
  --wine: #3A0F1E;
  --white: #FFFFFF;

  --rail-w: 224px;
  --bar-h: 64px;
  --radius-pill: 999px;
  --radius-block: 28px;
  --radius-tag: 8px;

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --dur: 200ms;

  --hair: rgba(232, 244, 246, 0.12);
  --hair-soft: rgba(232, 244, 246, 0.07);

  --font-body: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", monospace;
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  padding-left: var(--rail-w);
  background: var(--ink);
  color: var(--snow);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

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

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

a { color: inherit; text-decoration: none; }

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

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

a:focus-visible,
button:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- 跳转链接 ---------- */
.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 200;
  transform: translateY(-180%);
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  background: var(--cyan);
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  transition: transform var(--dur) var(--ease);
}
.skip-link:focus-visible {
  transform: translateY(0);
  outline: 2px solid var(--white);
  outline-offset: 2px;
}

/* ---------- 顶部阅读进度 ---------- */
.rail-progress {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(90deg, var(--cyan), var(--orange) 68%, var(--lime));
  transform-origin: 0 50%;
  transform: scaleX(var(--progress, 0));
  transition: transform 120ms linear;
}

/* ---------- 侧边品牌轨道 ---------- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 90;
  width: var(--rail-w);
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 26px 18px 20px;
  background: var(--panel);
  border-right: 1px solid var(--hair);
  overflow-y: auto;
  scrollbar-width: thin;
}

.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(232, 244, 246, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(232, 244, 246, 0.05) 1px, transparent 1px);
  background-size: 24px 24px;
  -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.1));
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.1));
}

.rail-brand,
.site-nav,
.rail-actions,
.nav-toggle,
.to-top {
  position: relative;
  z-index: 1;
}

.rail-brand {
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-width: 0;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  flex: none;
  border-radius: 18px;
  background: var(--cyan);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.04em;
  transition: filter var(--dur) var(--ease);
}
a.brand-mark:hover { filter: brightness(1.12); }

.brand-line {
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 0.02em;
  color: var(--silver);
  max-width: 19ch;
}

.status-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.55;
  letter-spacing: 0.02em;
  color: var(--silver);
}

.status-dot {
  width: 6px;
  height: 6px;
  margin-top: 5px;
  flex: none;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.16);
}

/* ---------- 导航 ---------- */
.site-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: none;
}

.nav-kicker {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(154, 169, 180, 0.7);
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-link {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 9px 10px 9px 8px;
  border-left: 2px solid transparent;
  border-radius: 10px;
  color: var(--silver);
  font-size: 14px;
  font-weight: 500;
  transition: color var(--dur) var(--ease), background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.nav-link:hover {
  color: var(--snow);
  background: rgba(0, 229, 255, 0.07);
  border-left-color: rgba(0, 229, 255, 0.4);
}

.nav-link[aria-current="page"] {
  color: var(--snow);
  font-weight: 700;
  background: rgba(0, 229, 255, 0.1);
  border-left-color: var(--cyan);
}

.nav-index {
  min-width: 1.7em;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: rgba(154, 169, 180, 0.55);
}

.nav-link[aria-current="page"] .nav-index { color: var(--cyan); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.01em;
  text-decoration: none;
  transition: transform var(--dur) var(--ease), background-color var(--dur) var(--ease),
    color var(--dur) var(--ease), border-color var(--dur) var(--ease), filter var(--dur) var(--ease);
}
.btn:active { transform: translateY(1px); }

.btn--primary {
  background: var(--cyan);
  color: var(--ink);
}
.btn--primary:hover {
  color: var(--ink);
  filter: brightness(1.12);
  text-decoration: none;
}

.btn--ghost {
  background: transparent;
  color: var(--snow);
  border-color: rgba(232, 244, 246, 0.24);
}
.btn--ghost:hover {
  color: var(--cyan);
  border-color: var(--cyan);
  text-decoration: none;
}

.btn--quiet {
  background: rgba(232, 244, 246, 0.06);
  color: var(--snow);
  border-color: transparent;
}
.btn--quiet:hover {
  background: rgba(232, 244, 246, 0.12);
  text-decoration: none;
}

.rail-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
}

.rail-actions .btn { width: 100%; }

/* ---------- 返回顶部 ---------- */
.to-top {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  flex: none;
  padding: 10px 12px;
  border: 1px dashed rgba(232, 244, 246, 0.18);
  border-radius: 10px;
  color: var(--silver);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.to-top:hover {
  color: var(--cyan);
  border-color: rgba(0, 229, 255, 0.55);
  background: rgba(0, 229, 255, 0.06);
}

.to-top-glyph { font-size: 14px; line-height: 1; }
.to-top-text { font-size: 12px; letter-spacing: 0.06em; }

/* ---------- 移动导航按钮与底部入口条 ---------- */
.nav-toggle {
  display: none;
  align-items: center;
  gap: 9px;
  padding: 8px 14px 8px 11px;
  border: 1px solid rgba(232, 244, 246, 0.2);
  border-radius: var(--radius-pill);
  background: rgba(232, 244, 246, 0.04);
  color: var(--snow);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  flex: none;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.nav-toggle[aria-expanded="true"] {
  color: var(--cyan);
  border-color: var(--cyan);
}

.nav-toggle-glyph {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  width: 14px;
}
.nav-toggle-glyph span {
  display: block;
  height: 1.5px;
  border-radius: 1px;
  background: currentColor;
  transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-glyph span:nth-child(1) { transform: translateY(4.5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-glyph span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-glyph span:nth-child(3) { transform: translateY(-4.5px) rotate(-45deg); }

.nav-toggle-text { white-space: nowrap; }

.mobile-dock {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 95;
  gap: 10px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
  background: rgba(11, 16, 22, 0.97);
  border-top: 1px solid var(--hair);
}
.mobile-dock .btn { flex: 1; padding: 12px 14px; font-size: 13px; }

/* ---------- 页脚 ---------- */
.site-footer {
  position: relative;
  margin-top: 72px;
  padding: 44px clamp(20px, 4vw, 56px) 26px;
  background: var(--panel);
  border-top: 1px solid var(--hair);
  overflow: hidden;
}
.site-footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--cyan), var(--orange) 55%, var(--lime));
  opacity: 0.7;
}

.footer-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  padding-bottom: 24px;
  margin-bottom: 30px;
  border-bottom: 1px solid var(--hair-soft);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--silver);
}

.legend-dot {
  width: 9px;
  height: 9px;
  flex: none;
  border-radius: 50%;
}
.legend-dot--stable { background: var(--cyan); box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.14); }
.legend-dot--beta { background: var(--orange); box-shadow: 0 0 0 3px rgba(255, 106, 43, 0.14); }
.legend-dot--preview { background: var(--lime); box-shadow: 0 0 0 3px rgba(182, 255, 59, 0.14); }

.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) repeat(3, minmax(0, 1fr));
  gap: 32px 28px;
  align-items: start;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  min-width: 0;
}
.footer-brand .brand-mark {
  width: 60px;
  height: 60px;
  border-radius: 20px;
  background: transparent;
  border: 1px solid rgba(0, 229, 255, 0.45);
  color: var(--snow);
  font-size: 24px;
}

.footer-tagline {
  font-size: 13px;
  line-height: 1.65;
  color: var(--silver);
  max-width: 24ch;
}

.footer-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.footer-col-title {
  margin-bottom: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--orange);
}

.footer-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.footer-list a {
  display: inline-block;
  font-size: 14px;
  color: var(--silver);
  transition: color var(--dur) var(--ease);
}
.footer-list a:hover {
  color: var(--snow);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.footer-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 26px;
  margin-top: 34px;
  padding: 18px 22px;
  border: 1px solid rgba(0, 229, 255, 0.16);
  border-radius: var(--radius-block);
  background: linear-gradient(120deg, rgba(18, 48, 58, 0.9), rgba(11, 16, 22, 0.92));
}

.footer-contact-line {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--snow);
}

.footer-base {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px 24px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--hair-soft);
}

.footer-legal {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: rgba(154, 169, 180, 0.85);
}

.footer-note {
  font-size: 12px;
  color: rgba(154, 169, 180, 0.85);
}

/* ---------- 通用正文容器与网格 ---------- */
.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 56px);
}

.section {
  position: relative;
  padding: clamp(40px, 6vw, 80px) 0;
}

.grid { display: grid; gap: clamp(16px, 2.4vw, 28px); }

.grid--split { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }

.grid--dense { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

.panel {
  padding: clamp(20px, 3vw, 32px);
  border: 1px solid var(--hair);
  border-radius: var(--radius-block);
  background: var(--panel);
}

.rule {
  height: 1px;
  border: 0;
  background: var(--hair);
  margin: 0;
}

/* ---------- 文字层级 ---------- */
.display {
  font-weight: 900;
  font-size: clamp(2.4rem, 6vw, 5.6rem);
  line-height: 1.04;
  letter-spacing: -0.03em;
}

.lede {
  font-size: clamp(15px, 1.6vw, 18px);
  line-height: 1.75;
  color: var(--silver);
  max-width: 32em;
}

.eyebrow {
  display: block;
  margin-bottom: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--orange);
}

.mono {
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
}

.prose { max-width: 40em; }
.prose p {
  margin-bottom: 1.1em;
  color: var(--silver);
}
.prose p:last-child { margin-bottom: 0; }

/* ---------- 版本标签 ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-tag);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  line-height: 1.4;
}
.tag--stable { color: var(--cyan); border-color: rgba(0, 229, 255, 0.4); background: rgba(0, 229, 255, 0.08); }
.tag--beta { color: var(--orange); border-color: rgba(255, 106, 43, 0.4); background: rgba(255, 106, 43, 0.08); }
.tag--preview { color: var(--lime); border-color: rgba(182, 255, 59, 0.4); background: rgba(182, 255, 59, 0.08); }

/* ---------- 面包屑 ---------- */
.breadcrumb { padding: 18px 0 0; }

.breadcrumb-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--silver);
}
.breadcrumb-list li {
  display: flex;
  align-items: center;
  gap: 8px;
}
.breadcrumb-list li + li::before {
  content: "/";
  color: rgba(154, 169, 180, 0.5);
}
.breadcrumb-list a {
  color: var(--silver);
  transition: color var(--dur) var(--ease);
}
.breadcrumb-list a:hover { color: var(--cyan); }
.breadcrumb-list [aria-current="page"] { color: var(--snow); }

/* ---------- 页内章节索引 ---------- */
.toc {
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-left: 14px;
  border-left: 2px solid rgba(232, 244, 246, 0.12);
}

.toc-title {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(154, 169, 180, 0.7);
}

.toc-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.toc-link {
  font-size: 13px;
  line-height: 1.5;
  color: var(--silver);
  transition: color var(--dur) var(--ease);
}
.toc-link:hover { color: var(--snow); }
.toc-link[aria-current="true"] {
  color: var(--cyan);
  font-weight: 700;
}

/* ---------- 图片容器基础规则 ---------- */
.media {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(232, 244, 246, 0.1);
  border-radius: var(--radius-block);
  background: linear-gradient(135deg, rgba(18, 48, 58, 0.9), rgba(11, 16, 22, 0.95));
}
.media::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.65;
  background-image:
    linear-gradient(to right, rgba(232, 244, 246, 0.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(232, 244, 246, 0.06) 1px, transparent 1px);
  background-size: 28px 28px;
}
.media img,
.media video {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media--wide { aspect-ratio: 16 / 9; }
.media--square { aspect-ratio: 1 / 1; }
.media--tall { aspect-ratio: 4 / 5; }
.media--rail { aspect-ratio: 3 / 4; }

.media__caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  padding: 10px 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--silver);
  background: linear-gradient(to top, rgba(5, 7, 10, 0.88), rgba(5, 7, 10, 0));
}

/* ---------- 平板 / 移动 ---------- */
@media (max-width: 1023px) {
  body {
    padding-left: 0;
    padding-top: var(--bar-h);
    padding-bottom: 78px;
  }

  .site-header {
    top: 0;
    left: 0;
    right: 0;
    bottom: auto;
    width: auto;
    height: var(--bar-h);
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--hair);
  }

  .site-header::before { display: none; }

  .rail-brand {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    font-size: 16px;
  }

  .brand-line {
    max-width: none;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .status-line { display: none; }

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

  .site-nav {
    position: absolute;
    top: var(--bar-h);
    left: 0;
    right: 0;
    max-height: 0;
    padding: 0 16px;
    gap: 8px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    background: var(--panel);
    border-bottom: 1px solid var(--hair);
    transition: max-height 260ms var(--ease), opacity 180ms var(--ease), padding 260ms var(--ease);
  }

  .site-header[data-open="true"] .site-nav {
    max-height: 74vh;
    padding: 16px;
    overflow-y: auto;
    opacity: 1;
    pointer-events: auto;
  }

  .nav-link {
    padding: 12px 12px 12px 10px;
    font-size: 15px;
  }

  .rail-actions { display: none; }

  .to-top {
    position: fixed;
    right: 16px;
    bottom: 88px;
    width: auto;
    z-index: 94;
    padding: 10px 14px;
    border-style: solid;
    border-color: rgba(0, 229, 255, 0.4);
    border-radius: var(--radius-pill);
    background: var(--panel);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  }

  .mobile-dock { display: flex; }

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

  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 1180px) and (min-width: 1024px) {
  .grid--split { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .footer-grid { grid-template-columns: 1fr; }
  .footer-contact { padding: 16px 18px; }
  .footer-base { flex-direction: column; align-items: flex-start; }
  .to-top { bottom: 92px; }
}

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