/* ---------------------------------------------------------
   申桥一 · 个人网站
   浅色极简 / 无依赖静态实现
--------------------------------------------------------- */

:root {
  --paper: #f6f5f1;
  --surface: #fffdfa;
  --ink: #15130f;
  --ink-soft: #3a362f;
  --muted: #77726a;
  --line: #e2dfd6;
  --line-soft: #ebe8e0;
  --accent: #a94e2c;
  --ok: #3f7048;
  --bad: #b23c22;

  --sans: "Inter", system-ui, -apple-system, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia,
    "Songti SC", "SimSun", serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", "JetBrains Mono",
    Consolas, "Liberation Mono", monospace;

  --maxw: 1180px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.75;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: #eadfd5; color: var(--ink); }

a { color: inherit; text-decoration: none; }

img { max-width: 100%; display: block; }

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 40px;
}

/* ---------------- 顶部导航 ---------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 245, 241, 0.84);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
}

.nav {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--serif);
  font-size: 20px;
  letter-spacing: -0.01em;
}

.brand .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  transform: translateY(-1px);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 30px;
  font-size: 13.5px;
  letter-spacing: 0.01em;
  color: var(--muted);
}

.nav-links a {
  position: relative;
  padding: 6px 0;
  transition: color 0.2s var(--ease);
}

.nav-links a:hover { color: var(--ink); }

.nav-links a[aria-current="page"] { color: var(--ink); }

.nav-links a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--ink);
}

.nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--ink);
  border-radius: 2px;
  font-size: 13px;
  transition: background 0.22s var(--ease), color 0.22s var(--ease);
}

.nav-cta:hover { background: var(--ink); color: var(--paper); }

/* 后台入口：比「联系我」轻一档，不和主 CTA 抢注意力 */
.nav-admin {
  display: inline-flex;
  align-items: center;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 2px;
  font-size: 12.5px;
  color: var(--ink-soft);
  transition: color 0.22s var(--ease), border-color 0.22s var(--ease);
}

.nav-admin:hover { color: var(--accent); border-color: var(--accent); }

.nav-toggle {
  display: none;
  width: 40px;
  height: 38px;
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 2px;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-direction: column;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  width: 15px;
  height: 1px;
  background: var(--ink);
}

/* ---------------- 通用排版 ---------------- */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.eyebrow::before {
  content: "";
  width: 18px;
  height: 1px;
  background: var(--accent);
}

.section { padding: 104px 0; border-top: 1px solid var(--line-soft); }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 48px;
}

.section-head h2 {
  margin: 14px 0 0;
  font-size: clamp(27px, 2.7vw, 36px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.22;
  text-wrap: balance;
}

.section-head p {
  margin: 12px 0 0;
  max-width: 56ch;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.8;
  letter-spacing: 0.01em;
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  padding-bottom: 3px;
  transition: border-color 0.25s var(--ease), gap 0.25s var(--ease);
  white-space: nowrap;
}

.link-arrow:hover { border-color: var(--ink); gap: 12px; }

/* ---------------- Hero ---------------- */

.hero { padding: 88px 0 64px; position: relative; overflow: hidden; }

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    90deg,
    rgba(21, 19, 15, 0.038) 0 1px,
    transparent 1px 88px
  );
  pointer-events: none;
  mask-image: linear-gradient(180deg, black, transparent 78%);
  -webkit-mask-image: linear-gradient(180deg, black, transparent 78%);
}

.hero .wrap { position: relative; }

.hero-grid {
  display: grid;
  grid-template-columns: 1.42fr 0.58fr;
  gap: 72px;
  align-items: start;
}

.hero h1 {
  margin: 26px 0 0;
  font-size: clamp(43px, 6.3vw, 84px);
  line-height: 1.04;
  letter-spacing: -0.03em;
  font-weight: 700;
  text-wrap: balance;
}

.hero h1 .soft { color: #b6b0a4; font-weight: 400; }

.hero h1 .mark {
  position: relative;
  display: inline-block;
  white-space: nowrap;
  padding-bottom: 12px;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat;
  background-size: 100% 2px;
  background-position: 0 calc(100% - 2px);
  animation: markDraw 0.9s var(--ease) 1.05s both;
}

/* 下划线末端的小方块，是编辑排版里常见的手工痕迹 */
.hero h1 .mark::after {
  content: "";
  position: absolute;
  right: -7px;
  bottom: 2px;
  width: 4px;
  height: 4px;
  background: var(--accent);
}

@keyframes markDraw {
  from { background-size: 0% 2px; }
  to   { background-size: 100% 2px; }
}

@media (prefers-reduced-motion: reduce) {
  .hero h1 .mark { animation: none; }
}

.hero-sub {
  margin: 32px 0 0;
  max-width: 46ch;
  font-size: 16.5px;
  line-height: 1.9;
  letter-spacing: 0.012em;
  color: var(--ink-soft);
}

.hero-sub strong { font-weight: 500; }

.hero-actions {
  margin-top: 38px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 22px;
  border-radius: 2px;
  font-size: 14px;
  border: 1px solid transparent;
  transition: transform 0.24s var(--ease), background 0.24s var(--ease),
    color 0.24s var(--ease), border-color 0.24s var(--ease);
}

.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { transform: translateY(-2px); background: #2b2721; }

.btn-ghost { border-color: var(--line); color: var(--ink); background: transparent; }
.btn-ghost:hover { border-color: var(--ink); transform: translateY(-2px); }

.hero-stats {
  margin-top: 56px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 56px;
  flex-wrap: wrap;
}

.stat .num {
  font-family: var(--mono);
  font-size: 20px;
  letter-spacing: -0.02em;
  display: block;
}

.stat .label {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

/* 侧边状态卡 */
.status-card {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 3px;
  padding: 22px 22px 18px;
  margin-top: 6px;
}

.status-top {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line-soft);
}

.pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3f7a55;
  box-shadow: 0 0 0 0 rgba(63, 122, 85, 0.5);
  animation: pulse 2.4s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(63, 122, 85, 0.45); }
  70% { box-shadow: 0 0 0 7px rgba(63, 122, 85, 0); }
  100% { box-shadow: 0 0 0 0 rgba(63, 122, 85, 0); }
}

.status-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 10px 0;
  font-size: 12.5px;
  border-bottom: 1px solid var(--line-soft);
}

.status-row:last-of-type { border-bottom: 0; }

.status-row .k { color: var(--muted); }
.status-row .v {
  font-size: 12.5px;
  letter-spacing: 0.01em;
  text-align: right;
}

/* 只有时间用等宽，数字才对得齐 */
.status-row .v#clock,
#clock {
  font-family: var(--mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.status-note {
  margin: 0;
  padding-top: 13px;
  border-top: 1px solid var(--line-soft);
  font-size: 12px;
  line-height: 1.78;
  color: var(--muted);
}

.status-recent {
  margin-top: 15px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}

.status-recent .k {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #9a948a;
}

.status-recent ul {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--ink-soft);
}

.status-recent li {
  position: relative;
  padding-left: 14px;
  margin-bottom: 6px;
}

.status-recent li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.78em;
  width: 6px;
  height: 1px;
  background: #c3bdaf;
}

/* ---------------- 技术栈条 ---------------- */

.stack-bar {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #f1efe9;
}

.stack-list {
  display: flex;
  align-items: center;
  gap: 0;
  overflow: hidden;
  height: 62px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  color: #5f5a52;
  text-transform: uppercase;
}

.stack-list span { padding: 0 20px; white-space: nowrap; }

.stack-list span + span { border-left: 1px solid var(--line); }

.stack-list span:first-child { padding-left: 0; }

/* ---------------- 作品列表 ---------------- */

.work-list { border-top: 1px solid var(--line); }

.work-row {
  display: grid;
  grid-template-columns: 62px 1fr 210px 34px;
  gap: 28px;
  align-items: center;
  padding: 30px 8px 30px 0;
  border-bottom: 1px solid var(--line);
  transition: background 0.26s var(--ease), padding 0.26s var(--ease);
}

.work-row:hover { background: var(--surface); padding-left: 12px; }

.work-index {
  font-family: var(--mono);
  font-size: 11px;
  color: #a09a8e;
  letter-spacing: 0.08em;
}

.work-title {
  font-size: 23px;
  letter-spacing: -0.02em;
  font-weight: 500;
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.work-title em {
  font-family: var(--mono);
  font-style: normal;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 2px 7px;
  transform: translateY(-3px);
}

.work-desc {
  margin: 8px 0 0;
  font-size: 13.8px;
  color: var(--muted);
  max-width: 58ch;
}

.work-meta {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-align: right;
  line-height: 1.9;
}

.work-arrow {
  font-size: 16px;
  color: #b8b2a6;
  transition: transform 0.26s var(--ease), color 0.26s var(--ease);
  text-align: right;
}

.work-row:hover .work-arrow { transform: translateX(4px); color: var(--accent); }

/* ---------------- 能力矩阵 ---------------- */

.cap-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line);
  background: var(--surface);
}

.cap {
  padding: 28px 24px 30px;
  border-right: 1px solid var(--line);
  transition: background 0.26s var(--ease);
}

.cap:last-child { border-right: 0; }

.cap:hover { background: #faf8f2; }

.cap .no {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  color: var(--accent);
}

.cap h3 {
  margin: 16px 0 10px;
  font-size: 16.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.cap p { margin: 0; font-size: 13.2px; line-height: 1.75; color: var(--muted); }

.cap ul {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.05em;
  color: #8a857b;
  line-height: 2;
}

/* ---------------- 经历时间线 ---------------- */

.timeline { border-top: 1px solid var(--line); }

.tl-item {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 40px;
  padding: 26px 0;
  border-bottom: 1px solid var(--line);
}

.tl-time {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding-top: 4px;
}

.tl-role { font-size: 17px; font-weight: 500; letter-spacing: -0.015em; }
.tl-org { font-size: 13px; color: var(--muted); margin-top: 3px; }
.tl-desc { margin: 10px 0 0; font-size: 13.5px; color: var(--ink-soft); max-width: 62ch; }

/* ---------------- 联系 ---------------- */

.contact-band {
  border-top: 1px solid var(--line);
  padding: 96px 0 88px;
}

.contact-band h2 {
  margin: 18px 0 0;
  font-family: var(--serif);
  font-size: clamp(38px, 5vw, 62px);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.06;
}

.contact-band h2 em { font-style: italic; color: var(--muted); }

.contact-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 64px;
  align-items: end;
}

.contact-lines { display: grid; gap: 2px; }

.contact-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  transition: padding 0.24s var(--ease), color 0.24s var(--ease);
}

.contact-line:hover { padding-left: 8px; color: var(--accent); }

.contact-line .k {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.contact-head { margin-bottom: 46px; }

.contact-body {
  display: grid;
  grid-template-columns: 0.86fr 1.14fr;
  gap: 64px;
  align-items: start;
}

.contact-note {
  margin: 18px 0 0;
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--muted);
  max-width: 34ch;
}

/* 留言表单 */
.form-card {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 3px;
  padding: 26px 28px 24px;
}

.form-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line-soft);
}

.mono-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.api-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: #918c82;
}

.api-state i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #c3bdaf;
  display: inline-block;
}

.api-state.is-online { color: #3f7a55; }
.api-state.is-online i { background: #3f7a55; box-shadow: 0 0 0 0 rgba(63, 122, 85, 0.45); animation: pulse 2.4s infinite; }
.api-state.is-offline { color: var(--accent); }
.api-state.is-offline i { background: var(--accent); }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 7px;
}

.field input,
.field textarea {
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  background: #fffefb;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 11px 12px;
  line-height: 1.6;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.field textarea { resize: vertical; min-height: 108px; }

.field input::placeholder,
.field textarea::placeholder { color: #aaa49a; }

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(21, 19, 15, 0.06);
}

.field.has-error input,
.field.has-error textarea { border-color: var(--accent); }

.field .err {
  display: block;
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--accent);
}

.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.form-foot {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 4px;
}

.form-foot .btn { height: 44px; }

.form-foot .btn[disabled] { opacity: 0.55; pointer-events: none; }

.form-hint {
  font-size: 11.5px;
  color: #9a948a;
}

.form-status {
  margin: 12px 0 0;
  font-size: 12.5px;
  color: var(--accent);
  min-height: 0;
}

.form-status.is-ok { color: #3f7a55; }

.form-done { text-align: left; padding: 8px 0 6px; }

.done-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid #3f7a55;
  color: #3f7a55;
  font-size: 14px;
  margin-bottom: 16px;
}

.done-title {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.02em;
  font-weight: 500;
}

.done-sub {
  margin: 8px 0 20px;
  font-size: 13.5px;
  color: var(--muted);
}

/* ---------------- 页脚 ---------------- */

.site-footer { border-top: 1px solid var(--line); padding: 30px 0 40px; }

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: #918c82;
  text-transform: uppercase;
}

.footer-inner a:hover { color: var(--ink); }

/* ---------------- 内页头部 ---------------- */

.page-head { padding: 76px 0 52px; border-bottom: 1px solid var(--line); }

.page-head h1 {
  margin: 20px 0 0;
  font-size: clamp(38px, 5vw, 60px);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1.04;
}

.page-head p {
  margin: 20px 0 0;
  max-width: 56ch;
  color: var(--muted);
  font-size: 15.5px;
  line-height: 1.8;
}

/* ---------------- 项目卡片 ---------------- */

.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 26px 0 40px;
}

.chip {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  transition: all 0.22s var(--ease);
}

.chip:hover { border-color: var(--ink); color: var(--ink); }

.chip.is-active { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 40px 32px;
  padding-bottom: 20px;
}

.project-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 3px;
  overflow: hidden;
  transform: translateY(var(--ty, 0px));
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.project-card:hover {
  /* 交给 fx.js 的倾斜变量叠加，避免与 3D 旋转互相覆盖 */
  --ty: -4px;
  box-shadow: 0 18px 40px -28px rgba(21, 19, 15, 0.4);
}

.thumb {
  position: relative;
  height: 214px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(135deg, #efece4 0%, #f8f6f0 55%, #ece9e0 100%);
}

.thumb::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(21, 19, 15, 0.075) 1px, transparent 1px),
    linear-gradient(90deg, rgba(21, 19, 15, 0.075) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.55;
}

.thumb .tag {
  position: absolute;
  top: 16px;
  left: 18px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #7c766b;
}

.thumb--a::after {
  content: "";
  position: absolute;
  right: 34px;
  bottom: 30px;
  width: 118px;
  height: 118px;
  border: 1px solid rgba(21, 19, 15, 0.22);
  border-radius: 50%;
  box-shadow: 0 0 0 22px rgba(255, 253, 250, 0.55),
    0 0 0 23px rgba(21, 19, 15, 0.09),
    0 0 0 46px rgba(255, 253, 250, 0.4),
    0 0 0 47px rgba(21, 19, 15, 0.07);
}

.thumb--b::after {
  content: "";
  position: absolute;
  left: 34px;
  bottom: 34px;
  width: 210px;
  height: 96px;
  background: repeating-linear-gradient(
    90deg,
    rgba(21, 19, 15, 0.5) 0 2px,
    transparent 2px 12px
  );
  clip-path: polygon(
    0% 78%, 12% 62%, 24% 70%, 36% 38%, 48% 52%, 60% 22%, 72% 44%,
    84% 26%, 100% 34%, 100% 100%, 0% 100%
  );
  opacity: 0.5;
}

.thumb--c::after {
  content: "";
  position: absolute;
  inset: 40px 40px 34px;
  border: 1px solid rgba(21, 19, 15, 0.18);
  background: repeating-linear-gradient(
      45deg,
      transparent 0 9px,
      rgba(21, 19, 15, 0.05) 9px 10px
    );
}

.thumb--d::after {
  content: "";
  position: absolute;
  right: 40px;
  top: 42px;
  width: 96px;
  height: 96px;
  background: var(--ink);
  transform: rotate(12deg);
  opacity: 0.9;
}

.project-body { padding: 22px 24px 26px; display: flex; flex-direction: column; flex: 1; }

.project-body .kicker {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.project-body h3 {
  margin: 10px 0 8px;
  font-size: 21px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.project-body p {
  margin: 0 0 18px;
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--muted);
}

.project-foot {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: #8d877c;
}

.project-foot .go { color: var(--ink); }

/* ---------------- 项目详情 ---------------- */

.case-hero { padding: 64px 0 48px; border-bottom: 1px solid var(--line); }

.case-hero h1 {
  margin: 18px 0 0;
  font-size: clamp(32px, 3.9vw, 46px);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.15;
}

.case-hero .lede {
  margin: 22px 0 0;
  max-width: 58ch;
  font-size: 16px;
  line-height: 1.8;
  color: var(--ink-soft);
}

.case-meta {
  margin-top: 44px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
}

.case-meta div { padding: 18px 0 0; }

.case-meta .k {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin-bottom: 8px;
}

.case-meta .v { font-size: 14px; }

.case-body { padding: 72px 0 40px; }

.case-section { display: grid; grid-template-columns: 220px 1fr; gap: 56px; padding-bottom: 56px; }

.case-section h2 {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 400;
  margin: 6px 0 0;
}

.case-section .content { max-width: 66ch; min-width: 0; }

.case-section .content p {
  margin: 0 0 18px;
  font-size: 15.5px;
  line-height: 1.85;
  color: var(--ink-soft);
}

.case-section .content h3 {
  margin: 30px 0 10px;
  font-size: 17px;
  font-weight: 500;
}

.pull {
  margin: 30px 0;
  padding: 4px 0 4px 24px;
  border-left: 2px solid var(--accent);
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.55;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.figure {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 3px;
  padding: 34px;
  margin: 26px 0;
}

.figure .bars { display: grid; gap: 14px; }

.figure .bar-row {
  display: grid;
  grid-template-columns: 92px 1fr 58px;
  gap: 16px;
  align-items: center;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
}

.figure .bar {
  height: 8px;
  background: #e7e3d9;
  border-radius: 1px;
  position: relative;
  overflow: hidden;
}

.figure .bar i {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--ink);
  display: block;
}

.figure .cap {
  margin: 22px 0 0;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: #918c82;
  text-transform: uppercase;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  background: var(--surface);
  margin: 24px 0 8px;
}

.result-grid div {
  padding: 24px 22px;
  border-right: 1px solid var(--line);
}

.result-grid div:last-child { border-right: 0; }

.result-grid .n {
  font-family: var(--mono);
  font-size: 26px;
  letter-spacing: -0.03em;
  display: block;
}

.result-grid .l { font-size: 12px; color: var(--muted); margin-top: 4px; }

.case-nav {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 28px 0 60px;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
}

/* ---------------- 关于 ---------------- */

.about-grid {
  display: grid;
  grid-template-columns: 0.76fr 1.24fr;
  gap: 68px;
  padding: 72px 0 24px;
}

.portrait {
  position: relative;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, #efece3, #f9f7f2 60%, #eae6dc);
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: 3px;
}

.portrait .grid-bg {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(21, 19, 15, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(21, 19, 15, 0.06) 1px, transparent 1px);
  background-size: 40px 40px;
}

.portrait .glyph {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 168px;
  color: rgba(21, 19, 15, 0.82);
  letter-spacing: -0.05em;
}

.portrait .sig {
  position: absolute;
  left: 20px;
  bottom: 18px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  color: #837d72;
  text-transform: uppercase;
}

.portrait-note {
  margin: 12px 0 0;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: #9a948a;
}

.about-copy h2 {
  margin: 16px 0 20px;
  font-size: clamp(26px, 2.8vw, 36px);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.25;
}

.about-copy p {
  margin: 0 0 18px;
  font-size: 15.5px;
  line-height: 1.9;
  color: var(--ink-soft);
}

.about-facts {
  margin-top: 32px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0 32px;
  border-top: 1px solid var(--line);
}

.about-facts div {
  padding: 14px 0;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.about-facts .k { color: var(--muted); font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; }

.skill-table { border-top: 1px solid var(--line); }

.skill-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 32px;
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
}

.skill-row .cat {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 4px;
}

.skill-tags { display: flex; flex-wrap: wrap; gap: 8px; }

.skill-tags span {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--ink-soft);
  background: var(--surface);
}

/* ---------------- 文章 ---------------- */

.post-list { border-top: 1px solid var(--line); }

.post {
  display: grid;
  grid-template-columns: 116px 1fr 120px;
  gap: 28px;
  align-items: baseline;
  padding: 26px 0;
  border-bottom: 1px solid var(--line);
  transition: padding 0.24s var(--ease);
}

.post:hover { padding-left: 10px; }

.post .date { font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: 0.05em; }
.post h3 { margin: 0; font-size: 19px; font-weight: 500; letter-spacing: -0.015em; }
.post p { margin: 6px 0 0; font-size: 13.5px; color: var(--muted); }
.post .cat { text-align: right; font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: #918c82; }

/* ---------------- 实验室 ---------------- */

.lab-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.lab-card {
  background: var(--surface);
  padding: 26px 24px 22px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.lab-card--wide { grid-column: 1 / -1; }

.lab-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 4px;
}

.lab-head h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.015em;
}

.lab-tag {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid rgba(169, 78, 44, 0.28);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}

.lab-lead {
  margin: 0 0 18px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted);
}

.lab-stage {
  border: 1px solid var(--line-soft);
  background: var(--paper);
  padding: 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.lab-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.lab-btn {
  appearance: none;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.02em;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}

.lab-btn:hover { opacity: 0.82; }
.lab-btn:active { transform: translateY(1px); }

.lab-btn--ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

.lab-btn--ghost:hover { border-color: var(--ink); opacity: 1; }

.lab-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.readout {
  display: flex;
  gap: 18px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-transform: uppercase;
}

.readout b {
  font-weight: 500;
  color: var(--ink);
  font-size: 12px;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  text-transform: none;
}

.readout b.is-good { color: #2f7a4f; }
.readout b.is-bad { color: var(--accent); }

/* 虚拟列表 */
.virt-viewport {
  height: 216px;
  overflow-y: auto;
  overflow-x: hidden;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 35px,
      var(--line-soft) 35px,
      var(--line-soft) 36px
    );
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.virt-row {
  height: 36px;
  display: grid;
  grid-template-columns: 46px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  font-size: 12.5px;
  border-bottom: 1px solid var(--line-soft);
}

.virt-row i {
  font-family: var(--mono);
  font-style: normal;
  font-size: 10px;
  color: #a8a29a;
}

.virt-row b { font-weight: 500; color: var(--ink-soft); }

.virt-row span {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
}

.virt-spacer { position: relative; }

/* 排序可视化 */
.sort-stage {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 176px;
  padding: 0 2px;
}

.sort-stage i {
  flex: 1;
  background: #cdc8bd;
  border-radius: 1px 1px 0 0;
  transition: height 0.06s linear, background 0.12s linear;
  min-height: 2px;
}

.sort-stage i.is-active { background: var(--accent); }
.sort-stage i.is-done { background: #2f7a4f; }

.sort-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

.sort-pair figure { margin: 0; }

.sort-pair figcaption {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
}

.sort-pair figcaption b {
  text-transform: none;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
  font-weight: 500;
}

/* API 控制台 */
.api-run { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }

.api-code {
  margin: 0;
  flex: 1;
  min-height: 150px;
  max-height: 240px;
  overflow: auto;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.72;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line-soft);
  padding: 12px 14px;
  white-space: pre-wrap;
  word-break: break-word;
  tab-size: 2;
}

.api-code .k { color: var(--accent); }
.api-code .s { color: #2f7a4f; }
.api-code .n { color: #3a5f94; }
.api-code .c { color: #a8a29a; }

/* 指标条 */
.metric-list { display: flex; flex-direction: column; gap: 0; }

.metric {
  display: grid;
  grid-template-columns: 1fr auto 58px;
  align-items: center;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12.5px;
}

.metric:last-child { border-bottom: 0; }

.metric-k { color: var(--muted); font-size: 12px; }

.metric-v {
  text-align: right;
  font-family: var(--mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  font-weight: 500;
}

.metric-badge {
  text-align: center;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  padding: 2px 0;
  border-radius: 2px;
  border: 1px solid transparent;
}

.metric-badge.is-good {
  color: #2f7a4f;
  border-color: rgba(47, 122, 79, 0.28);
  background: rgba(47, 122, 79, 0.07);
}

.metric-badge.is-mid {
  color: #8a5a2b;
  border-color: rgba(138, 90, 43, 0.28);
  background: rgba(138, 90, 43, 0.07);
}

.metric-badge.is-info {
  color: var(--muted);
  border-color: var(--line);
  background: transparent;
}

/* 代码块（技术笔记正文） */
.code-block {
  margin: 22px 0;
  border: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
}

.code-block .cb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--paper);
}

.code-block pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.78;
  color: var(--ink-soft);
  tab-size: 2;
}

.code-block .cm { color: #a8a29a; }
.code-block .kw { color: var(--accent); }
.code-block .st { color: #2f7a4f; }
.code-block .fn { color: #3a5f94; }
.code-block .nu { color: #8a5a2b; }

/* 学习路径 / 时间线变体 */
.learn-list { border-top: 1px solid var(--line); }

.learn-item {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 26px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.learn-time {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding-top: 4px;
}

.learn-item h3 {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.learn-item p { margin: 0; font-size: 13.5px; color: var(--muted); }

.learn-item ul {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.learn-item li {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 2px 7px;
}

/* 技术切面卡 */
.slice-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.slice {
  background: var(--surface);
  padding: 22px 20px 20px;
  display: flex;
  flex-direction: column;
}

.slice .no {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  color: var(--accent);
}

.slice h3 { margin: 12px 0 8px; font-size: 15.5px; font-weight: 500; }
.slice p { margin: 0; font-size: 12.5px; line-height: 1.7; color: var(--muted); flex: 1; }

.slice .slice-metric {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}

.slice .slice-metric b { font-size: 15px; font-weight: 500; color: var(--accent); }

/* 警示条（占位提示） */
/* 演示卡片下方的补充说明（原 todo-band，已改成普通正文样式） */
.lab-note {
  margin: 14px 0 0;
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--muted);
}

.lab-note b { color: var(--ink-soft); font-weight: 600; }

/* 文章正文 */
.post-body {
  max-width: 720px;
  font-size: 15px;
  line-height: 1.95;
  color: var(--ink-soft);
}

.post-body h2 {
  margin: 44px 0 14px;
  font-size: 21px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.4;
}

.post-body h3 {
  margin: 30px 0 10px;
  font-size: 16.5px;
  font-weight: 500;
  color: var(--ink);
}

.post-body p { margin: 0 0 18px; }
.post-body strong { color: var(--ink); font-weight: 600; }
.post-body em { font-style: italic; color: var(--ink); }

.post-body ul, .post-body ol { margin: 0 0 18px; padding-left: 22px; }
.post-body li { margin-bottom: 8px; }

.post-body code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: rgba(21, 19, 15, 0.055);
  padding: 1.5px 5px;
  border-radius: 2px;
  color: var(--ink);
}

.post-body blockquote {
  margin: 24px 0;
  padding: 2px 0 2px 20px;
  border-left: 2px solid var(--accent);
  color: var(--muted);
  font-size: 14.5px;
}

.post-body hr {
  margin: 40px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.post-body .lede {
  font-size: 16.5px;
  line-height: 1.85;
  color: var(--ink-soft);
  margin-bottom: 30px;
}

@media (max-width: 1024px) {
  .slice-grid { grid-template-columns: 1fr 1fr; }
  .lab-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .slice-grid { grid-template-columns: 1fr; }
  .lab-card { padding: 22px 16px 18px; }
  .sort-pair { grid-template-columns: 1fr; gap: 22px; }
  .metric { grid-template-columns: 1fr auto 50px; gap: 8px; font-size: 11.5px; }
  .learn-item { grid-template-columns: 1fr; gap: 6px; }
  .learn-time { padding-top: 0; }
  .readout { gap: 12px; font-size: 9.5px; }
  .readout b { font-size: 11px; }
  .post-body { font-size: 14.5px; line-height: 1.9; }
  .api-code { font-size: 10.5px; }
}

/* ---------------- 移动端菜单遮罩 ---------------- */

.nav-mask {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(21, 19, 15, 0.22);
  -webkit-backdrop-filter: blur(1.5px);
  backdrop-filter: blur(1.5px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s var(--ease), visibility 0.22s var(--ease);
}

body.nav-open .nav-mask { opacity: 1; visibility: visible; }
body.nav-open { overflow: hidden; }

@media (min-width: 721px) {
  .nav-mask { display: none; }
}

/* ---------------- 特效层（fx.js） ---------------- */
/* 全部沿用现有 token：纸白 / 墨黑 / 陶土红，不引入新色值 */

/* 顶部滚动进度：一根 2px 的墨色线，陶土红收尾 */
.fx-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 60;
  pointer-events: none;
  background: transparent;
}

.fx-progress i {
  display: block;
  height: 100%;
  width: 100%;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--ink) 0%, var(--ink) 62%, var(--accent) 100%);
  opacity: 0.82;
}

/* 首屏粒子层 */
[data-fx-area] { position: relative; }

.fx-canvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

[data-fx-area] > .wrap { position: relative; z-index: 1; }

/* 首屏正文压一层纸色光晕，让粒子线不穿过文字 */
.hero .eyebrow,
.hero-sub,
.hero-stats .stat {
  text-shadow: 0 0 4px var(--paper), 0 0 13px var(--paper);
}

/* 标题逐字入场 */
.fx-ch {
  display: inline-block;
  opacity: 0;
  transform: translateY(0.42em) rotate(1.5deg);
  animation: fxCharIn 0.72s var(--ease) forwards;
}

@keyframes fxCharIn {
  to { opacity: 1; transform: none; }
}

/* 减少动效时不做拆分，直接可见 */
.fx-split-done .fx-ch {
  animation: none;
  opacity: 1;
  transform: none;
}

/* 卡片 3D 倾斜：用 CSS 变量叠加，不影响原有 hover 上浮 */
[data-fx-tilt] {
  /* perspective() 必须是 transform 列表的第一个函数，否则整条声明失效 */
  transform:
    perspective(900px)
    translateY(var(--ty, 0px))
    rotateX(var(--rx, 0deg))
    rotateY(var(--ry, 0deg));
  transition: transform 0.16s var(--ease), box-shadow 0.24s var(--ease);
}

[data-fx-tilt].is-tilting {
  z-index: 2;
  box-shadow: 0 22px 48px -30px rgba(21, 19, 15, 0.42);
}

/* 跟随鼠标的高光，只在倾斜时出现 */
[data-fx-tilt]::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.24s var(--ease);
  background: radial-gradient(
    340px circle at var(--mx, 50%) var(--my, 50%),
    rgba(255, 253, 250, 0.55),
    transparent 62%
  );
}

[data-fx-tilt].is-tilting::after { opacity: 1; }

[data-fx-tilt] { position: relative; overflow: hidden; }

/* 交错入场 */
.fx-stagger-item {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity 0.66s var(--ease),
    transform 0.66s var(--ease);
  transition-delay: calc(var(--i, 0) * 70ms);
}

.fx-stagger-item.fx-stagger-in {
  opacity: 1;
  transform: none;
}

/* 能力雷达 */
.radar-block {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 46px;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 34px 36px;
}

.radar-canvas-wrap {
  position: relative;
  height: 380px;
  min-width: 0;
}

.radar-canvas-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.radar-legend {
  min-width: 0;
}

.radar-legend .rl-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 12px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.radar-legend .rl-head span {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.radar-legend ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.radar-legend li {
  display: grid;
  grid-template-columns: 1fr 46px;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12.5px;
  color: var(--ink-soft);
}

.radar-legend li:last-child { border-bottom: 0; }

.radar-legend li b {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--accent);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.radar-legend li i {
  font-family: var(--mono);
  font-style: normal;
  font-size: 9.5px;
  color: var(--muted);
}

.radar-legend .rl-note {
  margin: 16px 0 0;
  font-size: 12px;
  line-height: 1.75;
  color: var(--muted);
}

@media (max-width: 1024px) {
  .radar-block { grid-template-columns: 1fr; gap: 26px; padding: 26px 22px; }
  .radar-canvas-wrap { height: 320px; }
}

@media (max-width: 720px) {
  .radar-block { padding: 20px 16px; }
  .radar-canvas-wrap { height: 268px; }
  .radar-legend li { font-size: 12px; padding: 8px 0; }
}

/* ---------------- 动效 ---------------- */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

.reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ---------------- 精修细节层 ---------------- */

/* 01 · 区块自动编号：01 │ PORTFOLIO 这样的编辑排版结构 */
body { counter-reset: sec; }

.section .eyebrow { counter-increment: sec; }

.section .eyebrow::before {
  content: counter(sec, decimal-leading-zero);
  width: auto;
  height: auto;
  background: none;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  padding-right: 11px;
  border-right: 1px solid var(--line);
}

/* 02 · 区块头部改双栏：标题在左、说明在右，右栏对齐，右侧不再空一大片 */
.section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 372px;
  column-gap: 72px;
  row-gap: 12px;
  align-items: start;
  margin-bottom: 52px;
}

.section-head > div { display: contents; }

.section-head .eyebrow {
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
}

.section-head h2 {
  grid-column: 1;
  grid-row: 2;
  margin: 0;
  align-self: start;
}

.section-head p {
  grid-column: 2;
  grid-row: 2;
  margin: 6px 0 0;
  max-width: none;
  align-self: start;
}

.section-head > .link-arrow,
.section-head > .btn {
  grid-column: 2;
  grid-row: 3;
  justify-self: start;
  margin-top: 2px;
}

/* 首屏网格线更清晰一点，像制图纸 */
.hero::before {
  background-image: repeating-linear-gradient(
    90deg,
    rgba(21, 19, 15, 0.05) 0 1px,
    transparent 1px 88px
  );
}

/* 03 · 数据条：竖细线分隔，数字用等宽字形 */
.hero-stats { gap: 0; }

.stat {
  padding: 0 40px;
  min-width: 0;
}

.stat:first-child { padding-left: 0; }
.stat:last-child { padding-right: 0; }
.stat + .stat { border-left: 1px solid var(--line); }

.stat .num {
  font-size: 30px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.stat .label {
  margin-top: 7px;
  font-size: 11.5px;
  letter-spacing: 0.08em;
  color: var(--muted);
  display: block;
  white-space: nowrap;
}

/* 04 · 按钮：箭头滑动 + 统一高度，主按钮带一点落地阴影 */
.btn {
  height: 48px;
  padding: 0 24px;
  font-size: 13.5px;
  letter-spacing: 0.01em;
  border-radius: 2px;
}

.btn span[aria-hidden] {
  display: inline-block;
  transition: transform 0.3s var(--ease);
}

.btn:hover span[aria-hidden] { transform: translateX(4px); }

.btn-primary {
  box-shadow: 0 8px 20px -14px rgba(21, 19, 15, 0.75);
}

.btn-primary:hover { box-shadow: 0 14px 28px -16px rgba(21, 19, 15, 0.8); }

/* 05 · 文字链接：下划线从左展开 */
.link-arrow {
  position: relative;
  padding-bottom: 3px;
}

.link-arrow::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.36s var(--ease);
}

.link-arrow:hover::after { transform: scaleX(1); }

.link-arrow span[aria-hidden] {
  display: inline-block;
  transition: transform 0.3s var(--ease);
}

.link-arrow:hover span[aria-hidden] { transform: translateX(3px); }

/* 06 · 卡片角标：只在左上和右下画 L 形细线，像印刷套准标记 */
.status-card,
.lab-card,
.project-card {
  position: relative;
}

.status-card::before,
.lab-card::before,
.project-card::before {
  content: "";
  position: absolute;
  top: -1px;
  left: -1px;
  width: 11px;
  height: 11px;
  border-top: 1px solid var(--ink-soft);
  border-left: 1px solid var(--ink-soft);
  pointer-events: none;
  opacity: 0.55;
  transition: opacity 0.3s var(--ease);
}

.status-card::after,
.lab-card::after,
.project-card::after {
  content: "";
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 11px;
  height: 11px;
  border-right: 1px solid var(--ink-soft);
  border-bottom: 1px solid var(--ink-soft);
  pointer-events: none;
  opacity: 0.55;
  transition: opacity 0.3s var(--ease);
}

.lab-card:hover::before,
.lab-card:hover::after,
.project-card:hover::before,
.project-card:hover::after {
  opacity: 1;
}

/* 07 · 能力格 hover：顶部一条陶土红细线从左侧长出 */
.cap {
  position: relative;
  overflow: hidden;
}

.cap::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.45s var(--ease);
}

.cap:hover::before { transform: scaleX(1); }

/* 08 · 列表行 hover：序号变陶土红、箭头右移 */
.work-row .no,
.post .date {
  transition: color 0.26s var(--ease);
}

.work-row:hover .no { color: var(--accent); }

.work-row .arrow {
  transition: transform 0.3s var(--ease), color 0.3s var(--ease);
}

.work-row:hover .arrow {
  transform: translateX(5px);
  color: var(--accent);
}

/* 09 · 键盘焦点：用陶土红给出清晰但克制的轮廓 */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 1px;
}

/* 10 · 图片与代码块收边，避免边缘发虚 */
.project-card img,
.photo-main img { backface-visibility: hidden; }

.code-block {
  border-radius: 3px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* 11 · 内页大标题也加粗一档，和首页统一 */
.page-head h1,
.case-hero h1 {
  font-weight: 700;
  letter-spacing: -0.032em;
  text-wrap: balance;
}

/* 12 · 页脚：中间加一条极细竖线，三段式更像印刷版式 */
.footer-inner {
  letter-spacing: 0.1em;
}

@media (max-width: 720px) {
  /* 数据条在窄屏改回三列网格，去掉竖线 */
  .stat { padding: 0; }
  .stat + .stat { border-left: 0; }
  .stat .num { font-size: 26px; }
  .stat .label { white-space: normal; font-size: 11px; letter-spacing: 0.06em; }

  .section .eyebrow::before { padding-right: 9px; }

  /* 区块头部在窄屏回到单列堆叠 */
  .section-head {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    margin-bottom: 34px;
  }

  .section-head > div { display: block; }

  .section-head h2 { margin: 14px 0 0; }

  .section-head p {
    margin: 12px 0 0;
    max-width: 46ch;
  }

  .section-head > .link-arrow,
  .section-head > .btn {
    align-self: flex-start;
    margin-top: 18px;
  }

  /* 角标在手机上略小，避免压住内容 */
  .status-card::before,
  .status-card::after,
  .lab-card::before,
  .lab-card::after,
  .project-card::before,
  .project-card::after {
    width: 8px;
    height: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn span[aria-hidden],
  .link-arrow span[aria-hidden],
  .work-row .arrow { transition: none; }
}

/* 13 · 紧接内页大标题的区块：留一点气，不要贴住分隔线 */
.section--tight { padding-top: 56px; }

/* 14 · 卡片标题加粗一档，和正文拉开层次 */
.slice h3,
.lab-head h3,
.cap h3,
.ai-card h3 {
  font-weight: 600;
}

/* 15 · 案例页左栏：顶部一条细线做视觉锚点，和右侧正文同起于一条基线 */
@media (min-width: 721px) {
  .case-section h2 {
    padding-top: 13px;
    border-top: 1px solid var(--line);
    max-width: 176px;
    font-size: 11.5px;
    line-height: 1.75;
  }
}

/* 16 · 案例页正文段落：首行不缩进，但段间留白更统一 */
.case-section .content p {
  letter-spacing: 0.012em;
}

/* 17 · 实验室演示框：内部再多一点留白，看起来不像工具面板 */
.lab-card { padding: 28px 26px 24px; }

/* 18 · 页脚：等宽字距已足够，不再加分隔符 */

@media (max-width: 720px) {
  .section--tight { padding-top: 34px; }
  .lab-card { padding: 22px 18px 20px; }
}

/* ---------------- 响应式 ---------------- */

@media (max-width: 1024px) {
  .hero-grid { grid-template-columns: 1fr; gap: 44px; }
  .status-card { max-width: 420px; }
  .cap-grid { grid-template-columns: repeat(2, 1fr); }
  .cap:nth-child(2) { border-right: 0; }
  .cap:nth-child(1), .cap:nth-child(2) { border-bottom: 1px solid var(--line); }
  .project-grid { grid-template-columns: 1fr; }
  .about-grid { grid-template-columns: 1fr; gap: 40px; }
  .portrait { max-width: 320px; }
  .contact-grid { grid-template-columns: 1fr; gap: 36px; }
  .contact-body { grid-template-columns: 1fr; gap: 36px; }
  .contact-note { max-width: none; }
  .case-section { grid-template-columns: 1fr; gap: 18px; }
  .case-meta { grid-template-columns: repeat(2, 1fr); gap: 8px 24px; }
}

@media (max-width: 720px) {
  .wrap { padding: 0 22px; }
  .nav { height: 64px; }
  .nav-links { display: none; }
  .nav-cta { display: none; }
  .nav-admin { padding: 0 10px; font-size: 11.5px; }
  .nav-toggle { display: inline-flex; }
  .nav-links.is-open {
    display: flex;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    z-index: 51;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 4px 20px 8px;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 22px 40px -26px rgba(21, 19, 15, 0.5);
  }
  .nav-links.is-open a {
    padding: 13px 2px;
    font-size: 16px;
    border-bottom: 1px solid var(--line-soft);
  }
  .nav-links.is-open a:last-child { border-bottom: 0; }
  /* 菜单里当前页用陶土红标，避免和分隔线打架 */
  .nav-links.is-open a[aria-current="page"] { color: var(--accent); }
  .nav-links.is-open a[aria-current="page"]::after { display: none; }
  .hero { padding: 52px 0 40px; }
  .hero-stats { gap: 28px; margin-top: 40px; }
  .section { padding: 62px 0; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 14px; }
  .work-row { grid-template-columns: 34px 1fr; gap: 16px; padding: 22px 0; }
  .work-meta { grid-column: 2; text-align: left; }
  .work-arrow { display: none; }
  .cap-grid { grid-template-columns: 1fr; }
  .cap { border-right: 0; border-bottom: 1px solid var(--line); }
  .cap:last-child { border-bottom: 0; }
  .tl-item { grid-template-columns: 1fr; gap: 8px; }
  .contact-band { padding: 62px 0; }
  .form-card { padding: 20px 18px 18px; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .form-foot { flex-wrap: wrap; gap: 10px; }
  .post { grid-template-columns: 1fr; gap: 6px; }
  .post .cat { display: none; }
  .result-grid { grid-template-columns: 1fr; }
  .result-grid div { border-right: 0; border-bottom: 1px solid var(--line); }
  .result-grid div:last-child { border-bottom: 0; }
  .stack-list { height: 54px; font-size: 10.5px; }
  .stack-list span { padding: 0 13px; }
}

/* ---------------- 手机端适配修正 ---------------- */

@media (max-width: 720px) {
  /* 首屏标题：44px 在 360 宽度下会贴边，收到 35-40 */
  .hero h1 {
    font-size: clamp(34px, 9.8vw, 40px);
    line-height: 1.04;
    letter-spacing: -0.04em;
  }

  /* 页面大标题平衡断行，避免末行只剩一两个字 */
  .page-head h1 {
    font-size: clamp(29px, 8.2vw, 36px);
    text-wrap: balance;
  }

  .case-hero h1 {
    font-size: clamp(25px, 7.4vw, 32px);
    text-wrap: balance;
  }

  /* 手写的桌面断行，小屏交给浏览器平衡 */
  .br-desktop { display: none; }

  /* 三个数据并排，不换行也不挤 */
  .hero-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 34px;
    padding-top: 18px;
  }

  .stat .num { font-size: 22px; }
  .stat .label { font-size: 11.5px; line-height: 1.5; display: block; }

  /* 状态卡在窄屏上留白收紧 */
  .status-card { padding: 20px 18px 18px; }

  /* 案例页 meta：两列且列宽不被长内容撑破，文字正常折行 */
  .case-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 20px;
  }
  .case-meta .v {
    font-size: 13px;
    line-height: 1.55;
    overflow-wrap: anywhere;
  }

  /* 实验室：指标行允许折行，别硬挤成一行 */
  .lab-bar { gap: 10px; }
  .readout {
    flex-wrap: wrap;
    gap: 6px 14px;
    font-size: 10px;
    line-height: 1.7;
  }
  .readout b { font-size: 11px; }
  .lab-btn { padding: 8px 15px; font-size: 12.5px; }

  /* 虚拟列表行：三段信息在小屏上收紧，避免第三段挤压 */
  .virt-row {
    grid-template-columns: 42px 1fr auto;
    gap: 8px;
    padding: 0 8px;
    font-size: 12px;
  }
  .virt-row span { font-size: 9.5px; }

  /* 代码块横向滚动时给出一点内边距，不贴边 */
  .code-block pre {
    padding: 12px 12px;
    font-size: 12.5px;
    -webkit-overflow-scrolling: touch;
  }

  /* 联系表单按钮占满一行更好点 */
  .form-foot .btn { flex: 1 1 auto; justify-content: center; }

  /* 技术栈条：手机上横向滑动，右侧渐隐提示还有内容，不要硬截断 */
  .stack-list {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, #000 86%, transparent 100%);
    mask-image: linear-gradient(90deg, #000 86%, transparent 100%);
    padding-right: 24px;
  }
  .stack-list::-webkit-scrollbar { display: none; }
  .stack-list span { padding: 0 14px; }
  .stack-list span:first-child { padding-left: 22px; }
}

/* 超窄屏（320-340）再收一档 */
@media (max-width: 340px) {
  .hero h1 { font-size: 30px; }
  .page-head h1 { font-size: 26px; }
  .case-hero h1 { font-size: 23px; }
  .wrap { padding: 0 18px; }
}

/* ---------------- 照片集 + 灯箱 ---------------- */

.photo-set { min-width: 0; }

.photo-main {
  display: block;
  position: relative;
  width: 100%;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: zoom-in;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.photo-main img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 0.5s var(--ease);
}

.photo-main:hover img { transform: scale(1.015); }

.photo-count {
  position: absolute;
  right: 10px;
  bottom: 10px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  padding: 4px 8px;
  border-radius: 2px;
  background: rgba(21, 19, 15, 0.7);
  color: var(--paper);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.photo-thumbs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.photo-thumbs button {
  padding: 0;
  border: 1px solid var(--line);
  background: none;
  cursor: zoom-in;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  -webkit-tap-highlight-color: transparent;
}

.photo-thumbs img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s var(--ease), opacity 0.3s var(--ease);
  opacity: 0.92;
}

.photo-thumbs button:hover img {
  transform: scale(1.06);
  opacity: 1;
}

/* 灯箱 */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 64px;
  background: rgba(21, 19, 15, 0.965);
  -webkit-backdrop-filter: blur(10px) saturate(60%);
  backdrop-filter: blur(10px) saturate(60%);
  opacity: 0;
  transition: opacity 0.24s var(--ease);
}

.lightbox[hidden] { display: none; }
.lightbox.is-open { opacity: 1; }

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 30px 90px -40px rgba(0, 0, 0, 0.9);
  user-select: none;
}

.lb-btn {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(246, 245, 241, 0.26);
  background: rgba(246, 245, 241, 0.08);
  color: var(--paper);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.lb-btn:hover {
  background: rgba(246, 245, 241, 0.18);
  border-color: rgba(246, 245, 241, 0.5);
}

.lb-close { top: 18px; right: 18px; }

/* 关闭按钮用两条线画，比字符更锐利也更可控 */
.lb-close::before,
.lb-close::after {
  content: "";
  position: absolute;
  width: 15px;
  height: 1.6px;
  background: currentColor;
  border-radius: 1px;
}
.lb-close::before { transform: rotate(45deg); }
.lb-close::after { transform: rotate(-45deg); }
.lb-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 16px; top: 50%; transform: translateY(-50%); }

.lb-counter {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 18px;
  text-align: center;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: rgba(246, 245, 241, 0.7);
}

@media (max-width: 720px) {
  .lightbox { padding: 58px 10px 62px; }
  .lb-prev { left: 8px; }
  .lb-next { right: 8px; }
  .lb-btn { width: 40px; height: 40px; }
  .photo-thumbs { gap: 6px; }
}

/* ---------------- AI 工作流 ---------------- */

.ai-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.ai-card {
  background: var(--surface);
  padding: 24px 22px 22px;
  display: flex;
  flex-direction: column;
}

.ai-card .phase {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.ai-card h3 {
  margin: 11px 0 9px;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.ai-card p {
  margin: 0;
  font-size: 13px;
  line-height: 1.75;
  color: var(--muted);
  flex: 1;
}

.ai-tools {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ai-tools span {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 2px 7px;
}

.ai-principles {
  margin-top: 22px;
  border-left: 2px solid var(--accent);
  padding: 4px 0 4px 20px;
}

.ai-principles li {
  font-size: 13.5px;
  line-height: 1.8;
  color: var(--ink-soft);
  margin-bottom: 8px;
}

.ai-principles li:last-child { margin-bottom: 0; }

.ai-principles strong { color: var(--ink); font-weight: 600; }

@media (max-width: 720px) {
  .ai-grid { grid-template-columns: 1fr; }
  .ai-card { padding: 20px 18px; }
}

/* ---------------- 复制微信号 ---------------- */

/* contact-line 原来是 <a>，换成 <button> 后要清掉默认样式 */
button.contact-line {
  width: 100%;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  font-family: inherit;
  font-size: 14px;
  color: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button.contact-line:hover { color: var(--accent); }

.copy-hint {
  margin-left: 10px;
  padding: 1px 7px;
  border: 1px solid var(--line);
  border-radius: 2px;
  font-family: var(--mono);
  font-size: 9.5px;
  font-style: normal;
  letter-spacing: 0.06em;
  color: var(--muted);
  vertical-align: 1px;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}

button.contact-line.is-copied .copy-hint {
  color: var(--accent);
  border-color: rgba(169, 78, 44, 0.38);
}

/* ==========================================================================
   12 · 深色模式
   只覆盖变量 + 少量硬编码浅色的选择器，不动的规则在两种主题下都成立
   ========================================================================== */

html[data-theme="dark"] {
  --paper: #16140f;
  --surface: #1d1b15;
  --ink: #f4f1e8;
  --ink-soft: #cdc7ba;
  --muted: #948e82;
  --line: #322e26;
  --line-soft: #262319;
  --accent: #e08159;

  color-scheme: dark;
}

/* 语法高亮：浅色底上的深色系全部提亮 */
html[data-theme="dark"] .code-block .cm,
html[data-theme="dark"] .api-code .c { color: #8a8579; }
html[data-theme="dark"] .code-block .kw { color: #e08159; }
html[data-theme="dark"] .code-block .st { color: #7fb98a; }
html[data-theme="dark"] .code-block .fn { color: #8ab0dd; }
html[data-theme="dark"] .code-block .nu { color: #d9a35f; }

/* 这些地方写死了浅色，需要单独压暗 */
html[data-theme="dark"] .status-recent .k,
html[data-theme="dark"] .form-hint,
html[data-theme="dark"] .portrait-note,
html[data-theme="dark"] .api-state,
html[data-theme="dark"] .footer-inner,
html[data-theme="dark"] .figure .cap,
html[data-theme="dark"] .virt-row i { color: var(--muted); }

html[data-theme="dark"] .status-recent li::before,
html[data-theme="dark"] .api-state i { background: #3d3930; }

html[data-theme="dark"] .stack-bar { background: #2a271f; }
html[data-theme="dark"] .cap:hover { background: #232119; }

html[data-theme="dark"] .field input,
html[data-theme="dark"] .field textarea {
  background: #14120d;
  color: var(--ink);
  border-color: var(--line);
}

html[data-theme="dark"] .thumb {
  background-image: linear-gradient(135deg, #221f18 0%, #2a2620 55%, #1c1a14 100%);
}

html[data-theme="dark"] .portrait {
  background-image: linear-gradient(160deg, #221f18, #2a2620 60%, #1a1712);
}

html[data-theme="dark"] .code-block,
html[data-theme="dark"] .photo-main,
html[data-theme="dark"] .photo-thumbs button,
html[data-theme="dark"] .post,
html[data-theme="dark"] .slice { border-color: var(--line); }

html[data-theme="dark"] img { opacity: 0.94; }

/* ==========================================================================
   13 · 阅读进度条 / 返回顶部 / 目录
   ========================================================================== */

#readbar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 400;
  height: 2px;
  width: 0;
  background: var(--accent);
  pointer-events: none;
  transition: width 0.08s linear;
}

#toTop {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 220;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.28s var(--ease), transform 0.28s var(--ease),
    border-color 0.2s var(--ease), color 0.2s var(--ease);
  -webkit-tap-highlight-color: transparent;
}

#toTop:hover { color: var(--accent); border-color: var(--accent); }
#toTop.is-on { opacity: 1; transform: none; pointer-events: auto; }

/* 导航栏里的主题开关 */
.theme-toggle {
  width: 34px;
  height: 34px;
  padding: 0;
  margin-left: 10px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: none;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }

/* 案例页目录 */
#tocBtn {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 220;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  cursor: pointer;
  box-shadow: 0 2px 14px rgba(21, 19, 15, 0.06);
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
  -webkit-tap-highlight-color: transparent;
}

#tocBtn:hover { color: var(--accent); border-color: var(--accent); }
#tocBtn[aria-expanded="true"] { color: var(--accent); border-color: var(--accent); }

#tocPanel {
  position: fixed;
  left: 18px;
  bottom: 68px;
  z-index: 221;
  width: min(280px, calc(100vw - 36px));
  max-height: 60vh;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 10px 40px rgba(21, 19, 15, 0.14);
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  transform-origin: left bottom;
  pointer-events: none;
  transition: opacity 0.22s var(--ease), transform 0.22s var(--ease);
}

#tocPanel.is-open { opacity: 1; transform: none; pointer-events: auto; }

#tocPanel a {
  display: block;
  padding: 9px 10px;
  font-size: 12.5px;
  line-height: 1.35;
  color: var(--ink-soft);
  text-decoration: none;
  border-radius: 2px;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

#tocPanel a:hover { background: var(--paper); color: var(--accent); }
#tocPanel a.is-active { color: var(--accent); background: var(--paper); }

@media (prefers-reduced-motion: reduce) {
  #toTop, #tocPanel, #readbar { transition: none; }
}

@media (max-width: 720px) {
  #toTop { right: 14px; bottom: 14px; width: 40px; height: 40px; }
  #tocBtn { left: 14px; bottom: 14px; }
  #tocPanel { left: 14px; bottom: 62px; }
}

/* 深色模式补丁：这两处写死了浅色主题的值 */
html[data-theme="dark"] .site-header {
  background: rgba(22, 20, 15, 0.84);
}

html[data-theme="dark"] .btn-primary:hover {
  background: #d7d2c4;
}

html[data-theme="dark"] .stack-list { color: #9d968a; }

html[data-theme="dark"] .photo-count {
  background: rgba(246, 245, 241, 0.9);
  color: #16120c;
}

html[data-theme="dark"] .api-code .n { color: #8ab0dd; }
html[data-theme="dark"] .api-code .k { color: #e08159; }
html[data-theme="dark"] .api-code .s { color: #7fb98a; }

/* 后台注入的段落里，链接不再带内联样式，这里补回统一的观感 */
.hero-sub a,
.about-copy p a {
  text-decoration: underline;
  text-decoration-color: rgba(169, 78, 44, 0.4);
  text-underline-offset: 3px;
}

html[data-theme="dark"] .hero-sub a,
html[data-theme="dark"] .about-copy p a {
  text-decoration-color: rgba(224, 129, 89, 0.5);
}

/* 技能表是 200px + 1fr 的两列，320–420 的窄屏放不下第二列 */
@media (max-width: 420px) {
  .skill-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    padding: 18px 0;
  }
  .skill-row .cat { padding-top: 0; }
}
