/* =========================================================
   biyi-team.com.cn — /assets/site.css
   高原数据瞭望塔 · 共享外壳与通用组件
   ========================================================= */

/* ---------- 01 reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body, h1, h2, h3, h4, h5, p, ul, ol, figure, blockquote, dl, dd, hr { margin: 0; }
ul, ol { list-style: none; padding: 0; }
img, svg, video { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
table { border-collapse: collapse; }
[hidden] { display: none !important; }

/* ---------- 02 tokens ---------- */
:root {
  --night: #0B1B33;
  --plateau: #14304F;
  --indigo: #4B2E63;
  --wine: #6B2C43;
  --brass: #C08A2E;
  --brass-lite: #E7C173;
  --paper: #F5F2E9;
  --paper-ink: #0E1A26;
  --note: #6E8399;
  --tag-blue: #3E7BB6;
  --tag-red: #A33B3B;
  --tag-green: #3F7A5E;
  --tag-yellow: #D9B23A;
  --line: rgba(192, 138, 46, 0.30);
  --line-soft: rgba(192, 138, 46, 0.14);
  --hair: rgba(245, 242, 233, 0.12);
  --wrap: 1240px;
  --header-h: 72px;
  --radius-cut: 22px;
  --font-head: "Source Han Serif SC", "Noto Serif SC", "Songti SC", "SimSun", Georgia, serif;
  --font-body: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: ui-monospace, "JetBrains Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.22, .68, .32, 1);
}

/* ---------- 03 base ---------- */
body {
  background: var(--night);
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.75;
  letter-spacing: 0.01em;
  min-height: 100vh;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5 {
  font-family: var(--font-head);
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.15;
  color: var(--paper);
}

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

::selection { background: var(--brass); color: var(--night); }

/* ---------- 04 utilities ---------- */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 24px;
}

.page-offset { padding-top: calc(var(--header-h) + 52px); }

.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.prose { max-width: 66ch; color: rgba(245, 242, 233, 0.86); font-size: 16px; }
.prose p + p { margin-top: 1.05em; }
.prose--paper { color: var(--paper-ink); }
.prose--paper a { color: var(--tag-blue); border-bottom: 1px solid currentColor; }

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 400;
  padding: 10px 18px;
  background: var(--brass);
  color: var(--night);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.08em;
  clip-path: polygon(8px 0, 100% 0, 100% 100%, 0 100%, 0 8px);
  transform: translateY(-220%);
  transition: transform 0.22s var(--ease);
}
.skip-link:focus { transform: translateY(0); }

/* ---------- 05 header ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 200;
  color: var(--paper);
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background-color 0.35s var(--ease), border-color 0.35s var(--ease);
}
.site-header.is-condensed {
  background: rgba(11, 27, 51, 0.96);
  border-bottom-color: var(--line);
  box-shadow: 0 12px 32px rgba(4, 12, 24, 0.42);
}

.site-header__bar {
  max-width: var(--wrap);
  margin-inline: auto;
  padding: 14px 24px;
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 18px;
  transition: min-height 0.3s var(--ease), padding 0.3s var(--ease);
}
.site-header.is-condensed .site-header__bar { min-height: 60px; padding-block: 8px; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  color: var(--paper);
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 17px;
  letter-spacing: 0.1em;
}
.brand__mark {
  width: 14px;
  height: 22px;
  background: linear-gradient(180deg, var(--brass-lite), var(--brass));
  clip-path: polygon(0 0, 100% 14%, 100% 100%, 0 86%);
  flex: 0 0 auto;
}
.brand__sub {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.26em;
  color: var(--note);
  padding-left: 8px;
  border-left: 1px solid var(--line-soft);
}
.brand--footer { font-size: 19px; margin-bottom: 14px; }

.nav-toggle {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  color: var(--brass-lite);
  font-size: 13px;
  letter-spacing: 0.12em;
  clip-path: polygon(7px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%, 0 7px);
}
.nav-toggle__bars {
  width: 16px;
  height: 10px;
  background:
    linear-gradient(var(--brass-lite), var(--brass-lite)) 0 0 / 100% 1.5px no-repeat,
    linear-gradient(var(--brass-lite), var(--brass-lite)) 0 50% / 100% 1.5px no-repeat,
    linear-gradient(var(--brass-lite), var(--brass-lite)) 0 100% / 100% 1.5px no-repeat;
}
.nav-toggle__text { line-height: 1; }

.site-nav {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-10px);
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease), visibility 0.25s;
}
.site-nav[data-open="true"] {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}
.site-nav__list {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
  padding: 12px 20px;
  background: rgba(11, 27, 51, 0.98);
  border-bottom: 1px solid var(--line);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.site-nav__link {
  flex: 0 0 auto;
  padding: 9px 14px;
  font-size: 14px;
  letter-spacing: 0.06em;
  color: rgba(245, 242, 233, 0.8);
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.site-nav__link:hover { color: var(--paper); }
.site-nav__link[aria-current="page"] { color: var(--brass-lite); border-bottom-color: var(--brass); }

.site-header__aside {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex: 0 0 auto;
}
.nav-toggle + .site-nav { order: 3; }

.index-toggle {
  padding: 8px 12px;
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--note);
  border-left: 1px solid var(--line-soft);
  transition: color 0.2s var(--ease);
}
.index-toggle:hover,
.index-toggle[aria-expanded="true"] { color: var(--brass-lite); }

.tower-index {
  position: absolute;
  top: 100%;
  right: 20px;
  width: min(304px, calc(100vw - 32px));
  padding: 18px 20px 22px;
  background: var(--plateau);
  border-top: 2px solid var(--brass);
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 0 100%);
  box-shadow: 0 24px 48px rgba(4, 12, 24, 0.55);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.24s var(--ease), transform 0.24s var(--ease), visibility 0.24s;
}
.tower-index[data-open="true"] { opacity: 1; visibility: visible; transform: translateY(0); }
.tower-index__label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.24em;
  color: var(--brass);
  margin-bottom: 12px;
}
.tower-index__list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 52vh;
  overflow-y: auto;
}
.tower-index__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  font-size: 13px;
  color: rgba(245, 242, 233, 0.78);
  border-left: 2px solid transparent;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.tower-index__item::before {
  content: attr(data-index);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--note);
  flex: 0 0 auto;
}
.tower-index__item:hover { background: rgba(192, 138, 46, 0.12); color: var(--paper); }
.tower-index__item[aria-current="true"] { border-left-color: var(--brass); color: var(--brass-lite); }

/* ---------- 06 breadcrumb ---------- */
.breadcrumb {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--note);
  margin-bottom: 22px;
}
.breadcrumb ol { display: flex; flex-wrap: wrap; gap: 8px; }
.breadcrumb li { display: inline-flex; align-items: center; gap: 8px; }
.breadcrumb li + li::before { content: "/"; color: rgba(110, 131, 153, 0.6); }
.breadcrumb a { color: var(--note); transition: color 0.2s var(--ease); }
.breadcrumb a:hover { color: var(--brass-lite); }

/* ---------- 07 section head ---------- */
.section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: end;
  padding-bottom: 18px;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--line);
}
.section-head__title { font-size: clamp(28px, 4vw, 46px); }
.section-head__note {
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--note);
  max-width: 34ch;
}

/* ---------- 08 cut panels ---------- */
.cut-panel {
  position: relative;
  padding: 26px 28px 30px;
  background: var(--plateau);
  clip-path: polygon(0 0, calc(100% - var(--radius-cut)) 0, 100% var(--radius-cut), 100% 100%, 0 100%);
}
.cut-panel::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 68px;
  height: 3px;
  background: var(--brass);
}
.cut-panel--indigo { background: var(--indigo); }
.cut-panel--wine { background: var(--wine); }
.cut-panel--paper { background: var(--paper); color: var(--paper-ink); }
.cut-panel--paper .cut-panel__title { color: var(--paper-ink); }

/* ---------- 09 grids ---------- */
.grid { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr); }
.grid--2, .grid--3 { grid-template-columns: minmax(0, 1fr); }
.grid--split { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr); }

/* ---------- 10 tags ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  line-height: 1.6;
  border: 1px solid currentColor;
  background: rgba(245, 242, 233, 0.04);
}
.tag--blue { color: #8CC0EA; border-color: rgba(62, 123, 182, 0.65); background: rgba(62, 123, 182, 0.16); }
.tag--red { color: #E29A9A; border-color: rgba(163, 59, 59, 0.65); background: rgba(163, 59, 59, 0.16); }
.tag--green { color: #86C3A4; border-color: rgba(63, 122, 94, 0.65); background: rgba(63, 122, 94, 0.16); }
.tag--yellow { color: #E7CF7C; border-color: rgba(217, 178, 58, 0.65); background: rgba(217, 178, 58, 0.16); }
.tag--brass { color: var(--brass-lite); border-color: rgba(192, 138, 46, 0.7); background: rgba(192, 138, 46, 0.14); }

/* ---------- 11 buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.4;
  clip-path: polygon(9px 0, 100% 0, 100% calc(100% - 9px), calc(100% - 9px) 100%, 0 100%, 0 9px);
  transition: background-color 0.22s var(--ease), color 0.22s var(--ease), border-color 0.22s var(--ease);
}
.btn--brass { background: var(--brass); color: var(--night); }
.btn--brass:hover { background: var(--brass-lite); }
.btn--ghost { border: 1px solid var(--line); color: var(--brass-lite); }
.btn--ghost:hover { border-color: var(--brass-lite); background: rgba(192, 138, 46, 0.12); }
.btn--sm { padding: 9px 16px; font-size: 13px; }

/* ---------- 12 scale rail ---------- */
.scale-rail {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-left: 18px;
  border-left: 1px solid var(--line);
}
.scale-rail__tick {
  position: relative;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--note);
}
.scale-rail__tick::before {
  content: "";
  position: absolute;
  left: -18px;
  top: 50%;
  width: 10px;
  height: 1px;
  background: var(--line);
}
.scale-rail__tick[aria-current="true"] { color: var(--brass-lite); font-size: 13px; }
.scale-rail__tick[aria-current="true"]::before { width: 16px; background: var(--brass); }

/* ---------- 13 media frames ---------- */
.media-frame {
  position: relative;
  overflow: hidden;
  background: var(--plateau);
  aspect-ratio: 16 / 9;
  clip-path: polygon(0 0, calc(100% - 26px) 0, 100% 26px, 100% 100%, 0 100%);
}
.media-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.72) contrast(1.06) brightness(0.94);
}
.media-frame--wide { aspect-ratio: 21 / 9; }
.media-frame--tall { aspect-ratio: 3 / 4; }
.media-frame__caption {
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.65;
  color: var(--note);
  letter-spacing: 0.04em;
}

/* ---------- 14 data table ---------- */
.data-table {
  width: 100%;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  text-align: left;
}
.data-table caption {
  caption-side: top;
  text-align: left;
  padding-bottom: 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.18em;
  color: var(--note);
}
.data-table th {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--note);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.data-table td {
  padding: 12px;
  color: rgba(245, 242, 233, 0.88);
  border-bottom: 1px solid var(--hair);
}
.data-table tbody tr { transition: background-color 0.18s var(--ease); }
.data-table tbody tr:hover { background: rgba(192, 138, 46, 0.08); }
.data-table--paper th { color: #5B6B7C; border-bottom-color: rgba(14, 26, 38, 0.18); }
.data-table--paper td { color: var(--paper-ink); border-bottom-color: rgba(14, 26, 38, 0.08); }

/* ---------- 15 footer ---------- */
.site-footer {
  position: relative;
  margin-top: 96px;
  padding-top: 64px;
  background: var(--night);
  border-top: 1px solid var(--line);
  color: rgba(245, 242, 233, 0.78);
}
.site-footer__flags {
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(
    90deg,
    var(--tag-blue) 0 20%,
    var(--paper) 20% 40%,
    var(--tag-red) 40% 60%,
    var(--tag-green) 60% 80%,
    var(--tag-yellow) 80% 100%
  );
}
.site-footer__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 34px;
  padding-bottom: 48px;
}
.footer-col__title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--brass);
  margin-bottom: 16px;
}
.footer-list { display: flex; flex-direction: column; gap: 9px; font-size: 14px; }
.footer-list a {
  color: rgba(245, 242, 233, 0.78);
  transition: color 0.2s var(--ease);
  border-bottom: 1px solid transparent;
}
.footer-list a:hover { color: var(--brass-lite); border-bottom-color: var(--line); }
.footer-list--plain { gap: 12px; }
.footer-list--plain li { display: flex; flex-direction: column; gap: 2px; }
.footer-list__key {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--note);
}
.footer-list__val { font-size: 14px; color: rgba(245, 242, 233, 0.86); word-break: break-word; }
.footer-note {
  font-size: 13px;
  line-height: 1.75;
  color: rgba(245, 242, 233, 0.6);
  max-width: 42ch;
}
.footer-note--mono {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  color: var(--note);
  margin-top: 14px;
}
.site-footer__base { border-top: 1px solid var(--hair); padding: 20px 0 26px; }
.site-footer__base-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 26px;
  align-items: center;
  justify-content: space-between;
}
.site-footer__base-inner .footer-note--mono { margin-top: 0; }

/* ---------- 16 reveal ---------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.72s var(--ease), transform 0.72s var(--ease);
}
[data-reveal].is-visible { opacity: 1; transform: none; }

/* ---------- 17 back to top ---------- */
.to-top {
  position: fixed;
  right: 20px;
  bottom: 24px;
  z-index: 180;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px 10px 12px;
  background: rgba(20, 48, 79, 0.94);
  border-left: 3px solid var(--brass);
  color: var(--brass-lite);
  font-size: 12px;
  letter-spacing: 0.14em;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 10px 100%, 0 calc(100% - 10px));
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.28s var(--ease), transform 0.28s var(--ease), visibility 0.28s;
}
.to-top[data-visible="true"] { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { background: var(--plateau); color: var(--brass); }
.to-top__mark {
  width: 10px;
  height: 10px;
  border-left: 2px solid currentColor;
  border-top: 2px solid currentColor;
  transform: rotate(45deg);
}
.to-top__text { line-height: 1; }

/* ---------- 18 breakpoints ---------- */
@media (max-width: 939px) {
  body.is-nav-open { overflow: hidden; }
  .site-header__aside .btn { display: none; }
}

@media (min-width: 640px) {
  .grid { gap: 28px; }
  .grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .section-head {
    grid-template-columns: minmax(0, 1fr) minmax(0, 300px);
    gap: 32px;
  }
  .site-footer__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 940px) {
  .wrap { padding-inline: 40px; }
  .nav-toggle { display: none; }
  .site-nav {
    position: static;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
    margin-left: auto;
  }
  .site-nav__list {
    padding: 0;
    background: none;
    border: 0;
    overflow: visible;
    gap: 2px;
  }
  .site-nav__link {
    padding: 8px 12px;
    border-bottom: 0;
    position: relative;
  }
  .site-nav__link::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 2px;
    height: 2px;
    background: var(--brass);
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.28s var(--ease);
  }
  .site-nav__link:hover::after { transform: scaleX(1); }
  .site-nav__link[aria-current="page"]::after { transform: scaleX(1); }
  .site-header__aside { margin-left: 0; }
  .grid { gap: 32px; }
  .grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid--split { grid-template-columns: minmax(0, 1fr) minmax(0, 300px); gap: 56px; }
  .site-footer__grid {
    grid-template-columns: 1.6fr 1fr 1fr 1.3fr;
    gap: 40px;
  }
}

@media (min-width: 1240px) {
  .section-head__note { font-size: 13px; }
}

/* ---------- 19 accessibility preferences ---------- */
@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;
  }
  [data-reveal] { opacity: 1; transform: none; }
  .to-top { transition: none; }
}

@media print {
  .site-header, .to-top, .nav-toggle, .tower-index { display: none !important; }
  body { background: #fff; color: #000; }
}
