/* =========================================================
   江铭 · 在线简历
   设计令牌 → 基础排版 → 组件 → 响应式 → 打印
   ========================================================= */

/* ---------- 设计令牌（浅色为基准） ---------- */
:root {
  --bg:          #f7f8fa;
  --bg-elevated: #ffffff;
  --bg-subtle:   #eef1f5;
  --text:        #14181f;
  --text-muted:  #59636f;
  --text-faint:  #8b95a1;
  --border:      #e2e6ec;
  --border-strong: #cdd4dd;

  --accent:      #0a7ea4;
  --accent-soft: rgba(10, 126, 164, .10);
  --accent-text: #0a6b8c;
  --go:          #00add8;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-md: 0 4px 16px -4px rgba(16, 24, 40, .10), 0 1px 3px rgba(16, 24, 40, .05);

  --radius-sm: 6px;
  --radius:    12px;
  --radius-lg: 18px;

  --wrap: 900px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Noto Sans SC", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

/* 跟随系统的深色 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:          #0d1117;
    --bg-elevated: #151b23;
    --bg-subtle:   #1b222c;
    --text:        #e6edf3;
    --text-muted:  #9aa7b4;
    --text-faint:  #6e7b8a;
    --border:      #262d38;
    --border-strong: #39414e;

    --accent:      #4cc4e8;
    --accent-soft: rgba(76, 196, 232, .13);
    --accent-text: #7dd6f2;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md: 0 6px 20px -6px rgba(0, 0, 0, .55), 0 1px 3px rgba(0, 0, 0, .3);
  }
}

/* 用户显式选择深色 */
:root[data-theme="dark"] {
  --bg:          #0d1117;
  --bg-elevated: #151b23;
  --bg-subtle:   #1b222c;
  --text:        #e6edf3;
  --text-muted:  #9aa7b4;
  --text-faint:  #6e7b8a;
  --border:      #262d38;
  --border-strong: #39414e;

  --accent:      #4cc4e8;
  --accent-soft: rgba(76, 196, 232, .13);
  --accent-text: #7dd6f2;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 6px 20px -6px rgba(0, 0, 0, .55), 0 1px 3px rgba(0, 0, 0, .3);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15.5px;
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { line-height: 1.35; margin: 0; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

em { font-style: normal; font-weight: 650; color: var(--accent-text); }
strong { font-weight: 650; }

svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 22px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- 顶部阅读进度条 ---------- */
.progress {
  position: fixed; inset: 0 0 auto 0;
  height: 2px; z-index: 60;
  pointer-events: none;
}
.progress span {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--go), var(--accent));
  transition: width .1s linear;
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s, background .25s;
}
.topbar.is-stuck { border-bottom-color: var(--border); }

.topbar__inner {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 22px;
  height: 58px;
  display: flex; align-items: center; gap: 18px;
}

.topbar__brand {
  font-weight: 700; color: var(--text); font-size: 16px;
  letter-spacing: .01em; white-space: nowrap;
}
.topbar__brand:hover { text-decoration: none; }
.topbar__brand span {
  color: var(--text-faint); font-weight: 500; font-size: 13px;
  font-family: var(--mono); margin-left: 6px;
}

.topbar__nav { display: flex; gap: 4px; margin-left: auto; }
.topbar__nav a {
  position: relative;
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 14px;
  color: var(--text-muted);
  transition: color .2s, background .2s;
}
.topbar__nav a:hover { color: var(--text); background: var(--bg-subtle); text-decoration: none; }
.topbar__nav a.is-active { color: var(--accent-text); background: var(--accent-soft); }

.topbar__actions { display: flex; gap: 6px; }

.icon-btn {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: pointer;
  transition: color .2s, border-color .2s, transform .15s;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); transform: translateY(-1px); }
.icon-btn svg { width: 17px; height: 17px; }

.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: none; }
  :root:not([data-theme="light"]) .icon-moon { display: block; }
}

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding: 64px 0 52px; }

.hero__glow {
  position: absolute; top: -220px; left: 50%;
  width: 780px; height: 460px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, var(--accent-soft), transparent 66%);
  pointer-events: none;
}

.hero__inner {
  position: relative;
  display: flex; align-items: flex-start; gap: 30px;
}

.hero__avatar {
  width: 112px; height: 112px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 3px solid var(--bg-elevated);
  box-shadow: var(--shadow-md);
  background: var(--bg-subtle);
}

.hero__name {
  font-size: clamp(30px, 6vw, 40px);
  letter-spacing: -.02em;
  font-weight: 700;
}
.hero__title {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 16px;
  font-weight: 500;
}

.hero__meta {
  display: flex; flex-wrap: wrap; gap: 8px 20px;
  margin-top: 16px;
  font-size: 14px;
  color: var(--text-muted);
}
.hero__meta li { display: inline-flex; align-items: center; gap: 7px; }
.hero__meta svg { width: 15px; height: 15px; color: var(--text-faint); flex-shrink: 0; }

.hero__cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }

.btn {
  display: inline-flex; align-items: center;
  padding: 8px 17px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 14px; font-weight: 550;
  box-shadow: var(--shadow-sm);
  transition: transform .15s, border-color .2s, box-shadow .2s;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.btn--primary {
  background: var(--accent); border-color: var(--accent);
  color: #fff;
}
:root[data-theme="dark"] .btn--primary { color: #06212b; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn--primary { color: #06212b; }
}

/* ---------- 章节 ---------- */
.section { padding: 46px 0; }
.section + .section { border-top: 1px solid var(--border); }

.section__title {
  display: flex; align-items: baseline; gap: 12px;
  font-size: 21px;
  margin-bottom: 24px;
}
.section__no {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--accent);
  opacity: .8;
}

.lead { color: var(--text-muted); font-size: 15.5px; }
.lead strong { color: var(--text); }

/* ---------- 数字条 ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 12px;
  margin-top: 26px;
}
.stats li {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
}
.stats b {
  display: block;
  font-size: 22px; font-weight: 700;
  letter-spacing: -.02em;
  color: var(--accent-text);
  font-family: var(--mono);
}
.stats span { font-size: 12.5px; color: var(--text-muted); }

/* ---------- 卡片 / 栅格 ---------- */
.grid { display: grid; gap: 16px; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

.card {
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
}
.card__title {
  display: flex; align-items: center; gap: 9px;
  font-size: 15.5px;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.card__title svg { width: 17px; height: 17px; color: var(--accent); }

/* ---------- 标签 ---------- */
.tag-block + .tag-block { margin-top: 15px; }
.tag-block__label {
  font-size: 12px; font-weight: 600;
  letter-spacing: .04em;
  color: var(--text-faint);
  margin-bottom: 7px;
}
.tag-block__note { font-size: 12.5px; color: var(--text-faint); margin-top: 8px; line-height: 1.6; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg-subtle);
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.6;
  transition: border-color .2s, color .2s;
}
.tag:hover { border-color: var(--border-strong); color: var(--text); }
.tag--go {
  color: #037d9c; border-color: rgba(0, 173, 216, .38); background: rgba(0, 173, 216, .10);
  font-weight: 600;
}
:root[data-theme="dark"] .tag--go { color: var(--go); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tag--go { color: var(--go); }
}
.tag--ai { border-style: dashed; }

.tags--stack { margin: 12px 0 14px; }

/* ---------- 时间轴（工作经历） ---------- */
.timeline { position: relative; padding-left: 26px; }
.timeline::before {
  content: "";
  position: absolute; left: 5px; top: 8px; bottom: 6px;
  width: 2px;
  background: linear-gradient(var(--accent), var(--border) 42%, transparent);
  border-radius: 2px;
}
.timeline__item { position: relative; }
.timeline__item::before {
  content: "";
  position: absolute; left: -26px; top: 8px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.timeline__head { margin-bottom: 14px; }
.timeline__head h3 { font-size: 17.5px; }
.timeline__role { color: var(--text-muted); font-size: 14.5px; margin-top: 2px; }
.timeline__meta { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }

.chip {
  display: inline-block;
  padding: 2px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
}
.chip--time { font-family: var(--mono); font-size: 12px; letter-spacing: -.01em; }

/* ---------- 要点列表 ---------- */
.bullets li {
  position: relative;
  padding-left: 18px;
  color: var(--text-muted);
  font-size: 14.8px;
}
.bullets li + li { margin-top: 11px; }
.bullets li::before {
  content: "";
  position: absolute; left: 2px; top: .78em;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--border-strong);
}
.bullets b { color: var(--text); font-weight: 650; }

/* ---------- 项目 ---------- */
.project {
  padding: 22px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
  transition: border-color .25s, box-shadow .25s, transform .25s;
}
.project + .project { margin-top: 16px; }
.project:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-2px); }

.project__head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
}
.project__name { font-size: 17px; }
.project__role { font-size: 13.5px; color: var(--text-faint); margin-top: 2px; }

.project__intro {
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--accent-soft);
  color: var(--text-muted);
  font-size: 14.5px;
  margin-bottom: 16px;
}

/* ---------- 教育 / 荣誉 ---------- */
.edu li {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
}
.edu li + li { border-top: 1px dashed var(--border); }
.edu__main { display: flex; flex-direction: column; }
.edu__main b { font-size: 14.8px; font-weight: 600; }
.edu__main span { font-size: 13px; color: var(--text-muted); }

.honors li {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 0;
  font-size: 14.5px;
  color: var(--text-muted);
}
.honors li + li { border-top: 1px dashed var(--border); }
.honor__medal {
  flex-shrink: 0;
  display: grid; place-items: center;
  width: 21px; height: 21px;
  margin-top: 2px;
  border-radius: 50%;
  background: linear-gradient(140deg, #d7dde5, #a9b4c0);
  color: #3b444f;
  font-size: 11px; font-weight: 700;
}
.honor__medal--bronze { background: linear-gradient(140deg, #e2b98d, #c08c55); color: #4a3320; }

/* ---------- 页脚 ---------- */
.footer {
  margin-top: 20px;
  border-top: 1px solid var(--border);
  padding: 26px 0 40px;
}
.footer__inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  font-size: 13.5px;
  color: var(--text-faint);
}
.footer__links { display: flex; gap: 16px; }

/* ---------- 入场动画 ---------- */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .6s cubic-bezier(.22, .61, .36, 1), transform .6s cubic-bezier(.22, .61, .36, 1);
}
.reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- 响应式 ---------- */
@media (max-width: 780px) {
  .topbar__nav { display: none; }
  .topbar__actions { margin-left: auto; }
}

@media (max-width: 620px) {
  body { font-size: 15px; }
  .hero { padding: 40px 0 34px; }
  .hero__inner { flex-direction: column; align-items: flex-start; gap: 18px; }
  .hero__avatar { width: 84px; height: 84px; }
  .hero__meta { gap: 6px 14px; }
  .section { padding: 36px 0; }
  .card, .project { padding: 18px 16px; }
  .stats { grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); }
  .stats b { font-size: 19px; }
}

/* ---------- 打印 / 导出 PDF ---------- */
@media print {
  /* 选择器需同时压过 [data-theme="dark"] 与 prefers-color-scheme 两处深色令牌 */
  :root,
  :root[data-theme="dark"],
  :root[data-theme="light"],
  :root:not([data-theme="light"]) {
    --bg: #fff; --bg-elevated: #fff; --bg-subtle: #fff;
    --text: #000; --text-muted: #24292f; --text-faint: #57606a;
    --border: #d0d7de; --border-strong: #b1bac4;
    --accent: #0a6b8c; --accent-text: #0a6b8c; --accent-soft: transparent;
    --go: #037d9c;
    --shadow-sm: none; --shadow-md: none;
  }

  @page { margin: 11mm 10mm; }

  body { font-size: 9.8pt; line-height: 1.5; background: #fff; }

  .topbar, .progress, .hero__glow, .hero__cta, .footer__links,
  .icon-btn { display: none !important; }

  .wrap { max-width: none; padding: 0; }
  .reveal { opacity: 1 !important; transform: none !important; }

  /* Hero */
  .hero { padding: 0 0 10px; }
  .hero__inner { gap: 20px; }
  .hero__avatar { width: 68px; height: 68px; border: 1px solid var(--border); box-shadow: none; }
  .hero__name { font-size: 19pt; }
  .hero__title { font-size: 10.5pt; margin-top: 2px; }
  .hero__meta { margin-top: 8px; gap: 3px 16px; font-size: 9pt; }

  /* 章节 */
  .section { padding: 10px 0; break-inside: auto; }
  .section__title { font-size: 12pt; margin-bottom: 10px; break-after: avoid; page-break-after: avoid; }
  .lead { font-size: 9.8pt; }

  /* 数字条 */
  .stats { gap: 7px; margin-top: 12px; grid-template-columns: repeat(5, 1fr); }
  .stats li { padding: 8px 10px; }
  .stats b { font-size: 14pt; }
  .stats span { font-size: 8pt; }

  /* 卡片 / 项目 */
  .card, .project { padding: 13px 15px; box-shadow: none; }
  .card, .project, .stats li {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  /* 工作经历较长，允许跨页流动，但单条要点不拆散 */
  .timeline__item { break-inside: auto; }
  .timeline__head, .bullets li { break-inside: avoid; page-break-inside: avoid; }
  .card__title { font-size: 11pt; padding-bottom: 8px; margin-bottom: 10px; }
  .grid { gap: 10px; }
  .project + .project { margin-top: 10px; }
  .project__name { font-size: 11.5pt; }
  .project__intro { background: none; padding: 6px 10px; margin-bottom: 10px; font-size: 9.5pt; }
  .tags--stack { margin: 8px 0 10px; }

  /* 标签与要点 */
  .tag { font-size: 8.2pt; padding: 1px 7px; }
  .tag-block + .tag-block { margin-top: 9px; }
  .tag-block__label { font-size: 8.5pt; margin-bottom: 5px; }
  .tag-block__note { font-size: 8.5pt; margin-top: 5px; }

  .bullets li { font-size: 9.4pt; padding-left: 14px; }
  .bullets li + li { margin-top: 6px; }
  .bullets li::before { width: 3.5px; height: 3.5px; left: 3px; }

  /* 教育 / 荣誉 */
  .edu li, .honors li { padding: 6px 0; font-size: 9.4pt; }
  .timeline__head { margin-bottom: 10px; }
  .timeline__head h3 { font-size: 12pt; }

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

  .footer { padding: 10px 0 0; margin-top: 6px; font-size: 8.5pt; }
}
