/* ==========================================================================
   个人简历网站样式 —— 极简风格（参考 Linear / Vercel）
   主题通过 body.dark 类切换，所有颜色由 CSS 变量提供。
   ========================================================================== */

:root {
  color-scheme: light;
  --container: 960px;
  --radius: 12px;
  --radius-sm: 8px;

  --bg: #ffffff;
  --bg-subtle: #f6f7f9;
  --header-bg: rgba(255, 255, 255, 0.8);
  --surface: #ffffff;
  --border: #e6e8ec;

  --text: #1f2430;
  --text-muted: #6b7280;

  /* 低调的灰蓝色 */
  --accent: #4a6fa5;
  --accent-hover: #3b5c8a;
  --accent-soft: rgba(74, 111, 165, 0.12);

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.1);
  --shadow-md: 0 8px 20px rgba(16, 24, 40, 0.12);
}

body.dark {
  color-scheme: dark;

  --bg: #0f1115;
  --bg-subtle: #141821;
  --header-bg: rgba(15, 17, 21, 0.8);
  --surface: #171a21;
  --border: #262b34;

  --text: #e6e8ec;
  --text-muted: #9aa3b2;

  --accent: #7aa2d6;
  --accent-hover: #9bbdea;
  --accent-soft: rgba(122, 162, 214, 0.16);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 10px 24px rgba(0, 0, 0, 0.5);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  transition: background-color 0.2s ease, color 0.2s ease;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

h1,
h2,
h3 {
  margin: 0 0 0.4em;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

p {
  margin: 0 0 1em;
}

.muted {
  color: var(--text-muted);
}

.empty {
  color: var(--text-muted);
}

/* ---------------------------------------------------------------- 顶部导航 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--header-bg);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 60px;
}

.brand {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.brand:hover {
  color: var(--text);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.nav-link {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.95rem;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.nav-link:hover {
  color: var(--text);
  background: var(--bg-subtle);
  text-decoration: none;
}

.nav-link.active {
  color: var(--accent);
  background: var(--accent-soft);
}

/* -------------------------------------------------------------- 主题切换键 */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--accent);
  transform: rotate(-12deg);
}

.theme-toggle .icon {
  width: 18px;
  height: 18px;
}

.theme-toggle .icon-moon {
  display: none;
}

body.dark .theme-toggle .icon-sun {
  display: none;
}

body.dark .theme-toggle .icon-moon {
  display: block;
}

/* ------------------------------------------------------------------ 主体 */
main.container {
  min-height: 60vh;
  padding-top: 40px;
  padding-bottom: 56px;
}

/* ------------------------------------------------------------------ 首页 */
.hero {
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
  padding: 8px 0 24px;
}

.hero__avatar {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 128px;
  height: 128px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg-subtle);
}

.hero__avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero__avatar-fallback {
  font-size: 3rem;
  font-weight: 700;
  color: var(--accent);
}

.hero__intro {
  flex: 1 1 320px;
}

.hero h1 {
  margin-bottom: 0.15em;
  font-size: 2rem;
}

.hero__headline {
  margin-bottom: 0.5em;
  color: var(--accent);
  font-weight: 600;
}

.hero__summary {
  color: var(--text-muted);
  white-space: pre-line;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

/* ------------------------------------------------------------ 社交链接 */
.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.social-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.social-link:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

/* 微信二维码：用 <details> 实现零 JS 的点击展开 */
.wechat {
  position: relative;
}

.wechat summary {
  list-style: none;
}

.wechat summary::-webkit-details-marker {
  display: none;
}

.wechat__popover {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 20;
  width: 208px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  text-align: center;
}

.wechat__popover img {
  display: block;
  width: 180px;
  height: 180px;
  padding: 6px;
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.wechat__popover p {
  margin: 8px 0 0;
  font-size: 0.85rem;
}

/* ---------------------------------------------------------------- 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 550;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease,
    background-color 0.15s ease, color 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.btn--primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.btn--primary:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
  color: #ffffff;
}

/* ---------------------------------------------------------------- 页头 */
.page-header {
  margin-bottom: 28px;
}

.page-header h1 {
  font-size: 1.8rem;
}

/* ---------------------------------------------------------------- 卡片 */
.card {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease,
    border-color 0.18s ease;
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.project-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.project-card--featured {
  border-color: var(--accent);
}

.project-card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.project-card__title {
  margin: 0;
  font-size: 1.1rem;
}

.project-card__period {
  font-size: 0.85rem;
  white-space: nowrap;
}

.project-card__role {
  margin: 0;
  font-size: 0.85rem;
}

.project-card__desc {
  margin: 0;
  color: var(--text-muted);
}

.project-card__highlights {
  margin: 0;
  padding-left: 1.1em;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.project-card__links {
  display: flex;
  gap: 14px;
  margin-top: auto;
  padding-top: 4px;
}

.link {
  font-size: 0.92rem;
  font-weight: 550;
}

/* ---------------------------------------------------------------- 标签 */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tag {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.8rem;
}

/* ---------------------------------------------------------------- 简历 */
.resume__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.resume__header h1 {
  margin-bottom: 0.1em;
  font-size: 2rem;
}

.resume__headline {
  margin: 0;
  color: var(--accent);
  font-weight: 600;
}

.resume__contact {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin: 0 0 28px;
  padding: 0;
  font-size: 0.92rem;
  list-style: none;
}

.resume__contact .muted {
  margin-right: 4px;
}

.resume__section {
  margin-bottom: 30px;
}

.section-title {
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent-soft);
  font-size: 1.15rem;
}

/* 时间线（工作 / 教育 / 项目，按时间倒序） */
.timeline {
  display: flex;
  flex-direction: column;
  padding-left: 20px;
  border-left: 2px solid var(--border);
}

.timeline__item {
  position: relative;
  padding: 12px 0;
}

.timeline__item::before {
  content: "";
  position: absolute;
  top: 20px;
  left: -26px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.timeline__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.timeline__title {
  margin: 0;
  font-size: 1.02rem;
}

.timeline__period {
  font-size: 0.88rem;
  white-space: nowrap;
}

.timeline__summary {
  margin: 6px 0 0;
}

.bullets {
  margin: 8px 0 0;
  padding-left: 1.2em;
  color: var(--text-muted);
}

.bullets li {
  margin-bottom: 2px;
}

.skill-groups {
  display: grid;
  gap: 14px;
}

.skill-group__title {
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ---------------------------------------------------------------- 页脚 */
.site-footer {
  padding: 24px 0;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.88rem;
  text-align: center;
}

.site-footer p {
  margin: 2px 0;
}

/* ---------------------------------------------------------------- 响应式 */
@media (max-width: 640px) {
  body {
    font-size: 15px;
  }

  .nav {
    height: 56px;
    gap: 8px;
  }

  .nav-link {
    padding: 6px 9px;
    font-size: 0.9rem;
  }

  main.container {
    padding-top: 28px;
  }

  .hero {
    gap: 18px;
  }

  .hero__avatar {
    width: 96px;
    height: 96px;
  }

  .hero h1 {
    font-size: 1.6rem;
  }

  .resume__header {
    flex-direction: column;
  }

  .resume__header h1 {
    font-size: 1.6rem;
  }
}

/* ---------------------------------------------------------------- 打印 / PDF */
@page {
  size: A4;
  margin: 16mm 14mm;
}

@media print {
  :root,
  body.dark {
    --bg: #ffffff;
    --surface: #ffffff;
    --text: #111111;
    --text-muted: #555555;
    --border: #dddddd;
    --accent: #333333;
    --accent-soft: #eeeeee;
  }

  .site-header,
  .site-footer,
  .no-print,
  .theme-toggle,
  .wechat {
    display: none !important;
  }

  body {
    font-size: 12px;
  }

  main.container {
    max-width: none;
    padding: 0;
  }

  a {
    color: #111111;
    text-decoration: none;
  }

  .card,
  .timeline__item {
    box-shadow: none;
  }

  .resume__section,
  .timeline__item {
    break-inside: avoid;
  }
}
