:root {
  --canvas: #f9f9f8;
  --ink: #111827;
  --subink: #6b7280;
  --muted: #9ca3af;
  --hairline: #e5e7eb;
  --hairline-strong: #d1d5db;
  --surface: #ffffff;
  --surface-alt: #f9f9f8;
  --font-sans: 'Inter', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; scrollbar-width: none; }
*::-webkit-scrollbar { width: 0; height: 0; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--canvas); color: var(--ink); font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
}
::selection { background: var(--ink); color: var(--canvas); }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p, ul { margin: 0; }
ul { list-style: none; padding: 0; }
button { font-family: inherit; cursor: pointer; }

/* Page frame: content-sized block, natural stacking on mobile */
.page { min-height: 100svh; width: 100%; }
.shell {
  margin: 0 auto; display: flex; width: 100%; max-width: 1280px;
  flex-direction: column; gap: 24px; padding: 32px 16px;
}
.bento { display: flex; flex-direction: column; gap: 24px; }
.row { display: flex; flex-direction: column; gap: 24px; }
.row-projects { display: grid; grid-template-columns: 1fr; gap: 24px; }

.card {
  display: flex; min-height: 0; flex-direction: column; overflow: hidden;
  border: 1px solid var(--hairline); background: var(--surface);
  border-radius: 16px; padding: 20px; text-align: left;
}
.card.between { justify-content: space-between; }
.flex2 { flex: 2; }
.flex1 { flex: 1; }

.label { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); }
.arrow { width: 14px; height: 14px; color: var(--muted); transition: transform .2s, color .2s; transform: translateY(.5px); flex: none; }
.rowlink:hover .arrow { transform: translate(2px, -2px); color: var(--ink); }

.h1 { margin-top: 12px; font-size: 24px; font-weight: 600; line-height: 1.15; letter-spacing: -.015em; color: var(--ink); }
.bio { margin-top: 12px; font-size: 14px; line-height: 1.6; color: var(--subink); }

.ext-list { margin-top: 12px; display: flex; flex-direction: column; gap: 4px; }
.rowlink { display: flex; align-items: center; justify-content: space-between; border-radius: 8px; padding: 6px 4px; transition: background .2s; }
.rowlink:hover { background: var(--surface-alt); }
.rowlink .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; color: var(--ink); }

.proj h3 { font-size: 15px; font-weight: 600; color: var(--ink); }
.proj h3.title-spaced { letter-spacing: 2px; }
.proj p { margin-top: 8px; font-size: 13px; line-height: 1.55; color: var(--subink);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.proj-items { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.proj-link {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 6px;
  padding: 6px 4px;
  font-size: 13px;
  color: var(--subink);
  text-decoration: none;
  transition: all .2s;
}
.proj-link:hover {
  background: var(--surface-alt);
  color: var(--ink);
}
.proj-link .arrow { opacity: 0.7; }
.proj-link:hover .arrow { opacity: 1; }

.toolbar { display: flex; align-items: center; justify-content: space-between; }
.seg { display: flex; align-items: center; gap: 4px; border: 1px solid var(--hairline); background: var(--surface-alt); border-radius: 8px; padding: 2px; }
.seg button { border: 0; background: none; border-radius: 6px; padding: 4px 12px; font-size: 12px; font-weight: 500; text-transform: capitalize; color: var(--muted); transition: background .2s, color .2s; }
.seg button:hover { color: var(--subink); }
.seg button.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 1px rgba(0,0,0,.04); }
.archive { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); transition: color .2s; }
.archive:hover { color: var(--ink); }

.list { margin-top: 8px; min-height: 0; flex: 1; }
.item { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--hairline); padding: 10px 0; }
.item:last-child { border-bottom: 0; }
.item .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 500; color: var(--ink); transition: color .2s; }
a.item:hover .t { color: var(--subink); }
.item .m { flex: none; font-family: var(--font-mono); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.item .by { flex: none; font-size: 12px; color: var(--muted); }

.email-row {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--ink);
  position: relative;
}
.email-label { color: var(--subink); font-size: 14px; }
.email-link { color: var(--ink); font-weight: 500; transition: color .2s; }
.email-link:hover { color: var(--subink); text-decoration: underline; }

.copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--hairline);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  transition: all .2s ease;
}
.copy-btn:hover {
  color: var(--ink);
  border-color: var(--hairline-strong);
  background: var(--surface-alt);
}
.copy-btn svg { width: 14px; height: 14px; transition: transform .2s ease, opacity .2s ease; }
.copy-btn .icon-check { display: none; color: #10b981; }

.copy-btn.copied {
  border-color: #a7f3d0;
  background: #ecfdf5;
}
.copy-btn.copied .icon-copy { display: none; }
.copy-btn.copied .icon-check { display: block; }

.copy-toast {
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--ink);
  color: var(--canvas);
  font-size: 11px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s ease, transform .2s ease;
}
.copy-btn.copied .copy-toast {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* 固定Writing / Reading卡片高度，防止切换Tab时上下跳动 */
.card-tabs {
  height: 260px;
}
.card-tabs .list {
  display: flex;
  flex-direction: column;
  height: 200px;
  overflow-y: auto;
}

/* Desktop: content-sized block, centered vertically */
@media (min-width: 640px) {
  .page { display: flex; align-items: center; }
  .shell { padding: 40px 24px; }
  .row { flex-direction: row; }
  .row:first-of-type { min-height: 272px; } /* row 1 taller (+70) */
  .row-projects { grid-template-columns: repeat(3, 1fr); min-height: 168px; } /* row 2 taller (+40) */
  .row-tabs .card { height: 260px; }
}
