/* ===== 1. Reset ===== */
*,
*::before,
*::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
img, picture, svg, video { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
ul, ol { padding: 0; }
a { color: inherit; }

/* ===== 2. 变量 ===== */
:root {
  --void: #070A12;
  --panel: #0E1524;
  --teal: #0B2F33;
  --indigo: #1B1240;
  --wine: #3A1026;
  --cyan: #31F2DE;
  --grape: #A56BFF;
  --lime: #8CFF54;
  --amber: #FFC24B;
  --ink: #E9F2F6;
  --ink-dim: #A3B4C8;
  --hair: #22304A;

  --font-head: "Space Grotesk", "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --font-body: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-pill: 999px;
  --shell: 1220px;
  --line: 1px solid var(--hair);
}

/* ===== 3. 基础排版 ===== */
body {
  background: var(--void);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
p { text-wrap: pretty; }

::selection { background: var(--cyan); color: #04140f; }

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

/* ===== 4. 容器与工具 ===== */
.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: clamp(1.15rem, 4vw, 2.5rem);
}
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.85em;
  letter-spacing: 0.04em;
}
.eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 0.9rem;
}
.h-display {
  font-size: clamp(2.4rem, 6vw, 5.5rem);
  line-height: 1.02;
}
.h-section {
  font-size: clamp(1.7rem, 3.4vw, 2.6rem);
}
.divider {
  height: 1px;
  border: 0;
  background: linear-gradient(90deg, var(--hair), rgba(34, 48, 74, 0));
  margin-block: 2.5rem;
}
.prose { max-width: 68ch; }
.prose p + p { margin-top: 1.1em; }
.prose h2 { font-size: clamp(1.4rem, 2.4vw, 1.9rem); margin-top: 2.2em; margin-bottom: 0.7em; }
.prose h3 { font-size: 1.15rem; margin-top: 1.6em; margin-bottom: 0.5em; }
.prose ul, .prose ol { margin: 1em 0 1em 1.2em; }
.prose li + li { margin-top: 0.5em; }
.prose a { color: var(--cyan); text-decoration: none; border-bottom: 1px solid rgba(49, 242, 222, 0.4); }
.prose a:hover { border-bottom-color: var(--cyan); }

/* ===== 5. 跳过链接 ===== */
.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 200;
  padding: 0.7rem 1.2rem;
  border-radius: var(--radius-pill);
  background: var(--cyan);
  color: #04140f;
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform 0.2s ease;
}
.skip-link:focus {
  transform: translateY(0);
}

/* ===== 6. 页头 ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(7, 10, 18, 0.9);
  backdrop-filter: blur(14px);
  border-bottom: var(--line);
}
.site-header::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  opacity: 0.45;
  pointer-events: none;
}
.scroll-progress {
  position: fixed;
  top: 0; left: 0;
  z-index: 90;
  height: 2px;
  width: 0;
  background: linear-gradient(90deg, var(--cyan), var(--grape));
  pointer-events: none;
}
.header-shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 74px;
  padding-block: 0.85rem;
}

/* 品牌 */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: var(--ink);
  flex: 0 0 auto;
}
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--cyan), var(--grape));
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  box-shadow: 0 8px 22px rgba(49, 242, 222, 0.18);
}
.brand-mark::before {
  content: "";
  width: 0; height: 0;
  margin-left: 3px;
  border-left: 11px solid #05080E;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
}
.brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  line-height: 1.2;
}
.brand-name {
  font-family: var(--font-head);
  font-size: 1.02rem;
  font-weight: 900;
  letter-spacing: -0.01em;
}
.brand-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--ink-dim);
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 0 3px rgba(140, 255, 84, 0.16);
  animation: dot-breathe 3.4s ease-in-out infinite;
}
@keyframes dot-breathe {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

/* 导航 */
.site-nav { display: flex; align-items: center; }
.nav-list {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
}
.nav-list a {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  color: var(--ink-dim);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.nav-list a:hover {
  color: var(--ink);
  border-color: var(--hair);
  background: rgba(49, 242, 222, 0.06);
}
.nav-list a[aria-current="page"] {
  color: var(--cyan);
  border-color: rgba(49, 242, 222, 0.55);
  background: rgba(49, 242, 222, 0.09);
}

/* 移动端切换按钮 */
.nav-toggle {
  display: none;
  align-items: center;
  gap: 0.55rem;
  padding: 0.7rem 1.15rem;
  border-radius: var(--radius-pill);
  border: var(--line);
  background: var(--panel);
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}
.nav-toggle:hover { border-color: var(--cyan); color: var(--cyan); }
.nav-toggle:active { transform: scale(0.97); }
.nav-toggle-bars {
  position: relative;
  display: block;
  width: 16px;
  height: 10px;
}
.nav-toggle-bars::before,
.nav-toggle-bars::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 1.5px;
  background: currentColor;
  transition: transform 0.2s ease;
}
.nav-toggle-bars::before { top: 0; }
.nav-toggle-bars::after { bottom: 0; }
.nav-toggle[aria-expanded="true"] {
  border-color: var(--cyan);
  color: var(--cyan);
  background: rgba(49, 242, 222, 0.1);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before { transform: translateY(4.5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after { transform: translateY(-4.5px) rotate(-45deg); }

/* ===== 7. 页脚 ===== */
.site-footer {
  position: relative;
  margin-top: clamp(3.5rem, 8vw, 7rem);
  background: var(--panel);
  border-top: var(--line);
}
.site-footer::before {
  content: "";
  position: absolute;
  top: -1px; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--grape), var(--cyan), transparent);
  opacity: 0.5;
}
.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4rem);
  padding-block: clamp(2.75rem, 6vw, 4.25rem) 2rem;
}
.footer-name {
  font-family: var(--font-head);
  font-size: 1.3rem;
  font-weight: 900;
  letter-spacing: -0.01em;
}
.footer-icp {
  margin-top: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--ink-dim);
}
.footer-contact {
  list-style: none;
  margin-top: 1.5rem;
  display: grid;
  gap: 0.55rem;
  max-width: 42ch;
  font-size: 0.9rem;
  color: var(--ink-dim);
}
.footer-contact li { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.footer-contact-key {
  flex: 0 0 auto;
  min-width: 4.2rem;
  color: var(--cyan);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding-top: 0.18rem;
}
.footer-contact .mono { color: var(--ink); }
.status-strip {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.75rem;
}
.status-item {
  border: var(--line);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.9rem;
  background: rgba(7, 10, 18, 0.65);
  min-width: 8rem;
}
.status-key {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--ink-dim);
}
.status-val {
  display: block;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  margin-top: 0.15rem;
}
.footer-cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1.5rem, 3vw, 2.5rem);
}
.footer-col-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--cyan);
  margin-bottom: 1rem;
}
.footer-links {
  list-style: none;
  display: grid;
  gap: 0.55rem;
  font-size: 0.9rem;
}
.footer-links a {
  color: var(--ink-dim);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.footer-links a:hover {
  color: var(--cyan);
  border-bottom-color: rgba(49, 242, 222, 0.6);
}
.footer-base {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  padding-block: 1.4rem 1.8rem;
  border-top: var(--line);
  font-size: 0.8rem;
  color: var(--ink-dim);
}
.footer-legal { max-width: 46ch; }

/* ===== 8. 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius-pill);
  border: var(--line);
  background: var(--panel);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}
.btn:hover { border-color: var(--cyan); color: var(--cyan); }
.btn:active { transform: scale(0.97); }
.btn--primary {
  background: var(--cyan);
  border-color: var(--cyan);
  color: #04140f;
  box-shadow: 0 14px 34px rgba(49, 242, 222, 0.22);
}
.btn--primary:hover { background: #5ff7e7; border-color: #5ff7e7; color: #04140f; }
.btn--ghost {
  background: transparent;
  border-color: rgba(165, 107, 255, 0.6);
  color: var(--grape);
}
.btn--ghost:hover { background: rgba(165, 107, 255, 0.12); color: #c9a6ff; border-color: var(--grape); }

/* ===== 9. 标签 ===== */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.72rem;
  border-radius: var(--radius-pill);
  border: var(--line);
  background: rgba(14, 21, 36, 0.85);
  color: var(--ink-dim);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.6;
}
.tag--cyan { color: var(--cyan); border-color: rgba(49, 242, 222, 0.5); background: rgba(49, 242, 222, 0.09); }
.tag--grape { color: var(--grape); border-color: rgba(165, 107, 255, 0.5); background: rgba(165, 107, 255, 0.1); }
.tag--lime { color: var(--lime); border-color: rgba(140, 255, 84, 0.45); background: rgba(140, 255, 84, 0.09); }
.tag--amber { color: var(--amber); border-color: rgba(255, 194, 75, 0.45); background: rgba(255, 194, 75, 0.09); }

/* ===== 10. 分区 ===== */
.section {
  position: relative;
  padding-block: clamp(3rem, 7vw, 6rem);
}
.section--panel { background: var(--panel); }
.section--teal { background: var(--teal); }
.section--indigo { background: var(--indigo); }
.section--wine { background: var(--wine); }
.section--void { background: var(--void); }

/* ===== 11. 栅格 ===== */
.grid-12 {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: clamp(1rem, 2.4vw, 2rem);
}
.col-main { grid-column: 1 / span 7; min-width: 0; }
.col-note { grid-column: 8 / span 3; min-width: 0; }
.col-half { grid-column: span 6; min-width: 0; }
.col-third { grid-column: span 4; min-width: 0; }
.col-full { grid-column: 1 / -1; min-width: 0; }

/* ===== 12. 面包屑 ===== */
.crumb { padding-block: 1.25rem 0; }
.crumb-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--ink-dim);
}
.crumb-list li { display: inline-flex; align-items: center; }
.crumb-list li + li::before {
  content: "/";
  margin-right: 0.5rem;
  color: var(--hair);
}
.crumb-list a {
  color: var(--ink-dim);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.crumb-list a:hover { color: var(--cyan); border-bottom-color: var(--cyan); }

/* ===== 13. 卡片 ===== */
.card {
  position: relative;
  background: var(--panel);
  border: var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(1.25rem, 2.4vw, 1.9rem);
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.card:hover { border-color: rgba(49, 242, 222, 0.5); }
.card--float {
  transform: rotate(-1.5deg);
  box-shadow: 0 26px 60px rgba(0, 0, 0, 0.5);
}
.card--float:hover { transform: rotate(0deg) translateY(-3px); }

/* ===== 14. 图片容器 ===== */
.media-frame {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: var(--line);
  background: linear-gradient(135deg, var(--panel), var(--void));
  aspect-ratio: 16 / 10;
}
.media-frame > img,
.media-frame > video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.media-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(180deg, rgba(233, 242, 246, 0.05) 0 1px, transparent 1px 4px);
  pointer-events: none;
}
.media-frame--wide { aspect-ratio: 21 / 9; }
.media-frame--tall { aspect-ratio: 4 / 5; }
.media-frame--square { aspect-ratio: 1 / 1; }
.media-frame--device { aspect-ratio: 9 / 19; max-width: 300px; }
.media-frame__caption {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  z-index: 1;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-pill);
  background: rgba(7, 10, 18, 0.78);
  border: var(--line);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--ink-dim);
}

/* ===== 15. 显现与目录高亮 ===== */
html.js [data-reveal] {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}
html.js [data-reveal].is-revealed {
  opacity: 1;
  transform: none;
}
[data-toc-link][aria-current="true"] {
  color: var(--cyan);
  border-color: rgba(49, 242, 222, 0.6);
}

/* ===== 16. 平板 ===== */
@media (max-width: 1080px) {
  .nav-list a { padding: 0.45rem 0.65rem; font-size: 0.85rem; }
  .col-main { grid-column: 1 / span 8; }
  .col-note { grid-column: 9 / span 4; }
}

/* ===== 17. 移动端 ===== */
@media (max-width: 960px) {
  body { padding-bottom: 5.25rem; }

  .site-header {
    backdrop-filter: none;
    background: var(--void);
  }
  .header-shell {
    min-height: 64px;
    padding-block: 0.7rem;
  }
  .brand-name { font-size: 0.95rem; }

  .nav-toggle {
    display: inline-flex;
    position: fixed;
    left: 50%;
    bottom: max(1rem, env(safe-area-inset-bottom));
    transform: translateX(-50%);
    z-index: 80;
    background: var(--panel);
    backdrop-filter: blur(10px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.62), 0 0 0 1px rgba(49, 242, 222, 0.16);
  }
  .nav-toggle:active { transform: translateX(-50%) scale(0.97); }

  .site-nav {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 70;
    display: block;
    max-height: 82vh;
    overflow-y: auto;
    padding: 1.5rem clamp(1.15rem, 4vw, 2rem) 6rem;
    background: var(--panel);
    border-top: var(--line);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: 0 -24px 60px rgba(0, 0, 0, 0.6);
    transform: translateY(115%);
    visibility: hidden;
    transition: transform 0.3s ease, visibility 0.3s ease;
  }
  .site-nav[data-open] {
    transform: translateY(0);
    visibility: visible;
  }
  .site-nav::before {
    content: "栏目路径";
    display: block;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    color: var(--ink-dim);
    margin-bottom: 1rem;
  }
  .nav-list {
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
  }
  .nav-list a {
    justify-content: flex-start;
    padding: 0.9rem 1.1rem;
    border-radius: var(--radius-md);
    border-color: var(--hair);
    background: rgba(7, 10, 18, 0.55);
    font-size: 1rem;
    font-weight: 700;
  }
  .nav-list a[aria-current="page"] {
    border-color: var(--cyan);
    background: rgba(49, 242, 222, 0.12);
  }

  .footer-grid { grid-template-columns: minmax(0, 1fr); }
  .footer-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .col-main,
  .col-note,
  .col-half,
  .col-third {
    grid-column: 1 / -1;
  }
}

@media (max-width: 520px) {
  .brand-meta { font-size: 0.64rem; }
  .footer-cols { grid-template-columns: minmax(0, 1fr); }
  .footer-base { flex-direction: column; }
  .status-item { flex: 1 1 45%; min-width: 0; }
}

/* ===== 18. 减少动态 ===== */
@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;
  }
  html.js [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
  }
  .site-nav { transition: none; }
}
