/* ==========================================================================
   harveywork.com — "Pixel Trace"
   白底黑字 + 像素风：2px 硬边框、无圆角、阶梯投影、像素字体。
   页面结构读起来像一次被良好观测的 agent 运行（trace / span / mono 元信息）。
   大胆只用在两处：首页 trace 窗口、career span 图；其余保持克制。
   字体：Pixelify Sans（标题，Google Fonts）+ Fusion Pixel 12px（中文像素 / 元信息，OFL）
        + Geist（长正文，保证可读）。像素字体尽量用 12 的倍数字号，渲染最清晰。
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --sunken: #f3f3f6;
  --ink: #111114;
  --muted: #50555f;
  --faint: #8b909a;
  --line: #e3e4e9;
  --grid-dot: #e9eaee;

  --accent: #3d43d8;
  --accent-ink: #2a2fb5;
  --hl: #ffe14d;
  --ok: #1fa64a;
  --lane-work: #3d43d8;
  --lane-intern: #e5801f;
  --lane-edu: #1fa64a;

  --bw: 2px;
  --shadow: 4px 4px 0 var(--ink);
  --shadow-sm: 2px 2px 0 var(--ink);
  --shadow-lg: 6px 6px 0 var(--ink);

  --f-display: "Pixelify Sans", "Fusion Pixel 12px Monospaced SC", "PingFang SC", system-ui, sans-serif;
  --f-pixel: "Fusion Pixel 12px Monospaced SC", "Pixelify Sans", ui-monospace, "PingFang SC", monospace;
  --f-body: "Geist", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --f-code: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --w-page: 1040px;
  --w-read: 720px;
  --gutter: 24px;
  --nav-h: 60px;

  color-scheme: light;
}

@media (max-width: 640px) {
  :root { --gutter: 16px; }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--nav-h) + 16px); }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  /* 淡淡的像素点阵底纹 */
  background-image: radial-gradient(var(--grid-dot) 1px, transparent 1.2px);
  background-size: 16px 16px;
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; }
img, svg, video { max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-ink); }
h1, h2, h3, h4, h5, h6 {
  font-family: var(--f-display);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0;
  margin: 0;
}
p { margin: 0 0 1em; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px dashed var(--accent); outline-offset: 3px; }
::selection { background: var(--hl); color: var(--ink); }

.wrap { max-width: calc(var(--w-page) + var(--gutter) * 2); margin: 0 auto; padding: 0 var(--gutter); }
.wrap--read { max-width: calc(var(--w-read) + var(--gutter) * 2); }

.pixel { font-family: var(--f-pixel); }
.muted { color: var(--muted); }
.d-none { display: none !important; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.px-icon { shape-rendering: crispEdges; display: inline-block; vertical-align: -2px; }

.eyebrow {
  font-family: var(--f-pixel);
  font-size: 12px;
  line-height: 1;
  color: var(--accent);
  margin: 0 0 14px;
}
.eyebrow::before { content: "// "; color: var(--faint); }

/* ---------- Buttons & chips ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 44px;
  padding: 0 18px;
  border: var(--bw) solid var(--ink);
  border-radius: 0;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
  font-family: var(--f-display);
  font-size: 16px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .08s steps(2), box-shadow .08s steps(2), background-color .1s;
}
.btn:hover { transform: translate(-2px, -2px); box-shadow: var(--shadow-lg); color: var(--ink); }
.btn:active { transform: translate(2px, 2px); box-shadow: var(--shadow-sm); }
.btn--primary { background: var(--ink); color: #fff; }
.btn--primary:hover { background: var(--accent); color: #fff; }
.btn--sm { height: 34px; padding: 0 12px; font-size: 14px; box-shadow: var(--shadow-sm); }
.btn--sm:hover { box-shadow: var(--shadow); }
.btn:disabled { opacity: .6; cursor: progress; transform: none; }

.chip {
  display: inline-flex;
  align-items: center;
  font-family: var(--f-pixel);
  font-size: 12px;
  line-height: 1;
  padding: 5px 7px;
  color: var(--muted);
  background: var(--sunken);
  border: 0;
  border-radius: 0;
  white-space: nowrap;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
button.chip { cursor: pointer; background: var(--ink); color: #fff; }
button.chip:hover { background: var(--accent); }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-h);
  background: var(--bg);
  border-bottom: var(--bw) solid var(--ink);
}
.topbar .wrap { height: 100%; display: flex; align-items: center; gap: 28px; }
.brand {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 24px;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
}
.brand:hover { color: var(--ink); }
.brand .caret {
  display: inline-block;
  width: 10px;
  height: 20px;
  margin-left: 4px;
  background: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.nav { display: flex; align-items: center; gap: 2px; margin: 0; padding: 0; list-style: none; }
.nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  font-family: var(--f-pixel);
  font-size: 12px;
  color: var(--muted);
}
.nav a:hover { color: var(--ink); background: var(--sunken); }
.nav a[aria-current="page"] { color: #fff; background: var(--ink); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.kbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 34px;
  padding: 0 6px 0 10px;
  border: var(--bw) solid var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: var(--muted);
  font-family: var(--f-pixel);
  font-size: 12px;
  cursor: pointer;
}
.kbar-btn:hover { color: var(--ink); background: var(--hl); }
.kbd {
  font-family: var(--f-pixel);
  font-size: 12px;
  padding: 3px 4px;
  background: var(--sunken);
  color: var(--ink);
  line-height: 1;
}

.lang-toggle { display: inline-flex; border: var(--bw) solid var(--ink); height: 34px; box-shadow: var(--shadow-sm); }
.lang-toggle form { margin: 0; display: flex; }
.lang-toggle button {
  border: 0;
  background: var(--surface);
  padding: 0 9px;
  font-family: var(--f-pixel);
  font-size: 12px;
  color: var(--faint);
  cursor: pointer;
}
.lang-toggle button:hover { color: var(--ink); background: var(--hl); }
.lang-toggle button[aria-pressed="true"] { background: var(--ink); color: #fff; cursor: default; }

.menu-btn {
  display: none;
  width: 34px; height: 34px;
  border: var(--bw) solid var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.menu-btn span, .menu-btn span::before, .menu-btn span::after {
  display: block; width: 14px; height: 2px; background: var(--ink); position: relative; content: "";
}
.menu-btn span::before { position: absolute; top: -5px; }
.menu-btn span::after { position: absolute; top: 5px; }

@media (max-width: 760px) {
  .topbar .wrap { gap: 12px; }
  .menu-btn { display: inline-flex; }
  .kbar-btn .kbar-label, .kbar-btn .kbd { display: none; }
  .kbar-btn { padding: 0; width: 34px; justify-content: center; }
  .nav {
    position: absolute;
    top: calc(var(--nav-h) - var(--bw));
    left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    padding: 10px var(--gutter) 16px;
    background: var(--bg);
    border-bottom: var(--bw) solid var(--ink);
    display: none;
  }
  .topbar.is-open .nav { display: flex; }
  .nav a { height: 44px; font-size: 12px; }
}

/* ---------- Footer ---------- */
.site-foot {
  margin-top: 96px;
  border-top: var(--bw) solid var(--ink);
  background: var(--bg);
  font-family: var(--f-pixel);
  font-size: 12px;
  color: var(--faint);
}
.site-foot .wrap { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between; padding-top: 22px; padding-bottom: 22px; }
.site-foot nav { display: flex; gap: 18px; }
.site-foot a { color: var(--muted); }
.site-foot a:hover { color: var(--ink); background: var(--hl); }
#copyright-text { cursor: default; user-select: none; margin: 0; }

/* ---------- Page head (shared) ---------- */
.page-head { padding: 64px 0 36px; }
.page-title {
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 700;
  line-height: 1.1;
  margin: 0 0 14px;
}
.page-sub { font-size: 17px; color: var(--muted); max-width: 56ch; margin: 0; }

.section { padding: 64px 0 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.section-title { font-size: 1.6rem; }
.link-arrow { font-family: var(--f-pixel); font-size: 12px; white-space: nowrap; }
.link-arrow:hover { background: var(--hl); color: var(--ink); }

/* ---------- Home: hero ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 56px; align-items: center; padding: 72px 0 24px; }
.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: var(--bw) solid var(--ink);
  background: var(--surface);
  font-family: var(--f-pixel);
  font-size: 12px;
  line-height: 1;
  color: var(--muted);
  margin-bottom: 24px;
}
.status .pulse { width: 8px; height: 8px; background: var(--ok); animation: blink 1.4s steps(1) infinite; }
.status b { color: var(--ink); font-weight: 400; }

.hero-title {
  font-size: clamp(2.1rem, 4.2vw, 3.3rem);
  font-weight: 700;
  line-height: 1.12;
  margin: 0 0 24px;
}
.hero-title em {
  font-style: normal;
  color: var(--ink);
  background: var(--hl);
  padding: 0 .12em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.hero-sub { font-size: 18px; color: var(--muted); max-width: 40ch; margin: 0 0 32px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; }

/* ---------- Home: trace window (signature) ---------- */
.trace {
  background: var(--surface);
  border: var(--bw) solid var(--ink);
  box-shadow: var(--shadow-lg);
  font-family: var(--f-pixel);
  font-size: 12px;
}
/* 老式像素窗口标题栏：横条纹 + 居中标签 */
.trace-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  border-bottom: var(--bw) solid var(--ink);
  background: repeating-linear-gradient(to bottom, var(--ink) 0 2px, var(--surface) 2px 4px) 0 7px / 100% 14px no-repeat;
}
.trace-head .fn { position: relative; background: var(--surface); padding: 0 10px; color: var(--ink); line-height: 16px; }
.trace-head .fn span { color: var(--accent); }
.trace-head .box {
  position: absolute; left: 12px; top: 7px;
  width: 14px; height: 14px; border: var(--bw) solid var(--ink); background: var(--surface);
}
.trace-meta { display: flex; justify-content: space-between; gap: 12px; padding: 12px 16px 4px; color: var(--faint); }
.trace-rows { list-style: none; margin: 0; padding: 4px 0 8px; }
.trace-row a {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) 56px 80px;
  align-items: center;
  gap: 12px;
  height: 36px;
  padding: 0 16px;
  color: var(--ink);
}
.trace-row a:hover { background: var(--hl); }
.t-verb {
  color: var(--c, var(--accent));
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.t-verb::before { content: ""; width: 6px; height: 6px; background: var(--c, var(--accent)); flex: none; }
.t-verb[data-verb="join"] { color: var(--ink); }
.t-title {
  font-family: var(--f-body);
  font-size: 14px;
  line-height: 20px;
  height: 20px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.t-when { position: relative; height: 12px; }
.t-when::before { content: ""; position: absolute; left: 0; right: 0; top: 5px; height: 2px; background: repeating-linear-gradient(to right, var(--line) 0 2px, transparent 2px 4px); }
.t-when i { position: absolute; top: 3px; width: 6px; height: 6px; margin-left: -3px; background: var(--c, var(--accent)); }
.t-date { color: var(--faint); text-align: right; }
.trace-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-top: var(--bw) dashed var(--line);
  color: var(--faint);
}
.trace-foot a:hover { background: var(--hl); color: var(--ink); }
.trace-foot .cursor::after {
  content: "";
  display: inline-block;
  width: 7px; height: 12px;
  margin-left: 4px;
  vertical-align: -2px;
  background: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}
/* JS 接管时才隐藏：无 JS 也能看到完整 trace */
.trace.is-streaming .trace-row { opacity: 0; }
.trace-row { transition: opacity .12s steps(2); }
.trace-row.is-in { opacity: 1 !important; }

/* ---------- Home: letter ---------- */
.letter {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 36px;
  max-width: 920px;
}
.avatar {
  width: 160px; height: 160px;
  object-fit: contain;
  border: var(--bw) solid var(--ink);
  box-shadow: var(--shadow);
  background: var(--sunken);
  display: block;
}
.letter p { font-size: 17px; line-height: 1.8; }
.letter a { color: var(--ink); font-weight: 500; background: linear-gradient(transparent 62%, var(--hl) 62%); }
.letter a:hover { background: var(--hl); color: var(--ink); }
.letter .sign { font-family: var(--f-pixel); font-size: 12px; color: var(--faint); margin: 0; }

/* ---------- Project cards (grid) ---------- */
.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 36px 28px; }
.pcard { display: flex; flex-direction: column; gap: 16px; color: var(--ink); }
.pcard:hover { color: var(--ink); }
.pcard-cover {
  aspect-ratio: 2 / 1;
  overflow: hidden;
  border: var(--bw) solid var(--ink);
  box-shadow: var(--shadow);
  background: var(--sunken);
  transition: transform .08s steps(2), box-shadow .08s steps(2);
}
.pcard:hover .pcard-cover { transform: translate(-2px, -2px); box-shadow: var(--shadow-lg); }
.pcard-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pcard-meta { font-family: var(--f-pixel); font-size: 12px; color: var(--faint); display: flex; gap: 10px; margin: 0 0 8px; }
.pcard-title { font-size: 1.35rem; margin: 0 0 6px; }
.pcard:hover .pcard-title span { background: var(--hl); }
.pcard-desc {
  font-size: 14.5px; color: var(--muted); margin: 6px 0 12px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* ---------- List rows (projects / blog) ---------- */
.rows { list-style: none; margin: 0; padding: 0; }
.row-card {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  gap: 22px;
  padding: 20px 0;
  border-bottom: var(--bw) dashed var(--line);
  color: var(--ink);
}
.row-card:hover { color: var(--ink); }
.row-card:hover .row-title span { background: var(--hl); }
.row-thumb {
  aspect-ratio: 2 / 1;
  overflow: hidden;
  border: var(--bw) solid var(--ink);
  background: var(--sunken);
  align-self: start;
  transition: box-shadow .08s steps(2), transform .08s steps(2);
}
.row-card:hover .row-thumb { box-shadow: var(--shadow); transform: translate(-2px, -2px); }
.row-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-ph {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--f-pixel); font-size: 12px; color: var(--faint);
  background-color: #fff;
  background-image:
    linear-gradient(45deg, var(--sunken) 25%, transparent 25%, transparent 75%, var(--sunken) 75%),
    linear-gradient(45deg, var(--sunken) 25%, transparent 25%, transparent 75%, var(--sunken) 75%);
  background-size: 8px 8px;
  background-position: 0 0, 4px 4px;
}
.row-meta { font-family: var(--f-pixel); font-size: 12px; line-height: 1; color: var(--faint); display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 2px 0 10px; }
.row-title { font-size: 1.2rem; margin: 0 0 6px; }
.row-desc {
  font-size: 14.5px; color: var(--muted); margin: 0 0 12px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.row-desc:last-child { margin-bottom: 0; }

@media (max-width: 640px) {
  .row-card { grid-template-columns: 104px minmax(0, 1fr); gap: 14px; padding: 16px 0; }
  .row-title { font-size: 1.05rem; }
  .row-desc { font-size: 14px; }
  .row-card .chips { display: none; }
}

/* ---------- Projects page ---------- */
.jumpbar {
  position: sticky;
  top: var(--nav-h);
  z-index: 10;
  background: var(--bg);
  border-bottom: var(--bw) solid var(--ink);
  margin-bottom: 8px;
}
.jumpbar ul { display: flex; gap: 10px; list-style: none; margin: 0; padding: 12px 4px 14px; overflow-x: auto; scrollbar-width: none; }
.jumpbar ul::-webkit-scrollbar { display: none; }
.jumpbar a {
  display: inline-flex; align-items: center; gap: 8px;
  height: 30px; padding: 0 10px;
  border: var(--bw) solid var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  font-family: var(--f-pixel); font-size: 12px; color: var(--ink);
  white-space: nowrap;
}
.jumpbar a:hover { background: var(--hl); }
.jumpbar a i { width: 8px; height: 8px; background: var(--c); }
.jumpbar a small { color: var(--faint); font-size: 12px; }

.cat { padding-top: 44px; }
.cat-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: var(--bw) solid var(--ink); }
.cat-title { font-size: 1.5rem; display: flex; align-items: baseline; gap: 10px; }
.cat-title i { width: 12px; height: 12px; background: var(--c); align-self: center; }
.cat-count { font-family: var(--f-pixel); font-size: 12px; color: var(--faint); font-weight: 400; }
.cat-empty { padding: 18px 0; color: var(--muted); font-size: 14.5px; list-style: none; }
.more-btn {
  border: 0; background: none; padding: 2px 0; cursor: pointer;
  font-family: var(--f-pixel); font-size: 12px; color: var(--accent);
}
.more-btn::before { content: "▸ "; }
.more-btn[aria-expanded="true"]::before { content: "▾ "; }
.more-btn:hover { background: var(--hl); color: var(--ink); }
.is-collapsed-item { display: none; }

/* ---------- Blog page ---------- */
.year-group { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 24px; padding-top: 28px; }
.year-label {
  font-family: var(--f-pixel);
  font-size: 12px;
  color: var(--faint);
  padding-top: 22px;
  position: sticky;
  top: calc(var(--nav-h) + 12px);
  align-self: start;
}
.year-label b { display: block; font-family: var(--f-display); font-size: 2.25rem; line-height: 1; color: var(--ink); font-weight: 700; margin-bottom: 8px; }
@media (max-width: 760px) {
  .year-group { grid-template-columns: 1fr; gap: 0; }
  .year-label { position: static; padding-top: 0; display: flex; gap: 10px; align-items: baseline; border-bottom: var(--bw) solid var(--ink); padding-bottom: 8px; }
  .year-label b { display: inline; font-size: 1.5rem; margin: 0; }
}

/* ---------- Article (blog / project detail) ---------- */
.read-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 4px; z-index: 60;
  background: var(--accent);
  transform-origin: 0 50%;
  transform: scaleX(0);
}
.back-link { font-family: var(--f-pixel); font-size: 12px; color: var(--faint); display: inline-block; margin: 32px 0 0; }
.back-link:hover { color: var(--ink); background: var(--hl); }
.article-head { padding: 36px 0 30px; }
.article-title {
  font-size: clamp(1.9rem, 4vw, 2.5rem);
  font-weight: 700;
  line-height: 1.12;
  margin: 0 0 18px;
}
.article-lead { font-size: 18.5px; color: var(--muted); margin: 0 0 22px; }
.article-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; font-family: var(--f-pixel); font-size: 12px; color: var(--faint); }
.article-meta .sep { width: 4px; height: 4px; background: var(--faint); }
.article-head .chips { margin-top: 4px; }
.article-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 22px; }
.article-cover {
  margin: 8px 0 44px;
  aspect-ratio: 2 / 1;
  overflow: hidden;
  border: var(--bw) solid var(--ink);
  box-shadow: var(--shadow);
  background: var(--sunken);
}
.article-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.article-rule { border: 0; border-top: var(--bw) solid var(--ink); margin: 0 0 36px; }

/* 正文排版：markdown 输出（长文用 Geist 保证可读） */
.prose { font-size: 17px; line-height: 1.8; overflow-wrap: break-word; min-width: 0; }
.prose > :first-child { margin-top: 0; }
.prose h1, .prose h2 { font-size: 1.75rem; margin: 2.2em 0 .7em; }
.prose h2::before { content: "# "; color: var(--accent); }
.prose h3 { font-size: 1.3rem; margin: 1.8em 0 .6em; }
.prose h4, .prose h5, .prose h6 { font-size: 1.1rem; margin: 1.6em 0 .5em; }
.prose p { margin: 0 0 1.25em; }
.prose a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.prose a:hover { background: var(--hl); color: var(--ink); }
.prose strong { font-weight: 600; color: var(--ink); }
.prose ul, .prose ol { margin: 0 0 1.25em; padding-left: 1.4em; }
.prose ul { list-style: none; padding-left: 1.2em; }
.prose ul > li { position: relative; }
.prose ul > li::before { content: ""; position: absolute; left: -1.1em; top: .72em; width: 6px; height: 6px; background: var(--ink); }
.prose li { margin: .3em 0; }
.prose ol li::marker { font-family: var(--f-pixel); color: var(--faint); }
.prose blockquote {
  margin: 1.6em 0;
  padding: 12px 16px;
  border-left: 6px solid var(--accent);
  background: var(--sunken);
  color: var(--muted);
}
.prose blockquote p:last-child { margin-bottom: 0; }
.prose hr { border: 0; border-top: var(--bw) dashed var(--ink); margin: 2.4em 0; }
.prose code {
  font-family: var(--f-code);
  font-size: .86em;
  background: var(--sunken);
  padding: .1em .35em;
}
.prose pre {
  font-family: var(--f-code);
  font-size: 13.5px;
  line-height: 1.65;
  background: var(--sunken);
  border: var(--bw) solid var(--ink);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  overflow-x: auto;
  margin: 1.6em 0;
}
.prose pre code { background: none; padding: 0; font-size: inherit; }
.prose .codehilite { margin: 1.6em 0; }
.prose .codehilite pre { margin: 0; }
.prose table { width: 100%; border-collapse: collapse; font-size: 14.5px; margin: 1.6em 0; display: block; overflow-x: auto; }
.prose th, .prose td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.prose thead th { font-family: var(--f-pixel); font-size: 12px; font-weight: 400; color: var(--ink); border-bottom: var(--bw) solid var(--ink); white-space: nowrap; }
.prose img, .prose svg {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.8em auto;
  border: var(--bw) solid var(--ink);
}
.prose video { display: block; width: 100%; max-width: 560px; height: auto; margin: 1.8em auto; border: var(--bw) solid var(--ink); }
.prose iframe { display: block; width: 100%; max-width: 100%; border: var(--bw) solid var(--ink); margin: 1.8em 0; }
.prose .mermaid-figure { margin: 1.8em 0; padding: 16px; border: var(--bw) solid var(--ink); background: var(--surface); overflow-x: auto; }
.prose .mermaid-figure svg { border: 0; margin: 0 auto; }

/* 作者卡 + 分享 */
.author {
  margin-top: 72px;
  padding: 22px;
  border: var(--bw) solid var(--ink);
  box-shadow: var(--shadow);
  background: var(--surface);
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 20px;
}
.author .avatar { width: 64px; height: 64px; box-shadow: none; }
.author-name { font-family: var(--f-display); font-weight: 600; font-size: 1.2rem; margin: 0 0 4px; }
.author-name span { font-family: var(--f-body); font-weight: 400; font-size: 14px; color: var(--muted); }
.author-bio { font-size: 14.5px; color: var(--muted); margin: 0 0 16px; }
.author-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.share-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 12px;
  border: var(--bw) solid var(--ink);
  background: var(--surface);
  font-family: var(--f-pixel); font-size: 12px; color: var(--ink);
  cursor: pointer;
}
.share-btn:hover { background: var(--hl); }
.share-btn.is-done { background: var(--ok); color: #fff; }

/* 通用面板（Stripe demo 等） */
.panel {
  border: var(--bw) solid var(--ink);
  box-shadow: var(--shadow);
  background: var(--surface);
  padding: 24px;
  margin: 44px 0 0;
}
.panel h2 { font-size: 1.3rem; margin: 0 0 6px; }
.panel h3 { font-family: var(--f-pixel); font-size: 12px; font-weight: 400; color: var(--muted); margin: 0 0 8px; }
.panel p { font-size: 14.5px; color: var(--muted); }
.panel-block { padding: 20px 0; border-top: var(--bw) dashed var(--line); }
.notice {
  padding: 12px 14px;
  border: var(--bw) solid var(--ink);
  background: var(--hl);
  font-size: 14px;
  color: var(--ink);
}
.error-text { color: #d33b3b; font-size: 13.5px; margin: 8px 0 0; }

/* ---------- Career ---------- */
.spans {
  border: var(--bw) solid var(--ink);
  box-shadow: var(--shadow);
  background: var(--surface);
  overflow-x: auto;
  font-family: var(--f-pixel);
  font-size: 12px;
}
.spans-inner { min-width: 780px; padding: 16px 20px 18px; }
.spans-axis, .spans-lane { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 12px; }
.spans-axis .track { height: 20px; }
.spans-axis .tick { position: absolute; top: 0; color: var(--faint); transform: translateX(-50%); }
.track { position: relative; }
.spans-lane { padding: 8px 0; border-top: var(--bw) dashed var(--line); }
.lane-label { color: var(--ink); padding-top: 4px; white-space: nowrap; }
.lane-label::before { content: ""; display: inline-block; width: 8px; height: 8px; background: var(--c); margin-right: 6px; }
.spans-lane .track { height: calc(var(--rows) * 28px); }
.gridline { position: absolute; top: -8px; bottom: -8px; width: 0; border-left: 1px dashed var(--line); }
.span {
  position: absolute;
  height: 22px;
  top: calc(var(--row) * 28px + 1px);
  background: color-mix(in srgb, var(--c) 22%, #fff);
  border: var(--bw) solid var(--ink);
  color: var(--ink);
  padding: 0 4px;
  line-height: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
}
.span.is-ongoing { border-right-style: dashed; }
.today { position: absolute; top: -20px; bottom: 0; width: 0; border-left: var(--bw) solid var(--accent); pointer-events: none; }
.today span { position: absolute; top: 0; left: 4px; white-space: nowrap; color: #fff; background: var(--accent); padding: 2px 4px; line-height: 1; }
.lane-work { --c: var(--lane-work); }
.lane-intern { --c: var(--lane-intern); }
.lane-edu { --c: var(--lane-edu); }

.career-group { padding-top: 56px; }
.career-group > .eyebrow { margin-bottom: 0; padding-bottom: 12px; border-bottom: var(--bw) solid var(--ink); }
.job {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 28px;
  padding: 28px 0;
  border-bottom: var(--bw) dashed var(--line);
}
.job:last-child { border-bottom: 0; }
.job-when { font-family: var(--f-pixel); font-size: 12px; color: var(--faint); padding-top: 8px; margin: 0; }
.job-when .now { color: #fff; background: var(--ok); padding: 1px 4px; }
.job-role { font-size: 1.45rem; margin: 0 0 4px; }
.job-org { font-size: 15px; color: var(--c, var(--accent)); margin: 0 0 16px; font-weight: 600; }
.job-org .badge { font-family: var(--f-pixel); font-size: 12px; color: var(--faint); font-weight: 400; margin-left: 8px; }
.job-desc { font-size: 15px; color: var(--muted); margin: 0 0 14px; }
.bullets { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 14px; }
.bullets li { position: relative; padding-left: 18px; }
.bullets li::before { content: ""; position: absolute; left: 0; top: .5em; width: 6px; height: 6px; background: var(--c, var(--ink)); }
.bullet-title { display: block; font-weight: 600; font-size: 15px; color: var(--ink); margin-bottom: 2px; }
.bullet-text {
  font-size: 14.5px; color: var(--muted); line-height: 1.65;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.job.is-open .bullet-text { -webkit-line-clamp: unset; display: block; }
.job-foot { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; justify-content: space-between; }
.chips .is-extra { display: none; }
.chips.is-open .is-extra { display: inline-flex; }
@media (max-width: 760px) {
  .job { grid-template-columns: 1fr; gap: 8px; }
  .job-when { padding-top: 0; }
}

/* ---------- Contact ---------- */
.contact { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 520px); gap: 64px; align-items: start; }
.contact-list { list-style: none; margin: 0; padding: 0; border-top: var(--bw) solid var(--ink); }
.contact-list li { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; gap: 12px; align-items: center; min-height: 56px; padding: 10px 0; border-bottom: var(--bw) dashed var(--line); }
.contact-list .k { font-family: var(--f-pixel); font-size: 12px; color: var(--faint); }
.contact-list .v { font-family: var(--f-pixel); font-size: 12px; color: var(--ink); overflow-wrap: anywhere; }
.contact-list a.v:hover { background: var(--hl); }
.form-card { border: var(--bw) solid var(--ink); box-shadow: var(--shadow-lg); background: var(--surface); padding: 24px; }
.field { display: block; margin-bottom: 16px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field span { display: block; font-family: var(--f-pixel); font-size: 12px; color: var(--ink); margin-bottom: 8px; }
.field input, .field textarea {
  width: 100%;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--surface);
  border: var(--bw) solid var(--ink);
  border-radius: 0;
  padding: 10px 12px;
}
.field textarea { resize: vertical; min-height: 132px; }
.field input:focus, .field textarea:focus { outline: none; box-shadow: 4px 4px 0 var(--accent); }
@media (max-width: 860px) {
  .contact { grid-template-columns: 1fr; gap: 40px; }
}
@media (max-width: 480px) {
  .field-row { grid-template-columns: 1fr; gap: 0; }
}

.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 80;
  max-width: 380px;
  padding: 12px 16px;
  border: var(--bw) solid var(--ink);
  box-shadow: var(--shadow);
  background: var(--surface); color: var(--ink);
  font-size: 14px;
  opacity: 0;
  transition: opacity .12s steps(2);
}
.toast.is-in { opacity: 1; }
.toast.is-error { background: #ffe1e1; }

/* ---------- ⌘K palette ---------- */
.kbar { position: fixed; inset: 0; z-index: 100; display: none; }
.kbar.is-open { display: block; }
.kbar-backdrop { position: absolute; inset: 0; background: rgba(255, 255, 255, 0.72); }
.kbar-dialog {
  position: relative;
  margin: 12vh auto 0;
  width: min(620px, calc(100% - 32px));
  background: var(--surface);
  border: var(--bw) solid var(--ink);
  box-shadow: 8px 8px 0 var(--ink);
}
.kbar-input-row { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: var(--bw) solid var(--ink); }
.kbar-input-row .prompt { font-family: var(--f-pixel); font-size: 24px; color: var(--accent); }
.kbar-input { flex: 1; border: 0; outline: 0; background: transparent; height: 54px; font-size: 16px; color: var(--ink); }
.kbar-list { list-style: none; margin: 0; padding: 6px; max-height: min(52vh, 420px); overflow-y: auto; }
.kbar-list li a {
  display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 9px 10px; color: var(--ink); font-size: 14.5px;
}
.kbar-list li a .k { font-family: var(--f-pixel); font-size: 12px; color: var(--faint); }
.kbar-list li a .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kbar-list li a .d { font-family: var(--f-pixel); font-size: 12px; color: var(--faint); }
.kbar-list li.is-active a { background: var(--hl); }
.kbar-list li.is-active a .k { color: var(--ink); }
.kbar-empty { padding: 18px 16px; color: var(--faint); font-size: 14px; }
.kbar-hint { display: flex; gap: 16px; padding: 10px 16px; border-top: var(--bw) dashed var(--line); font-family: var(--f-pixel); font-size: 12px; color: var(--faint); }

/* ---------- Home / misc responsive ---------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 44px; padding-top: 44px; }
  .card-grid { gap: 32px 20px; }
}
@media (max-width: 640px) {
  .page-head { padding: 40px 0 24px; }
  .hero-sub { font-size: 16.5px; }
  .trace-row a { grid-template-columns: 56px minmax(0, 1fr) 80px; gap: 10px; padding: 0 12px; }
  .t-when { display: none; }
  .card-grid { grid-template-columns: 1fr; }
  .letter { grid-template-columns: 1fr; gap: 20px; }
  .letter .avatar { width: 140px; height: 140px; }
  .letter p { font-size: 16px; }
  .prose { font-size: 16px; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .author { grid-template-columns: 1fr; }
}

/* ---------- 中文排版 ---------- */
:lang(zh) .hero-title { line-height: 1.25; font-size: clamp(2.1rem, 4.2vw, 3rem); }
:lang(zh) .page-title, :lang(zh) .article-title { line-height: 1.25; }
:lang(zh) .prose { line-height: 1.9; }

/* ---------- Motion preference ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .trace.is-streaming .trace-row { opacity: 1; }
}
