:root {
  --bg: #f3f1ec;
  --fg: #2b2b2b;
  --muted: #6f6a63;
  --accent: #2f54eb;
  --line: #ddd8cf;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  --maxw: 1080px;
  --hm0: #ebe7df;
  --hm1: #c6e6c9;
  --hm2: #7bc97f;
  --hm3: #3da34d;
  --hm4: #1f7a2e;
}

/* 大屏进一步放宽，避免内容过窄 */
@media (min-width: 1400px) {
  :root {
    --maxw: 1200px;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1a1c;
    --fg: #e6e3dd;
    --muted: #9a958c;
    --accent: #6f8cff;
    --line: #2e2e31;
    --hm0: #232326;
    --hm1: #1f4d2b;
    --hm2: #2f7d3f;
    --hm3: #46b35a;
    --hm4: #6fe07f;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }

/* Header */
.site-header {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 28px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.logo {
  font-family: var(--mono);
  font-weight: 700;
  letter-spacing: 0.02em;
}
.nav a {
  margin-left: 22px;
  font-size: 14px;
  color: var(--muted);
  transition: color 0.15s ease;
}
.nav a:hover { color: var(--fg); }

/* Layout */
main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

/* Hero */
.hero {
  padding: 96px 0 64px;
  border-bottom: 1px solid var(--line);
}
.eyebrow {
  font-family: var(--mono);
  color: var(--accent);
  font-size: 13px;
  margin: 0 0 18px;
}
.hero h1 {
  font-size: clamp(34px, 6vw, 56px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 24px;
  font-weight: 700;
}
.lead {
  font-size: 18px;
  color: var(--muted);
  max-width: 60ch;
  margin: 0 0 32px;
}
.lead strong { color: var(--fg); }

.terminal {
  font-family: var(--mono);
  font-size: 15px;
  background: #232326;
  color: #e8e8e8;
  padding: 14px 18px;
  border-radius: 8px;
  display: inline-block;
  min-width: 320px;
}
.prompt { color: var(--accent); margin-right: 8px; }
.cursor { animation: blink 1s steps(2, start) infinite; color: var(--accent); }
@keyframes blink { to { visibility: hidden; } }
@media (prefers-color-scheme: dark) {
  .terminal { background: #0f0f11; color: #d6d3cd; }
}

/* Sections */
section { padding: 56px 0; border-bottom: 1px solid var(--line); }
section h2 {
  font-size: 14px;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 24px;
  font-weight: 600;
}

/* Stack tags */
.tags {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.tags li {
  font-family: var(--mono);
  font-size: 13px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--fg);
}

/* Projects */
.project-list { list-style: none; padding: 0; margin: 0; }
.project-list li:first-child { border-top: none; }
.project-list a {
  display: grid;
  grid-template-columns: 200px 1fr auto;
  gap: 24px;
  align-items: baseline;
  padding: 20px 0;
  transition: opacity 0.15s ease;
}
.project-list a:hover { opacity: 0.6; }
.project-name {
  font-family: var(--mono);
  font-weight: 600;
}
.project-desc { color: var(--muted); font-size: 15px; }
.arrow { color: var(--accent); font-family: var(--mono); }

/* Contributions */
.contrib-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 40px;
}
.stat-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.stat-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.stat-num {
  font-family: var(--mono);
  font-size: 30px;
  font-weight: 700;
  color: var(--fg);
  line-height: 1;
}
.stat-label {
  font-size: 13px;
  color: var(--muted);
}

/* Heatmap */
.heatmap-wrap {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
  overflow-x: auto;
}
.heatmap-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.heatmap-title {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--fg);
}
.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}
.heatmap-legend .cell {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}
.heatmap {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, 14px);
  gap: 4px;
  width: max-content;
}
.heatmap .cell {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: var(--hm0);
}
.heatmap .cell.lvl0 { background: var(--hm0); }
.heatmap .cell.lvl1 { background: var(--hm1); }
.heatmap .cell.lvl2 { background: var(--hm2); }
.heatmap .cell.lvl3 { background: var(--hm3); }
.heatmap .cell.lvl4 { background: var(--hm4); }
.heatmap .cell.empty { background: transparent; }
.heatmap-months {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(1, 14px);
  gap: 4px;
  width: max-content;
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
.heatmap-months span { width: 14px; height: 14px; line-height: 14px; }

/* Top repos */
.top-repos { margin-top: 40px; }
.top-repos h3 {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 16px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.repo-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.repo-list li { border: 1px solid var(--line); border-radius: 10px; }
.repo-list a {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 18px;
  transition: border-color 0.15s ease;
}
.repo-list a:hover { opacity: 0.7; }
.repo-name { font-family: var(--mono); font-weight: 600; font-size: 15px; }
.repo-meta { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.repo-meta .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); display: inline-block; }
.repo-meta .dot.accent { background: var(--accent); }

/* Contact */
.contact p { color: var(--muted); margin: 0 0 18px; }
.contact-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 20px; }
.contact-list a {
  font-family: var(--mono);
  font-size: 15px;
  border-bottom: 1px solid var(--accent);
  padding-bottom: 2px;
}

/* Footer */
.site-footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 32px 24px 64px;
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
}
.muted { color: var(--muted); }

/* Responsive */
@media (max-width: 640px) {
  .hero { padding: 64px 0 48px; }
  .project-list a { grid-template-columns: 1fr; gap: 4px; }
  .arrow { display: none; }
  .contrib-stats { grid-template-columns: repeat(2, 1fr); }
  .repo-list { grid-template-columns: 1fr; }
}
