/*
 * Spriteloom 站点样式。
 *
 * 色板直接取编辑器的 UI 色，点进 /app/ 时视觉不断裂。两个强调色而不是一个：
 * 蓝是「当前」，黄是「对照高亮」，它们在产品里各有语义。
 *
 * 材料真实性：像素画里没有抗锯齿曲线也没有柔和阴影，所以整站零圆角、零阴影、
 * 2px 硬边，间距一律 8 的倍数（tile 的常见尺寸）。
 *
 * 不引外部字体。站点承诺「什么都不上传」，却给 Google Fonts 发请求会自相矛盾。
 */

:root {
  --bg: #16161c;
  --surface: #23232b;
  --line: #3a3a46;
  --text: #e4e4ee;
  --muted: #8a8a9a;
  --blue: #4a5fd0;
  --blue-lit: #6a7fe0;
  --gold: #ffcc33;

  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono", Menlo,
    Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    "Noto Sans", sans-serif;

  --unit: 8px;
  --measure: 62ch;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
}

/* 键盘焦点必须看得见，且用高亮黄而不是蓝——蓝在这套色里是「当前项」 */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

a { color: var(--blue-lit); }
a:hover { color: var(--gold); }

/* 不给 code 指定字体的话会掉进浏览器 fallback，`.tres` 里的点和字母之间会裂开 */
code {
  font-family: var(--mono);
  font-size: 0.9em;
  color: var(--text);
}

.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 calc(var(--unit) * 3);
}

/* ── 顶栏 ─────────────────────────────────────────── */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(var(--unit) * 2);
  padding: calc(var(--unit) * 2) 0;
  border-bottom: 2px solid var(--line);
}

.brand {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}

.top nav {
  display: flex;
  align-items: center;
  gap: calc(var(--unit) * 3);
  font-size: 14px;
}
.top nav a:not(.btn) { color: var(--muted); text-decoration: none; }
.top nav a:not(.btn):hover { color: var(--text); }

/* ── 按钮 ─────────────────────────────────────────── */

.btn {
  display: inline-block;
  padding: calc(var(--unit) * 1.5) calc(var(--unit) * 3);
  border: 2px solid var(--blue);
  background: var(--blue);
  color: #fff;
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
}
.btn:hover { background: var(--blue-lit); border-color: var(--blue-lit); color: #fff; }

.btn-quiet {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}
.btn-quiet:hover { background: var(--surface); border-color: var(--muted); color: var(--text); }

/* ── hero ─────────────────────────────────────────── */

/*
 * 标题跨整宽，正文与演示在它下面左右分。让标题挤在左半栏的话，
 * 46px 的等宽字每行只放得下 18 个字符，两句都会断在不该断的地方。
 */
.hero { padding: calc(var(--unit) * 9) 0 calc(var(--unit) * 8); }

.hero-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: calc(var(--unit) * 6);
  align-items: center;
  margin-top: calc(var(--unit) * 4);
}

h1 {
  margin: 0 0 calc(var(--unit) * 3);
  font-family: var(--mono);
  font-size: clamp(30px, 5vw, 46px);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.03em;
  text-wrap: balance;
}
/* 第二行压低一档：第一句是承认现状，第二句才是主张 */
h1 .then { color: var(--muted); display: block; }

.lede {
  max-width: var(--measure);
  margin: 0 0 calc(var(--unit) * 4);
  color: var(--muted);
  font-size: 17px;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: calc(var(--unit) * 2);
}
.cta-note { color: var(--muted); font-size: 14px; }

/* ── hero 演示：两张网格，高亮格在两边同步走 ───────── */

.demo {
  display: grid;
  grid-template-columns: auto auto;
  gap: 2px;
  border: 2px solid var(--line);
  background: var(--line);
}

.pane { background: var(--surface); padding: calc(var(--unit) * 1.5); }

.pane-label {
  margin-bottom: var(--unit);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}

/* 12 格 × 14px，网格线用 repeating-gradient 画，省掉 144 个 div */
.grid {
  position: relative;
  width: 168px;
  height: 168px;
  background-image:
    repeating-linear-gradient(to right, #34343f 0 1px, transparent 1px 14px),
    repeating-linear-gradient(to bottom, #34343f 0 1px, transparent 1px 14px);
}

.grid img {
  position: absolute;
  inset: 0;
  width: 168px;
  height: 168px;
  image-rendering: pixelated;
}

.cursor {
  position: absolute;
  top: 0;
  left: 0;
  width: 14px;
  height: 14px;
  box-shadow: 0 0 0 2px var(--gold);
  animation: trace 6s steps(1, end) infinite;
}

/* 全站唯一的动效：高亮格在两张图上同时走过同几格 */
@keyframes trace {
  0%   { transform: translate(56px, 84px); }
  20%  { transform: translate(70px, 84px); }
  40%  { transform: translate(84px, 84px); }
  60%  { transform: translate(84px, 98px); }
  80%  { transform: translate(70px, 98px); }
  100% { transform: translate(56px, 98px); }
}

@media (prefers-reduced-motion: reduce) {
  .cursor { animation: none; transform: translate(56px, 84px); }
}

/* ── 段落区块 ─────────────────────────────────────── */

section { border-top: 2px solid var(--line); padding: calc(var(--unit) * 7) 0; }

h2 {
  margin: 0 0 calc(var(--unit) * 4);
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

h3 {
  margin: 0 0 var(--unit);
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 600;
}

p { max-width: var(--measure); }

/* 左对齐的条目，不是等大的圆角卡片 */
.items { display: grid; gap: calc(var(--unit) * 4); }
@media (min-width: 720px) {
  .items { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: calc(var(--unit) * 5); }
}

.item { border-left: 2px solid var(--line); padding-left: calc(var(--unit) * 2); }
.item p { margin: 0; color: var(--muted); font-size: 15px; }

/* 「不做什么」用金色边，和上面的中性条目区分开 */
.limits { display: grid; gap: calc(var(--unit) * 3); max-width: var(--measure); }
.limit { border-left: 2px solid var(--gold); padding-left: calc(var(--unit) * 2); }
.limit p { margin: 0; color: var(--muted); font-size: 15px; }

.steps { max-width: var(--measure); margin: 0; padding-left: calc(var(--unit) * 3); }
.steps li { margin-bottom: var(--unit); color: var(--muted); }
.steps code {
  font-family: var(--mono);
  font-size: 0.92em;
  color: var(--text);
}

/* ── 页脚 ─────────────────────────────────────────── */

footer {
  border-top: 2px solid var(--line);
  padding: calc(var(--unit) * 4) 0 calc(var(--unit) * 8);
  color: var(--muted);
  font-size: 14px;
}
footer .row { display: flex; flex-wrap: wrap; gap: calc(var(--unit) * 3); }
footer a { color: var(--muted); text-decoration: none; }
footer a:hover { color: var(--text); text-decoration: underline; }

/* ── 正文页（隐私政策）────────────────────────────── */

.doc { padding: calc(var(--unit) * 7) 0 calc(var(--unit) * 9); }
.doc h1 { font-size: clamp(26px, 4vw, 34px); }
.doc h2 { margin-top: calc(var(--unit) * 5); font-size: 19px; }
.doc p, .doc li { color: var(--muted); }
.doc ul { max-width: var(--measure); padding-left: calc(var(--unit) * 3); }
.doc li { margin-bottom: var(--unit); }
.doc .updated { font-family: var(--mono); font-size: 13px; }

/* ── 窄屏 ─────────────────────────────────────────── */

@media (max-width: 860px) {
  .hero-body { grid-template-columns: minmax(0, 1fr); gap: calc(var(--unit) * 5); }
  .demo { justify-self: start; }
}

@media (max-width: 520px) {
  .grid, .grid img { width: 140px; height: 140px; }
  .grid {
    background-size: 100% 100%;
    background-image:
      repeating-linear-gradient(to right, #34343f 0 1px, transparent 1px 11.667px),
      repeating-linear-gradient(to bottom, #34343f 0 1px, transparent 1px 11.667px);
  }
  /* 格子变小，高亮框和轨迹按同一比例缩 */
  .cursor { width: 11.667px; height: 11.667px; animation-name: trace-sm; }
  @keyframes trace-sm {
    0%   { transform: translate(46.7px, 70px); }
    20%  { transform: translate(58.3px, 70px); }
    40%  { transform: translate(70px, 70px); }
    60%  { transform: translate(70px, 81.7px); }
    80%  { transform: translate(58.3px, 81.7px); }
    100% { transform: translate(46.7px, 81.7px); }
  }
}
