/* ==========================================================================
   君临国际 · 站点共享样式 /assets/site.css
   结构：变量 → 重置 → 排版 → 外壳 → 页头轨道 → 抽屉导航 → 页脚 → 通用组件
   ========================================================================== */

/* ---------- 1. 设计令牌 ---------- */
:root {
  --abyss-950: #050B18;
  --graphite-900: #0E1319;
  --board-050: #F4F7FA;
  --ink-800: #121A24;
  --steel-600: #2B3A4C;
  --haze-400: #94A3B4;
  --signal-500: #FF5A1F;
  --signal-600: #E64A12;
  --electron-400: #22D3D0;
  --route-700: #1B3A6B;
  --glass-100: rgba(244, 247, 250, 0.08);
  --glass-line: rgba(244, 247, 250, 0.14);

  --rail-w: 88px;
  --bar-h: 60px;
  --shell-max: 1400px;
  --gutter: clamp(20px, 4vw, 64px);
  --radius: 3px;

  --font-sans: "Noto Sans SC", "Source Han Sans SC", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, SFMono-Regular,
    Menlo, Consolas, "Courier New", monospace;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --t-fast: 120ms;
  --t-base: 180ms;

  --focus: 0 0 0 2px var(--abyss-950), 0 0 0 4px var(--electron-400);
}

/* ---------- 2. 重置 ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

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

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

ol, ul { list-style: none; }

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

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

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

table { border-collapse: collapse; width: 100%; }

hr { border: 0; }

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

/* ---------- 3. 全局排版 ---------- */
body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--abyss-950);
  color: var(--board-050);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.8;
  letter-spacing: 0.01em;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body.nav-open { overflow: hidden; }

h1, .h1 {
  font-size: clamp(40px, 7vw, 112px);
  font-weight: 900;
  line-height: 1.02;
  letter-spacing: -0.02em;
  font-style: normal;
}

h2, .h2 {
  font-size: clamp(28px, 3.6vw, 48px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

h3, .h3 {
  font-size: clamp(20px, 2vw, 26px);
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: 0;
}

h4, .h4 {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0.01em;
}

p { max-width: 74ch; }

strong { font-weight: 700; }

.mono {
  font-family: var(--font-mono);
  font-size: 0.9em;
  letter-spacing: 0.04em;
  font-weight: 500;
}

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

/* ---------- 4. 页面外壳 ---------- */
.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 999;
  padding: 10px 20px;
  background: var(--signal-500);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  border-radius: 2px;
  transform: translateY(-220%);
  transition: transform var(--t-fast) var(--ease);
}

.skip-link:focus { transform: translateY(0); }

.shell {
  width: 100%;
  max-width: var(--shell-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

#main-content { display: block; scroll-margin-top: 80px; }

.panel {
  position: relative;
  padding-block: clamp(56px, 8vw, 120px);
}

.panel--abyss { background: var(--abyss-950); color: var(--board-050); }
.panel--graphite { background: var(--graphite-900); color: var(--board-050); }
.panel--route { background: var(--route-700); color: var(--board-050); }
.panel--board { background: var(--board-050); color: var(--ink-800); }

.panel--board .annotation,
.panel--board .breadcrumb,
.panel--board .media-caption,
.panel--board .section-kicker { color: #55667A; }

.panel--board .section-no { color: var(--signal-600); }

.glass {
  background: var(--glass-100);
  border: 1px solid var(--glass-line);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.section-no {
  display: block;
  font-family: var(--font-mono);
  font-size: clamp(26px, 3.6vw, 44px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--signal-500);
}

.annotation {
  font-size: 12px;
  letter-spacing: 0.32em;
  line-height: 1.6;
  color: var(--haze-400);
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

.divider {
  height: 1px;
  background: var(--steel-600);
  opacity: 0.7;
}

/* ---------- 5. 页头：纵向轨道 ---------- */
.site-header {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 400;
  width: var(--rail-w);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 0 16px;
  background: linear-gradient(180deg, var(--graphite-900) 0%, var(--abyss-950) 100%);
  border-right: 1px solid var(--steel-600);
}

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

/* 品牌 */
.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 4px 6px 20px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  background: var(--signal-500);
  color: #fff;
  font-size: 19px;
  font-weight: 900;
  line-height: 1;
  border-radius: 2px;
  transition: background var(--t-base) var(--ease);
}

.brand:hover .brand-mark { background: var(--signal-600); }

.brand-name {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--board-050);
  text-align: center;
  white-space: nowrap;
}

/* 轨道导航 */
.site-nav {
  flex: 1 1 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--steel-600) transparent;
}

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

.nav-item { width: 100%; }

.nav-link {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 11px 5px;
  color: var(--haze-400);
  border-radius: 2px;
  transition: color var(--t-base) var(--ease),
    background-color var(--t-base) var(--ease);
}

.nav-num {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1;
  opacity: 0.7;
  transition: color var(--t-base) var(--ease), opacity var(--t-base) var(--ease);
}

.nav-label {
  font-size: 11px;
  line-height: 1.45;
  letter-spacing: 0.04em;
  text-align: center;
  word-break: break-word;
}

.nav-link:hover {
  color: var(--board-050);
  background: var(--glass-100);
}

.nav-link:hover .nav-num { color: var(--electron-400); opacity: 1; }

.nav-link[aria-current="page"],
.nav-link[data-scrolled] { color: #fff; }

.nav-link[aria-current="page"] .nav-num,
.nav-link[data-scrolled] .nav-num {
  color: var(--signal-500);
  opacity: 1;
}

.nav-link[aria-current="page"]::before,
.nav-link[data-scrolled]::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 2px;
  height: 62%;
  transform: translateY(-50%);
  background: var(--signal-500);
}

/* 轨道底部 */
.nav-aside {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 14px 6px 4px;
  border-top: 1px solid var(--steel-600);
}

.nav-version {
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.6;
  letter-spacing: 0.06em;
  color: var(--haze-400);
  text-align: center;
  max-width: 100%;
}

.nav-cta { display: none; }

/* 轨道进度 */
.rail-progress {
  position: absolute;
  top: 0;
  right: 0;
  width: 2px;
  height: var(--progress, 0%);
  background: linear-gradient(180deg, var(--electron-400) 0%, var(--signal-500) 100%);
  pointer-events: none;
}

/* 汉堡按钮（桌面隐藏） */
.nav-toggle { display: none; }

/* ---------- 6. 移动端：顶栏 + 全屏抽屉 ---------- */
@media (max-width: 900px) {
  body { padding-left: 0; padding-top: var(--bar-h); }

  .site-header {
    inset: 0 0 auto 0;
    width: 100%;
    height: var(--bar-h);
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 14px;
    padding: 0 14px;
    border-right: 0;
    border-bottom: 1px solid var(--steel-600);
    background: var(--graphite-900);
  }

  .nav-toggle {
    order: 1;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 8px 12px;
    border: 1px solid var(--steel-600);
    border-radius: 2px;
    color: var(--board-050);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.1em;
    transition: border-color var(--t-base) var(--ease),
      color var(--t-base) var(--ease);
  }

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

  .nav-toggle-bars {
    display: grid;
    gap: 4px;
    width: 16px;
  }

  .nav-toggle-bars span {
    display: block;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    transition: transform var(--t-base) var(--ease);
  }

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

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

  .brand {
    order: 2;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    width: auto;
    padding: 0;
  }

  .brand-mark { width: 28px; height: 28px; font-size: 15px; }
  .brand-name { font-size: 14px; letter-spacing: 0.1em; }

  .site-nav {
    position: fixed;
    top: var(--bar-h);
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 350;
    display: flex;
    flex-direction: column;
    padding: 22px var(--gutter) calc(28px + env(safe-area-inset-bottom));
    background: var(--abyss-950);
    border-top: 1px solid var(--steel-600);
    overflow-y: auto;
    transform: translateY(-101%);
    visibility: hidden;
    transition: transform var(--t-base) var(--ease),
      visibility 0s linear var(--t-base);
  }

  .site-nav[data-open] {
    transform: translateY(0);
    visibility: visible;
    transition-delay: 0s;
  }

  .nav-list { gap: 0; }

  .nav-link {
    flex-direction: row;
    align-items: baseline;
    gap: 16px;
    padding: 16px 2px;
    border-bottom: 1px solid var(--steel-600);
    border-radius: 0;
    color: var(--haze-400);
  }

  .nav-link::before { display: none; }

  .nav-num { font-size: 11px; }

  .nav-label {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-align: left;
  }

  .nav-link[aria-current="page"],
  .nav-link[data-scrolled] { color: var(--signal-500); }

  .nav-aside {
    margin-top: 26px;
    align-items: stretch;
    gap: 14px;
    padding: 0;
    border-top: 0;
  }

  .nav-version {
    font-size: 12px;
    text-align: left;
    letter-spacing: 0.08em;
  }

  .nav-cta {
    display: block;
    padding: 16px 20px;
    background: var(--signal-500);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-align: center;
    border-radius: 2px;
    transition: background var(--t-base) var(--ease);
  }

  .nav-cta:hover { background: var(--signal-600); }

  .rail-progress {
    top: auto;
    bottom: 0;
    left: 0;
    right: auto;
    width: var(--progress, 0%);
    height: 2px;
    background: linear-gradient(90deg, var(--electron-400) 0%, var(--signal-500) 100%);
  }

  #main-content { scroll-margin-top: calc(var(--bar-h) + 16px); }
}

/* ---------- 7. 页脚 ---------- */
.site-footer {
  background: var(--graphite-900);
  color: var(--haze-400);
  border-top: 1px solid var(--steel-600);
  padding-top: clamp(48px, 6vw, 84px);
}

.footer-grid {
  width: 100%;
  max-width: var(--shell-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
  display: grid;
  gap: clamp(30px, 4vw, 52px);
  grid-template-columns:
    minmax(240px, 1.5fr)
    repeat(3, minmax(100px, 0.72fr))
    minmax(210px, 1.15fr);
}

.footer-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.1em;
  line-height: 1.2;
  color: var(--board-050);
}

.footer-mark::before {
  content: "君";
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  background: var(--signal-500);
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  border-radius: 2px;
  flex: none;
}

.footer-intro {
  margin-top: 18px;
  font-size: 14px;
  line-height: 1.9;
  color: var(--haze-400);
  max-width: 40ch;
}

.footer-version {
  margin-top: 18px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--haze-400);
}

.footer-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.26em;
  color: var(--board-050);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--steel-600);
}

.footer-links {
  display: grid;
  gap: 11px;
}

.footer-links a {
  font-size: 14px;
  color: var(--haze-400);
  transition: color var(--t-base) var(--ease),
    padding-left var(--t-base) var(--ease);
}

.footer-links a:hover { color: var(--electron-400); padding-left: 5px; }

.footer-dl {
  display: grid;
  gap: 14px;
}

.footer-dl dt {
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--haze-400);
  opacity: 0.72;
  margin-bottom: 4px;
}

.footer-dl dd {
  font-size: 14px;
  line-height: 1.7;
  color: var(--board-050);
  word-break: break-word;
}

.footer-dl dd .mono { font-size: 13px; }

.footer-note {
  margin-top: 16px;
  font-size: 12px;
  line-height: 1.8;
  color: var(--haze-400);
  opacity: 0.86;
  padding-left: 10px;
  border-left: 2px solid var(--route-700);
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 1px 9px;
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  vertical-align: middle;
  color: var(--electron-400);
  border: 1px solid rgba(34, 211, 208, 0.42);
  border-radius: 999px;
  transition: background-color var(--t-base) var(--ease),
    color var(--t-base) var(--ease),
    border-color var(--t-base) var(--ease);
}

.copy-btn:hover {
  background: rgba(34, 211, 208, 0.12);
  border-color: var(--electron-400);
}

.copy-btn[data-copied] {
  color: var(--signal-500);
  border-color: rgba(255, 90, 31, 0.55);
  background: rgba(255, 90, 31, 0.1);
}

.footer-base {
  margin-top: clamp(40px, 5vw, 68px);
  border-top: 1px solid var(--steel-600);
}

.footer-base-inner {
  max-width: var(--shell-max);
  margin-inline: auto;
  padding: 20px var(--gutter) 28px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 28px;
}

.footer-legal {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--haze-400);
  max-width: none;
}

@media (max-width: 1180px) {
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-brand { grid-column: 1 / -1; }
  .footer-intro { max-width: 56ch; }
}

@media (max-width: 560px) {
  .footer-grid { grid-template-columns: minmax(0, 1fr); gap: 30px; }
  .footer-brand { grid-column: auto; }
  .footer-base-inner { flex-direction: column; align-items: flex-start; }
}

/* ---------- 8. 通用组件 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 26px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1.3;
  border: 1px solid transparent;
  border-radius: 2px;
  transition: background-color var(--t-base) var(--ease),
    color var(--t-base) var(--ease),
    border-color var(--t-base) var(--ease),
    transform var(--t-base) var(--ease);
}

.btn--signal { background: var(--signal-500); color: #fff; }
.btn--signal:hover { background: var(--signal-600); transform: translateY(-2px); }

.btn--ghost {
  border-color: var(--steel-600);
  color: var(--board-050);
  background: transparent;
}
.btn--ghost:hover {
  border-color: var(--electron-400);
  color: var(--electron-400);
  transform: translateY(-2px);
}

.btn--ink { background: var(--ink-800); color: var(--board-050); }
.btn--ink:hover { background: #1C2735; transform: translateY(-2px); }

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--haze-400);
}

.breadcrumb li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.breadcrumb li + li::before {
  content: "/";
  color: var(--steel-600);
}

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

.breadcrumb [aria-current="page"] { color: currentColor; opacity: 1; font-weight: 500; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 11px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1.7;
  color: var(--electron-400);
  background: rgba(34, 211, 208, 0.07);
  border: 1px solid rgba(34, 211, 208, 0.34);
  border-radius: 999px;
}

.tag--signal {
  color: var(--signal-500);
  background: rgba(255, 90, 31, 0.09);
  border-color: rgba(255, 90, 31, 0.42);
}

.tag--muted {
  color: var(--haze-400);
  background: var(--glass-100);
  border-color: var(--glass-line);
}

.media {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background:
    linear-gradient(140deg, var(--route-700) 0%, var(--graphite-900) 58%, var(--abyss-950) 100%);
  isolation: isolate;
}

.media::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(var(--glass-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--glass-line) 1px, transparent 1px);
  background-size: 44px 44px;
  opacity: 0.34;
  pointer-events: none;
}

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

.media--16x9 { aspect-ratio: 16 / 9; }
.media--21x9 { aspect-ratio: 21 / 9; }
.media--4x3 { aspect-ratio: 4 / 3; }
.media--1x1 { aspect-ratio: 1 / 1; }
.media--3x4 { aspect-ratio: 3 / 4; }

.media-caption {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
  letter-spacing: 0.14em;
  color: var(--haze-400);
}

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

.grid--2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(248px, 1fr)); }

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

@media (max-width: 720px) {
  .grid--12 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

.stack > * + * { margin-top: var(--stack-gap, 16px); }

/* ---------- 9. 显现动效 ---------- */
.has-reveal [data-reveal] {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--t-base) var(--ease), transform var(--t-base) var(--ease);
  will-change: opacity, transform;
}

.has-reveal [data-reveal].is-visible {
  opacity: 1;
  transform: none;
  will-change: auto;
}

/* ---------- 10. 减少动效 ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .has-reveal [data-reveal] {
    opacity: 1;
    transform: none;
  }

  .btn:hover,
  .header-cta:hover,
  .footer-links a:hover { transform: none; }
}
