:root {
  --color-bg: #F7F4ED;
  --color-flour: #F1F0E8;
  --color-cloud: #E9E4D9;
  --color-ink: #131A29;
  --color-brand: #1D2B64;
  --color-gold: #C9971C;
  --color-barley: #D9A441;
  --color-charcoal: #2B2B33;
  --color-green: #1B5E4A;
  --color-terra: #A64A3C;
  --font-heading: "Noto Sans CJK SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --font-body: "Noto Sans CJK SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  --radius-pill: 999px;
  --radius-lg: 28px;
  --radius-md: 18px;
  --quickbar-w: 112px;
  --content-max: 1200px;
  --z-header: 100;
  --z-quickbar: 95;
  --z-topbtn: 80;
  --z-skip: 200;
  --shadow-panel: 0 20px 60px rgba(19, 26, 41, 0.14);
}

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

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

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.8;
  color: var(--color-ink);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--color-brand);
}

::selection {
  background: var(--color-gold);
  color: var(--color-ink);
}

h1, h2, h3, h4 {
  margin: 0 0 0.6em;
  font-family: var(--font-heading);
  font-weight: 900;
  line-height: 1.2;
  color: var(--color-ink);
}

h1 {
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.1;
  letter-spacing: -0.01em;
}

h2 {
  font-size: clamp(26px, 3.4vw, 32px);
  line-height: 1.2;
}

h3 {
  font-size: 20px;
  line-height: 1.35;
}

p {
  margin: 0 0 1em;
}

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

.text-mono {
  font-family: var(--font-mono);
}

.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 96px 0;
}

.section--tight {
  padding: 48px 0;
}

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

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

.card {
  background: var(--color-flour);
  border: 1px solid rgba(19, 26, 41, 0.08);
  border-radius: var(--radius-lg);
  padding: 28px 26px;
  box-shadow: 0 6px 24px rgba(19, 26, 41, 0.06);
}

.prose {
  font-size: 16px;
  line-height: 1.9;
  color: var(--color-charcoal);
}

.prose p {
  margin: 0 0 1.2em;
}

.prose h2 {
  margin-top: 1.6em;
}

.prose a {
  color: var(--color-brand);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--color-cloud);
  padding: 2px 6px;
  border-radius: 6px;
}

.page-lead {
  font-size: 18px;
  line-height: 1.8;
  color: var(--color-charcoal);
  max-width: 720px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border: 0;
  border-radius: var(--radius-pill);
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.btn--ghost {
  background: transparent;
  color: var(--color-ink);
  box-shadow: inset 0 0 0 2px var(--color-ink);
}

.btn--ghost:hover,
.btn--ghost:focus-visible {
  background: var(--color-ink);
  color: var(--color-bg);
}

.btn--light {
  background: var(--color-flour);
  color: var(--color-ink);
}

.btn--light:hover,
.btn--light:focus-visible {
  background: var(--color-bg);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  background: var(--color-cloud);
  color: var(--color-charcoal);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
}

/* ===== 头部 ===== */

.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: var(--color-bg);
  border-bottom: 1px solid rgba(19, 26, 41, 0.08);
}

.site-header::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 38%;
  height: 10px;
  background: var(--color-gold);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 44px 100%);
  z-index: 1;
}

.skip-link {
  position: fixed;
  top: -80px;
  left: 24px;
  z-index: var(--z-skip);
  padding: 12px 20px;
  border-radius: var(--radius-pill);
  background: var(--color-gold);
  color: var(--color-ink);
  font-weight: 800;
  text-decoration: none;
  box-shadow: var(--shadow-panel);
  transition: top 0.2s ease;
}

.skip-link:focus-visible {
  top: 16px;
}

.header-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 14px 24px;
}

.brand-block {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 18px 6px 6px;
  border-radius: 999px 20px 20px 999px;
  background: var(--color-brand);
  text-decoration: none;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.brand-link:hover,
.brand-link:focus-visible {
  background: var(--color-ink);
  box-shadow: 0 0 0 2px var(--color-gold);
}

.brand-mark {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 50%;
  background: var(--color-gold);
  color: var(--color-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 19px;
  line-height: 1;
  transition: transform 0.2s ease;
}

.brand-link:hover .brand-mark {
  transform: rotate(-8deg);
}

.brand-mono {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--color-flour);
  white-space: nowrap;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 14px;
}

.nav-list {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-item {
  margin: 0;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-pill);
  background: var(--color-ink);
  color: var(--color-flour);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.nav-link:hover,
.nav-link:focus-visible {
  background: var(--color-gold);
  color: var(--color-ink);
  transform: translateY(-2px);
}

.nav-link[aria-current="page"] {
  background: var(--color-gold);
  color: var(--color-ink);
}

.nav-link[aria-current="page"]::before {
  content: "";
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border-radius: 50%;
  background: var(--color-ink);
}

.btn-download {
  background: var(--color-gold);
  color: var(--color-ink);
  box-shadow: 0 6px 18px rgba(201, 151, 28, 0.35);
}

.btn-download:hover,
.btn-download:focus-visible {
  background: var(--color-barley);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(201, 151, 28, 0.4);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: var(--color-ink);
  cursor: pointer;
}

.nav-toggle-line {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 2px;
  background: var(--color-flour);
  transition: transform 0.25s ease, opacity 0.25s ease;
}

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

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

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

/* ===== 常用栏 ===== */

.quick-bar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--quickbar-w);
  z-index: var(--z-quickbar);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 8px;
  padding: 18px 12px;
  background: var(--color-brand);
  border-right: 1px solid rgba(247, 244, 237, 0.08);
}

.quick-bar::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--color-gold), var(--color-barley) 60%, var(--color-brand));
}

.quick-bar-label {
  position: absolute;
  top: 22px;
  left: 0;
  right: 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.24em;
  text-indent: 0.24em;
  color: var(--color-barley);
}

.quick-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px 6px;
  border-radius: 16px;
  background: transparent;
  color: var(--color-flour);
  text-decoration: none;
  text-align: center;
  line-height: 1.25;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.quick-link:hover,
.quick-link:focus-visible {
  background: var(--color-gold);
  color: var(--color-ink);
  transform: translateX(3px);
}

.quick-link-num {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--color-barley);
}

.quick-link:hover .quick-link-num,
.quick-link:focus-visible .quick-link-num {
  color: var(--color-ink);
}

.quick-link-name {
  font-size: 13px;
  font-weight: 800;
}

/* ===== 页脚 ===== */

.site-footer {
  margin-top: 96px;
  background: var(--color-ink);
  color: var(--color-flour);
}

.footer-mountains {
  line-height: 0;
}

.footer-mountains-svg {
  display: block;
  width: 100%;
  height: 90px;
}

.footer-mountain {
  fill: none;
}

.footer-mountain--far {
  fill: var(--color-brand);
  opacity: 0.55;
}

.footer-mountain--near {
  fill: var(--color-gold);
  opacity: 0.28;
}

.footer-inner {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1.2fr;
  gap: 48px;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 56px 24px 36px;
}

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

.footer-col--brand {
  max-width: 440px;
}

.footer-brand-name {
  margin: 0 0 10px;
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: var(--color-bg);
}

.footer-brand-name::before {
  content: "▲";
  display: inline-block;
  margin-right: 8px;
  font-size: 13px;
  color: var(--color-gold);
  transform: translateY(-2px);
}

.footer-brand-desc {
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.8;
  color: rgba(247, 244, 237, 0.75);
}

.footer-trust {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 8px 16px;
  border: 1px solid rgba(201, 151, 28, 0.55);
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 700;
  color: var(--color-barley);
}

.footer-trust::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-gold);
}

.footer-title {
  margin: 0 0 18px;
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: var(--color-bg);
}

.footer-title::after {
  content: "";
  display: block;
  width: 32px;
  height: 3px;
  margin-top: 8px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--color-gold), var(--color-barley));
}

.footer-links-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 18px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-links-item {
  margin: 0;
}

.footer-link {
  color: rgba(247, 244, 237, 0.8);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s ease, padding-left 0.2s ease;
}

.footer-link:hover,
.footer-link:focus-visible {
  color: var(--color-gold);
  padding-left: 4px;
}

.footer-contact-list {
  display: grid;
  gap: 12px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-contact-item {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 10px;
  align-items: start;
  font-size: 14px;
  line-height: 1.6;
}

.footer-contact-label {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--color-barley);
  padding-top: 2px;
}

.footer-mono {
  font-family: var(--font-mono);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.footer-note {
  margin: 18px 0 0;
  padding-top: 16px;
  border-top: 1px solid rgba(247, 244, 237, 0.12);
  font-size: 12.5px;
  line-height: 1.7;
  color: rgba(247, 244, 237, 0.55);
}

.footer-bottom {
  background: rgba(0, 0, 0, 0.16);
  border-top: 1px solid rgba(247, 244, 237, 0.1);
}

.footer-bottom-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 18px 24px;
  font-size: 13px;
  color: rgba(247, 244, 237, 0.6);
}

.footer-copyright {
  margin: 0;
}

.footer-icp {
  margin: 0;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}

/* ===== 返回顶部 ===== */

.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 84px;
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid var(--color-gold);
  background: var(--color-bg);
  color: var(--color-ink);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  z-index: var(--z-topbtn);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px rgba(19, 26, 41, 0.18);
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.back-to-top:hover,
.back-to-top:focus-visible {
  background: var(--color-gold);
  transform: translateY(-3px);
}

.back-to-top[hidden] {
  display: none;
}

/* ===== 面包屑 ===== */

.breadcrumbs {
  padding: 20px 0 12px;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(19, 26, 41, 0.08);
}

.breadcrumbs-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.breadcrumbs-item {
  font-size: 13px;
  color: var(--color-charcoal);
}

.breadcrumbs-item + .breadcrumbs-item::before {
  content: "/";
  margin-right: 6px;
  color: var(--color-barley);
}

.breadcrumbs-link {
  color: var(--color-brand);
  text-decoration: none;
  font-weight: 700;
}

.breadcrumbs-link:hover,
.breadcrumbs-link:focus-visible {
  color: var(--color-gold);
}

/* ===== 图片容器 ===== */

.image-holder {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  aspect-ratio: 16 / 9;
  background: var(--color-cloud);
}

.image-holder--portrait {
  aspect-ratio: 4 / 5;
}

.image-holder--wide {
  aspect-ratio: 21 / 9;
}

.image-holder img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}

.image-holder::after {
  content: "图片占位 · 16:9";
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.1em;
  color: var(--color-charcoal);
  background: linear-gradient(135deg, rgba(19, 26, 41, 0.04), rgba(201, 151, 28, 0.09));
}

.image-holder--portrait::after {
  content: "图片占位 · 4:5";
}

.image-holder--wide::after {
  content: "图片占位 · 21:9";
}

.image-holder[data-placeholder]::after {
  display: grid;
}

/* ===== 章节协议 ===== */

[data-chapter-block] {
  scroll-margin-top: 90px;
}

a[data-chapter-link] {
  display: block;
  padding: 8px 12px;
  border-left: 3px solid transparent;
  color: var(--color-charcoal);
  text-decoration: none;
  font-weight: 700;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

a[data-chapter-link]:hover,
a[data-chapter-link]:focus-visible {
  color: var(--color-brand);
}

a[data-chapter-link].is-active,
a[data-chapter-link][aria-current="location"] {
  color: var(--color-brand);
  border-left-color: var(--color-gold);
  background: rgba(201, 151, 28, 0.08);
}

/* ===== 滚动显现 ===== */

html.js [data-reveal] {
  opacity: 0;
  transition: opacity 0.6s ease, transform 0.6s ease;
}

html.js [data-reveal="left"] {
  transform: translate(-28px, 12px);
}

html.js [data-reveal="right"] {
  transform: translate(28px, 12px);
}

html.js [data-reveal="up"] {
  transform: translate(0, 24px);
}

html.js [data-reveal].is-inview {
  opacity: 1;
  transform: none;
}

/* ===== 焦点可见 ===== */

:focus-visible {
  outline: 3px solid var(--color-gold);
  outline-offset: 3px;
}

/* ===== 响应式：平板与手机 ===== */

@media (min-width: 1024px) {
  body {
    padding-left: var(--quickbar-w);
  }
}

@media (max-width: 1023px) {
  body {
    padding-left: 0;
    padding-bottom: 56px;
  }

  .site-header::before {
    width: 65%;
  }

  .header-inner {
    padding: 10px 16px;
  }

  .brand-link {
    padding: 5px 12px 5px 5px;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
    font-size: 17px;
  }

  .brand-mono {
    font-size: 12px;
  }

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

  .header-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    padding: 16px 16px 20px;
    background: var(--color-ink);
    border-bottom: 2px solid var(--color-gold);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    box-shadow: 0 30px 50px rgba(19, 26, 41, 0.28);
  }

  .header-nav[data-open="true"] {
    display: flex;
  }

  .header-nav .nav-list {
    flex-direction: column;
    align-items: stretch;
  }

  .nav-link {
    justify-content: space-between;
    background: transparent;
    color: var(--color-flour);
    border-radius: 14px;
  }

  .nav-link:hover,
  .nav-link:focus-visible {
    transform: none;
  }

  .header-nav .btn-download {
    margin-top: 12px;
  }

  .quick-bar {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: auto;
    height: 56px;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-top: 2px solid var(--color-gold);
    border-right: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .quick-bar::-webkit-scrollbar {
    display: none;
  }

  .quick-bar::before {
    width: 100%;
    height: 3px;
    top: 0;
    bottom: auto;
    background: linear-gradient(90deg, var(--color-gold), var(--color-barley) 60%, var(--color-brand));
  }

  .quick-bar-label {
    display: none;
  }

  .quick-link {
    flex: 0 0 auto;
    flex-direction: row;
    padding: 8px 14px;
    border-radius: var(--radius-pill);
    background: rgba(247, 244, 237, 0.08);
  }

  .quick-link:hover,
  .quick-link:focus-visible {
    transform: none;
  }

  .back-to-top {
    right: 16px;
    bottom: 72px;
  }
}

@media (max-width: 900px) {
  .section {
    padding: 64px 0;
  }

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

  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .footer-inner {
    grid-template-columns: 1fr 1fr;
    gap: 40px 32px;
  }

  .footer-col--brand {
    grid-column: 1 / -1;
    max-width: none;
  }
}

@media (max-width: 620px) {
  .section {
    padding: 48px 0;
  }

  .container {
    padding: 0 16px;
  }

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

  .footer-inner {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 40px 20px 28px;
  }

  .footer-mountains-svg {
    height: 56px;
  }

  .footer-bottom-inner {
    padding: 16px 20px;
  }

  .footer-trust {
    font-size: 12px;
  }
}

/* ===== 动效偏好 ===== */

@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;
  }

  html.js [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}
