:root {
  --bg: #ffffff;
  --bg-subtle: #f5f5f5;
  --border: #e0e0e0;
  --text: #1a1a1a;
  --text-muted: #666666;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --tag-bg: #e8f0fe;
  --tag-text: #1d4ed8;
  --timeline-dot: #2563eb;
}
[data-theme="dark"] {
  --bg: #0f0f0f;
  --bg-subtle: #1a1a1a;
  --border: #2a2a2a;
  --text: #e8e8e8;
  --text-muted: #888888;
  --accent: #60a5fa;
  --accent-hover: #93c5fd;
  --tag-bg: #1e3a5f;
  --tag-text: #93c5fd;
  --timeline-dot: #60a5fa;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  transition: background 0.2s, color 0.2s;
}

.container { max-width: 860px; margin: 0 auto; padding: 0 24px; }

/* ── Header ── */
header {
  border-bottom: 1px solid var(--border);
  padding: 48px 0 36px;
}
.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}
.avatar {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.header-id { flex: 1; }
.name { font-size: 2rem; font-weight: 700; letter-spacing: -0.5px; }
.name a { color: inherit; text-decoration: none; }
.title { margin-top: 6px; font-size: 1rem; color: var(--text-muted); }
.contact {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  font-size: 0.875rem;
  color: var(--text-muted);
}
.contact a { color: var(--accent); text-decoration: none; }
.contact a:hover { color: var(--accent-hover); text-decoration: underline; }

.header-controls { display: flex; gap: 8px; flex-shrink: 0; }

.theme-btn, .lang-btn, .print-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: inherit;
  transition: background 0.15s;
  white-space: nowrap;
}
.theme-btn:hover, .lang-btn:hover, .print-btn:hover { background: var(--border); }

/* ── Nav ── */
.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 18px;
  font-size: 0.875rem;
}
.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.nav-links a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.nav-links a[aria-current="page"] { color: var(--accent); }

/* ── Entry list (首页) ── */
.entries { border-top: 1px solid var(--border); }
.entry {
  display: block;
  padding: 30px 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
}
.entry:hover .entry-title { color: var(--accent); }
.entry-title {
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.3px;
  transition: color 0.15s;
}
.entry-desc { margin-top: 6px; font-size: 0.9rem; color: var(--text-muted); }
.entry-body { margin-top: 10px; font-size: 0.875rem; color: var(--text-muted); max-width: 640px; }
.entry-arrow { float: right; color: var(--text-muted); font-size: 1.2rem; line-height: 1.4; }
.entry-icon {
  width: 1.05em;
  height: 1.05em;
  fill: currentColor;
  vertical-align: -0.12em;
  margin-right: 8px;
}

/* ── Sections ── */
section { padding: 40px 0; border-bottom: 1px solid var(--border); }
section:last-of-type { border-bottom: none; }

.section-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* ── Summary ── */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.summary-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 20px;
}
.summary-card h3 { font-size: 0.875rem; font-weight: 600; margin-bottom: 6px; }
.summary-card p { font-size: 0.8rem; color: var(--text-muted); line-height: 1.55; }

/* ── Skills ── */
.skills-table { width: 100%; border-collapse: collapse; }
.skills-table tr { border-bottom: 1px solid var(--border); }
.skills-table tr:last-child { border-bottom: none; }
.skills-table td { padding: 12px 0; font-size: 0.875rem; vertical-align: top; }
.skills-table td:first-child {
  width: 120px;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding-right: 20px;
  white-space: nowrap;
}
.tag-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  background: var(--tag-bg);
  color: var(--tag-text);
  border-radius: 4px;
  padding: 2px 9px;
  font-size: 0.78rem;
  font-weight: 500;
}

/* ── Timeline ── */
.timeline { display: flex; flex-direction: column; gap: 32px; }
.tl-item { display: flex; gap: 20px; }
.tl-line { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; }
.tl-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--timeline-dot);
  margin-top: 6px;
  flex-shrink: 0;
}
.tl-track { width: 1px; flex: 1; background: var(--border); margin-top: 6px; }
.tl-item:last-child .tl-track { display: none; }
.tl-body { flex: 1; padding-bottom: 4px; }
.tl-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px;
}
.tl-company { font-size: 1rem; font-weight: 600; }
.tl-date { font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; }
.tl-role { font-size: 0.85rem; color: var(--accent); margin-top: 2px; font-weight: 500; }
.tl-body ul {
  margin-top: 10px;
  padding-left: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.tl-body ul li {
  font-size: 0.875rem;
  color: var(--text-muted);
  padding-left: 14px;
  position: relative;
}
.tl-body ul li::before { content: "–"; position: absolute; left: 0; color: var(--border); }

/* ── Cards (projects / works) ── */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.project-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  transition: border-color 0.15s;
}
.project-card:hover { border-color: var(--accent); }
.project-card h3 { font-size: 0.9rem; font-weight: 600; margin-bottom: 8px; }
.project-card p { font-size: 0.825rem; color: var(--text-muted); line-height: 1.55; }
.project-card a { color: var(--accent); text-decoration: none; font-size: 0.8rem; }
.project-card a:hover { text-decoration: underline; }
.project-tags { margin-top: 12px; }
.shot { width: 100%; border-radius: 6px; margin-bottom: 12px; display: block; }

/* ── Education ── */
.edu-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px;
}
.edu-school { font-size: 1rem; font-weight: 600; }
.edu-year { font-size: 0.78rem; color: var(--text-muted); }
.edu-major { font-size: 0.875rem; color: var(--text-muted); margin-top: 4px; }

/* ── Footer ── */
footer {
  padding: 32px 0;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ── Responsive ── */
@media (max-width: 560px) {
  .name { font-size: 1.5rem; }
  .header-inner { flex-direction: column; align-items: flex-start; gap: 14px; }
  .header-controls { order: -1; align-self: flex-end; }
  .avatar { width: 68px; height: 68px; }
  .tl-item { gap: 12px; }
  .skills-table td:first-child { width: 90px; }
  .entry-title { font-size: 1.2rem; }
}

/* ── Print ── */
@media print {
  :root,
  [data-theme="dark"] {
    --bg: #ffffff;
    --bg-subtle: #ffffff;
    --border: #cccccc;
    --text: #000000;
    --text-muted: #333333;
    --accent: #000000;
    --accent-hover: #000000;
    --tag-bg: #eeeeee;
    --tag-text: #000000;
    --timeline-dot: #000000;
  }
  body { line-height: 1.5; transition: none; }
  .container { max-width: none; padding: 0; }
  .header-controls, .nav-links, .entries, footer { display: none !important; }
  header { padding: 0 0 12px; }
  .avatar { width: 64px; height: 64px; }
  section { padding: 14px 0; }
  .project-card, .summary-card { break-inside: avoid; }
  .tl-item { break-inside: avoid; }
}
