/* ==========================================================================
   协议中心 · 全局样式
   ========================================================================== */

:root {
  --bg: #faf8f4;
  --bg-grain: #f3efe7;
  --surface: #ffffff;
  --surface-soft: #f6f3ec;
  --ink: #14181c;
  --ink-soft: #4c545c;
  --ink-faint: #7c858e;
  --line: #e4ded4;
  --line-strong: #d3cbbd;
  --accent: #0d4f4a;
  --accent-hover: #0a3b37;
  --accent-soft: #e6f0ee;
  --accent-ink: #0d4f4a;
  --warn-soft: #fbf2e3;
  --warn-line: #ecd9b6;
  --shadow: 0 1px 2px rgba(20, 24, 28, 0.04), 0 12px 32px -16px rgba(20, 24, 28, 0.16);
  --radius: 14px;
  --radius-sm: 9px;
  --maxw: 1160px;
  --font-sans: system-ui, -apple-system, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

html[data-theme="dark"] {
  --bg: #101318;
  --bg-grain: #151920;
  --surface: #171b21;
  --surface-soft: #1c212a;
  --ink: #e8ecf0;
  --ink-soft: #a9b2bc;
  --ink-faint: #7c8792;
  --line: #262c35;
  --line-strong: #333b46;
  --accent: #6fd6c4;
  --accent-hover: #8ee3d4;
  --accent-soft: #16302d;
  --accent-ink: #6fd6c4;
  --warn-soft: #2a2317;
  --warn-line: #453920;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 16px 40px -20px rgba(0, 0, 0, 0.8);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background-color: var(--bg);
  background-image: radial-gradient(
      circle at 15% -10%,
      var(--bg-grain) 0%,
      transparent 45%
    ),
    radial-gradient(circle at 90% 0%, var(--bg-grain) 0%, transparent 38%);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
}

img {
  max-width: 100%;
}

a {
  color: var(--accent-ink);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

::selection {
  background: var(--accent);
  color: var(--bg);
}

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

/* ---------- 顶栏 ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
  height: 66px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  font-size: 15px;
  letter-spacing: 0.01em;
  color: var(--ink);
  flex-shrink: 0;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--bg);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.brand-mark svg {
  width: 17px;
  height: 17px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.site-nav a {
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 14px;
  color: var(--ink-soft);
  transition: background-color 0.18s ease, color 0.18s ease;
}

.site-nav a:hover {
  background: var(--surface-soft);
  color: var(--ink);
  text-decoration: none;
}

.site-nav a[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 600;
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.icon-btn:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

html[data-theme="light"] .icon-moon,
html[data-theme="dark"] .icon-sun {
  display: none;
}

/* ---------- 阅读进度条 ---------- */

.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 100%;
  z-index: 60;
  pointer-events: none;
  background: transparent;
}

.progress-bar span {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.08s linear;
}

/* ---------- 首页 ---------- */

.page {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

.hero {
  padding: 88px 0 64px;
  max-width: 760px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 22px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-ink);
}

.eyebrow::before {
  content: "";
  width: 22px;
  height: 1px;
  background: var(--accent);
  opacity: 0.6;
}

.hero h1 {
  margin: 0 0 22px;
  font-size: clamp(2.1rem, 5vw, 3.35rem);
  line-height: 1.14;
  letter-spacing: -0.025em;
  font-weight: 700;
}

.hero h1 em {
  font-style: normal;
  color: var(--accent-ink);
}

.hero p.lead {
  margin: 0 0 34px;
  font-size: clamp(1rem, 1.4vw, 1.12rem);
  color: var(--ink-soft);
  max-width: 600px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 34px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.18s ease, background-color 0.18s ease,
    border-color 0.18s ease, color 0.18s ease;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-ghost {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

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

.btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-size: 13px;
  color: var(--ink-faint);
  font-family: var(--font-mono);
}

/* 文档卡片 */

.doc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  padding-bottom: 84px;
}

.doc-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 30px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: inherit;
  overflow: hidden;
  transition: transform 0.22s ease, border-color 0.22s ease,
    box-shadow 0.22s ease;
}

.doc-card::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), transparent 70%);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.doc-card:hover {
  text-decoration: none;
  transform: translateY(-3px);
  border-color: var(--line-strong);
}

.doc-card:hover::after {
  opacity: 1;
}

.doc-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.doc-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.doc-card-icon svg {
  width: 21px;
  height: 21px;
}

.doc-card-tag {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-family: var(--font-mono);
  padding-top: 4px;
}

.doc-card h2 {
  margin: 0;
  font-size: 21px;
  letter-spacing: -0.01em;
  line-height: 1.35;
}

.doc-card p {
  margin: 0;
  font-size: 14.5px;
  color: var(--ink-soft);
}

.doc-card ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 7px;
}

.doc-card ul li {
  position: relative;
  padding-left: 18px;
  font-size: 13.5px;
  color: var(--ink-soft);
}

.doc-card ul li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 10px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.55;
}

.doc-card-foot {
  margin-top: auto;
  padding-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--accent-ink);
}

.doc-card-foot svg {
  width: 14px;
  height: 14px;
  transition: transform 0.22s ease;
}

.doc-card:hover .doc-card-foot svg {
  transform: translateX(3px);
}

/* 摘要 / 变更记录 */

.section-block {
  padding: 0 0 84px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 30px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.section-head h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.01em;
}

.section-head span {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-faint);
}

.principle-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.principle {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.principle-num {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-ink);
  letter-spacing: 0.1em;
  display: block;
  margin-bottom: 12px;
}

.principle h3 {
  margin: 0 0 8px;
  font-size: 15.5px;
  font-weight: 650;
}

.principle p {
  margin: 0;
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.7;
}

.timeline {
  display: grid;
  gap: 0;
}

.timeline-item {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 24px;
  padding: 20px 0;
  border-bottom: 1px dashed var(--line);
}

.timeline-item:last-child {
  border-bottom: none;
}

.timeline-date {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink-faint);
  padding-top: 3px;
}

.timeline-body h3 {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 650;
}

.timeline-body p {
  margin: 0;
  font-size: 13.5px;
  color: var(--ink-soft);
}

/* ---------- 文档页 ---------- */

.doc-layout {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 56px;
  align-items: start;
}

.toc {
  position: sticky;
  top: 96px;
  padding: 40px 0 60px;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  scrollbar-width: thin;
}

.toc-title {
  margin: 0 0 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-family: var(--font-mono);
}

.toc ul {
  margin: 0;
  padding: 0;
  list-style: none;
  border-left: 1px solid var(--line);
  display: grid;
  gap: 1px;
}

.toc a {
  display: block;
  padding: 6px 0 6px 14px;
  margin-left: -1px;
  border-left: 2px solid transparent;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-faint);
  transition: color 0.18s ease, border-color 0.18s ease;
}

.toc a:hover {
  color: var(--ink);
  text-decoration: none;
}

.toc a.is-active {
  color: var(--accent-ink);
  border-left-color: var(--accent);
  font-weight: 600;
}

.doc {
  max-width: 720px;
  padding: 52px 0 90px;
  min-width: 0;
}

.doc-head {
  padding-bottom: 34px;
  margin-bottom: 38px;
  border-bottom: 1px solid var(--line);
}

.doc-head h1 {
  margin: 0 0 18px;
  font-size: clamp(1.9rem, 3.6vw, 2.6rem);
  line-height: 1.2;
  letter-spacing: -0.025em;
  font-weight: 700;
}

.doc-meta {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: 12.5px;
  color: var(--ink-faint);
  font-family: var(--font-mono);
}

.doc-meta b {
  font-weight: 500;
  color: var(--ink-soft);
}

.doc-lead {
  font-size: 16.5px;
  line-height: 1.85;
  color: var(--ink-soft);
  margin: 0 0 40px;
  padding-left: 18px;
  border-left: 2px solid var(--accent);
}

.doc h2 {
  margin: 52px 0 16px;
  font-size: 20px;
  line-height: 1.4;
  letter-spacing: -0.01em;
  font-weight: 680;
  scroll-margin-top: 96px;
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.doc h2 .num {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--accent-ink);
  opacity: 0.75;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.doc h3 {
  margin: 30px 0 10px;
  font-size: 16px;
  font-weight: 650;
  line-height: 1.5;
}

.doc p {
  margin: 0 0 16px;
  color: var(--ink-soft);
  font-size: 15.3px;
  line-height: 1.9;
}

.doc strong {
  color: var(--ink);
  font-weight: 650;
}

.doc ul,
.doc ol {
  margin: 0 0 18px;
  padding-left: 22px;
  color: var(--ink-soft);
  font-size: 15.3px;
  line-height: 1.9;
}

.doc li {
  margin-bottom: 8px;
}

.doc li::marker {
  color: var(--accent);
}

.doc table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 24px;
  font-size: 14px;
}

.doc th,
.doc td {
  text-align: left;
  padding: 11px 14px;
  border: 1px solid var(--line);
  vertical-align: top;
  color: var(--ink-soft);
}

.doc th {
  background: var(--surface-soft);
  color: var(--ink);
  font-weight: 650;
  white-space: nowrap;
}

.doc table code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: var(--surface-soft);
  padding: 1px 6px;
  border-radius: 5px;
  color: var(--accent-ink);
}

.callout {
  margin: 26px 0;
  padding: 18px 20px;
  border: 1px solid var(--warn-line);
  background: var(--warn-soft);
  border-radius: var(--radius-sm);
  font-size: 14.3px;
  line-height: 1.8;
  color: var(--ink-soft);
}

.callout b {
  color: var(--ink);
}

.callout--plain {
  border-color: var(--line);
  background: var(--surface-soft);
}

.doc-footer {
  margin-top: 60px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 13px;
  color: var(--ink-faint);
}

.doc-footer a {
  font-weight: 600;
}

.placeholder {
  color: var(--accent-ink);
  border-bottom: 1px dashed var(--accent);
  padding-bottom: 1px;
  font-weight: 500;
}

/* 飞书联系方式 */

.contact-card {
  display: flex;
  align-items: center;
  gap: 26px;
  flex-wrap: wrap;
  margin: 26px 0;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.contact-qr {
  display: block;
  width: 176px;
  height: auto;
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
}

.contact-body {
  flex: 1 1 240px;
  min-width: 0;
}

.contact-body h3 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 650;
}

.contact-body p {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--ink-soft);
}

.contact-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.contact-tags li {
  margin: 0;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 12.5px;
  font-weight: 600;
}

.contact-tags li::marker {
  content: none;
}

/* 回到顶部 */

.to-top {
  position: fixed;
  right: 26px;
  bottom: 26px;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
  z-index: 40;
}

.to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.to-top svg {
  width: 16px;
  height: 16px;
}

/* ---------- 页脚 ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
}

.footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 34px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  font-size: 13px;
  color: var(--ink-faint);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.footer-links a {
  color: var(--ink-soft);
}

/* ---------- 响应式 ---------- */

@media (max-width: 900px) {
  .doc-grid,
  .principle-grid {
    grid-template-columns: 1fr;
  }

  .doc-layout {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .toc {
    position: static;
    max-height: none;
    padding: 28px 0 0;
    border-bottom: 1px solid var(--line);
  }

  .toc ul {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-left: none;
  }

  .toc a {
    border-left: none;
    padding-left: 0;
  }

  .toc a.is-active {
    border-left: none;
    padding-left: 8px;
  }

  .doc {
    padding-top: 36px;
  }

  .hero {
    padding: 62px 0 46px;
  }

  .timeline-item {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

@media (max-width: 640px) {
  .header-inner {
    padding: 0 18px;
    gap: 12px;
  }

  .page,
  .doc-layout {
    padding-left: 18px;
    padding-right: 18px;
  }

  .site-nav a {
    padding: 6px 10px;
    font-size: 13px;
  }

  .brand span {
    display: none;
  }

  .doc-card {
    padding: 24px;
  }

  .doc table {
    display: block;
    overflow-x: auto;
  }

  .toc ul {
    grid-template-columns: 1fr;
  }
}

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

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

@media print {
  .site-header,
  .toc,
  .to-top,
  .progress-bar,
  .site-footer {
    display: none !important;
  }

  .doc-layout {
    display: block;
  }

  body {
    background: #fff;
    color: #000;
  }
}
