/* base.css —— Tether 宣传页 v4：令牌、重置、字体角色、版式、构件、导航、经验条、页脚、浮现、减弱动效全局规则（任务 1 负责）。
   令牌原值取自产品默认主题「封蜡」wax 深色，不另调色。 */
:root {
  color-scheme: dark;
  --bg: #171312;
  --stage: #110D0C;
  --sidebar: #1C1716;
  --surface: #221D1B;
  --raised: #312B29;
  --overlay: #282321;
  --line-1: #322C2A;
  --line-2: #453E3B;
  --line-3: #827A76;
  --text-1: #F0EAE6;
  --text-2: #CAC2BE;
  --text-3: #A59C98;
  --text-4: #716A67;
  --accent: #EB6150;
  --accent-hover: #DF5949;
  --accent-press: #D25243;
  --accent-soft: #47211B;
  --accent-soft-text: #F2A89C;
  --on-accent: #1D0C0A;
  --link: #F2897A;
  --success: #6FC884;
  --success-soft: #1C3121;
  --warning: #E6B55D;
  --warning-soft: #372813;
  --danger: #F57595;
  --danger-soft: #402027;
  --info: #86B7E1;
  --info-soft: #1C2D3C;
  --focus: #EB6150;
  --selection: #70322A;
  --seal-w1: #E4A97D;
  --seal-w2: #CF4D26;
  --seal-w3: #B42318;
  --seal-w4: #80001E;
  --seal-c1: #FBF1DC;
  --seal-c2: #E2C690;
  --seal-c3: #AC855C;
  --brass: var(--seal-c2);

  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-io: cubic-bezier(.65, 0, .35, 1);
  --ease-in: cubic-bezier(.55, 0, 1, .45);
  --t-xs: 120ms;
  --t-s: 240ms;
  --t-m: 480ms;
  --t-l: 800ms;

  --f-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --f-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --f-serif: "XN Serif", "Songti SC", "Noto Serif SC", serif;
  --f-px: "XN Frame Pixel 12", var(--f-mono);
  --f-pxm: "XN Frame Pixel 12 Mono", var(--f-mono);
  --f-pxt: "XN Title Pixel 16", var(--f-mono);

  --xp: 0;   /* 经验条进度 0–1：支持 scroll(root) 时由 CSS 驱动，否则 main.js 写 */
}

/* ── 最小重置 ── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--text-1); font-family: var(--f-sans); font-size: 17px; line-height: 28px; }
h1, h2, h3, h4, p, ol, ul, figure, blockquote { margin: 0; }
img, svg, canvas { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--selection); color: var(--text-1); }
[hidden] { display: none !important; }
.vh { 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; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ── 字体角色（标记约定见 tools/subset-tether.mjs；改了带标记的字要重跑它）── */
[data-cjk] { font-family: var(--f-serif); font-weight: 400; font-synthesis: none; }
[data-px] { font-family: var(--f-px); font-size: 12px; line-height: 16px; font-weight: 400; font-synthesis: none; letter-spacing: 0; }
[data-pxm] { font-family: var(--f-pxm); font-size: 12px; line-height: 16px; font-weight: 400; font-synthesis: none; letter-spacing: 0; }
[data-pxt] { font-family: var(--f-pxt); font-size: 16px; line-height: 24px; font-weight: 400; font-synthesis: none; letter-spacing: 0; }
/* 像素字的字形取整内层（main.js 的 snapGlyphs 把内容包进来后用 translate 平移 ≤0.5px）：
   盒子在整数、字形可以落在 .5 上（居中文本），平移元素本身会连盒子一起挪，所以只挪这个内联块 */
.snap-in { display: inline-block; }
[data-sprite] { image-rendering: pixelated; }
code, kbd, samp, .mono { font-family: var(--f-mono); font-size: 13px; line-height: 20px; }

/* 字标：Jacquard，暖色硬分段渐变字（配色照产品 wax 深色的字标渐变） */
.wordmark { margin: 0; color: transparent; background: linear-gradient(180deg, #F7E2A6 0 34%, #DDB875 34% 56%, #C99C5C 56% 76%, #9B6D45 76%); -webkit-background-clip: text; background-clip: text; font-weight: 400; font-synthesis: none; letter-spacing: 0; white-space: nowrap; }
.wordmark-l { display: inline-block; vertical-align: top; height: 32px; font-family: "Jacquard 24", Georgia, serif; font-size: 43px; line-height: 31px; }
.wordmark-s { display: block; width: 53px; height: 19px; font-family: "Jacquard 12", Georgia, serif; font-size: 21px; line-height: 19px; }

/* ── 焦点环（全站统一）── */
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }

/* 跳过链接：聚焦时出现 */
.skip { position: absolute; left: 16px; top: -64px; z-index: 100; padding: 8px 12px; color: var(--text-1); background: var(--surface); border: 1px solid var(--line-2); border-radius: 8px; text-decoration: none; }
.skip:focus { top: 8px; }

/* ── 版式 ── */
.wrap { max-width: 1200px; margin-inline: auto; padding-inline: 32px; }
/* 奇数视口宽下 margin auto 会算出 x.5px，连累 .wrap 里所有像素元素（节标、字标、页脚图）；
   支持 round() 时左右 margin 取整（两侧最多差 1px，不可觉），与 404 页 .nf 同一套写法。 */
@supports (width: round(1px, 1px)) {
  .wrap { margin-inline: max(0px, round(down, (100% - 1200px) / 2, 1px)); }
}
.sec { padding-top: 160px; }
.sec-head .lead { margin-top: 16px; max-width: 640px; color: var(--text-3); }
h2[data-cjk] { font-size: clamp(30px, 4vw, 52px); line-height: normal; }
/* 支持 round() 时按设计值 1.22 取整到整像素 */
@supports (line-height: round(up, 10px, 1px)) {
  h2[data-cjk] { line-height: round(up, 1.22em, 1px); }
}
h3 { font-size: 20px; line-height: 28px; font-weight: 600; }
h1, h2, .lead { text-wrap: balance; }
/* 中文每字之间都是断行点，balance 会把行拉齐，于是标题断在词中间。
   keep-all 收掉字间断行，只在标点、空格和 <wbr> 处断；anywhere 兜底，
   一行真放不下时才任意断，保证窄屏不溢出。.lead 不动。 */
h1, h2 { word-break: keep-all; overflow-wrap: anywhere; }
.sec-no { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.sec-no [data-pxm] { color: var(--accent); }
.sec-no [data-px] { color: var(--text-3); }
@media (max-width: 1023px) { .sec { padding-top: 120px; } .wrap { padding-inline: 24px; } }
@media (max-width: 767px) { .sec { padding-top: 96px; } .wrap { padding-inline: 20px; } body { font-size: 16px; line-height: 26px; } }

/* 标题按行遮罩升起（data-reveal="lines"，每行 .ln > span）。
   H2 行高取整：clamp 的 vw 可能算出半像素行高，让后续元素落到分数 y（像素审计会报）；
   line-height: normal 按系统 serif 回退，子集字体就绪后由下面的 round() 提到 1.22 的整数值。 */
.ln { display: block; overflow: hidden; }
.ln > span { display: block; }

/* ── 浮现（R4）：main.js 在非减弱动效且有 IO 时加 html.io，进入视口的元素由 IO 加 .is-in（只加一次）── */
@media (prefers-reduced-motion: no-preference) {
  html.io [data-reveal]:not([data-reveal="lines"]) { opacity: 0; transform: translate3d(0, 24px, 0); transition: opacity var(--t-l) var(--ease-out), transform var(--t-l) var(--ease-out); }
  html.io [data-reveal]:not([data-reveal="lines"]).is-in { opacity: 1; transform: none; }
  html.io [data-reveal="lines"] .ln > span { transform: translate3d(0, 105%, 0); transition: transform var(--t-l) var(--ease-out); }
  html.io [data-reveal="lines"] .ln:nth-child(2) > span { transition-delay: 80ms; }
  html.io [data-reveal="lines"] .ln:nth-child(3) > span { transition-delay: 160ms; }
  html.io [data-reveal="lines"] .ln:nth-child(4) > span { transition-delay: 240ms; }
  html.io [data-reveal="lines"].is-in .ln > span { transform: none; }
}
/* 无 JS / 减弱动效时不加 html.io，上面的隐藏规则不生效，行标题保持终态（transform 无，y 为整数） */

/* ── 构件 ── */
/* 卡片：四角 2×2 像素刻点（背景图层画），悬停边框变 --line-2 + 跟随指针的 --accent 8% 径向微光 */
.card { position: relative; padding: 28px; background: var(--surface); border: 1px solid var(--line-1); border-radius: 12px; }
.card::before { content: ""; position: absolute; inset: 0; border-radius: 12px; pointer-events: none;
  background: radial-gradient(220px circle at var(--mx, 50%) var(--my, 50%), rgba(235, 97, 80, .08), transparent 70%);
  opacity: 0; transition: opacity var(--t-s) var(--ease-out); }
.card::after { content: ""; position: absolute; inset: 0; border-radius: 12px; pointer-events: none;
  background-image: linear-gradient(var(--line-3), var(--line-3)), linear-gradient(var(--line-3), var(--line-3)), linear-gradient(var(--line-3), var(--line-3)), linear-gradient(var(--line-3), var(--line-3));
  background-size: 2px 2px; background-repeat: no-repeat;
  background-position: 6px 6px, calc(100% - 6px) 6px, 6px calc(100% - 6px), calc(100% - 6px) calc(100% - 6px); }
.card:hover { border-color: var(--line-2); }
.card:hover::before { opacity: 1; }
@media (max-width: 767px) { .card { padding: 20px; } }

/* HUD 框：四角 12px 准星角标；进入视口（.is-in）时从外向内合拢 8px。
   自身伪元素画左上和右下，另两角由子元素 .hud-x 的伪元素画。 */
.hud { position: relative; --hud-in: 8px; }
.hud.is-in, .hud.is-in .hud-x { --hud-in: 0px; }
.hud::before, .hud::after, .hud .hud-x::before, .hud .hud-x::after { content: ""; position: absolute; width: 12px; height: 12px; pointer-events: none; z-index: 1;
  background-image: linear-gradient(var(--line-3), var(--line-3)), linear-gradient(var(--line-3), var(--line-3));
  background-size: 12px 1px, 1px 12px; background-repeat: no-repeat; }
.hud::before { top: calc(-12px + var(--hud-in)); left: calc(-12px + var(--hud-in)); background-position: 0 0, 0 0; }
.hud::after { bottom: calc(-12px + var(--hud-in)); right: calc(-12px + var(--hud-in)); background-position: 0 100%, 100% 0; }
.hud .hud-x::before { top: calc(-12px + var(--hud-in)); right: calc(-12px + var(--hud-in)); background-position: 0 0, 100% 0; }
.hud .hud-x::after { bottom: calc(-12px + var(--hud-in)); left: calc(-12px + var(--hud-in)); background-position: 0 100%, 0 0; }
@supports (transition: --hud-in 1s) {
  @media (prefers-reduced-motion: no-preference) {
    .hud, .hud .hud-x { transition: --hud-in var(--t-m) var(--ease-out); }
  }
}

/* 按钮：主（火漆红底）/ 次（透明 + 1px 边）/ 小号（高 36） */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px; border: 1px solid transparent; border-radius: 8px; background: var(--accent); color: var(--on-accent); font-size: 15px; font-weight: 600; line-height: 20px; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--accent-hover); }
.btn:active { background: var(--accent-press); }
.btn.btn-2 { background: transparent; border-color: var(--line-2); color: var(--text-1); }
.btn.btn-2:hover { background: transparent; border-color: var(--line-3); }
.btn.btn-sm { min-height: 36px; padding: 0 14px; font-size: 14px; }
.btn:disabled { cursor: default; opacity: .55; }

/* 状态签：像素字 12、1px 边、圆角 4 */
.chip { display: inline-flex; align-items: baseline; gap: 4px; padding: 1px 6px; border: 1px solid var(--line-1); border-radius: 4px; color: var(--text-3); white-space: nowrap; }
.chip.chip-opt { border-color: var(--line-2); }
.chip.chip-pre { border-color: var(--accent); color: var(--accent-soft-text); }

/* 证据签：等宽 12/16、--raised 底、圆角 4 */
.ev { display: inline-block; padding: 0 5px; background: var(--raised); border-radius: 4px; color: var(--text-2); font-family: var(--f-mono); font-size: 12px; line-height: 16px; white-space: nowrap; }

/* 雪碧图图标 */
.ic { flex: none; width: 16px; height: 16px; }

/* 文字链 */
.link { color: var(--link); text-decoration: none; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* 演示窗：标题栏 36px（左侧三个 6×6 像素方点 + 像素字窗标题），内容区 --surface */
.win { border: 1px solid var(--line-1); border-radius: 12px; background: var(--surface); overflow: hidden; }
.win-bar { display: flex; align-items: center; gap: 12px; height: 36px; padding-inline: 14px; border-bottom: 1px solid var(--line-1); }
.win-dots { flex: none; display: flex; gap: 4px; }
.win-dots > i { width: 6px; height: 6px; background: var(--line-2); }
.win-title { margin: 0; color: var(--text-3); }
.win-body { padding: 20px; }

/* ── 导航（高 56 吸顶；离开首屏后磨砂；底边叠 2px 经验条）── */
.nav { position: sticky; top: 0; z-index: 50; height: 56px; background: transparent; }
.nav.is-solid { background: rgba(23, 19, 18, .82); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line-1); }
.nav-in { display: flex; align-items: center; gap: 28px; height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { width: 32px; height: 32px; }
.nav-links { display: flex; gap: 4px; }
.nav-links a { display: block; padding: 4px 12px; border-radius: 6px; color: var(--text-3); font-size: 15px; line-height: 24px; text-decoration: none; }
.nav-links a:hover { color: var(--text-1); }
.nav-links a[aria-current="true"] { color: var(--accent); }
.nav-act { display: flex; align-items: center; gap: 16px; margin-left: auto; }
.nav-ext { color: var(--text-3); font-size: 15px; line-height: 24px; text-decoration: none; }
.nav-ext:hover { color: var(--text-1); }
.menu-btn { display: none; align-items: center; min-height: 36px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 8px; background: transparent; color: var(--text-1); font-size: 14px; cursor: pointer; }
.menu { position: absolute; top: 56px; left: 0; right: 0; max-height: calc(100svh - 56px); overflow-y: auto; padding: 8px 20px 16px; background: var(--overlay); border-bottom: 1px solid var(--line-1); }
.menu a { display: flex; align-items: baseline; gap: 10px; padding: 10px 4px; color: var(--text-1); font-size: 16px; line-height: 24px; text-decoration: none; border-bottom: 1px solid var(--line-1); }
.menu a:last-child { border-bottom: 0; }
.menu a [data-pxm] { color: var(--accent); }
.menu a[aria-current="true"] { color: var(--accent); }
/* 菜单打开时锁住页面滚动，防止穿透滚动误点 */
html.menu-open, html.menu-open body { overflow: hidden; }
@media (max-width: 1023px) {
  .nav-links, .nav-ext { display: none; }
  .menu-btn { display: inline-flex; }
}

/* 经验条：导航底边 2px --accent 条 + 8 个 1×6 节刻度 */
.xp { position: absolute; left: 0; right: 0; bottom: -1px; height: 6px; pointer-events: none; }
.xp-bar { position: absolute; left: 0; bottom: 0; display: block; width: 100%; height: 2px; background: var(--accent); transform-origin: 0 50%; transform: scaleX(var(--xp)); }
.xp-tick { position: absolute; bottom: 0; left: calc(var(--xp-x, 0) * (100% - 1px)); width: 1px; height: 6px; background: var(--line-2); }
.xp-tick.is-on { background: var(--accent); }
html.no-js .xp-tick { display: none; }
@supports (animation-timeline: scroll(root)) {
  @media (prefers-reduced-motion: no-preference) {
    .xp-bar { animation: xp-fill linear both; animation-timeline: scroll(root); }
  }
}
@keyframes xp-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ── 08 现状 #status ── */
.status-act { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 40px; padding-bottom: 160px; }
@media (max-width: 1023px) { .status-act { padding-bottom: 120px; } }
@media (max-width: 767px) { .status-act { padding-bottom: 96px; } }

/* ── 页脚 ── */
.footer { border-top: 1px solid var(--line-1); }
.footer-in { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px 24px; padding-top: 28px; padding-bottom: 28px; color: var(--text-3); font-size: 14px; line-height: 22px; }
.footer-brand { display: flex; align-items: flex-start; gap: 8px; }
.footer-brand img { margin-top: 2px; }
.footer-brand .wordmark-s { width: 53px; }
.footer a { color: var(--text-3); text-decoration: none; }
.footer a:hover { color: var(--text-1); text-decoration: underline; text-underline-offset: 3px; }

/* ── 404：居中于视口的 360 整宽栏（margin 取整，栏内文字居中，页脚行左对齐），全部落在整像素上 ── */
.nf { width: min(360px, 100% - 32px); min-height: 100svh; margin-left: calc((100% - min(360px, 100% - 32px)) / 2); margin-left: round(down, (100% - min(360px, 100% - 32px)) / 2, 1px); padding: max(48px, calc((100svh - 400px) / 2)) 0 48px; padding: max(48px, round(down, (100svh - 400px) / 2, 1px)) 0 48px; text-align: center; }
.nf .wordmark-l { font-size: 86px; line-height: 62px; height: 64px; }
.nf-h { margin-top: 24px; color: var(--text-1); font-size: 24px; line-height: 32px; }
.nf .btn { margin-top: 32px; }
.nf-foot { display: flex; align-items: flex-start; justify-content: center; gap: 8px; margin-top: 64px; color: var(--text-4); font-size: 14px; line-height: 22px; }
.nf-foot img { flex: none; margin-top: 2px; }

/* ── 减弱动效：全局停掉动画与过渡（除此和 [hidden]、.vh 外不用 !important）── */
html.reduce *, html.reduce *::before, html.reduce *::after { animation: none !important; transition: none !important; }
/* 关 JS 时 html.reduce 不会出现，系统设置同样生效 */
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
