/* ============================================================
   基础层：重置 / 原型外壳 / 蓝图氛围 / 排版 / 入场编排 / 降级
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--c-paper);
  color: var(--c-text);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  letter-spacing: .01em;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, p, figure, ul, ol, dl { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
img { max-width: 100%; display: block; }
table { border-collapse: collapse; width: 100%; }
:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; border-radius: var(--r-xs); }
::selection { background: var(--c-blue); color: #fff; }

/* 滚动条：细工程线 */
* { scrollbar-width: thin; scrollbar-color: var(--c-line-2) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--c-line-2); border-radius: var(--r-pill); }
::-webkit-scrollbar-track { background: transparent; }

/* ——— 原型工具条 ——— */
.proto-topbar {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: var(--sp-5);
  padding: 0 var(--gutter);
  background: var(--c-sidebar);
  color: var(--c-text-inv);
  position: relative; z-index: 40;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.proto-brand { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.proto-brand img { height: 30px; width: auto; }           /* 深色底：纯白版 LOGO，不加白框 */
.proto-brand .pb-name { font-size: var(--fs-md); font-weight: 700; letter-spacing: .04em; white-space: nowrap; }
.proto-brand .pb-tag {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em;
  color: var(--c-text-inv-2); border-left: 1px solid rgba(255,255,255,.2);
  padding-left: var(--sp-3); white-space: nowrap;
}
.proto-switch { display: flex; gap: 2px; margin-left: auto; padding: 3px; background: rgba(255,255,255,.07); border-radius: var(--r-md); }
.proto-switch button {
  padding: 7px 16px; min-height: 36px; font-size: var(--fs-sm); font-weight: 600;
  color: var(--c-text-inv-2); border-radius: var(--r-sm); transition: all var(--dur-fast) ease-out;
  white-space: nowrap;
}
.proto-switch button:hover { color: #fff; background: rgba(255,255,255,.08); }
.proto-switch button[aria-pressed="true"] { background: var(--c-blue); color: #fff; box-shadow: var(--sh-1); }
.proto-tools { display: flex; align-items: center; gap: var(--sp-3); }
.proto-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; min-height: 36px; font-size: var(--fs-sm); font-weight: 600;
  color: var(--c-text-inv); border: 1px solid rgba(255,255,255,.24); border-radius: var(--r-sm);
  transition: all var(--dur-fast) ease-out;
}
.proto-btn:hover { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.5); }

/* ——— 页面导航条 ——— */
.proto-subnav {
  min-height: var(--subnav-h); display: flex; align-items: center; gap: var(--sp-2);
  padding: 6px var(--gutter);
  background: var(--c-surface); border-bottom: 1px solid var(--c-line);
  position: relative; z-index: 30; overflow-x: auto;
}
.proto-subnav .sn-label {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .14em;
  color: var(--c-muted); text-transform: uppercase; white-space: nowrap;
  padding-right: var(--sp-3); margin-right: var(--sp-1); border-right: 1px solid var(--c-line);
}
.proto-subnav button {
  padding: 6px 12px; min-height: 32px; border-radius: var(--r-sm);
  font-size: var(--fs-sm); color: var(--c-text-2); white-space: nowrap;
  border: 1px solid transparent; transition: all var(--dur-fast) ease-out;
}
.proto-subnav button:hover { background: var(--c-surface-3); color: var(--c-ink); }
.proto-subnav button[aria-current="page"] {
  background: var(--c-blue-soft); color: var(--c-blue-deep); font-weight: 700;
  border-color: var(--c-blue-line);
}

/* ——— 舞台 + 蓝图氛围 ——— */
.proto-stage { position: relative; min-height: calc(100vh - var(--topbar-h) - var(--subnav-h)); }
.proto-stage::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    linear-gradient(rgba(11, 99, 197, .038) 1px, transparent 1px),
    linear-gradient(90deg, rgba(11, 99, 197, .038) 1px, transparent 1px),
    linear-gradient(rgba(11, 99, 197, .055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(11, 99, 197, .055) 1px, transparent 1px);
  background-size: 32px 32px, 32px 32px, 160px 160px, 160px 160px;
}
.proto-stage::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 1; opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.view { position: relative; z-index: 2; animation: viewIn var(--dur-base) var(--ease-out) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* 一次编排好的入场序列：内容始终可见，仅做轻微渐显与上浮
   —— 不依赖 JS 加 class，避免任何时序下出现空白屏 */
.reveal { opacity: 1; transform: none; }
@media (prefers-reduced-motion: no-preference) {
  .reveal { animation: revealIn var(--dur-base) var(--ease-out) both; }
  .reveal:nth-child(1) { animation-delay: 0ms; }
  .reveal:nth-child(2) { animation-delay: 60ms; }
  .reveal:nth-child(3) { animation-delay: 120ms; }
  .reveal:nth-child(4) { animation-delay: 180ms; }
  .reveal:nth-child(5) { animation-delay: 240ms; }
  .reveal:nth-child(6) { animation-delay: 300ms; }
}
@keyframes revealIn {
  from { opacity: .4; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

/* ——— 排版工具 ——— */
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.num { font-family: var(--font-display); font-variant-numeric: tabular-nums; font-weight: 700; letter-spacing: -.01em; }
.sec-no {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .18em;
  color: var(--c-blue); text-transform: uppercase;
}
.eyebrow { font-family: var(--font-mono); font-size: 10px; letter-spacing: .16em; color: var(--c-muted); text-transform: uppercase; }
.h-display { font-family: var(--font-display); font-weight: 700; line-height: var(--lh-tight); letter-spacing: -.025em; }
.muted { color: var(--c-muted); }
.t-blue { color: var(--c-blue); }
.t-accent { color: var(--c-accent); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 施工标注：章节编号 + 尺寸线 */
.sec-head { display: flex; align-items: baseline; gap: var(--sp-4); margin-bottom: var(--sp-5); }
.sec-head .sh-line { flex: 1; height: 1px; background: var(--c-line); position: relative; }
.sec-head .sh-line::after {
  content: ""; position: absolute; right: 0; top: -3px; width: 7px; height: 7px;
  border-top: 1px solid var(--c-blue); border-right: 1px solid var(--c-blue); transform: rotate(45deg);
}
.sec-head h2 { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -.02em; }

/* 四角括号装饰 */
.corner { position: relative; }
.corner::before, .corner::after {
  content: ""; position: absolute; width: 12px; height: 12px; pointer-events: none;
}
.corner::before { top: -1px; left: -1px; border-top: 2px solid var(--c-blue); border-left: 2px solid var(--c-blue); }
.corner::after { bottom: -1px; right: -1px; border-bottom: 2px solid var(--c-blue); border-right: 2px solid var(--c-blue); }

/* ——— 通用容器 ——— */
.wrap { width: var(--content-w); margin: 0 auto; padding: var(--sp-6) var(--gutter) var(--sp-9); }
.stack { display: flex; flex-direction: column; gap: var(--sp-5); }
.row { display: flex; align-items: center; gap: var(--sp-3); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); }
.grid { display: grid; gap: var(--sp-4); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1fr) 320px; }
.g-side { grid-template-columns: 260px minmax(0, 1fr); }

/* ——— 响应式意图 ——— */
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  :root { --topbar-h: auto; }
  .proto-topbar { flex-wrap: wrap; padding: 10px var(--gutter); gap: var(--sp-3); }
  .proto-switch { margin-left: 0; order: 3; width: 100%; }
  .proto-switch button { flex: 1; }
  .pb-tag { display: none; }
  .g3, .g2, .g-side { grid-template-columns: minmax(0, 1fr); }
  .wrap { padding: var(--sp-5) var(--gutter) var(--sp-8); }
}
@media (max-width: 560px) {
  .g4 { grid-template-columns: minmax(0, 1fr); }
  .proto-tools .proto-btn span { display: none; }
}

/* ——— 动效降级：所有动画在 reduce 下关闭 ——— */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
}
