/* ==========================================================================
   皇官方版口 CN 中国官网 — 共享样式 /assets/site.css
   分屏骨架 · 金线语言 · 深墨重音
   ========================================================================== */

:root {
  --gold: #C9A227;
  --gold-deep: #8A6A16;
  --ink: #111111;
  --graphite: #1F2124;
  --cinnabar: #B22222;
  --paper: #F3F4F1;
  --paper-warm: #E9E2D2;
  --stone: #6F7477;
  --moss: #4E5D45;
  --clay: #A45A3B;

  --font-serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", Georgia, serif;
  --font-sans: "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", "Courier New", monospace;

  --header-h: 74px;
  --gutter: clamp(18px, 3vw, 40px);
  --shell-max: 1240px;
  --radius: 6px;
  --rule: rgba(17, 17, 17, 0.12);
  --rule-gold: rgba(201, 162, 39, 0.38);
  --rule-ink: rgba(243, 244, 241, 0.14);
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16.5px;
  font-weight: 400;
  line-height: 1.8;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg, video { max-width: 100%; height: auto; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }

h1, h2, h3, h4, h5 {
  font-family: var(--font-serif);
  font-weight: 700;
  line-height: 1.28;
  letter-spacing: -0.01em;
  margin: 0 0 0.6em;
  color: var(--ink);
  text-wrap: pretty;
}

h1 { font-size: clamp(32px, 4.4vw, 54px); font-weight: 900; }
h2 { font-size: clamp(24px, 2.6vw, 30px); }
h3 { font-size: clamp(19px, 1.8vw, 22px); }
h4 { font-size: 17px; }

p { margin: 0 0 1.1em; text-wrap: pretty; }
p:last-child { margin-bottom: 0; }

a { color: var(--gold-deep); text-decoration: none; transition: color 0.2s ease, border-color 0.2s ease; }
a:hover { color: var(--cinnabar); }

ul, ol { margin: 0 0 1.1em; padding-left: 1.3em; }
li { margin-bottom: 0.35em; }

hr { border: 0; border-top: 1px solid var(--rule); margin: 2.4em 0; }

:where([id]) { scroll-margin-top: calc(var(--header-h) + 28px); }

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

::selection { background: rgba(201, 162, 39, 0.35); color: var(--ink); }

/* ---------- utilities ---------- */
.container {
  width: min(var(--shell-max), 100% - 2 * var(--gutter));
  margin-inline: auto;
}

.mono { font-family: var(--font-mono); letter-spacing: 0.02em; }
.muted { color: var(--stone); }
.gold-text { color: var(--gold-deep); }

.rule-gold {
  height: 1px;
  border: 0;
  margin: 0;
  background: linear-gradient(90deg, var(--gold) 0%, rgba(201, 162, 39, 0.25) 58%, rgba(201, 162, 39, 0) 100%);
}

.version-num {
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: -0.02em;
  border-bottom: 3px solid var(--gold);
  padding-bottom: 2px;
}

.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.2em;
  color: var(--gold-deep);
  margin-bottom: 14px;
}

.lede {
  font-size: 17.5px;
  line-height: 1.85;
  color: #3a3d3f;
  max-width: 40em;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-family: var(--font-sans);
  font-size: 14.5px;
  font-weight: 500;
  letter-spacing: 0.05em;
  line-height: 1.4;
  border: 1px solid transparent;
  border-radius: 3px;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.24s ease, color 0.24s ease, border-color 0.24s ease;
}

.btn-solid { background: var(--gold); border-color: var(--gold); color: #1a1405; }
.btn-solid:hover,
.btn-solid:focus-visible { background: var(--gold-deep); border-color: var(--gold-deep); color: #fff; }

.btn-ghost { background: transparent; border-color: rgba(201, 162, 39, 0.5); color: var(--paper-warm); }
.btn-ghost:hover,
.btn-ghost:focus-visible { border-color: var(--gold); color: var(--gold); }

.btn-ink { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn-ink:hover,
.btn-ink:focus-visible { background: var(--cinnabar); border-color: var(--cinnabar); color: #fff; }

.btn-outline { background: transparent; border-color: rgba(17, 17, 17, 0.22); color: var(--ink); }
.btn-outline:hover,
.btn-outline:focus-visible { border-color: var(--cinnabar); color: var(--cinnabar); }

/* ==========================================================================
   HEADER
   ========================================================================== */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 90;
  color: var(--paper);
  background: rgba(17, 17, 17, 0.82);
  border-bottom: 1px solid rgba(201, 162, 39, 0.24);
  transition: background-color 0.32s ease, border-color 0.32s ease, box-shadow 0.32s ease;
}

.site-header.is-scrolled {
  background: var(--ink);
  border-bottom-color: var(--gold);
  box-shadow: 0 12px 34px rgba(17, 17, 17, 0.3);
}

.scroll-progress {
  position: absolute;
  left: 0;
  bottom: -1px;
  height: 2px;
  width: 0;
  background: linear-gradient(90deg, var(--cinnabar) 0%, var(--gold) 100%);
  transition: width 0.1s linear;
}

.header-shell {
  display: flex;
  align-items: center;
  gap: 18px;
  width: min(1320px, 100% - 2 * var(--gutter));
  margin-inline: auto;
  height: var(--header-h);
}

.skip-link {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 130;
  padding: 10px 16px;
  background: var(--gold);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  border-radius: 3px;
  text-decoration: none;
  transform: translateY(-180%);
  transition: transform 0.2s ease;
}
.skip-link:focus { transform: translateY(0); color: var(--ink); }

/* brand */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  color: inherit;
  text-decoration: none;
}
.brand:hover { color: inherit; }

.brand-mark {
  position: relative;
  display: block;
  width: 26px;
  height: 26px;
  border: 1px solid var(--gold);
  transform: rotate(45deg);
  flex: 0 0 auto;
  transition: border-color 0.24s ease;
}
.brand-mark-line {
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(201, 162, 39, 0.55);
}
.brand:hover .brand-mark { border-color: var(--cinnabar); }

.brand-text { display: block; }
.brand-name {
  display: block;
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1.15;
  color: var(--paper-warm);
}
.brand-sub {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  line-height: 1.5;
  color: rgba(233, 226, 210, 0.6);
}

/* nav */
.site-nav { margin-left: auto; }

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

.nav-list a {
  position: relative;
  display: block;
  padding: 9px 13px;
  font-size: 14.5px;
  color: rgba(243, 244, 241, 0.82);
  text-decoration: none;
  border-radius: 3px;
}
.nav-list a::after {
  content: "";
  position: absolute;
  left: 13px;
  right: 13px;
  bottom: 3px;
  height: 1px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.28s ease;
}
.nav-list a:hover,
.nav-list a:focus-visible { color: #fff; }
.nav-list a:hover::after,
.nav-list a:focus-visible::after { transform: scaleX(1); }

.nav-list a[aria-current="page"] { color: var(--gold); }
.nav-list a[aria-current="page"]::after {
  transform: scaleX(1);
  background: var(--cinnabar);
  height: 2px;
}

.nav-foot { display: none; }
.nav-foot-note {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: rgba(233, 226, 210, 0.55);
}

/* header actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  margin-left: 12px;
}

/* nav toggle */
.nav-toggle {
  display: none;
  align-items: center;
  gap: 9px;
  margin-left: auto;
  padding: 9px 14px;
  background: transparent;
  border: 1px solid rgba(201, 162, 39, 0.45);
  border-radius: 3px;
  color: var(--paper-warm);
  font-size: 13.5px;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: border-color 0.22s ease, color 0.22s ease;
}
.nav-toggle:hover,
.nav-toggle:focus-visible { border-color: var(--gold); color: var(--gold); }

.nav-toggle-bars {
  position: relative;
  display: block;
  width: 16px;
  height: 10px;
}
.nav-toggle-bars::before,
.nav-toggle-bars::after {
  content: "";
  position: absolute;
  left: 0;
  width: 16px;
  height: 1px;
  background: currentColor;
  transition: transform 0.24s ease, top 0.24s ease;
}
.nav-toggle-bars::before { top: 1px; }
.nav-toggle-bars::after { top: 8px; }

.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before { top: 5px; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after { top: 5px; transform: rotate(-45deg); }

/* main offset */
#main-content {
  display: block;
  padding-top: var(--header-h);
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.site-footer {
  position: relative;
  margin-top: clamp(72px, 9vw, 132px);
  background: var(--ink);
  color: rgba(243, 244, 241, 0.72);
  border-top: 1px solid var(--gold);
}

.footer-shell {
  width: min(var(--shell-max), 100% - 2 * var(--gutter));
  margin-inline: auto;
  padding: clamp(52px, 6vw, 86px) 0 30px;
}

.footer-top {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  gap: clamp(30px, 5vw, 72px);
  padding-bottom: clamp(32px, 4vw, 52px);
  border-bottom: 1px solid rgba(201, 162, 39, 0.22);
}

.footer-mark {
  display: block;
  width: 20px;
  height: 20px;
  border: 1px solid var(--gold);
  transform: rotate(45deg);
  margin-bottom: 20px;
}

.footer-brand-name {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: var(--paper-warm);
  margin: 0 0 12px;
}

.footer-summary {
  margin: 0;
  max-width: 30em;
  font-size: 14.5px;
  line-height: 1.85;
  color: rgba(243, 244, 241, 0.6);
}

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

.footer-col-title {
  margin: 0 0 16px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.18em;
  color: var(--gold);
}

.footer-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.footer-col li { margin: 0; }

.footer-col a {
  display: inline-block;
  font-size: 14.5px;
  color: rgba(243, 244, 241, 0.74);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.footer-col a:hover,
.footer-col a:focus-visible { color: var(--gold); border-bottom-color: var(--gold); }

.footer-contact {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px 34px;
  padding: 28px 0;
  border-bottom: 1px solid rgba(201, 162, 39, 0.22);
}

.footer-contact-line {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0;
  font-size: 14px;
}

.footer-contact-key {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--gold);
}

.footer-contact-val {
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.7;
  color: rgba(243, 244, 241, 0.78);
  word-break: break-word;
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 28px;
  padding-top: 24px;
  font-size: 13px;
  color: rgba(243, 244, 241, 0.48);
}

.footer-legal {
  margin: 0;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}
.footer-icp { color: rgba(243, 244, 241, 0.66); }
.footer-note { margin: 0; }

/* back to top */
.back-to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 85;
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  color: var(--gold);
  background: rgba(17, 17, 17, 0.92);
  border: 1px solid var(--gold);
  border-radius: 50%;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.28s ease, transform 0.28s ease, visibility 0.28s ease, background-color 0.24s ease, color 0.24s ease;
}
.back-to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover,
.back-to-top:focus-visible { background: var(--gold); color: var(--ink); }

/* ==========================================================================
   PAGE BUILDING BLOCKS
   ========================================================================== */
.section { padding-block: clamp(56px, 8vw, 118px); }

.section-band {
  background: var(--paper-warm);
  padding-block: clamp(48px, 6vw, 88px);
}

.section-ink {
  background: var(--graphite);
  color: rgba(243, 244, 241, 0.82);
  padding-block: clamp(52px, 7vw, 96px);
}
.section-ink h1,
.section-ink h2,
.section-ink h3 { color: var(--paper-warm); }
.section-ink .lede { color: rgba(243, 244, 241, 0.72); }
.section-ink .eyebrow { color: var(--gold); }
.section-ink .muted { color: rgba(243, 244, 241, 0.55); }

.section-head { margin-bottom: clamp(28px, 3.4vw, 48px); max-width: 46em; }
.section-title { margin: 0 0 16px; }

/* split skeleton */
.split {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 9fr);
  gap: clamp(28px, 4vw, 72px);
  align-items: start;
}

.split-aside { min-width: 0; }
.split-main { min-width: 0; }

.split-aside.is-sticky {
  position: sticky;
  top: calc(var(--header-h) + 28px);
  align-self: start;
  max-height: calc(100vh - var(--header-h) - 56px);
  overflow-y: auto;
  padding-right: 4px;
}

.aside-panel {
  border-top: 2px solid var(--gold);
  padding-top: 16px;
  margin-bottom: 34px;
}
.aside-panel:last-child { margin-bottom: 0; }

/* toc */
.toc {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.toc li { margin: 0; }
.toc a {
  display: block;
  padding: 8px 0 8px 14px;
  font-size: 14px;
  color: var(--stone);
  border-left: 1px solid var(--rule);
  text-decoration: none;
}
.toc a:hover,
.toc a:focus-visible { color: var(--ink); border-left-color: var(--gold); }
.toc a.is-current {
  color: var(--cinnabar);
  border-left-color: var(--cinnabar);
  font-weight: 500;
}

/* breadcrumb */
.breadcrumb {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.06em;
  color: var(--stone);
  margin-bottom: 22px;
}
.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.breadcrumb li { margin: 0; }
.breadcrumb li:not(:last-child)::after {
  content: "／";
  margin-left: 8px;
  color: rgba(201, 162, 39, 0.75);
}
.breadcrumb a { color: var(--stone); }
.breadcrumb a:hover { color: var(--gold-deep); }

/* tags */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 11px;
  font-size: 13px;
  line-height: 1.6;
  border-radius: 999px;
  border: 1px solid rgba(111, 116, 119, 0.3);
  background: rgba(111, 116, 119, 0.1);
  color: var(--stone);
  white-space: nowrap;
}
.tag--gold { border-color: rgba(201, 162, 39, 0.42); background: rgba(201, 162, 39, 0.14); color: var(--gold-deep); }
.tag--moss { border-color: rgba(78, 93, 69, 0.32); background: rgba(78, 93, 69, 0.12); color: var(--moss); }
.tag--clay { border-color: rgba(164, 90, 59, 0.32); background: rgba(164, 90, 59, 0.12); color: var(--clay); }
.tag--red { border-color: rgba(178, 34, 34, 0.35); background: rgba(178, 34, 34, 0.1); color: var(--cinnabar); }

/* folds */
.fold {
  border-top: 1px solid var(--rule);
}
.fold:last-of-type { border-bottom: 1px solid var(--rule); }

.fold summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 0;
  font-family: var(--font-serif);
  font-size: 17.5px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.fold summary::-webkit-details-marker { display: none; }
.fold summary::after {
  content: "＋";
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--gold-deep);
}
.fold[open] summary::after { content: "－"; color: var(--cinnabar); }
.fold summary:hover { color: var(--gold-deep); }

.fold-body {
  padding: 0 0 22px;
  font-size: 15.5px;
  color: #3a3d3f;
}
.fold-body p:last-child { margin-bottom: 0; }

/* grids */
.grid { display: grid; gap: clamp(18px, 2.2vw, 30px); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* media */
.media {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: var(--radius);
  background: linear-gradient(155deg, #262a2d 0%, #111111 78%);
}
.media::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(201, 162, 39, 0.3);
  border-radius: inherit;
  pointer-events: none;
}
.media img,
.media > svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.media--square { aspect-ratio: 1 / 1; }
.media--4x3 { aspect-ratio: 4 / 3; }
.media--16x9 { aspect-ratio: 16 / 9; }
.media--3x4 { aspect-ratio: 3 / 4; }
.media--wide { aspect-ratio: 21 / 9; }

.media-caption {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.03em;
  color: var(--stone);
}

/* reveal (progressive enhancement) */
.reveal-init {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.22, 0.72, 0.28, 1);
}
.reveal-init.is-visible { opacity: 1; transform: none; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 1040px) {
  :root { --header-h: 64px; }

  .header-actions { display: none; }
  .nav-toggle { display: inline-flex; }

  .site-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 95;
    margin-left: 0;
    padding: 18px var(--gutter) calc(26px + env(safe-area-inset-bottom, 0px));
    max-height: 76vh;
    overflow-y: auto;
    background: var(--graphite);
    border-top: 1px solid var(--gold);
    box-shadow: 0 -22px 44px rgba(17, 17, 17, 0.45);
    transform: translateY(105%);
    visibility: hidden;
    transition: transform 0.36s cubic-bezier(0.22, 0.72, 0.28, 1), visibility 0.36s;
  }
  .site-nav[data-open] { transform: translateY(0); visibility: visible; }

  .nav-list { flex-direction: column; align-items: stretch; gap: 0; }
  .nav-list a {
    padding: 15px 4px;
    font-size: 16px;
    border-radius: 0;
    border-bottom: 1px solid rgba(201, 162, 39, 0.14);
  }
  .nav-list a::after { display: none; }
  .nav-list a[aria-current="page"] {
    display: flex;
    align-items: center;
    color: var(--gold);
  }
  .nav-list a[aria-current="page"]::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 10px;
    background: var(--cinnabar);
    flex: 0 0 auto;
  }

  .nav-foot {
    display: block;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(201, 162, 39, 0.2);
  }

  .split { grid-template-columns: minmax(0, 1fr); gap: 34px; }
  .split-aside.is-sticky {
    position: static;
    max-height: none;
    overflow: visible;
  }

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

  .footer-top { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 700px) {
  body { font-size: 16px; line-height: 1.78; }
  :root { --header-h: 60px; --gutter: 18px; }

  .brand-sub { display: none; }
  .brand-name { font-size: 17px; }

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

  .footer-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }

  .back-to-top { right: 14px; bottom: 78px; width: 42px; height: 42px; }
}

@media (max-width: 420px) {
  .footer-cols { grid-template-columns: minmax(0, 1fr); }
}

/* ==========================================================================
   MOTION PREFERENCE
   ========================================================================== */
@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;
  }

  .site-nav { transition: none; }
  .scroll-progress { transition: none; }
  .reveal-init { opacity: 1; transform: none; transition: none; }
  .back-to-top { transition: none; }
}
