/* =====================================================================
 *  样式表
 *  想改配色：只改下面 :root 和 [data-theme="dark"] 里的变量即可
 * ===================================================================== */

/* ---------- 配色变量 ---------- */
:root {
  --bg: #fbfbfd;
  --bg-soft: #f3f4f8;
  --surface: #ffffff;
  --border: #e6e6ec;
  --text: #18181b;
  --text-soft: #52525b;
  --text-mute: #8a8a99;
  --accent: #4f46e5;
  --accent-soft: #eef0ff;
  --shadow: 0 1px 2px rgba(16, 18, 27, 0.04), 0 8px 24px rgba(16, 18, 27, 0.06);
  --radius: 16px;
  --maxw: 880px;
}

[data-theme="dark"] {
  --bg: #0e1014;
  --bg-soft: #14171d;
  --surface: #171a21;
  --border: #262a33;
  --text: #e8eaed;
  --text-soft: #a9b0bd;
  --text-mute: #6f7784;
  --accent: #8b8ff9;
  --accent-soft: #1d2032;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 30px rgba(0, 0, 0, 0.35);
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.75;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

img { max-width: 100%; display: block; }

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

main {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px 80px;
}

/* ---------- 主题切换按钮 ---------- */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10;
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.theme-toggle:hover { transform: translateY(-1px); color: var(--accent); border-color: var(--accent); }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* ---------- 首屏 ---------- */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 110px 0 72px;
}

.avatar {
  width: 104px;
  height: 104px;
  border-radius: 999px;
  padding: 3px;
  background: linear-gradient(135deg, var(--accent), #22d3ee 55%, #f472b6);
  margin-bottom: 26px;
}
.avatar img,
.avatar .avatar-initial {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  object-fit: cover;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0;
}

.hero-name {
  margin: 0 0 12px;
  font-size: clamp(30px, 6vw, 46px);
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 700;
}

.hero-tagline {
  margin: 0;
  max-width: 560px;
  color: var(--text-soft);
  font-size: 17px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 34px;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 22px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease, border-color 0.16s ease;
}
.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
  border-color: var(--accent);
  color: var(--accent);
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.28);
}
.btn-primary:hover {
  background: var(--accent);
  color: #fff;
  filter: brightness(1.06);
  border-color: var(--accent);
}

/* ---------- 区块 ---------- */
.section { padding: 44px 0 8px; }

.section-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 22px;
}

.section-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-mute);
}
.section-title::after {
  content: "";
  display: block;
  width: 32px;
  height: 2px;
  margin-top: 8px;
  border-radius: 2px;
  background: var(--accent);
}

.section-sub { margin: 0; color: var(--text-soft); }

/* ---------- 正文 ---------- */
.prose p { margin: 0 0 16px; color: var(--text-soft); }
.prose p:last-child { margin-bottom: 0; }
.prose-lead { margin: 0 0 18px; color: var(--text-soft); }

/* ---------- 技能标签 ---------- */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}
.chip {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  font-size: 14px;
  transition: border-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}
.chip:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }

/* ---------- 项目卡片 ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

.card {
  display: flex;
  flex-direction: column;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  box-shadow: 0 2px 4px rgba(16, 18, 27, 0.05), 0 16px 36px rgba(16, 18, 27, 0.10);
}

.card-title {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card-desc {
  margin: 0 0 16px;
  color: var(--text-soft);
  font-size: 14.5px;
  line-height: 1.7;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0;
  margin: 0 0 16px;
  list-style: none;
}
.tag {
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 500;
}

.card-link {
  margin-top: auto;
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
}
.card-link:hover { text-decoration: none; opacity: 0.75; }

/* ---------- 联系方式 ---------- */
.contact-list {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}
.contact-item {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.contact-label { color: var(--text-mute); font-size: 14px; }
.contact-value { color: var(--text); font-size: 14.5px; font-weight: 500; word-break: break-all; }
a.contact-value:hover { color: var(--accent); }

/* ---------- 页脚 ---------- */
.footer {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  color: var(--text-mute);
  font-size: 13.5px;
  text-align: center;
}
.footer p { margin: 0; }

/* ---------- 滚动淡入 ---------- */
/* 默认可见：禁用 JS / 搜索引擎抓取时内容不会消失；只有 JS 运行时才做入场动画 */
.reveal { transition: opacity 0.55s ease, transform 0.55s ease; }
.js .reveal:not(.is-visible) {
  opacity: 0;
  transform: translateY(14px);
}

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  main { padding: 0 20px 64px; }
  .hero { padding: 84px 0 52px; }
  .avatar { width: 88px; height: 88px; }
  .hero-actions { width: 100%; }
  .btn { flex: 1 1 auto; }
  .grid { grid-template-columns: 1fr; }
  .theme-toggle { top: 14px; right: 14px; }
}

/* ---------- 无障碍 / 减少动效 ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
  .js .reveal:not(.is-visible) { opacity: 1; transform: none; }
}

/* ---------- 选中文字 ---------- */
::selection { background: var(--accent); color: #fff; }

/* ---------- 友链 ---------- */
.friend-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.friend-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}
.friend-link:hover {
  text-decoration: none;
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.friend-avatar {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0;
}

.friend-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.friend-name {
  color: var(--text);
  font-size: 14.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.friend-desc {
  color: var(--text-mute);
  font-size: 12.5px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.friend-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
  display: block;
}