/* hero.css —— 首屏 #top 与数字条 #facts（任务 2）。令牌、字体角色、.btn / .chip 等构件在 base.css。
   约束：像素元素必须落在整数像素上（tools/tether-audit.mjs pixel）；居中一律用整数 margin / 整数列宽，
   不用 translate(-50%)、不用 flex 竖向居中（高度会落到半像素）。 */

/* ── 舞台背景：固定铺满视口；渐变底画在 stage 自身上，好跟它一起淡出 ── */
#stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(118% 96% at 50% 26%, #241C19 0%, var(--stage) 38%, var(--bg) 76%, var(--bg) 100%);
  image-rendering: pixelated;
}

/* 没有 WebGL / 没有 JS 时 stage 是空的，渐变底改由首屏自己出（否则静态标志会落在纯 --bg 上） */
html:not(.webgl) #stage { background: none; }

/* ── 首屏 ─────────────────────────────────────────────────────────────── */
#top {
  --hpad: 64px;      /* 顶部留白：让过 56px 吸顶导航 */
  --g1: 16px;        /* 眉标 → 标志 */
  --g2: 16px;        /* 标志 → H1 */
  --g3: 16px;        /* H1 → 导语 */
  --g4: 16px;        /* 导语 → 状态签 */
  --g5: 16px;        /* 状态签 → 按钮 */
  --mark: 256px;     /* 2×：标志 256×256 */

  position: relative;
  z-index: 1;        /* 压在 stage (0) 上，位于导航 (50) 之下 */
  height: 100svh;
  min-height: 720px;
  padding: var(--hpad) 20px 0;
  overflow: hidden;

  background:
    radial-gradient(118% 96% at 50% 26%, #241C19 0%, var(--stage) 38%, var(--bg) 76%, var(--bg) 100%);
}
html.webgl #top { background: none; }

/* 首屏下沿的透视网格：6% 透明度，只在最下面一段 */
#top::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 320px;
  pointer-events: none;
  background-image:
    repeating-linear-gradient(to right, rgba(240, 234, 230, .06) 0 1px, transparent 1px 52px),
    repeating-linear-gradient(to bottom, rgba(240, 234, 230, .06) 0 1px, transparent 1px 44px);
  transform: perspective(420px) rotateX(64deg);
  transform-origin: 50% 100%;
  -webkit-mask-image: linear-gradient(to top, #000 0%, transparent 88%);
  mask-image: linear-gradient(to top, #000 0%, transparent 88%);
}

@media (min-height: 900px) {
  #top { --hpad: 64px; --g1: 16px; --g2: 16px; --g3: 12px; --g4: 12px; --g5: 16px; }
}
@media (min-width: 1024px) and (min-height: 900px) {
  #top { --mark: 384px; --hpad: 64px; --g1: 16px; --g2: 16px; --g3: 12px; --g4: 12px; --g5: 16px; }
}
@media (min-width: 768px) {
  #top { padding-left: 24px; padding-right: 24px; }
}
@media (min-width: 1024px) {
  #top { padding-left: 32px; padding-right: 32px; }
}
@media (min-height: 1000px) {
  #top { --hpad: 128px; }
}
@media (max-height: 719px) {
  #top { --hpad: 20px; --g1: 10px; --g2: 10px; --g3: 10px; --g4: 10px; --g5: 10px; }
  .hero-hint { display: none; }
}

/* 眉标：像素字，块级居中（块宽 = 内容宽，x 恒为整数） */
.hero-eyebrow {
  margin: 0 0 var(--g1);
  text-align: center;
  color: var(--text-3);
  animation: hero-rise 600ms var(--ease-out) 200ms both;
}

/* 标志框：粒子目标点、静态兜底图、封蜡印都在这一个 256/384 的方框里 */
.hero-mark {
  position: relative;
  width: var(--mark);
  height: var(--mark);
  /* 整数居中：标志框里挂着封蜡印，落半像素会糊 */
  margin-right: auto;
  margin-bottom: var(--g2);
  margin-left: auto;
  margin-left: max(0px, round(down, calc((100% - var(--mark)) / 2), 1px));
}
.hero-mark-img {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 26px rgba(235, 97, 80, .22));
  animation: mark-float 7s ease-in-out 2600ms infinite;
}
/* 有 JS 且 WebGL 建成就藏起静态图；no-webgl / stage-failed / 无 JS 时显示 */
html.js:not(.no-webgl):not(.stage-failed) .hero-mark-img { display: none; }

/* ── 封蜡印：沿用 v3 垂印 .hang / .cord（docs/tether-site.md），色用 --seal-c1…c3 ── */
.hero-seal {
  position: absolute;
  top: 76px;
  left: 186px;
  animation: seal-fall 800ms cubic-bezier(.55, 0, .75, 0) 1800ms both;
}
.hero-seal-lg { display: none; }
.hero-seal .hang {
  --tether-seal-c2: var(--seal-c2);
  --tether-seal-c3: var(--seal-c3);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: var(--n);
  transform-origin: calc((var(--cx) + 1.5) * var(--s) * 1px) 0;
  animation: settle 2400ms ease-in-out 2550ms both;
}
.hero-seal .cord {
  --u: calc(var(--s) * 1px);
  flex: none;
  width: calc(3 * var(--u));
  height: calc(var(--len) + var(--kt) * var(--u));
  margin-left: calc(var(--cx) * var(--u));
  margin-bottom: calc(var(--kt) * -1 * var(--u));
  background:
    linear-gradient(var(--tether-seal-c2) 0 50%, var(--tether-seal-c3) 0) 0 100% / var(--u) calc(4 * var(--u)) repeat-y,
    linear-gradient(var(--tether-seal-c2) 0 25%, var(--tether-seal-c3) 0 75%, var(--tether-seal-c2) 0) var(--u) 100% / var(--u) calc(4 * var(--u)) repeat-y,
    linear-gradient(var(--tether-seal-c3) 0 50%, var(--tether-seal-c2) 0) calc(2 * var(--u)) 100% / var(--u) calc(4 * var(--u)) repeat-y;
}
.hero-seal .px { position: relative; flex: none; image-rendering: pixelated; }

@media (min-width: 1024px) and (min-height: 900px) {
  .hero-seal-sm { display: none; }
  .hero-seal-lg { display: block; top: 114px; left: 262px; }
}

/* ── 标题、导语、状态签、按钮 ── */
.hero-h {
  margin: 0 0 var(--g3);
  text-align: center;
  color: var(--text-1);
  font-size: clamp(40px, 6vw, 76px);
}
.hero-h .ln {
  display: block;
  overflow: hidden;
  /* 行高取偶数：判据是 mdpi 下每一行都不落在半像素，下面这行是它的回退 */
  line-height: 1.18;
  line-height: round(down, calc(1.18 * 1em), 2px);
}
.hero-h .ln > span {
  display: block;
  animation: hero-line 800ms var(--ease-out) both;
}
.hero-h .ln:nth-child(1) > span { animation-delay: 1400ms; }
.hero-h .ln:nth-child(2) > span { animation-delay: 1480ms; }

.hero-lead {
  max-width: 620px;
  margin: 0 auto var(--g4);
  text-align: center;
  color: var(--text-2);
  animation: hero-rise 700ms var(--ease-out) 1720ms both;
}

.hero-chips {
  margin: 0 0 var(--g5);
  text-align: center;
  animation: hero-rise 700ms var(--ease-out) 1880ms both;
}
.hero-chips .chip { display: inline-block; vertical-align: top; }
.hero-chips .chip + .chip { margin-left: 8px; }

.hero-cta {
  margin: 0;
  text-align: center;
  animation: hero-rise 700ms var(--ease-out) 2020ms both;
}
.hero-cta .btn + .btn { margin-left: 12px; }

.hero-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 20px;
  text-align: center;
  color: var(--text-4);
  animation: hero-rise 600ms var(--ease-out) 2400ms both, hint-blink 1s steps(2, end) 3000ms infinite;
}

@media (max-width: 767px) {
  .hero-h { font-size: clamp(30px, 8.4vw, 46px); }
  .hero-lead { font-size: 16px; line-height: 26px; }
}

@keyframes hero-rise {
  from { opacity: 0; translate: 0 10px; }
  to { opacity: 1; translate: 0 0; }
}
@keyframes hero-line {
  from { transform: translateY(105%); }
  to { transform: none; }
}
@keyframes hint-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: .45; }
}
@keyframes seal-fall {
  0% { opacity: 0; translate: 0 -180px; }
  55% { opacity: 1; }
  100% { opacity: 1; translate: 0 0; }
}
/* v3 垂印落定后的轻晃（bd643fa:products/tether/assets/css/tether.css） */
@keyframes settle {
  0% { transform: rotate(0); }
  10% { transform: rotate(3.5deg); }
  28% { transform: rotate(-2.5deg); }
  46% { transform: rotate(1.6deg); }
  64% { transform: rotate(-.9deg); }
  82% { transform: rotate(.35deg); }
  100% { transform: rotate(0); }
}
@keyframes mark-float {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -6px; }
}

/* 随滚动淡出首屏内容 (0..240px)，支持 CSS scroll-timeline 时硬件加速合成 */
@supports (animation-timeline: scroll(root)) {
  @media (prefers-reduced-motion: no-preference) {
    .hero-in, .hero-hint {
      animation: hero-scroll-fade linear both;
      animation-timeline: scroll(root);
      animation-range: 0px 240px;
    }
  }
}
@keyframes hero-scroll-fade {
  to { opacity: 0; pointer-events: none; visibility: hidden; }
}

/* ── 数字条 ───────────────────────────────────────────────────────────── */
#facts {
  position: relative;
  z-index: 2;        /* 层级高于 stage (0) 与 top (1)，在导航 (50) 之下 */
  padding: 104px 0 176px;
}
.facts-in {
  /* 整数居中：整 1264 宽（1200 内容 + 两侧 32），奇数视口宽也不会落到半像素 */
  width: min(1264px, 100%);
  margin-right: auto;
  margin-left: auto;
  margin-left: max(0px, round(down, calc((100% - 1264px) / 2), 1px));
  padding: 0 20px;
  display: grid;
  grid-template-columns: round(down, calc((100% - 24px) / 2), 1px) 1fr;
  gap: 32px 24px;
}
@media (min-width: 768px) {
  .facts-in { padding: 0 24px; }
}
@media (min-width: 1024px) {
  #facts { padding: 120px 0 160px; }
  .facts-in {
    padding: 0 32px;
    grid-template-columns:
      round(down, calc((100% - 72px) / 4), 1px)
      round(down, calc((100% - 72px) / 4), 1px)
      round(down, calc((100% - 72px) / 4), 1px)
      1fr;
    gap: 0 24px;
  }
}
@media (max-width: 767px) {
  #facts { padding: 72px 0 96px; }
}

.fact {
  position: relative;
  z-index: 2;
}
/* 数字条文字在舞台之上且清楚可读：给每格一层半透明 --bg 底与微边，不改动文字排版位置 */
.fact::before {
  content: "";
  position: absolute;
  inset: -12px -16px;
  border-radius: 8px;
  background: rgba(23, 19, 18, .72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(50, 44, 42, .45);
  z-index: -1;
  pointer-events: none;
}

.fact-num {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 48px;
  line-height: 56px;
  text-align: left;
  text-shadow: 0 2px 14px var(--bg), 0 0 24px var(--bg);
}
.fact-label {
  margin: 0 0 4px;
  color: var(--text-1);
  font-size: 17px;
  line-height: 24px;
  text-shadow: 0 1px 8px var(--bg);
}
.fact-note {
  margin: 0;
  color: var(--text-3);
  font-size: 13px;
  line-height: 20px;
  text-shadow: 0 1px 6px var(--bg);
}
